jsr166/0000755000000000000000000000000011652013241006772 5ustar jsr166/src/0000755000000000000000000000000011652013242007562 5ustar jsr166/src/jsr166y/0000755000000000000000000000000011652013242011006 5ustar jsr166/src/jsr166y/RecursiveTask.java0000644000000000000000000000344411537741066014466 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166y; /** * A recursive result-bearing {@link ForkJoinTask}. * *

For a classic example, here is a task computing Fibonacci numbers: * *

 {@code
 * class Fibonacci extends RecursiveTask {
 *   final int n;
 *   Fibonacci(int n) { this.n = n; }
 *   Integer compute() {
 *     if (n <= 1)
 *        return n;
 *     Fibonacci f1 = new Fibonacci(n - 1);
 *     f1.fork();
 *     Fibonacci f2 = new Fibonacci(n - 2);
 *     return f2.compute() + f1.join();
 *   }
 * }}
* * However, besides being a dumb way to compute Fibonacci functions * (there is a simple fast linear algorithm that you'd use in * practice), this is likely to perform poorly because the smallest * subtasks are too small to be worthwhile splitting up. Instead, as * is the case for nearly all fork/join applications, you'd pick some * minimum granularity size (for example 10 here) for which you always * sequentially solve rather than subdividing. * * @since 1.7 * @author Doug Lea */ public abstract class RecursiveTask extends ForkJoinTask { private static final long serialVersionUID = 5232453952276485270L; /** * The result of the computation. */ V result; /** * The main computation performed by this task. */ protected abstract V compute(); public final V getRawResult() { return result; } protected final void setRawResult(V value) { result = value; } /** * Implements execution conventions for RecursiveTask. */ protected final boolean exec() { result = compute(); return true; } } jsr166/src/jsr166y/RecursiveAction.java0000644000000000000000000001120111537741066014767 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166y; /** * A recursive resultless {@link ForkJoinTask}. This class * establishes conventions to parameterize resultless actions as * {@code Void} {@code ForkJoinTask}s. Because {@code null} is the * only valid value of type {@code Void}, methods such as join always * return {@code null} upon completion. * *

Sample Usages. Here is a sketch of a ForkJoin sort that * sorts a given {@code long[]} array: * *

 {@code
 * class SortTask extends RecursiveAction {
 *   final long[] array; final int lo; final int hi;
 *   SortTask(long[] array, int lo, int hi) {
 *     this.array = array; this.lo = lo; this.hi = hi;
 *   }
 *   protected void compute() {
 *     if (hi - lo < THRESHOLD)
 *       sequentiallySort(array, lo, hi);
 *     else {
 *       int mid = (lo + hi) >>> 1;
 *       invokeAll(new SortTask(array, lo, mid),
 *                 new SortTask(array, mid, hi));
 *       merge(array, lo, hi);
 *     }
 *   }
 * }}
* * You could then sort {@code anArray} by creating {@code new * SortTask(anArray, 0, anArray.length-1) } and invoking it in a * ForkJoinPool. As a more concrete simple example, the following * task increments each element of an array: *
 {@code
 * class IncrementTask extends RecursiveAction {
 *   final long[] array; final int lo; final int hi;
 *   IncrementTask(long[] array, int lo, int hi) {
 *     this.array = array; this.lo = lo; this.hi = hi;
 *   }
 *   protected void compute() {
 *     if (hi - lo < THRESHOLD) {
 *       for (int i = lo; i < hi; ++i)
 *         array[i]++;
 *     }
 *     else {
 *       int mid = (lo + hi) >>> 1;
 *       invokeAll(new IncrementTask(array, lo, mid),
 *                 new IncrementTask(array, mid, hi));
 *     }
 *   }
 * }}
* *

The following example illustrates some refinements and idioms * that may lead to better performance: RecursiveActions need not be * fully recursive, so long as they maintain the basic * divide-and-conquer approach. Here is a class that sums the squares * of each element of a double array, by subdividing out only the * right-hand-sides of repeated divisions by two, and keeping track of * them with a chain of {@code next} references. It uses a dynamic * threshold based on method {@code getSurplusQueuedTaskCount}, but * counterbalances potential excess partitioning by directly * performing leaf actions on unstolen tasks rather than further * subdividing. * *

 {@code
 * double sumOfSquares(ForkJoinPool pool, double[] array) {
 *   int n = array.length;
 *   Applyer a = new Applyer(array, 0, n, null);
 *   pool.invoke(a);
 *   return a.result;
 * }
 *
 * class Applyer extends RecursiveAction {
 *   final double[] array;
 *   final int lo, hi;
 *   double result;
 *   Applyer next; // keeps track of right-hand-side tasks
 *   Applyer(double[] array, int lo, int hi, Applyer next) {
 *     this.array = array; this.lo = lo; this.hi = hi;
 *     this.next = next;
 *   }
 *
 *   double atLeaf(int l, int h) {
 *     double sum = 0;
 *     for (int i = l; i < h; ++i) // perform leftmost base step
 *       sum += array[i] * array[i];
 *     return sum;
 *   }
 *
 *   protected void compute() {
 *     int l = lo;
 *     int h = hi;
 *     Applyer right = null;
 *     while (h - l > 1 && getSurplusQueuedTaskCount() <= 3) {
 *        int mid = (l + h) >>> 1;
 *        right = new Applyer(array, mid, h, right);
 *        right.fork();
 *        h = mid;
 *     }
 *     double sum = atLeaf(l, h);
 *     while (right != null) {
 *        if (right.tryUnfork()) // directly calculate if not stolen
 *          sum += right.atLeaf(right.lo, right.hi);
 *       else {
 *          right.join();
 *          sum += right.result;
 *        }
 *        right = right.next;
 *      }
 *     result = sum;
 *   }
 * }}
* * @since 1.7 * @author Doug Lea */ public abstract class RecursiveAction extends ForkJoinTask { private static final long serialVersionUID = 5232453952276485070L; /** * The main computation performed by this task. */ protected abstract void compute(); /** * Always returns {@code null}. * * @return {@code null} always */ public final Void getRawResult() { return null; } /** * Requires null completion value. */ protected final void setRawResult(Void mustBeNull) { } /** * Implements execution conventions for RecursiveActions. */ protected final boolean exec() { compute(); return true; } } jsr166/src/jsr166y/LinkedTransferQueue.java0000644000000000000000000015266411537741066015625 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166y; import java.util.AbstractQueue; import java.util.Collection; import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.Queue; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.LockSupport; /** * An unbounded {@link TransferQueue} based on linked nodes. * This queue orders elements FIFO (first-in-first-out) with respect * to any given producer. The head of the queue is that * element that has been on the queue the longest time for some * producer. The tail of the queue is that element that has * been on the queue the shortest time for some producer. * *

Beware that, unlike in most collections, the {@code size} * method is NOT a constant-time operation. Because of the * asynchronous nature of these queues, determining the current number * of elements requires a traversal of the elements. * *

This class and its iterator implement all of the * optional methods of the {@link Collection} and {@link * Iterator} interfaces. * *

Memory consistency effects: As with other concurrent * collections, actions in a thread prior to placing an object into a * {@code LinkedTransferQueue} * happen-before * actions subsequent to the access or removal of that element from * the {@code LinkedTransferQueue} in another thread. * *

This class is a member of the * * Java Collections Framework. * * @since 1.7 * @author Doug Lea * @param the type of elements held in this collection */ public class LinkedTransferQueue extends AbstractQueue implements TransferQueue, java.io.Serializable { private static final long serialVersionUID = -3223113410248163686L; /* * *** Overview of Dual Queues with Slack *** * * Dual Queues, introduced by Scherer and Scott * (http://www.cs.rice.edu/~wns1/papers/2004-DISC-DDS.pdf) are * (linked) queues in which nodes may represent either data or * requests. When a thread tries to enqueue a data node, but * encounters a request node, it instead "matches" and removes it; * and vice versa for enqueuing requests. Blocking Dual Queues * arrange that threads enqueuing unmatched requests block until * other threads provide the match. Dual Synchronous Queues (see * Scherer, Lea, & Scott * http://www.cs.rochester.edu/u/scott/papers/2009_Scherer_CACM_SSQ.pdf) * additionally arrange that threads enqueuing unmatched data also * block. Dual Transfer Queues support all of these modes, as * dictated by callers. * * A FIFO dual queue may be implemented using a variation of the * Michael & Scott (M&S) lock-free queue algorithm * (http://www.cs.rochester.edu/u/scott/papers/1996_PODC_queues.pdf). * It maintains two pointer fields, "head", pointing to a * (matched) node that in turn points to the first actual * (unmatched) queue node (or null if empty); and "tail" that * points to the last node on the queue (or again null if * empty). For example, here is a possible queue with four data * elements: * * head tail * | | * v v * M -> U -> U -> U -> U * * The M&S queue algorithm is known to be prone to scalability and * overhead limitations when maintaining (via CAS) these head and * tail pointers. This has led to the development of * contention-reducing variants such as elimination arrays (see * Moir et al http://portal.acm.org/citation.cfm?id=1074013) and * optimistic back pointers (see Ladan-Mozes & Shavit * http://people.csail.mit.edu/edya/publications/OptimisticFIFOQueue-journal.pdf). * However, the nature of dual queues enables a simpler tactic for * improving M&S-style implementations when dual-ness is needed. * * In a dual queue, each node must atomically maintain its match * status. While there are other possible variants, we implement * this here as: for a data-mode node, matching entails CASing an * "item" field from a non-null data value to null upon match, and * vice-versa for request nodes, CASing from null to a data * value. (Note that the linearization properties of this style of * queue are easy to verify -- elements are made available by * linking, and unavailable by matching.) Compared to plain M&S * queues, this property of dual queues requires one additional * successful atomic operation per enq/deq pair. But it also * enables lower cost variants of queue maintenance mechanics. (A * variation of this idea applies even for non-dual queues that * support deletion of interior elements, such as * j.u.c.ConcurrentLinkedQueue.) * * Once a node is matched, its match status can never again * change. We may thus arrange that the linked list of them * contain a prefix of zero or more matched nodes, followed by a * suffix of zero or more unmatched nodes. (Note that we allow * both the prefix and suffix to be zero length, which in turn * means that we do not use a dummy header.) If we were not * concerned with either time or space efficiency, we could * correctly perform enqueue and dequeue operations by traversing * from a pointer to the initial node; CASing the item of the * first unmatched node on match and CASing the next field of the * trailing node on appends. (Plus some special-casing when * initially empty). While this would be a terrible idea in * itself, it does have the benefit of not requiring ANY atomic * updates on head/tail fields. * * We introduce here an approach that lies between the extremes of * never versus always updating queue (head and tail) pointers. * This offers a tradeoff between sometimes requiring extra * traversal steps to locate the first and/or last unmatched * nodes, versus the reduced overhead and contention of fewer * updates to queue pointers. For example, a possible snapshot of * a queue is: * * head tail * | | * v v * M -> M -> U -> U -> U -> U * * The best value for this "slack" (the targeted maximum distance * between the value of "head" and the first unmatched node, and * similarly for "tail") is an empirical matter. We have found * that using very small constants in the range of 1-3 work best * over a range of platforms. Larger values introduce increasing * costs of cache misses and risks of long traversal chains, while * smaller values increase CAS contention and overhead. * * Dual queues with slack differ from plain M&S dual queues by * virtue of only sometimes updating head or tail pointers when * matching, appending, or even traversing nodes; in order to * maintain a targeted slack. The idea of "sometimes" may be * operationalized in several ways. The simplest is to use a * per-operation counter incremented on each traversal step, and * to try (via CAS) to update the associated queue pointer * whenever the count exceeds a threshold. Another, that requires * more overhead, is to use random number generators to update * with a given probability per traversal step. * * In any strategy along these lines, because CASes updating * fields may fail, the actual slack may exceed targeted * slack. However, they may be retried at any time to maintain * targets. Even when using very small slack values, this * approach works well for dual queues because it allows all * operations up to the point of matching or appending an item * (hence potentially allowing progress by another thread) to be * read-only, thus not introducing any further contention. As * described below, we implement this by performing slack * maintenance retries only after these points. * * As an accompaniment to such techniques, traversal overhead can * be further reduced without increasing contention of head * pointer updates: Threads may sometimes shortcut the "next" link * path from the current "head" node to be closer to the currently * known first unmatched node, and similarly for tail. Again, this * may be triggered with using thresholds or randomization. * * These ideas must be further extended to avoid unbounded amounts * of costly-to-reclaim garbage caused by the sequential "next" * links of nodes starting at old forgotten head nodes: As first * described in detail by Boehm * (http://portal.acm.org/citation.cfm?doid=503272.503282) if a GC * delays noticing that any arbitrarily old node has become * garbage, all newer dead nodes will also be unreclaimed. * (Similar issues arise in non-GC environments.) To cope with * this in our implementation, upon CASing to advance the head * pointer, we set the "next" link of the previous head to point * only to itself; thus limiting the length of connected dead lists. * (We also take similar care to wipe out possibly garbage * retaining values held in other Node fields.) However, doing so * adds some further complexity to traversal: If any "next" * pointer links to itself, it indicates that the current thread * has lagged behind a head-update, and so the traversal must * continue from the "head". Traversals trying to find the * current tail starting from "tail" may also encounter * self-links, in which case they also continue at "head". * * It is tempting in slack-based scheme to not even use CAS for * updates (similarly to Ladan-Mozes & Shavit). However, this * cannot be done for head updates under the above link-forgetting * mechanics because an update may leave head at a detached node. * And while direct writes are possible for tail updates, they * increase the risk of long retraversals, and hence long garbage * chains, which can be much more costly than is worthwhile * considering that the cost difference of performing a CAS vs * write is smaller when they are not triggered on each operation * (especially considering that writes and CASes equally require * additional GC bookkeeping ("write barriers") that are sometimes * more costly than the writes themselves because of contention). * * *** Overview of implementation *** * * We use a threshold-based approach to updates, with a slack * threshold of two -- that is, we update head/tail when the * current pointer appears to be two or more steps away from the * first/last node. The slack value is hard-wired: a path greater * than one is naturally implemented by checking equality of * traversal pointers except when the list has only one element, * in which case we keep slack threshold at one. Avoiding tracking * explicit counts across method calls slightly simplifies an * already-messy implementation. Using randomization would * probably work better if there were a low-quality dirt-cheap * per-thread one available, but even ThreadLocalRandom is too * heavy for these purposes. * * With such a small slack threshold value, it is not worthwhile * to augment this with path short-circuiting (i.e., unsplicing * interior nodes) except in the case of cancellation/removal (see * below). * * We allow both the head and tail fields to be null before any * nodes are enqueued; initializing upon first append. This * simplifies some other logic, as well as providing more * efficient explicit control paths instead of letting JVMs insert * implicit NullPointerExceptions when they are null. While not * currently fully implemented, we also leave open the possibility * of re-nulling these fields when empty (which is complicated to * arrange, for little benefit.) * * All enqueue/dequeue operations are handled by the single method * "xfer" with parameters indicating whether to act as some form * of offer, put, poll, take, or transfer (each possibly with * timeout). The relative complexity of using one monolithic * method outweighs the code bulk and maintenance problems of * using separate methods for each case. * * Operation consists of up to three phases. The first is * implemented within method xfer, the second in tryAppend, and * the third in method awaitMatch. * * 1. Try to match an existing node * * Starting at head, skip already-matched nodes until finding * an unmatched node of opposite mode, if one exists, in which * case matching it and returning, also if necessary updating * head to one past the matched node (or the node itself if the * list has no other unmatched nodes). If the CAS misses, then * a loop retries advancing head by two steps until either * success or the slack is at most two. By requiring that each * attempt advances head by two (if applicable), we ensure that * the slack does not grow without bound. Traversals also check * if the initial head is now off-list, in which case they * start at the new head. * * If no candidates are found and the call was untimed * poll/offer, (argument "how" is NOW) return. * * 2. Try to append a new node (method tryAppend) * * Starting at current tail pointer, find the actual last node * and try to append a new node (or if head was null, establish * the first node). Nodes can be appended only if their * predecessors are either already matched or are of the same * mode. If we detect otherwise, then a new node with opposite * mode must have been appended during traversal, so we must * restart at phase 1. The traversal and update steps are * otherwise similar to phase 1: Retrying upon CAS misses and * checking for staleness. In particular, if a self-link is * encountered, then we can safely jump to a node on the list * by continuing the traversal at current head. * * On successful append, if the call was ASYNC, return. * * 3. Await match or cancellation (method awaitMatch) * * Wait for another thread to match node; instead cancelling if * the current thread was interrupted or the wait timed out. On * multiprocessors, we use front-of-queue spinning: If a node * appears to be the first unmatched node in the queue, it * spins a bit before blocking. In either case, before blocking * it tries to unsplice any nodes between the current "head" * and the first unmatched node. * * Front-of-queue spinning vastly improves performance of * heavily contended queues. And so long as it is relatively * brief and "quiet", spinning does not much impact performance * of less-contended queues. During spins threads check their * interrupt status and generate a thread-local random number * to decide to occasionally perform a Thread.yield. While * yield has underdefined specs, we assume that might it help, * and will not hurt in limiting impact of spinning on busy * systems. We also use smaller (1/2) spins for nodes that are * not known to be front but whose predecessors have not * blocked -- these "chained" spins avoid artifacts of * front-of-queue rules which otherwise lead to alternating * nodes spinning vs blocking. Further, front threads that * represent phase changes (from data to request node or vice * versa) compared to their predecessors receive additional * chained spins, reflecting longer paths typically required to * unblock threads during phase changes. * * * ** Unlinking removed interior nodes ** * * In addition to minimizing garbage retention via self-linking * described above, we also unlink removed interior nodes. These * may arise due to timed out or interrupted waits, or calls to * remove(x) or Iterator.remove. Normally, given a node that was * at one time known to be the predecessor of some node s that is * to be removed, we can unsplice s by CASing the next field of * its predecessor if it still points to s (otherwise s must * already have been removed or is now offlist). But there are two * situations in which we cannot guarantee to make node s * unreachable in this way: (1) If s is the trailing node of list * (i.e., with null next), then it is pinned as the target node * for appends, so can only be removed later after other nodes are * appended. (2) We cannot necessarily unlink s given a * predecessor node that is matched (including the case of being * cancelled): the predecessor may already be unspliced, in which * case some previous reachable node may still point to s. * (For further explanation see Herlihy & Shavit "The Art of * Multiprocessor Programming" chapter 9). Although, in both * cases, we can rule out the need for further action if either s * or its predecessor are (or can be made to be) at, or fall off * from, the head of list. * * Without taking these into account, it would be possible for an * unbounded number of supposedly removed nodes to remain * reachable. Situations leading to such buildup are uncommon but * can occur in practice; for example when a series of short timed * calls to poll repeatedly time out but never otherwise fall off * the list because of an untimed call to take at the front of the * queue. * * When these cases arise, rather than always retraversing the * entire list to find an actual predecessor to unlink (which * won't help for case (1) anyway), we record a conservative * estimate of possible unsplice failures (in "sweepVotes"). * We trigger a full sweep when the estimate exceeds a threshold * ("SWEEP_THRESHOLD") indicating the maximum number of estimated * removal failures to tolerate before sweeping through, unlinking * cancelled nodes that were not unlinked upon initial removal. * We perform sweeps by the thread hitting threshold (rather than * background threads or by spreading work to other threads) * because in the main contexts in which removal occurs, the * caller is already timed-out, cancelled, or performing a * potentially O(n) operation (e.g. remove(x)), none of which are * time-critical enough to warrant the overhead that alternatives * would impose on other threads. * * Because the sweepVotes estimate is conservative, and because * nodes become unlinked "naturally" as they fall off the head of * the queue, and because we allow votes to accumulate even while * sweeps are in progress, there are typically significantly fewer * such nodes than estimated. Choice of a threshold value * balances the likelihood of wasted effort and contention, versus * providing a worst-case bound on retention of interior nodes in * quiescent queues. The value defined below was chosen * empirically to balance these under various timeout scenarios. * * Note that we cannot self-link unlinked interior nodes during * sweeps. However, the associated garbage chains terminate when * some successor ultimately falls off the head of the list and is * self-linked. */ /** True if on multiprocessor */ private static final boolean MP = Runtime.getRuntime().availableProcessors() > 1; /** * The number of times to spin (with randomly interspersed calls * to Thread.yield) on multiprocessor before blocking when a node * is apparently the first waiter in the queue. See above for * explanation. Must be a power of two. The value is empirically * derived -- it works pretty well across a variety of processors, * numbers of CPUs, and OSes. */ private static final int FRONT_SPINS = 1 << 7; /** * The number of times to spin before blocking when a node is * preceded by another node that is apparently spinning. Also * serves as an increment to FRONT_SPINS on phase changes, and as * base average frequency for yielding during spins. Must be a * power of two. */ private static final int CHAINED_SPINS = FRONT_SPINS >>> 1; /** * The maximum number of estimated removal failures (sweepVotes) * to tolerate before sweeping through the queue unlinking * cancelled nodes that were not unlinked upon initial * removal. See above for explanation. The value must be at least * two to avoid useless sweeps when removing trailing nodes. */ static final int SWEEP_THRESHOLD = 32; /** * Queue nodes. Uses Object, not E, for items to allow forgetting * them after use. Relies heavily on Unsafe mechanics to minimize * unnecessary ordering constraints: Writes that are intrinsically * ordered wrt other accesses or CASes use simple relaxed forms. */ static final class Node { final boolean isData; // false if this is a request node volatile Object item; // initially non-null if isData; CASed to match volatile Node next; volatile Thread waiter; // null until waiting // CAS methods for fields final boolean casNext(Node cmp, Node val) { return UNSAFE.compareAndSwapObject(this, nextOffset, cmp, val); } final boolean casItem(Object cmp, Object val) { // assert cmp == null || cmp.getClass() != Node.class; return UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val); } /** * Constructs a new node. Uses relaxed write because item can * only be seen after publication via casNext. */ Node(Object item, boolean isData) { UNSAFE.putObject(this, itemOffset, item); // relaxed write this.isData = isData; } /** * Links node to itself to avoid garbage retention. Called * only after CASing head field, so uses relaxed write. */ final void forgetNext() { UNSAFE.putObject(this, nextOffset, this); } /** * Sets item to self and waiter to null, to avoid garbage * retention after matching or cancelling. Uses relaxed writes * because order is already constrained in the only calling * contexts: item is forgotten only after volatile/atomic * mechanics that extract items. Similarly, clearing waiter * follows either CAS or return from park (if ever parked; * else we don't care). */ final void forgetContents() { UNSAFE.putObject(this, itemOffset, this); UNSAFE.putObject(this, waiterOffset, null); } /** * Returns true if this node has been matched, including the * case of artificial matches due to cancellation. */ final boolean isMatched() { Object x = item; return (x == this) || ((x == null) == isData); } /** * Returns true if this is an unmatched request node. */ final boolean isUnmatchedRequest() { return !isData && item == null; } /** * Returns true if a node with the given mode cannot be * appended to this node because this node is unmatched and * has opposite data mode. */ final boolean cannotPrecede(boolean haveData) { boolean d = isData; Object x; return d != haveData && (x = item) != this && (x != null) == d; } /** * Tries to artificially match a data node -- used by remove. */ final boolean tryMatchData() { // assert isData; Object x = item; if (x != null && x != this && casItem(x, null)) { LockSupport.unpark(waiter); return true; } return false; } // Unsafe mechanics private static final sun.misc.Unsafe UNSAFE = getUnsafe(); private static final long nextOffset = objectFieldOffset(UNSAFE, "next", Node.class); private static final long itemOffset = objectFieldOffset(UNSAFE, "item", Node.class); private static final long waiterOffset = objectFieldOffset(UNSAFE, "waiter", Node.class); private static final long serialVersionUID = -3375979862319811754L; } /** head of the queue; null until first enqueue */ transient volatile Node head; /** tail of the queue; null until first append */ private transient volatile Node tail; /** The number of apparent failures to unsplice removed nodes */ private transient volatile int sweepVotes; // CAS methods for fields private boolean casTail(Node cmp, Node val) { return UNSAFE.compareAndSwapObject(this, tailOffset, cmp, val); } private boolean casHead(Node cmp, Node val) { return UNSAFE.compareAndSwapObject(this, headOffset, cmp, val); } private boolean casSweepVotes(int cmp, int val) { return UNSAFE.compareAndSwapInt(this, sweepVotesOffset, cmp, val); } /* * Possible values for "how" argument in xfer method. */ private static final int NOW = 0; // for untimed poll, tryTransfer private static final int ASYNC = 1; // for offer, put, add private static final int SYNC = 2; // for transfer, take private static final int TIMED = 3; // for timed poll, tryTransfer @SuppressWarnings("unchecked") static E cast(Object item) { // assert item == null || item.getClass() != Node.class; return (E) item; } /** * Implements all queuing methods. See above for explanation. * * @param e the item or null for take * @param haveData true if this is a put, else a take * @param how NOW, ASYNC, SYNC, or TIMED * @param nanos timeout in nanosecs, used only if mode is TIMED * @return an item if matched, else e * @throws NullPointerException if haveData mode but e is null */ private E xfer(E e, boolean haveData, int how, long nanos) { if (haveData && (e == null)) throw new NullPointerException(); Node s = null; // the node to append, if needed retry: for (;;) { // restart on append race for (Node h = head, p = h; p != null;) { // find & match first node boolean isData = p.isData; Object item = p.item; if (item != p && (item != null) == isData) { // unmatched if (isData == haveData) // can't match break; if (p.casItem(item, e)) { // match for (Node q = p; q != h;) { Node n = q.next; // update by 2 unless singleton if (head == h && casHead(h, n == null ? q : n)) { h.forgetNext(); break; } // advance and retry if ((h = head) == null || (q = h.next) == null || !q.isMatched()) break; // unless slack < 2 } LockSupport.unpark(p.waiter); return this.cast(item); } } Node n = p.next; p = (p != n) ? n : (h = head); // Use head if p offlist } if (how != NOW) { // No matches available if (s == null) s = new Node(e, haveData); Node pred = tryAppend(s, haveData); if (pred == null) continue retry; // lost race vs opposite mode if (how != ASYNC) return awaitMatch(s, pred, e, (how == TIMED), nanos); } return e; // not waiting } } /** * Tries to append node s as tail. * * @param s the node to append * @param haveData true if appending in data mode * @return null on failure due to losing race with append in * different mode, else s's predecessor, or s itself if no * predecessor */ private Node tryAppend(Node s, boolean haveData) { for (Node t = tail, p = t;;) { // move p to last node and append Node n, u; // temps for reads of next & tail if (p == null && (p = head) == null) { if (casHead(null, s)) return s; // initialize } else if (p.cannotPrecede(haveData)) return null; // lost race vs opposite mode else if ((n = p.next) != null) // not last; keep traversing p = p != t && t != (u = tail) ? (t = u) : // stale tail (p != n) ? n : null; // restart if off list else if (!p.casNext(null, s)) p = p.next; // re-read on CAS failure else { if (p != t) { // update if slack now >= 2 while ((tail != t || !casTail(t, s)) && (t = tail) != null && (s = t.next) != null && // advance and retry (s = s.next) != null && s != t); } return p; } } } /** * Spins/yields/blocks until node s is matched or caller gives up. * * @param s the waiting node * @param pred the predecessor of s, or s itself if it has no * predecessor, or null if unknown (the null case does not occur * in any current calls but may in possible future extensions) * @param e the comparison value for checking match * @param timed if true, wait only until timeout elapses * @param nanos timeout in nanosecs, used only if timed is true * @return matched item, or e if unmatched on interrupt or timeout */ private E awaitMatch(Node s, Node pred, E e, boolean timed, long nanos) { long lastTime = timed ? System.nanoTime() : 0L; Thread w = Thread.currentThread(); int spins = -1; // initialized after first item and cancel checks ThreadLocalRandom randomYields = null; // bound if needed for (;;) { Object item = s.item; if (item != e) { // matched // assert item != s; s.forgetContents(); // avoid garbage return this.cast(item); } if ((w.isInterrupted() || (timed && nanos <= 0)) && s.casItem(e, s)) { // cancel unsplice(pred, s); return e; } if (spins < 0) { // establish spins at/near front if ((spins = spinsFor(pred, s.isData)) > 0) randomYields = ThreadLocalRandom.current(); } else if (spins > 0) { // spin --spins; if (randomYields.nextInt(CHAINED_SPINS) == 0) Thread.yield(); // occasionally yield } else if (s.waiter == null) { s.waiter = w; // request unpark then recheck } else if (timed) { long now = System.nanoTime(); if ((nanos -= now - lastTime) > 0) LockSupport.parkNanos(this, nanos); lastTime = now; } else { LockSupport.park(this); } } } /** * Returns spin/yield value for a node with given predecessor and * data mode. See above for explanation. */ private static int spinsFor(Node pred, boolean haveData) { if (MP && pred != null) { if (pred.isData != haveData) // phase change return FRONT_SPINS + CHAINED_SPINS; if (pred.isMatched()) // probably at front return FRONT_SPINS; if (pred.waiter == null) // pred apparently spinning return CHAINED_SPINS; } return 0; } /* -------------- Traversal methods -------------- */ /** * Returns the successor of p, or the head node if p.next has been * linked to self, which will only be true if traversing with a * stale pointer that is now off the list. */ final Node succ(Node p) { Node next = p.next; return (p == next) ? head : next; } /** * Returns the first unmatched node of the given mode, or null if * none. Used by methods isEmpty, hasWaitingConsumer. */ private Node firstOfMode(boolean isData) { for (Node p = head; p != null; p = succ(p)) { if (!p.isMatched()) return (p.isData == isData) ? p : null; } return null; } /** * Returns the item in the first unmatched node with isData; or * null if none. Used by peek. */ private E firstDataItem() { for (Node p = head; p != null; p = succ(p)) { Object item = p.item; if (p.isData) { if (item != null && item != p) return this.cast(item); } else if (item == null) return null; } return null; } /** * Traverses and counts unmatched nodes of the given mode. * Used by methods size and getWaitingConsumerCount. */ private int countOfMode(boolean data) { int count = 0; for (Node p = head; p != null; ) { if (!p.isMatched()) { if (p.isData != data) return 0; if (++count == Integer.MAX_VALUE) // saturated break; } Node n = p.next; if (n != p) p = n; else { count = 0; p = head; } } return count; } final class Itr implements Iterator { private Node nextNode; // next node to return item for private E nextItem; // the corresponding item private Node lastRet; // last returned node, to support remove private Node lastPred; // predecessor to unlink lastRet /** * Moves to next node after prev, or first node if prev null. */ private void advance(Node prev) { /* * To track and avoid buildup of deleted nodes in the face * of calls to both Queue.remove and Itr.remove, we must * include variants of unsplice and sweep upon each * advance: Upon Itr.remove, we may need to catch up links * from lastPred, and upon other removes, we might need to * skip ahead from stale nodes and unsplice deleted ones * found while advancing. */ Node r, b; // reset lastPred upon possible deletion of lastRet if ((r = lastRet) != null && !r.isMatched()) lastPred = r; // next lastPred is old lastRet else if ((b = lastPred) == null || b.isMatched()) lastPred = null; // at start of list else { Node s, n; // help with removal of lastPred.next while ((s = b.next) != null && s != b && s.isMatched() && (n = s.next) != null && n != s) b.casNext(s, n); } this.lastRet = prev; for (Node p = prev, s, n;;) { s = (p == null) ? head : p.next; if (s == null) break; else if (s == p) { p = null; continue; } Object item = s.item; if (s.isData) { if (item != null && item != s) { nextItem = LinkedTransferQueue.cast(item); nextNode = s; return; } } else if (item == null) break; // assert s.isMatched(); if (p == null) p = s; else if ((n = s.next) == null) break; else if (s == n) p = null; else p.casNext(s, n); } nextNode = null; nextItem = null; } Itr() { advance(null); } public final boolean hasNext() { return nextNode != null; } public final E next() { Node p = nextNode; if (p == null) throw new NoSuchElementException(); E e = nextItem; advance(p); return e; } public final void remove() { final Node lastRet = this.lastRet; if (lastRet == null) throw new IllegalStateException(); this.lastRet = null; if (lastRet.tryMatchData()) unsplice(lastPred, lastRet); } } /* -------------- Removal methods -------------- */ /** * Unsplices (now or later) the given deleted/cancelled node with * the given predecessor. * * @param pred a node that was at one time known to be the * predecessor of s, or null or s itself if s is/was at head * @param s the node to be unspliced */ final void unsplice(Node pred, Node s) { s.forgetContents(); // forget unneeded fields /* * See above for rationale. Briefly: if pred still points to * s, try to unlink s. If s cannot be unlinked, because it is * trailing node or pred might be unlinked, and neither pred * nor s are head or offlist, add to sweepVotes, and if enough * votes have accumulated, sweep. */ if (pred != null && pred != s && pred.next == s) { Node n = s.next; if (n == null || (n != s && pred.casNext(s, n) && pred.isMatched())) { for (;;) { // check if at, or could be, head Node h = head; if (h == pred || h == s || h == null) return; // at head or list empty if (!h.isMatched()) break; Node hn = h.next; if (hn == null) return; // now empty if (hn != h && casHead(h, hn)) h.forgetNext(); // advance head } if (pred.next != pred && s.next != s) { // recheck if offlist for (;;) { // sweep now if enough votes int v = sweepVotes; if (v < SWEEP_THRESHOLD) { if (casSweepVotes(v, v + 1)) break; } else if (casSweepVotes(v, 0)) { sweep(); break; } } } } } } /** * Unlinks matched (typically cancelled) nodes encountered in a * traversal from head. */ private void sweep() { for (Node p = head, s, n; p != null && (s = p.next) != null; ) { if (!s.isMatched()) // Unmatched nodes are never self-linked p = s; else if ((n = s.next) == null) // trailing node is pinned break; else if (s == n) // stale // No need to also check for p == s, since that implies s == n p = head; else p.casNext(s, n); } } /** * Main implementation of remove(Object) */ private boolean findAndRemove(Object e) { if (e != null) { for (Node pred = null, p = head; p != null; ) { Object item = p.item; if (p.isData) { if (item != null && item != p && e.equals(item) && p.tryMatchData()) { unsplice(pred, p); return true; } } else if (item == null) break; pred = p; if ((p = p.next) == pred) { // stale pred = null; p = head; } } } return false; } /** * Creates an initially empty {@code LinkedTransferQueue}. */ public LinkedTransferQueue() { } /** * Creates a {@code LinkedTransferQueue} * initially containing the elements of the given collection, * added in traversal order of the collection's iterator. * * @param c the collection of elements to initially contain * @throws NullPointerException if the specified collection or any * of its elements are null */ public LinkedTransferQueue(Collection c) { this(); addAll(c); } /** * Inserts the specified element at the tail of this queue. * As the queue is unbounded, this method will never block. * * @throws NullPointerException if the specified element is null */ public void put(E e) { xfer(e, true, ASYNC, 0); } /** * Inserts the specified element at the tail of this queue. * As the queue is unbounded, this method will never block or * return {@code false}. * * @return {@code true} (as specified by * {@link BlockingQueue#offer(Object,long,TimeUnit) BlockingQueue.offer}) * @throws NullPointerException if the specified element is null */ public boolean offer(E e, long timeout, TimeUnit unit) { xfer(e, true, ASYNC, 0); return true; } /** * Inserts the specified element at the tail of this queue. * As the queue is unbounded, this method will never return {@code false}. * * @return {@code true} (as specified by {@link Queue#offer}) * @throws NullPointerException if the specified element is null */ public boolean offer(E e) { xfer(e, true, ASYNC, 0); return true; } /** * Inserts the specified element at the tail of this queue. * As the queue is unbounded, this method will never throw * {@link IllegalStateException} or return {@code false}. * * @return {@code true} (as specified by {@link Collection#add}) * @throws NullPointerException if the specified element is null */ public boolean add(E e) { xfer(e, true, ASYNC, 0); return true; } /** * Transfers the element to a waiting consumer immediately, if possible. * *

More precisely, transfers the specified element immediately * if there exists a consumer already waiting to receive it (in * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), * otherwise returning {@code false} without enqueuing the element. * * @throws NullPointerException if the specified element is null */ public boolean tryTransfer(E e) { return xfer(e, true, NOW, 0) == null; } /** * Transfers the element to a consumer, waiting if necessary to do so. * *

More precisely, transfers the specified element immediately * if there exists a consumer already waiting to receive it (in * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), * else inserts the specified element at the tail of this queue * and waits until the element is received by a consumer. * * @throws NullPointerException if the specified element is null */ public void transfer(E e) throws InterruptedException { if (xfer(e, true, SYNC, 0) != null) { Thread.interrupted(); // failure possible only due to interrupt throw new InterruptedException(); } } /** * Transfers the element to a consumer if it is possible to do so * before the timeout elapses. * *

More precisely, transfers the specified element immediately * if there exists a consumer already waiting to receive it (in * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), * else inserts the specified element at the tail of this queue * and waits until the element is received by a consumer, * returning {@code false} if the specified wait time elapses * before the element can be transferred. * * @throws NullPointerException if the specified element is null */ public boolean tryTransfer(E e, long timeout, TimeUnit unit) throws InterruptedException { if (xfer(e, true, TIMED, unit.toNanos(timeout)) == null) return true; if (!Thread.interrupted()) return false; throw new InterruptedException(); } public E take() throws InterruptedException { E e = xfer(null, false, SYNC, 0); if (e != null) return e; Thread.interrupted(); throw new InterruptedException(); } public E poll(long timeout, TimeUnit unit) throws InterruptedException { E e = xfer(null, false, TIMED, unit.toNanos(timeout)); if (e != null || !Thread.interrupted()) return e; throw new InterruptedException(); } public E poll() { return xfer(null, false, NOW, 0); } /** * @throws NullPointerException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc} */ public int drainTo(Collection c) { if (c == null) throw new NullPointerException(); if (c == this) throw new IllegalArgumentException(); int n = 0; E e; while ( (e = poll()) != null) { c.add(e); ++n; } return n; } /** * @throws NullPointerException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc} */ public int drainTo(Collection c, int maxElements) { if (c == null) throw new NullPointerException(); if (c == this) throw new IllegalArgumentException(); int n = 0; E e; while (n < maxElements && (e = poll()) != null) { c.add(e); ++n; } return n; } /** * Returns an iterator over the elements in this queue in proper * sequence, from head to tail. * *

The returned iterator is a "weakly consistent" iterator that * will never throw * {@link ConcurrentModificationException ConcurrentModificationException}, * and guarantees to traverse elements as they existed upon * construction of the iterator, and may (but is not guaranteed * to) reflect any modifications subsequent to construction. * * @return an iterator over the elements in this queue in proper sequence */ public Iterator iterator() { return new Itr(); } public E peek() { return firstDataItem(); } /** * Returns {@code true} if this queue contains no elements. * * @return {@code true} if this queue contains no elements */ public boolean isEmpty() { for (Node p = head; p != null; p = succ(p)) { if (!p.isMatched()) return !p.isData; } return true; } public boolean hasWaitingConsumer() { return firstOfMode(false) != null; } /** * Returns the number of elements in this queue. If this queue * contains more than {@code Integer.MAX_VALUE} elements, returns * {@code Integer.MAX_VALUE}. * *

Beware that, unlike in most collections, this method is * NOT a constant-time operation. Because of the * asynchronous nature of these queues, determining the current * number of elements requires an O(n) traversal. * * @return the number of elements in this queue */ public int size() { return countOfMode(true); } public int getWaitingConsumerCount() { return countOfMode(false); } /** * Removes a single instance of the specified element from this queue, * if it is present. More formally, removes an element {@code e} such * that {@code o.equals(e)}, if this queue contains one or more such * elements. * Returns {@code true} if this queue contained the specified element * (or equivalently, if this queue changed as a result of the call). * * @param o element to be removed from this queue, if present * @return {@code true} if this queue changed as a result of the call */ public boolean remove(Object o) { return findAndRemove(o); } /** * Returns {@code true} if this queue contains the specified element. * More formally, returns {@code true} if and only if this queue contains * at least one element {@code e} such that {@code o.equals(e)}. * * @param o object to be checked for containment in this queue * @return {@code true} if this queue contains the specified element */ public boolean contains(Object o) { if (o == null) return false; for (Node p = head; p != null; p = succ(p)) { Object item = p.item; if (p.isData) { if (item != null && item != p && o.equals(item)) return true; } else if (item == null) break; } return false; } /** * Always returns {@code Integer.MAX_VALUE} because a * {@code LinkedTransferQueue} is not capacity constrained. * * @return {@code Integer.MAX_VALUE} (as specified by * {@link BlockingQueue#remainingCapacity()}) */ public int remainingCapacity() { return Integer.MAX_VALUE; } /** * Saves the state to a stream (that is, serializes it). * * @serialData All of the elements (each an {@code E}) in * the proper order, followed by a null * @param s the stream */ private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { s.defaultWriteObject(); for (E e : this) s.writeObject(e); // Use trailing null as sentinel s.writeObject(null); } /** * Reconstitutes the Queue instance from a stream (that is, * deserializes it). * * @param s the stream */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { s.defaultReadObject(); for (;;) { @SuppressWarnings("unchecked") E item = (E) s.readObject(); if (item == null) break; else offer(item); } } // Unsafe mechanics private static final sun.misc.Unsafe UNSAFE = getUnsafe(); private static final long headOffset = objectFieldOffset(UNSAFE, "head", LinkedTransferQueue.class); private static final long tailOffset = objectFieldOffset(UNSAFE, "tail", LinkedTransferQueue.class); private static final long sweepVotesOffset = objectFieldOffset(UNSAFE, "sweepVotes", LinkedTransferQueue.class); static long objectFieldOffset(sun.misc.Unsafe UNSAFE, String field, Class klazz) { try { return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); } catch (NoSuchFieldException e) { // Convert Exception to corresponding Error NoSuchFieldError error = new NoSuchFieldError(field); error.initCause(e); throw error; } } /** * Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. * Replace with a simple call to Unsafe.getUnsafe when integrating * into a jdk. * * @return a sun.misc.Unsafe */ static sun.misc.Unsafe getUnsafe() { try { return sun.misc.Unsafe.getUnsafe(); } catch (SecurityException se) { try { return java.security.AccessController.doPrivileged (new java.security .PrivilegedExceptionAction() { public sun.misc.Unsafe run() throws Exception { java.lang.reflect.Field f = sun.misc .Unsafe.class.getDeclaredField("theUnsafe"); f.setAccessible(true); return (sun.misc.Unsafe) f.get(null); }}); } catch (java.security.PrivilegedActionException e) { throw new RuntimeException("Could not initialize intrinsics", e.getCause()); } } } } jsr166/src/jsr166y/ThreadLocalRandom.java0000644000000000000000000001516211537741066015217 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166y; import java.util.Random; /** * A random number generator isolated to the current thread. Like the * global {@link java.util.Random} generator used by the {@link * java.lang.Math} class, a {@code ThreadLocalRandom} is initialized * with an internally generated seed that may not otherwise be * modified. When applicable, use of {@code ThreadLocalRandom} rather * than shared {@code Random} objects in concurrent programs will * typically encounter much less overhead and contention. Use of * {@code ThreadLocalRandom} is particularly appropriate when multiple * tasks (for example, each a {@link ForkJoinTask}) use random numbers * in parallel in thread pools. * *

Usages of this class should typically be of the form: * {@code ThreadLocalRandom.current().nextX(...)} (where * {@code X} is {@code Int}, {@code Long}, etc). * When all usages are of this form, it is never possible to * accidently share a {@code ThreadLocalRandom} across multiple threads. * *

This class also provides additional commonly used bounded random * generation methods. * * @since 1.7 * @author Doug Lea */ public class ThreadLocalRandom extends Random { // same constants as Random, but must be redeclared because private private final static long multiplier = 0x5DEECE66DL; private final static long addend = 0xBL; private final static long mask = (1L << 48) - 1; /** * The random seed. We can't use super.seed. */ private long rnd; /** * Initialization flag to permit calls to setSeed to succeed only * while executing the Random constructor. We can't allow others * since it would cause setting seed in one part of a program to * unintentionally impact other usages by the thread. */ boolean initialized; // Padding to help avoid memory contention among seed updates in // different TLRs in the common case that they are located near // each other. private long pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7; /** * The actual ThreadLocal */ private static final ThreadLocal localRandom = new ThreadLocal() { protected ThreadLocalRandom initialValue() { return new ThreadLocalRandom(); } }; /** * Constructor called only by localRandom.initialValue. */ ThreadLocalRandom() { super(); initialized = true; } /** * Returns the current thread's {@code ThreadLocalRandom}. * * @return the current thread's {@code ThreadLocalRandom} */ public static ThreadLocalRandom current() { return localRandom.get(); } /** * Throws {@code UnsupportedOperationException}. Setting seeds in * this generator is not supported. * * @throws UnsupportedOperationException always */ public void setSeed(long seed) { if (initialized) throw new UnsupportedOperationException(); rnd = (seed ^ multiplier) & mask; } protected int next(int bits) { rnd = (rnd * multiplier + addend) & mask; return (int) (rnd >>> (48-bits)); } /** * Returns a pseudorandom, uniformly distributed value between the * given least value (inclusive) and bound (exclusive). * * @param least the least value returned * @param bound the upper bound (exclusive) * @throws IllegalArgumentException if least greater than or equal * to bound * @return the next value */ public int nextInt(int least, int bound) { if (least >= bound) throw new IllegalArgumentException(); return nextInt(bound - least) + least; } /** * Returns a pseudorandom, uniformly distributed value * between 0 (inclusive) and the specified value (exclusive). * * @param n the bound on the random number to be returned. Must be * positive. * @return the next value * @throws IllegalArgumentException if n is not positive */ public long nextLong(long n) { if (n <= 0) throw new IllegalArgumentException("n must be positive"); // Divide n by two until small enough for nextInt. On each // iteration (at most 31 of them but usually much less), // randomly choose both whether to include high bit in result // (offset) and whether to continue with the lower vs upper // half (which makes a difference only if odd). long offset = 0; while (n >= Integer.MAX_VALUE) { int bits = next(2); long half = n >>> 1; long nextn = ((bits & 2) == 0) ? half : n - half; if ((bits & 1) == 0) offset += n - nextn; n = nextn; } return offset + nextInt((int) n); } /** * Returns a pseudorandom, uniformly distributed value between the * given least value (inclusive) and bound (exclusive). * * @param least the least value returned * @param bound the upper bound (exclusive) * @return the next value * @throws IllegalArgumentException if least greater than or equal * to bound */ public long nextLong(long least, long bound) { if (least >= bound) throw new IllegalArgumentException(); return nextLong(bound - least) + least; } /** * Returns a pseudorandom, uniformly distributed {@code double} value * between 0 (inclusive) and the specified value (exclusive). * * @param n the bound on the random number to be returned. Must be * positive. * @return the next value * @throws IllegalArgumentException if n is not positive */ public double nextDouble(double n) { if (n <= 0) throw new IllegalArgumentException("n must be positive"); return nextDouble() * n; } /** * Returns a pseudorandom, uniformly distributed value between the * given least value (inclusive) and bound (exclusive). * * @param least the least value returned * @param bound the upper bound (exclusive) * @return the next value * @throws IllegalArgumentException if least greater than or equal * to bound */ public double nextDouble(double least, double bound) { if (least >= bound) throw new IllegalArgumentException(); return nextDouble() * (bound - least) + least; } private static final long serialVersionUID = -5851777807851030925L; } jsr166/src/jsr166y/package-info.java0000644000000000000000000000250011537741066014210 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Preview versions of classes targeted for Java 7. Includes a * fine-grained parallel computation framework: ForkJoinTasks and * their related support classes provide a very efficient basis for * obtaining platform-independent parallel speed-ups of * computation-intensive operations. They are not a full substitute * for the kinds of arbitrary processing supported by Executors or * Threads. However, when applicable, they typically provide * significantly greater performance on multiprocessor platforms. * *

Candidates for fork/join processing mainly include those that * can be expressed using parallel divide-and-conquer techniques: To * solve a problem, break it in two (or more) parts, and then solve * those parts in parallel, continuing on in this way until the * problem is too small to be broken up, so is solved directly. The * underlying work-stealing framework makes subtasks * available to other threads (normally one per CPU), that help * complete the tasks. In general, the most efficient ForkJoinTasks * are those that directly implement this algorithmic design pattern. */ package jsr166y; jsr166/src/jsr166y/Phaser.java0000644000000000000000000013222111537741066013112 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166y; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.LockSupport; /** * A reusable synchronization barrier, similar in functionality to * {@link java.util.concurrent.CyclicBarrier CyclicBarrier} and * {@link java.util.concurrent.CountDownLatch CountDownLatch} * but supporting more flexible usage. * *

Registration. Unlike the case for other barriers, the * number of parties registered to synchronize on a phaser * may vary over time. Tasks may be registered at any time (using * methods {@link #register}, {@link #bulkRegister}, or forms of * constructors establishing initial numbers of parties), and * optionally deregistered upon any arrival (using {@link * #arriveAndDeregister}). As is the case with most basic * synchronization constructs, registration and deregistration affect * only internal counts; they do not establish any further internal * bookkeeping, so tasks cannot query whether they are registered. * (However, you can introduce such bookkeeping by subclassing this * class.) * *

Synchronization. Like a {@code CyclicBarrier}, a {@code * Phaser} may be repeatedly awaited. Method {@link * #arriveAndAwaitAdvance} has effect analogous to {@link * java.util.concurrent.CyclicBarrier#await CyclicBarrier.await}. Each * generation of a phaser has an associated phase number. The phase * number starts at zero, and advances when all parties arrive at the * phaser, wrapping around to zero after reaching {@code * Integer.MAX_VALUE}. The use of phase numbers enables independent * control of actions upon arrival at a phaser and upon awaiting * others, via two kinds of methods that may be invoked by any * registered party: * *

    * *
  • Arrival. Methods {@link #arrive} and * {@link #arriveAndDeregister} record arrival. These methods * do not block, but return an associated arrival phase * number; that is, the phase number of the phaser to which * the arrival applied. When the final party for a given phase * arrives, an optional action is performed and the phase * advances. These actions are performed by the party * triggering a phase advance, and are arranged by overriding * method {@link #onAdvance(int, int)}, which also controls * termination. Overriding this method is similar to, but more * flexible than, providing a barrier action to a {@code * CyclicBarrier}. * *
  • Waiting. Method {@link #awaitAdvance} requires an * argument indicating an arrival phase number, and returns when * the phaser advances to (or is already at) a different phase. * Unlike similar constructions using {@code CyclicBarrier}, * method {@code awaitAdvance} continues to wait even if the * waiting thread is interrupted. Interruptible and timeout * versions are also available, but exceptions encountered while * tasks wait interruptibly or with timeout do not change the * state of the phaser. If necessary, you can perform any * associated recovery within handlers of those exceptions, * often after invoking {@code forceTermination}. Phasers may * also be used by tasks executing in a {@link ForkJoinPool}, * which will ensure sufficient parallelism to execute tasks * when others are blocked waiting for a phase to advance. * *
* *

Termination. A phaser may enter a termination * state, that may be checked using method {@link #isTerminated}. Upon * termination, all synchronization methods immediately return without * waiting for advance, as indicated by a negative return value. * Similarly, attempts to register upon termination have no effect. * Termination is triggered when an invocation of {@code onAdvance} * returns {@code true}. The default implementation returns {@code * true} if a deregistration has caused the number of registered * parties to become zero. As illustrated below, when phasers control * actions with a fixed number of iterations, it is often convenient * to override this method to cause termination when the current phase * number reaches a threshold. Method {@link #forceTermination} is * also available to abruptly release waiting threads and allow them * to terminate. * *

Tiering. Phasers may be tiered (i.e., * constructed in tree structures) to reduce contention. Phasers with * large numbers of parties that would otherwise experience heavy * synchronization contention costs may instead be set up so that * groups of sub-phasers share a common parent. This may greatly * increase throughput even though it incurs greater per-operation * overhead. * *

In a tree of tiered phasers, registration and deregistration of * child phasers with their parent are managed automatically. * Whenever the number of registered parties of a child phaser becomes * non-zero (as established in the {@link #Phaser(Phaser,int)} * constructor, {@link #register}, or {@link #bulkRegister}), the * child phaser is registered with its parent. Whenever the number of * registered parties becomes zero as the result of an invocation of * {@link #arriveAndDeregister}, the child phaser is deregistered * from its parent. * *

Monitoring. While synchronization methods may be invoked * only by registered parties, the current state of a phaser may be * monitored by any caller. At any given moment there are {@link * #getRegisteredParties} parties in total, of which {@link * #getArrivedParties} have arrived at the current phase ({@link * #getPhase}). When the remaining ({@link #getUnarrivedParties}) * parties arrive, the phase advances. The values returned by these * methods may reflect transient states and so are not in general * useful for synchronization control. Method {@link #toString} * returns snapshots of these state queries in a form convenient for * informal monitoring. * *

Sample usages: * *

A {@code Phaser} may be used instead of a {@code CountDownLatch} * to control a one-shot action serving a variable number of parties. * The typical idiom is for the method setting this up to first * register, then start the actions, then deregister, as in: * *

 {@code
 * void runTasks(List tasks) {
 *   final Phaser phaser = new Phaser(1); // "1" to register self
 *   // create and start threads
 *   for (Runnable task : tasks) {
 *     phaser.register();
 *     new Thread() {
 *       public void run() {
 *         phaser.arriveAndAwaitAdvance(); // await all creation
 *         task.run();
 *       }
 *     }.start();
 *   }
 *
 *   // allow threads to start and deregister self
 *   phaser.arriveAndDeregister();
 * }}
* *

One way to cause a set of threads to repeatedly perform actions * for a given number of iterations is to override {@code onAdvance}: * *

 {@code
 * void startTasks(List tasks, final int iterations) {
 *   final Phaser phaser = new Phaser() {
 *     protected boolean onAdvance(int phase, int registeredParties) {
 *       return phase >= iterations || registeredParties == 0;
 *     }
 *   };
 *   phaser.register();
 *   for (final Runnable task : tasks) {
 *     phaser.register();
 *     new Thread() {
 *       public void run() {
 *         do {
 *           task.run();
 *           phaser.arriveAndAwaitAdvance();
 *         } while (!phaser.isTerminated());
 *       }
 *     }.start();
 *   }
 *   phaser.arriveAndDeregister(); // deregister self, don't wait
 * }}
* * If the main task must later await termination, it * may re-register and then execute a similar loop: *
 {@code
 *   // ...
 *   phaser.register();
 *   while (!phaser.isTerminated())
 *     phaser.arriveAndAwaitAdvance();}
* *

Related constructions may be used to await particular phase numbers * in contexts where you are sure that the phase will never wrap around * {@code Integer.MAX_VALUE}. For example: * *

 {@code
 * void awaitPhase(Phaser phaser, int phase) {
 *   int p = phaser.register(); // assumes caller not already registered
 *   while (p < phase) {
 *     if (phaser.isTerminated())
 *       // ... deal with unexpected termination
 *     else
 *       p = phaser.arriveAndAwaitAdvance();
 *   }
 *   phaser.arriveAndDeregister();
 * }}
* * *

To create a set of {@code n} tasks using a tree of phasers, you * could use code of the following form, assuming a Task class with a * constructor accepting a {@code Phaser} that it registers with upon * construction. After invocation of {@code build(new Task[n], 0, n, * new Phaser())}, these tasks could then be started, for example by * submitting to a pool: * *

 {@code
 * void build(Task[] tasks, int lo, int hi, Phaser ph) {
 *   if (hi - lo > TASKS_PER_PHASER) {
 *     for (int i = lo; i < hi; i += TASKS_PER_PHASER) {
 *       int j = Math.min(i + TASKS_PER_PHASER, hi);
 *       build(tasks, i, j, new Phaser(ph));
 *     }
 *   } else {
 *     for (int i = lo; i < hi; ++i)
 *       tasks[i] = new Task(ph);
 *       // assumes new Task(ph) performs ph.register()
 *   }
 * }}
* * The best value of {@code TASKS_PER_PHASER} depends mainly on * expected synchronization rates. A value as low as four may * be appropriate for extremely small per-phase task bodies (thus * high rates), or up to hundreds for extremely large ones. * *

Implementation notes: This implementation restricts the * maximum number of parties to 65535. Attempts to register additional * parties result in {@code IllegalStateException}. However, you can and * should create tiered phasers to accommodate arbitrarily large sets * of participants. * * @since 1.7 * @author Doug Lea */ public class Phaser { /* * This class implements an extension of X10 "clocks". Thanks to * Vijay Saraswat for the idea, and to Vivek Sarkar for * enhancements to extend functionality. */ /** * Primary state representation, holding four fields: * * * unarrived -- the number of parties yet to hit barrier (bits 0-15) * * parties -- the number of parties to wait (bits 16-31) * * phase -- the generation of the barrier (bits 32-62) * * terminated -- set if barrier is terminated (bit 63 / sign) * * Except that a phaser with no registered parties is * distinguished with the otherwise illegal state of having zero * parties and one unarrived parties (encoded as EMPTY below). * * To efficiently maintain atomicity, these values are packed into * a single (atomic) long. Good performance relies on keeping * state decoding and encoding simple, and keeping race windows * short. * * All state updates are performed via CAS except initial * registration of a sub-phaser (i.e., one with a non-null * parent). In this (relatively rare) case, we use built-in * synchronization to lock while first registering with its * parent. * * The phase of a subphaser is allowed to lag that of its * ancestors until it is actually accessed -- see method * reconcileState. */ private volatile long state; private static final int MAX_PARTIES = 0xffff; private static final int MAX_PHASE = 0x7fffffff; private static final int PARTIES_SHIFT = 16; private static final int PHASE_SHIFT = 32; private static final long PHASE_MASK = -1L << PHASE_SHIFT; private static final int UNARRIVED_MASK = 0xffff; // to mask ints private static final long PARTIES_MASK = 0xffff0000L; // to mask longs private static final long TERMINATION_BIT = 1L << 63; // some special values private static final int ONE_ARRIVAL = 1; private static final int ONE_PARTY = 1 << PARTIES_SHIFT; private static final int EMPTY = 1; // The following unpacking methods are usually manually inlined private static int unarrivedOf(long s) { int counts = (int)s; return (counts == EMPTY) ? 0 : counts & UNARRIVED_MASK; } private static int partiesOf(long s) { return (int)s >>> PARTIES_SHIFT; } private static int phaseOf(long s) { return (int) (s >>> PHASE_SHIFT); } private static int arrivedOf(long s) { int counts = (int)s; return (counts == EMPTY) ? 0 : (counts >>> PARTIES_SHIFT) - (counts & UNARRIVED_MASK); } /** * The parent of this phaser, or null if none */ private final Phaser parent; /** * The root of phaser tree. Equals this if not in a tree. */ private final Phaser root; /** * Heads of Treiber stacks for waiting threads. To eliminate * contention when releasing some threads while adding others, we * use two of them, alternating across even and odd phases. * Subphasers share queues with root to speed up releases. */ private final AtomicReference evenQ; private final AtomicReference oddQ; private AtomicReference queueFor(int phase) { return ((phase & 1) == 0) ? evenQ : oddQ; } /** * Returns message string for bounds exceptions on arrival. */ private String badArrive(long s) { return "Attempted arrival of unregistered party for " + stateToString(s); } /** * Returns message string for bounds exceptions on registration. */ private String badRegister(long s) { return "Attempt to register more than " + MAX_PARTIES + " parties for " + stateToString(s); } /** * Main implementation for methods arrive and arriveAndDeregister. * Manually tuned to speed up and minimize race windows for the * common case of just decrementing unarrived field. * * @param deregister false for arrive, true for arriveAndDeregister */ private int doArrive(boolean deregister) { int adj = deregister ? ONE_ARRIVAL|ONE_PARTY : ONE_ARRIVAL; final Phaser root = this.root; for (;;) { long s = (root == this) ? state : reconcileState(); int phase = (int)(s >>> PHASE_SHIFT); int counts = (int)s; int unarrived = (counts & UNARRIVED_MASK) - 1; if (phase < 0) return phase; else if (counts == EMPTY || unarrived < 0) { if (root == this || reconcileState() == s) throw new IllegalStateException(badArrive(s)); } else if (UNSAFE.compareAndSwapLong(this, stateOffset, s, s-=adj)) { if (unarrived == 0) { long n = s & PARTIES_MASK; // base of next state int nextUnarrived = ((int)n) >>> PARTIES_SHIFT; if (root != this) return parent.doArrive(nextUnarrived == 0); if (onAdvance(phase, nextUnarrived)) n |= TERMINATION_BIT; else if (nextUnarrived == 0) n |= EMPTY; else n |= nextUnarrived; n |= ((long)((phase + 1) & MAX_PHASE)) << PHASE_SHIFT; UNSAFE.compareAndSwapLong(this, stateOffset, s, n); releaseWaiters(phase); } return phase; } } } /** * Implementation of register, bulkRegister * * @param registrations number to add to both parties and * unarrived fields. Must be greater than zero. */ private int doRegister(int registrations) { // adjustment to state long adj = ((long)registrations << PARTIES_SHIFT) | registrations; Phaser par = parent; int phase; for (;;) { long s = state; int counts = (int)s; int parties = counts >>> PARTIES_SHIFT; int unarrived = counts & UNARRIVED_MASK; if (registrations > MAX_PARTIES - parties) throw new IllegalStateException(badRegister(s)); else if ((phase = (int)(s >>> PHASE_SHIFT)) < 0) break; else if (counts != EMPTY) { // not 1st registration if (par == null || reconcileState() == s) { if (unarrived == 0) // wait out advance root.internalAwaitAdvance(phase, null); else if (UNSAFE.compareAndSwapLong(this, stateOffset, s, s + adj)) break; } } else if (par == null) { // 1st root registration long next = (((long) phase) << PHASE_SHIFT) | adj; if (UNSAFE.compareAndSwapLong(this, stateOffset, s, next)) break; } else { synchronized (this) { // 1st sub registration if (state == s) { // recheck under lock par.doRegister(1); do { // force current phase phase = (int)(root.state >>> PHASE_SHIFT); // assert phase < 0 || (int)state == EMPTY; } while (!UNSAFE.compareAndSwapLong (this, stateOffset, state, (((long) phase) << PHASE_SHIFT) | adj)); break; } } } } return phase; } /** * Resolves lagged phase propagation from root if necessary. * Reconciliation normally occurs when root has advanced but * subphasers have not yet done so, in which case they must finish * their own advance by setting unarrived to parties (or if * parties is zero, resetting to unregistered EMPTY state). * However, this method may also be called when "floating" * subphasers with possibly some unarrived parties are merely * catching up to current phase, in which case counts are * unaffected. * * @return reconciled state */ private long reconcileState() { final Phaser root = this.root; long s = state; if (root != this) { int phase, u, p; // CAS root phase with current parties; possibly trip unarrived while ((phase = (int)(root.state >>> PHASE_SHIFT)) != (int)(s >>> PHASE_SHIFT) && !UNSAFE.compareAndSwapLong (this, stateOffset, s, s = ((((long) phase) << PHASE_SHIFT) | (s & PARTIES_MASK) | ((p = (int)s >>> PARTIES_SHIFT) == 0 ? EMPTY : (u = (int)s & UNARRIVED_MASK) == 0 ? p : u)))) s = state; } return s; } /** * Creates a new phaser with no initially registered parties, no * parent, and initial phase number 0. Any thread using this * phaser will need to first register for it. */ public Phaser() { this(null, 0); } /** * Creates a new phaser with the given number of registered * unarrived parties, no parent, and initial phase number 0. * * @param parties the number of parties required to advance to the * next phase * @throws IllegalArgumentException if parties less than zero * or greater than the maximum number of parties supported */ public Phaser(int parties) { this(null, parties); } /** * Equivalent to {@link #Phaser(Phaser, int) Phaser(parent, 0)}. * * @param parent the parent phaser */ public Phaser(Phaser parent) { this(parent, 0); } /** * Creates a new phaser with the given parent and number of * registered unarrived parties. When the given parent is non-null * and the given number of parties is greater than zero, this * child phaser is registered with its parent. * * @param parent the parent phaser * @param parties the number of parties required to advance to the * next phase * @throws IllegalArgumentException if parties less than zero * or greater than the maximum number of parties supported */ public Phaser(Phaser parent, int parties) { if (parties >>> PARTIES_SHIFT != 0) throw new IllegalArgumentException("Illegal number of parties"); int phase = 0; this.parent = parent; if (parent != null) { final Phaser root = parent.root; this.root = root; this.evenQ = root.evenQ; this.oddQ = root.oddQ; if (parties != 0) phase = parent.doRegister(1); } else { this.root = this; this.evenQ = new AtomicReference(); this.oddQ = new AtomicReference(); } this.state = (parties == 0) ? (long) EMPTY : ((((long) phase) << PHASE_SHIFT) | (((long) parties) << PARTIES_SHIFT) | ((long) parties)); } /** * Adds a new unarrived party to this phaser. If an ongoing * invocation of {@link #onAdvance} is in progress, this method * may await its completion before returning. If this phaser has * a parent, and this phaser previously had no registered parties, * this child phaser is also registered with its parent. If * this phaser is terminated, the attempt to register has * no effect, and a negative value is returned. * * @return the arrival phase number to which this registration * applied. If this value is negative, then this phaser has * terminated, in which case registration has no effect. * @throws IllegalStateException if attempting to register more * than the maximum supported number of parties */ public int register() { return doRegister(1); } /** * Adds the given number of new unarrived parties to this phaser. * If an ongoing invocation of {@link #onAdvance} is in progress, * this method may await its completion before returning. If this * phaser has a parent, and the given number of parties is greater * than zero, and this phaser previously had no registered * parties, this child phaser is also registered with its parent. * If this phaser is terminated, the attempt to register has no * effect, and a negative value is returned. * * @param parties the number of additional parties required to * advance to the next phase * @return the arrival phase number to which this registration * applied. If this value is negative, then this phaser has * terminated, in which case registration has no effect. * @throws IllegalStateException if attempting to register more * than the maximum supported number of parties * @throws IllegalArgumentException if {@code parties < 0} */ public int bulkRegister(int parties) { if (parties < 0) throw new IllegalArgumentException(); if (parties == 0) return getPhase(); return doRegister(parties); } /** * Arrives at this phaser, without waiting for others to arrive. * *

It is a usage error for an unregistered party to invoke this * method. However, this error may result in an {@code * IllegalStateException} only upon some subsequent operation on * this phaser, if ever. * * @return the arrival phase number, or a negative value if terminated * @throws IllegalStateException if not terminated and the number * of unarrived parties would become negative */ public int arrive() { return doArrive(false); } /** * Arrives at this phaser and deregisters from it without waiting * for others to arrive. Deregistration reduces the number of * parties required to advance in future phases. If this phaser * has a parent, and deregistration causes this phaser to have * zero parties, this phaser is also deregistered from its parent. * *

It is a usage error for an unregistered party to invoke this * method. However, this error may result in an {@code * IllegalStateException} only upon some subsequent operation on * this phaser, if ever. * * @return the arrival phase number, or a negative value if terminated * @throws IllegalStateException if not terminated and the number * of registered or unarrived parties would become negative */ public int arriveAndDeregister() { return doArrive(true); } /** * Arrives at this phaser and awaits others. Equivalent in effect * to {@code awaitAdvance(arrive())}. If you need to await with * interruption or timeout, you can arrange this with an analogous * construction using one of the other forms of the {@code * awaitAdvance} method. If instead you need to deregister upon * arrival, use {@code awaitAdvance(arriveAndDeregister())}. * *

It is a usage error for an unregistered party to invoke this * method. However, this error may result in an {@code * IllegalStateException} only upon some subsequent operation on * this phaser, if ever. * * @return the arrival phase number, or the (negative) * {@linkplain #getPhase() current phase} if terminated * @throws IllegalStateException if not terminated and the number * of unarrived parties would become negative */ public int arriveAndAwaitAdvance() { // Specialization of doArrive+awaitAdvance eliminating some reads/paths final Phaser root = this.root; for (;;) { long s = (root == this) ? state : reconcileState(); int phase = (int)(s >>> PHASE_SHIFT); int counts = (int)s; int unarrived = (counts & UNARRIVED_MASK) - 1; if (phase < 0) return phase; else if (counts == EMPTY || unarrived < 0) { if (reconcileState() == s) throw new IllegalStateException(badArrive(s)); } else if (UNSAFE.compareAndSwapLong(this, stateOffset, s, s -= ONE_ARRIVAL)) { if (unarrived != 0) return root.internalAwaitAdvance(phase, null); if (root != this) return parent.arriveAndAwaitAdvance(); long n = s & PARTIES_MASK; // base of next state int nextUnarrived = ((int)n) >>> PARTIES_SHIFT; if (onAdvance(phase, nextUnarrived)) n |= TERMINATION_BIT; else if (nextUnarrived == 0) n |= EMPTY; else n |= nextUnarrived; int nextPhase = (phase + 1) & MAX_PHASE; n |= (long)nextPhase << PHASE_SHIFT; if (!UNSAFE.compareAndSwapLong(this, stateOffset, s, n)) return (int)(state >>> PHASE_SHIFT); // terminated releaseWaiters(phase); return nextPhase; } } } /** * Awaits the phase of this phaser to advance from the given phase * value, returning immediately if the current phase is not equal * to the given phase value or this phaser is terminated. * * @param phase an arrival phase number, or negative value if * terminated; this argument is normally the value returned by a * previous call to {@code arrive} or {@code arriveAndDeregister}. * @return the next arrival phase number, or the argument if it is * negative, or the (negative) {@linkplain #getPhase() current phase} * if terminated */ public int awaitAdvance(int phase) { final Phaser root = this.root; long s = (root == this) ? state : reconcileState(); int p = (int)(s >>> PHASE_SHIFT); if (phase < 0) return phase; if (p == phase) return root.internalAwaitAdvance(phase, null); return p; } /** * Awaits the phase of this phaser to advance from the given phase * value, throwing {@code InterruptedException} if interrupted * while waiting, or returning immediately if the current phase is * not equal to the given phase value or this phaser is * terminated. * * @param phase an arrival phase number, or negative value if * terminated; this argument is normally the value returned by a * previous call to {@code arrive} or {@code arriveAndDeregister}. * @return the next arrival phase number, or the argument if it is * negative, or the (negative) {@linkplain #getPhase() current phase} * if terminated * @throws InterruptedException if thread interrupted while waiting */ public int awaitAdvanceInterruptibly(int phase) throws InterruptedException { final Phaser root = this.root; long s = (root == this) ? state : reconcileState(); int p = (int)(s >>> PHASE_SHIFT); if (phase < 0) return phase; if (p == phase) { QNode node = new QNode(this, phase, true, false, 0L); p = root.internalAwaitAdvance(phase, node); if (node.wasInterrupted) throw new InterruptedException(); } return p; } /** * Awaits the phase of this phaser to advance from the given phase * value or the given timeout to elapse, throwing {@code * InterruptedException} if interrupted while waiting, or * returning immediately if the current phase is not equal to the * given phase value or this phaser is terminated. * * @param phase an arrival phase number, or negative value if * terminated; this argument is normally the value returned by a * previous call to {@code arrive} or {@code arriveAndDeregister}. * @param timeout how long to wait before giving up, in units of * {@code unit} * @param unit a {@code TimeUnit} determining how to interpret the * {@code timeout} parameter * @return the next arrival phase number, or the argument if it is * negative, or the (negative) {@linkplain #getPhase() current phase} * if terminated * @throws InterruptedException if thread interrupted while waiting * @throws TimeoutException if timed out while waiting */ public int awaitAdvanceInterruptibly(int phase, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { long nanos = unit.toNanos(timeout); final Phaser root = this.root; long s = (root == this) ? state : reconcileState(); int p = (int)(s >>> PHASE_SHIFT); if (phase < 0) return phase; if (p == phase) { QNode node = new QNode(this, phase, true, true, nanos); p = root.internalAwaitAdvance(phase, node); if (node.wasInterrupted) throw new InterruptedException(); else if (p == phase) throw new TimeoutException(); } return p; } /** * Forces this phaser to enter termination state. Counts of * registered parties are unaffected. If this phaser is a member * of a tiered set of phasers, then all of the phasers in the set * are terminated. If this phaser is already terminated, this * method has no effect. This method may be useful for * coordinating recovery after one or more tasks encounter * unexpected exceptions. */ public void forceTermination() { // Only need to change root state final Phaser root = this.root; long s; while ((s = root.state) >= 0) { if (UNSAFE.compareAndSwapLong(root, stateOffset, s, s | TERMINATION_BIT)) { // signal all threads releaseWaiters(0); releaseWaiters(1); return; } } } /** * Returns the current phase number. The maximum phase number is * {@code Integer.MAX_VALUE}, after which it restarts at * zero. Upon termination, the phase number is negative, * in which case the prevailing phase prior to termination * may be obtained via {@code getPhase() + Integer.MIN_VALUE}. * * @return the phase number, or a negative value if terminated */ public final int getPhase() { return (int)(root.state >>> PHASE_SHIFT); } /** * Returns the number of parties registered at this phaser. * * @return the number of parties */ public int getRegisteredParties() { return partiesOf(state); } /** * Returns the number of registered parties that have arrived at * the current phase of this phaser. If this phaser has terminated, * the returned value is meaningless and arbitrary. * * @return the number of arrived parties */ public int getArrivedParties() { return arrivedOf(reconcileState()); } /** * Returns the number of registered parties that have not yet * arrived at the current phase of this phaser. If this phaser has * terminated, the returned value is meaningless and arbitrary. * * @return the number of unarrived parties */ public int getUnarrivedParties() { return unarrivedOf(reconcileState()); } /** * Returns the parent of this phaser, or {@code null} if none. * * @return the parent of this phaser, or {@code null} if none */ public Phaser getParent() { return parent; } /** * Returns the root ancestor of this phaser, which is the same as * this phaser if it has no parent. * * @return the root ancestor of this phaser */ public Phaser getRoot() { return root; } /** * Returns {@code true} if this phaser has been terminated. * * @return {@code true} if this phaser has been terminated */ public boolean isTerminated() { return root.state < 0L; } /** * Overridable method to perform an action upon impending phase * advance, and to control termination. This method is invoked * upon arrival of the party advancing this phaser (when all other * waiting parties are dormant). If this method returns {@code * true}, this phaser will be set to a final termination state * upon advance, and subsequent calls to {@link #isTerminated} * will return true. Any (unchecked) Exception or Error thrown by * an invocation of this method is propagated to the party * attempting to advance this phaser, in which case no advance * occurs. * *

The arguments to this method provide the state of the phaser * prevailing for the current transition. The effects of invoking * arrival, registration, and waiting methods on this phaser from * within {@code onAdvance} are unspecified and should not be * relied on. * *

If this phaser is a member of a tiered set of phasers, then * {@code onAdvance} is invoked only for its root phaser on each * advance. * *

To support the most common use cases, the default * implementation of this method returns {@code true} when the * number of registered parties has become zero as the result of a * party invoking {@code arriveAndDeregister}. You can disable * this behavior, thus enabling continuation upon future * registrations, by overriding this method to always return * {@code false}: * *

 {@code
     * Phaser phaser = new Phaser() {
     *   protected boolean onAdvance(int phase, int parties) { return false; }
     * }}
* * @param phase the current phase number on entry to this method, * before this phaser is advanced * @param registeredParties the current number of registered parties * @return {@code true} if this phaser should terminate */ protected boolean onAdvance(int phase, int registeredParties) { return registeredParties == 0; } /** * Returns a string identifying this phaser, as well as its * state. The state, in brackets, includes the String {@code * "phase = "} followed by the phase number, {@code "parties = "} * followed by the number of registered parties, and {@code * "arrived = "} followed by the number of arrived parties. * * @return a string identifying this phaser, as well as its state */ public String toString() { return stateToString(reconcileState()); } /** * Implementation of toString and string-based error messages */ private String stateToString(long s) { return super.toString() + "[phase = " + phaseOf(s) + " parties = " + partiesOf(s) + " arrived = " + arrivedOf(s) + "]"; } // Waiting mechanics /** * Removes and signals threads from queue for phase. */ private void releaseWaiters(int phase) { QNode q; // first element of queue Thread t; // its thread AtomicReference head = (phase & 1) == 0 ? evenQ : oddQ; while ((q = head.get()) != null && q.phase != (int)(root.state >>> PHASE_SHIFT)) { if (head.compareAndSet(q, q.next) && (t = q.thread) != null) { q.thread = null; LockSupport.unpark(t); } } } /** * Variant of releaseWaiters that additionally tries to remove any * nodes no longer waiting for advance due to timeout or * interrupt. Currently, nodes are removed only if they are at * head of queue, which suffices to reduce memory footprint in * most usages. * * @return current phase on exit */ private int abortWait(int phase) { AtomicReference head = (phase & 1) == 0 ? evenQ : oddQ; for (;;) { Thread t; QNode q = head.get(); int p = (int)(root.state >>> PHASE_SHIFT); if (q == null || ((t = q.thread) != null && q.phase == p)) return p; if (head.compareAndSet(q, q.next) && t != null) { q.thread = null; LockSupport.unpark(t); } } } /** The number of CPUs, for spin control */ private static final int NCPU = Runtime.getRuntime().availableProcessors(); /** * The number of times to spin before blocking while waiting for * advance, per arrival while waiting. On multiprocessors, fully * blocking and waking up a large number of threads all at once is * usually a very slow process, so we use rechargeable spins to * avoid it when threads regularly arrive: When a thread in * internalAwaitAdvance notices another arrival before blocking, * and there appear to be enough CPUs available, it spins * SPINS_PER_ARRIVAL more times before blocking. The value trades * off good-citizenship vs big unnecessary slowdowns. */ static final int SPINS_PER_ARRIVAL = (NCPU < 2) ? 1 : 1 << 8; /** * Possibly blocks and waits for phase to advance unless aborted. * Call only from root node. * * @param phase current phase * @param node if non-null, the wait node to track interrupt and timeout; * if null, denotes noninterruptible wait * @return current phase */ private int internalAwaitAdvance(int phase, QNode node) { releaseWaiters(phase-1); // ensure old queue clean boolean queued = false; // true when node is enqueued int lastUnarrived = 0; // to increase spins upon change int spins = SPINS_PER_ARRIVAL; long s; int p; while ((p = (int)((s = state) >>> PHASE_SHIFT)) == phase) { if (node == null) { // spinning in noninterruptible mode int unarrived = (int)s & UNARRIVED_MASK; if (unarrived != lastUnarrived && (lastUnarrived = unarrived) < NCPU) spins += SPINS_PER_ARRIVAL; boolean interrupted = Thread.interrupted(); if (interrupted || --spins < 0) { // need node to record intr node = new QNode(this, phase, false, false, 0L); node.wasInterrupted = interrupted; } } else if (node.isReleasable()) // done or aborted break; else if (!queued) { // push onto queue AtomicReference head = (phase & 1) == 0 ? evenQ : oddQ; QNode q = node.next = head.get(); if ((q == null || q.phase == phase) && (int)(state >>> PHASE_SHIFT) == phase) // avoid stale enq queued = head.compareAndSet(q, node); } else { try { ForkJoinPool.managedBlock(node); } catch (InterruptedException ie) { node.wasInterrupted = true; } } } if (node != null) { if (node.thread != null) node.thread = null; // avoid need for unpark() if (node.wasInterrupted && !node.interruptible) Thread.currentThread().interrupt(); if (p == phase && (p = (int)(state >>> PHASE_SHIFT)) == phase) return abortWait(phase); // possibly clean up on abort } releaseWaiters(phase); return p; } /** * Wait nodes for Treiber stack representing wait queue */ static final class QNode implements ForkJoinPool.ManagedBlocker { final Phaser phaser; final int phase; final boolean interruptible; final boolean timed; boolean wasInterrupted; long nanos; long lastTime; volatile Thread thread; // nulled to cancel wait QNode next; QNode(Phaser phaser, int phase, boolean interruptible, boolean timed, long nanos) { this.phaser = phaser; this.phase = phase; this.interruptible = interruptible; this.nanos = nanos; this.timed = timed; this.lastTime = timed ? System.nanoTime() : 0L; thread = Thread.currentThread(); } public boolean isReleasable() { if (thread == null) return true; if (phaser.getPhase() != phase) { thread = null; return true; } if (Thread.interrupted()) wasInterrupted = true; if (wasInterrupted && interruptible) { thread = null; return true; } if (timed) { if (nanos > 0L) { long now = System.nanoTime(); nanos -= now - lastTime; lastTime = now; } if (nanos <= 0L) { thread = null; return true; } } return false; } public boolean block() { if (isReleasable()) return true; else if (!timed) LockSupport.park(this); else if (nanos > 0) LockSupport.parkNanos(this, nanos); return isReleasable(); } } // Unsafe mechanics private static final sun.misc.Unsafe UNSAFE = getUnsafe(); private static final long stateOffset = objectFieldOffset("state", Phaser.class); private static long objectFieldOffset(String field, Class klazz) { try { return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); } catch (NoSuchFieldException e) { // Convert Exception to corresponding Error NoSuchFieldError error = new NoSuchFieldError(field); error.initCause(e); throw error; } } /** * Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. * Replace with a simple call to Unsafe.getUnsafe when integrating * into a jdk. * * @return a sun.misc.Unsafe */ private static sun.misc.Unsafe getUnsafe() { try { return sun.misc.Unsafe.getUnsafe(); } catch (SecurityException se) { try { return java.security.AccessController.doPrivileged (new java.security .PrivilegedExceptionAction() { public sun.misc.Unsafe run() throws Exception { java.lang.reflect.Field f = sun.misc .Unsafe.class.getDeclaredField("theUnsafe"); f.setAccessible(true); return (sun.misc.Unsafe) f.get(null); }}); } catch (java.security.PrivilegedActionException e) { throw new RuntimeException("Could not initialize intrinsics", e.getCause()); } } } } jsr166/src/jsr166y/ForkJoinTask.java0000644000000000000000000015236311537741066014245 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166y; import java.io.Serializable; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.RandomAccess; import java.util.Map; import java.lang.ref.WeakReference; import java.lang.ref.ReferenceQueue; import java.util.concurrent.Callable; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RunnableFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.locks.ReentrantLock; import java.lang.reflect.Constructor; /** * Abstract base class for tasks that run within a {@link ForkJoinPool}. * A {@code ForkJoinTask} is a thread-like entity that is much * lighter weight than a normal thread. Huge numbers of tasks and * subtasks may be hosted by a small number of actual threads in a * ForkJoinPool, at the price of some usage limitations. * *

A "main" {@code ForkJoinTask} begins execution when submitted * to a {@link ForkJoinPool}. Once started, it will usually in turn * start other subtasks. As indicated by the name of this class, * many programs using {@code ForkJoinTask} employ only methods * {@link #fork} and {@link #join}, or derivatives such as {@link * #invokeAll(ForkJoinTask...) invokeAll}. However, this class also * provides a number of other methods that can come into play in * advanced usages, as well as extension mechanics that allow * support of new forms of fork/join processing. * *

A {@code ForkJoinTask} is a lightweight form of {@link Future}. * The efficiency of {@code ForkJoinTask}s stems from a set of * restrictions (that are only partially statically enforceable) * reflecting their intended use as computational tasks calculating * pure functions or operating on purely isolated objects. The * primary coordination mechanisms are {@link #fork}, that arranges * asynchronous execution, and {@link #join}, that doesn't proceed * until the task's result has been computed. Computations should * avoid {@code synchronized} methods or blocks, and should minimize * other blocking synchronization apart from joining other tasks or * using synchronizers such as Phasers that are advertised to * cooperate with fork/join scheduling. Tasks should also not perform * blocking IO, and should ideally access variables that are * completely independent of those accessed by other running * tasks. Minor breaches of these restrictions, for example using * shared output streams, may be tolerable in practice, but frequent * use may result in poor performance, and the potential to * indefinitely stall if the number of threads not waiting for IO or * other external synchronization becomes exhausted. This usage * restriction is in part enforced by not permitting checked * exceptions such as {@code IOExceptions} to be thrown. However, * computations may still encounter unchecked exceptions, that are * rethrown to callers attempting to join them. These exceptions may * additionally include {@link RejectedExecutionException} stemming * from internal resource exhaustion, such as failure to allocate * internal task queues. Rethrown exceptions behave in the same way as * regular exceptions, but, when possible, contain stack traces (as * displayed for example using {@code ex.printStackTrace()}) of both * the thread that initiated the computation as well as the thread * actually encountering the exception; minimally only the latter. * *

The primary method for awaiting completion and extracting * results of a task is {@link #join}, but there are several variants: * The {@link Future#get} methods support interruptible and/or timed * waits for completion and report results using {@code Future} * conventions. Method {@link #invoke} is semantically * equivalent to {@code fork(); join()} but always attempts to begin * execution in the current thread. The "quiet" forms of * these methods do not extract results or report exceptions. These * may be useful when a set of tasks are being executed, and you need * to delay processing of results or exceptions until all complete. * Method {@code invokeAll} (available in multiple versions) * performs the most common form of parallel invocation: forking a set * of tasks and joining them all. * *

The execution status of tasks may be queried at several levels * of detail: {@link #isDone} is true if a task completed in any way * (including the case where a task was cancelled without executing); * {@link #isCompletedNormally} is true if a task completed without * cancellation or encountering an exception; {@link #isCancelled} is * true if the task was cancelled (in which case {@link #getException} * returns a {@link java.util.concurrent.CancellationException}); and * {@link #isCompletedAbnormally} is true if a task was either * cancelled or encountered an exception, in which case {@link * #getException} will return either the encountered exception or * {@link java.util.concurrent.CancellationException}. * *

The ForkJoinTask class is not usually directly subclassed. * Instead, you subclass one of the abstract classes that support a * particular style of fork/join processing, typically {@link * RecursiveAction} for computations that do not return results, or * {@link RecursiveTask} for those that do. Normally, a concrete * ForkJoinTask subclass declares fields comprising its parameters, * established in a constructor, and then defines a {@code compute} * method that somehow uses the control methods supplied by this base * class. While these methods have {@code public} access (to allow * instances of different task subclasses to call each other's * methods), some of them may only be called from within other * ForkJoinTasks (as may be determined using method {@link * #inForkJoinPool}). Attempts to invoke them in other contexts * result in exceptions or errors, possibly including * {@code ClassCastException}. * *

Method {@link #join} and its variants are appropriate for use * only when completion dependencies are acyclic; that is, the * parallel computation can be described as a directed acyclic graph * (DAG). Otherwise, executions may encounter a form of deadlock as * tasks cyclically wait for each other. However, this framework * supports other methods and techniques (for example the use of * {@link Phaser}, {@link #helpQuiesce}, and {@link #complete}) that * may be of use in constructing custom subclasses for problems that * are not statically structured as DAGs. * *

Most base support methods are {@code final}, to prevent * overriding of implementations that are intrinsically tied to the * underlying lightweight task scheduling framework. Developers * creating new basic styles of fork/join processing should minimally * implement {@code protected} methods {@link #exec}, {@link * #setRawResult}, and {@link #getRawResult}, while also introducing * an abstract computational method that can be implemented in its * subclasses, possibly relying on other {@code protected} methods * provided by this class. * *

ForkJoinTasks should perform relatively small amounts of * computation. Large tasks should be split into smaller subtasks, * usually via recursive decomposition. As a very rough rule of thumb, * a task should perform more than 100 and less than 10000 basic * computational steps, and should avoid indefinite looping. If tasks * are too big, then parallelism cannot improve throughput. If too * small, then memory and internal task maintenance overhead may * overwhelm processing. * *

This class provides {@code adapt} methods for {@link Runnable} * and {@link Callable}, that may be of use when mixing execution of * {@code ForkJoinTasks} with other kinds of tasks. When all tasks are * of this form, consider using a pool constructed in asyncMode. * *

ForkJoinTasks are {@code Serializable}, which enables them to be * used in extensions such as remote execution frameworks. It is * sensible to serialize tasks only before or after, but not during, * execution. Serialization is not relied on during execution itself. * * @since 1.7 * @author Doug Lea */ public abstract class ForkJoinTask implements Future, Serializable { /* * See the internal documentation of class ForkJoinPool for a * general implementation overview. ForkJoinTasks are mainly * responsible for maintaining their "status" field amidst relays * to methods in ForkJoinWorkerThread and ForkJoinPool. The * methods of this class are more-or-less layered into (1) basic * status maintenance (2) execution and awaiting completion (3) * user-level methods that additionally report results. This is * sometimes hard to see because this file orders exported methods * in a way that flows well in javadocs. */ /* * The status field holds run control status bits packed into a * single int to minimize footprint and to ensure atomicity (via * CAS). Status is initially zero, and takes on nonnegative * values until completed, upon which status holds value * NORMAL, CANCELLED, or EXCEPTIONAL. Tasks undergoing blocking * waits by other threads have the SIGNAL bit set. Completion of * a stolen task with SIGNAL set awakens any waiters via * notifyAll. Even though suboptimal for some purposes, we use * basic builtin wait/notify to take advantage of "monitor * inflation" in JVMs that we would otherwise need to emulate to * avoid adding further per-task bookkeeping overhead. We want * these monitors to be "fat", i.e., not use biasing or thin-lock * techniques, so use some odd coding idioms that tend to avoid * them. */ /** The run status of this task */ volatile int status; // accessed directly by pool and workers private static final int NORMAL = -1; private static final int CANCELLED = -2; private static final int EXCEPTIONAL = -3; private static final int SIGNAL = 1; /** * Marks completion and wakes up threads waiting to join this task, * also clearing signal request bits. * * @param completion one of NORMAL, CANCELLED, EXCEPTIONAL * @return completion status on exit */ private int setCompletion(int completion) { for (int s;;) { if ((s = status) < 0) return s; if (UNSAFE.compareAndSwapInt(this, statusOffset, s, completion)) { if (s != 0) synchronized (this) { notifyAll(); } return completion; } } } /** * Tries to block a worker thread until completed or timed out. * Uses Object.wait time argument conventions. * May fail on contention or interrupt. * * @param millis if > 0, wait time. */ final void tryAwaitDone(long millis) { int s; try { if (((s = status) > 0 || (s == 0 && UNSAFE.compareAndSwapInt(this, statusOffset, 0, SIGNAL))) && status > 0) { synchronized (this) { if (status > 0) wait(millis); } } } catch (InterruptedException ie) { // caller must check termination } } /** * Blocks a non-worker-thread until completion. * @return status upon completion */ private int externalAwaitDone() { int s; if ((s = status) >= 0) { boolean interrupted = false; synchronized (this) { while ((s = status) >= 0) { if (s == 0) UNSAFE.compareAndSwapInt(this, statusOffset, 0, SIGNAL); else { try { wait(); } catch (InterruptedException ie) { interrupted = true; } } } } if (interrupted) Thread.currentThread().interrupt(); } return s; } /** * Blocks a non-worker-thread until completion or interruption or timeout. */ private int externalInterruptibleAwaitDone(long millis) throws InterruptedException { int s; if (Thread.interrupted()) throw new InterruptedException(); if ((s = status) >= 0) { synchronized (this) { while ((s = status) >= 0) { if (s == 0) UNSAFE.compareAndSwapInt(this, statusOffset, 0, SIGNAL); else { wait(millis); if (millis > 0L) break; } } } } return s; } /** * Primary execution method for stolen tasks. Unless done, calls * exec and records status if completed, but doesn't wait for * completion otherwise. */ final void doExec() { if (status >= 0) { boolean completed; try { completed = exec(); } catch (Throwable rex) { setExceptionalCompletion(rex); return; } if (completed) setCompletion(NORMAL); // must be outside try block } } /** * Primary mechanics for join, get, quietlyJoin. * @return status upon completion */ private int doJoin() { Thread t; ForkJoinWorkerThread w; int s; boolean completed; if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) { if ((s = status) < 0) return s; if ((w = (ForkJoinWorkerThread)t).unpushTask(this)) { try { completed = exec(); } catch (Throwable rex) { return setExceptionalCompletion(rex); } if (completed) return setCompletion(NORMAL); } return w.joinTask(this); } else return externalAwaitDone(); } /** * Primary mechanics for invoke, quietlyInvoke. * @return status upon completion */ private int doInvoke() { int s; boolean completed; if ((s = status) < 0) return s; try { completed = exec(); } catch (Throwable rex) { return setExceptionalCompletion(rex); } if (completed) return setCompletion(NORMAL); else return doJoin(); } // Exception table support /** * Table of exceptions thrown by tasks, to enable reporting by * callers. Because exceptions are rare, we don't directly keep * them with task objects, but instead use a weak ref table. Note * that cancellation exceptions don't appear in the table, but are * instead recorded as status values. * * Note: These statics are initialized below in static block. */ private static final ExceptionNode[] exceptionTable; private static final ReentrantLock exceptionTableLock; private static final ReferenceQueue exceptionTableRefQueue; /** * Fixed capacity for exceptionTable. */ private static final int EXCEPTION_MAP_CAPACITY = 32; /** * Key-value nodes for exception table. The chained hash table * uses identity comparisons, full locking, and weak references * for keys. The table has a fixed capacity because it only * maintains task exceptions long enough for joiners to access * them, so should never become very large for sustained * periods. However, since we do not know when the last joiner * completes, we must use weak references and expunge them. We do * so on each operation (hence full locking). Also, some thread in * any ForkJoinPool will call helpExpungeStaleExceptions when its * pool becomes isQuiescent. */ static final class ExceptionNode extends WeakReference>{ final Throwable ex; ExceptionNode next; final long thrower; // use id not ref to avoid weak cycles ExceptionNode(ForkJoinTask task, Throwable ex, ExceptionNode next) { super(task, exceptionTableRefQueue); this.ex = ex; this.next = next; this.thrower = Thread.currentThread().getId(); } } /** * Records exception and sets exceptional completion. * * @return status on exit */ private int setExceptionalCompletion(Throwable ex) { int h = System.identityHashCode(this); final ReentrantLock lock = exceptionTableLock; lock.lock(); try { expungeStaleExceptions(); ExceptionNode[] t = exceptionTable; int i = h & (t.length - 1); for (ExceptionNode e = t[i]; ; e = e.next) { if (e == null) { t[i] = new ExceptionNode(this, ex, t[i]); break; } if (e.get() == this) // already present break; } } finally { lock.unlock(); } return setCompletion(EXCEPTIONAL); } /** * Removes exception node and clears status */ private void clearExceptionalCompletion() { int h = System.identityHashCode(this); final ReentrantLock lock = exceptionTableLock; lock.lock(); try { ExceptionNode[] t = exceptionTable; int i = h & (t.length - 1); ExceptionNode e = t[i]; ExceptionNode pred = null; while (e != null) { ExceptionNode next = e.next; if (e.get() == this) { if (pred == null) t[i] = next; else pred.next = next; break; } pred = e; e = next; } expungeStaleExceptions(); status = 0; } finally { lock.unlock(); } } /** * Returns a rethrowable exception for the given task, if * available. To provide accurate stack traces, if the exception * was not thrown by the current thread, we try to create a new * exception of the same type as the one thrown, but with the * recorded exception as its cause. If there is no such * constructor, we instead try to use a no-arg constructor, * followed by initCause, to the same effect. If none of these * apply, or any fail due to other exceptions, we return the * recorded exception, which is still correct, although it may * contain a misleading stack trace. * * @return the exception, or null if none */ private Throwable getThrowableException() { if (status != EXCEPTIONAL) return null; int h = System.identityHashCode(this); ExceptionNode e; final ReentrantLock lock = exceptionTableLock; lock.lock(); try { expungeStaleExceptions(); ExceptionNode[] t = exceptionTable; e = t[h & (t.length - 1)]; while (e != null && e.get() != this) e = e.next; } finally { lock.unlock(); } Throwable ex; if (e == null || (ex = e.ex) == null) return null; if (e.thrower != Thread.currentThread().getId()) { Class ec = ex.getClass(); try { Constructor noArgCtor = null; Constructor[] cs = ec.getConstructors();// public ctors only for (int i = 0; i < cs.length; ++i) { Constructor c = cs[i]; Class[] ps = c.getParameterTypes(); if (ps.length == 0) noArgCtor = c; else if (ps.length == 1 && ps[0] == Throwable.class) return (Throwable)(c.newInstance(ex)); } if (noArgCtor != null) { Throwable wx = (Throwable)(noArgCtor.newInstance()); wx.initCause(ex); return wx; } } catch (Exception ignore) { } } return ex; } /** * Poll stale refs and remove them. Call only while holding lock. */ private static void expungeStaleExceptions() { for (Object x; (x = exceptionTableRefQueue.poll()) != null;) { if (x instanceof ExceptionNode) { ForkJoinTask key = ((ExceptionNode)x).get(); ExceptionNode[] t = exceptionTable; int i = System.identityHashCode(key) & (t.length - 1); ExceptionNode e = t[i]; ExceptionNode pred = null; while (e != null) { ExceptionNode next = e.next; if (e == x) { if (pred == null) t[i] = next; else pred.next = next; break; } pred = e; e = next; } } } } /** * If lock is available, poll stale refs and remove them. * Called from ForkJoinPool when pools become quiescent. */ static final void helpExpungeStaleExceptions() { final ReentrantLock lock = exceptionTableLock; if (lock.tryLock()) { try { expungeStaleExceptions(); } finally { lock.unlock(); } } } /** * Report the result of invoke or join; called only upon * non-normal return of internal versions. */ private V reportResult() { int s; Throwable ex; if ((s = status) == CANCELLED) throw new CancellationException(); if (s == EXCEPTIONAL && (ex = getThrowableException()) != null) UNSAFE.throwException(ex); return getRawResult(); } // public methods /** * Arranges to asynchronously execute this task. While it is not * necessarily enforced, it is a usage error to fork a task more * than once unless it has completed and been reinitialized. * Subsequent modifications to the state of this task or any data * it operates on are not necessarily consistently observable by * any thread other than the one executing it unless preceded by a * call to {@link #join} or related methods, or a call to {@link * #isDone} returning {@code true}. * *

This method may be invoked only from within {@code * ForkJoinPool} computations (as may be determined using method * {@link #inForkJoinPool}). Attempts to invoke in other contexts * result in exceptions or errors, possibly including {@code * ClassCastException}. * * @return {@code this}, to simplify usage */ public final ForkJoinTask fork() { ((ForkJoinWorkerThread) Thread.currentThread()) .pushTask(this); return this; } /** * Returns the result of the computation when it {@link #isDone is * done}. This method differs from {@link #get()} in that * abnormal completion results in {@code RuntimeException} or * {@code Error}, not {@code ExecutionException}, and that * interrupts of the calling thread do not cause the * method to abruptly return by throwing {@code * InterruptedException}. * * @return the computed result */ public final V join() { if (doJoin() != NORMAL) return reportResult(); else return getRawResult(); } /** * Commences performing this task, awaits its completion if * necessary, and returns its result, or throws an (unchecked) * {@code RuntimeException} or {@code Error} if the underlying * computation did so. * * @return the computed result */ public final V invoke() { if (doInvoke() != NORMAL) return reportResult(); else return getRawResult(); } /** * Forks the given tasks, returning when {@code isDone} holds for * each task or an (unchecked) exception is encountered, in which * case the exception is rethrown. If more than one task * encounters an exception, then this method throws any one of * these exceptions. If any task encounters an exception, the * other may be cancelled. However, the execution status of * individual tasks is not guaranteed upon exceptional return. The * status of each task may be obtained using {@link * #getException()} and related methods to check if they have been * cancelled, completed normally or exceptionally, or left * unprocessed. * *

This method may be invoked only from within {@code * ForkJoinPool} computations (as may be determined using method * {@link #inForkJoinPool}). Attempts to invoke in other contexts * result in exceptions or errors, possibly including {@code * ClassCastException}. * * @param t1 the first task * @param t2 the second task * @throws NullPointerException if any task is null */ public static void invokeAll(ForkJoinTask t1, ForkJoinTask t2) { t2.fork(); t1.invoke(); t2.join(); } /** * Forks the given tasks, returning when {@code isDone} holds for * each task or an (unchecked) exception is encountered, in which * case the exception is rethrown. If more than one task * encounters an exception, then this method throws any one of * these exceptions. If any task encounters an exception, others * may be cancelled. However, the execution status of individual * tasks is not guaranteed upon exceptional return. The status of * each task may be obtained using {@link #getException()} and * related methods to check if they have been cancelled, completed * normally or exceptionally, or left unprocessed. * *

This method may be invoked only from within {@code * ForkJoinPool} computations (as may be determined using method * {@link #inForkJoinPool}). Attempts to invoke in other contexts * result in exceptions or errors, possibly including {@code * ClassCastException}. * * @param tasks the tasks * @throws NullPointerException if any task is null */ public static void invokeAll(ForkJoinTask... tasks) { Throwable ex = null; int last = tasks.length - 1; for (int i = last; i >= 0; --i) { ForkJoinTask t = tasks[i]; if (t == null) { if (ex == null) ex = new NullPointerException(); } else if (i != 0) t.fork(); else if (t.doInvoke() < NORMAL && ex == null) ex = t.getException(); } for (int i = 1; i <= last; ++i) { ForkJoinTask t = tasks[i]; if (t != null) { if (ex != null) t.cancel(false); else if (t.doJoin() < NORMAL && ex == null) ex = t.getException(); } } if (ex != null) UNSAFE.throwException(ex); } /** * Forks all tasks in the specified collection, returning when * {@code isDone} holds for each task or an (unchecked) exception * is encountered, in which case the exception is rethrown. If * more than one task encounters an exception, then this method * throws any one of these exceptions. If any task encounters an * exception, others may be cancelled. However, the execution * status of individual tasks is not guaranteed upon exceptional * return. The status of each task may be obtained using {@link * #getException()} and related methods to check if they have been * cancelled, completed normally or exceptionally, or left * unprocessed. * *

This method may be invoked only from within {@code * ForkJoinPool} computations (as may be determined using method * {@link #inForkJoinPool}). Attempts to invoke in other contexts * result in exceptions or errors, possibly including {@code * ClassCastException}. * * @param tasks the collection of tasks * @return the tasks argument, to simplify usage * @throws NullPointerException if tasks or any element are null */ public static > Collection invokeAll(Collection tasks) { if (!(tasks instanceof RandomAccess) || !(tasks instanceof List)) { invokeAll(tasks.toArray(new ForkJoinTask[tasks.size()])); return tasks; } @SuppressWarnings("unchecked") List> ts = (List>) tasks; Throwable ex = null; int last = ts.size() - 1; for (int i = last; i >= 0; --i) { ForkJoinTask t = ts.get(i); if (t == null) { if (ex == null) ex = new NullPointerException(); } else if (i != 0) t.fork(); else if (t.doInvoke() < NORMAL && ex == null) ex = t.getException(); } for (int i = 1; i <= last; ++i) { ForkJoinTask t = ts.get(i); if (t != null) { if (ex != null) t.cancel(false); else if (t.doJoin() < NORMAL && ex == null) ex = t.getException(); } } if (ex != null) UNSAFE.throwException(ex); return tasks; } /** * Attempts to cancel execution of this task. This attempt will * fail if the task has already completed or could not be * cancelled for some other reason. If successful, and this task * has not started when {@code cancel} is called, execution of * this task is suppressed. After this method returns * successfully, unless there is an intervening call to {@link * #reinitialize}, subsequent calls to {@link #isCancelled}, * {@link #isDone}, and {@code cancel} will return {@code true} * and calls to {@link #join} and related methods will result in * {@code CancellationException}. * *

This method may be overridden in subclasses, but if so, must * still ensure that these properties hold. In particular, the * {@code cancel} method itself must not throw exceptions. * *

This method is designed to be invoked by other * tasks. To terminate the current task, you can just return or * throw an unchecked exception from its computation method, or * invoke {@link #completeExceptionally}. * * @param mayInterruptIfRunning this value has no effect in the * default implementation because interrupts are not used to * control cancellation. * * @return {@code true} if this task is now cancelled */ public boolean cancel(boolean mayInterruptIfRunning) { return setCompletion(CANCELLED) == CANCELLED; } /** * Cancels, ignoring any exceptions thrown by cancel. Used during * worker and pool shutdown. Cancel is spec'ed not to throw any * exceptions, but if it does anyway, we have no recourse during * shutdown, so guard against this case. */ final void cancelIgnoringExceptions() { try { cancel(false); } catch (Throwable ignore) { } } public final boolean isDone() { return status < 0; } public final boolean isCancelled() { return status == CANCELLED; } /** * Returns {@code true} if this task threw an exception or was cancelled. * * @return {@code true} if this task threw an exception or was cancelled */ public final boolean isCompletedAbnormally() { return status < NORMAL; } /** * Returns {@code true} if this task completed without throwing an * exception and was not cancelled. * * @return {@code true} if this task completed without throwing an * exception and was not cancelled */ public final boolean isCompletedNormally() { return status == NORMAL; } /** * Returns the exception thrown by the base computation, or a * {@code CancellationException} if cancelled, or {@code null} if * none or if the method has not yet completed. * * @return the exception, or {@code null} if none */ public final Throwable getException() { int s = status; return ((s >= NORMAL) ? null : (s == CANCELLED) ? new CancellationException() : getThrowableException()); } /** * Completes this task abnormally, and if not already aborted or * cancelled, causes it to throw the given exception upon * {@code join} and related operations. This method may be used * to induce exceptions in asynchronous tasks, or to force * completion of tasks that would not otherwise complete. Its use * in other situations is discouraged. This method is * overridable, but overridden versions must invoke {@code super} * implementation to maintain guarantees. * * @param ex the exception to throw. If this exception is not a * {@code RuntimeException} or {@code Error}, the actual exception * thrown will be a {@code RuntimeException} with cause {@code ex}. */ public void completeExceptionally(Throwable ex) { setExceptionalCompletion((ex instanceof RuntimeException) || (ex instanceof Error) ? ex : new RuntimeException(ex)); } /** * Completes this task, and if not already aborted or cancelled, * returning the given value as the result of subsequent * invocations of {@code join} and related operations. This method * may be used to provide results for asynchronous tasks, or to * provide alternative handling for tasks that would not otherwise * complete normally. Its use in other situations is * discouraged. This method is overridable, but overridden * versions must invoke {@code super} implementation to maintain * guarantees. * * @param value the result value for this task */ public void complete(V value) { try { setRawResult(value); } catch (Throwable rex) { setExceptionalCompletion(rex); return; } setCompletion(NORMAL); } /** * Waits if necessary for the computation to complete, and then * retrieves its result. * * @return the computed result * @throws CancellationException if the computation was cancelled * @throws ExecutionException if the computation threw an * exception * @throws InterruptedException if the current thread is not a * member of a ForkJoinPool and was interrupted while waiting */ public final V get() throws InterruptedException, ExecutionException { int s = (Thread.currentThread() instanceof ForkJoinWorkerThread) ? doJoin() : externalInterruptibleAwaitDone(0L); Throwable ex; if (s == CANCELLED) throw new CancellationException(); if (s == EXCEPTIONAL && (ex = getThrowableException()) != null) throw new ExecutionException(ex); return getRawResult(); } /** * Waits if necessary for at most the given time for the computation * to complete, and then retrieves its result, if available. * * @param timeout the maximum time to wait * @param unit the time unit of the timeout argument * @return the computed result * @throws CancellationException if the computation was cancelled * @throws ExecutionException if the computation threw an * exception * @throws InterruptedException if the current thread is not a * member of a ForkJoinPool and was interrupted while waiting * @throws TimeoutException if the wait timed out */ public final V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { Thread t = Thread.currentThread(); if (t instanceof ForkJoinWorkerThread) { ForkJoinWorkerThread w = (ForkJoinWorkerThread) t; long nanos = unit.toNanos(timeout); if (status >= 0) { boolean completed = false; if (w.unpushTask(this)) { try { completed = exec(); } catch (Throwable rex) { setExceptionalCompletion(rex); } } if (completed) setCompletion(NORMAL); else if (status >= 0 && nanos > 0) w.pool.timedAwaitJoin(this, nanos); } } else { long millis = unit.toMillis(timeout); if (millis > 0) externalInterruptibleAwaitDone(millis); } int s = status; if (s != NORMAL) { Throwable ex; if (s == CANCELLED) throw new CancellationException(); if (s != EXCEPTIONAL) throw new TimeoutException(); if ((ex = getThrowableException()) != null) throw new ExecutionException(ex); } return getRawResult(); } /** * Joins this task, without returning its result or throwing its * exception. This method may be useful when processing * collections of tasks when some have been cancelled or otherwise * known to have aborted. */ public final void quietlyJoin() { doJoin(); } /** * Commences performing this task and awaits its completion if * necessary, without returning its result or throwing its * exception. */ public final void quietlyInvoke() { doInvoke(); } /** * Possibly executes tasks until the pool hosting the current task * {@link ForkJoinPool#isQuiescent is quiescent}. This method may * be of use in designs in which many tasks are forked, but none * are explicitly joined, instead executing them until all are * processed. * *

This method may be invoked only from within {@code * ForkJoinPool} computations (as may be determined using method * {@link #inForkJoinPool}). Attempts to invoke in other contexts * result in exceptions or errors, possibly including {@code * ClassCastException}. */ public static void helpQuiesce() { ((ForkJoinWorkerThread) Thread.currentThread()) .helpQuiescePool(); } /** * Resets the internal bookkeeping state of this task, allowing a * subsequent {@code fork}. This method allows repeated reuse of * this task, but only if reuse occurs when this task has either * never been forked, or has been forked, then completed and all * outstanding joins of this task have also completed. Effects * under any other usage conditions are not guaranteed. * This method may be useful when executing * pre-constructed trees of subtasks in loops. * *

Upon completion of this method, {@code isDone()} reports * {@code false}, and {@code getException()} reports {@code * null}. However, the value returned by {@code getRawResult} is * unaffected. To clear this value, you can invoke {@code * setRawResult(null)}. */ public void reinitialize() { if (status == EXCEPTIONAL) clearExceptionalCompletion(); else status = 0; } /** * Returns the pool hosting the current task execution, or null * if this task is executing outside of any ForkJoinPool. * * @see #inForkJoinPool * @return the pool, or {@code null} if none */ public static ForkJoinPool getPool() { Thread t = Thread.currentThread(); return (t instanceof ForkJoinWorkerThread) ? ((ForkJoinWorkerThread) t).pool : null; } /** * Returns {@code true} if the current thread is a {@link * ForkJoinWorkerThread} executing as a ForkJoinPool computation. * * @return {@code true} if the current thread is a {@link * ForkJoinWorkerThread} executing as a ForkJoinPool computation, * or {@code false} otherwise */ public static boolean inForkJoinPool() { return Thread.currentThread() instanceof ForkJoinWorkerThread; } /** * Tries to unschedule this task for execution. This method will * typically succeed if this task is the most recently forked task * by the current thread, and has not commenced executing in * another thread. This method may be useful when arranging * alternative local processing of tasks that could have been, but * were not, stolen. * *

This method may be invoked only from within {@code * ForkJoinPool} computations (as may be determined using method * {@link #inForkJoinPool}). Attempts to invoke in other contexts * result in exceptions or errors, possibly including {@code * ClassCastException}. * * @return {@code true} if unforked */ public boolean tryUnfork() { return ((ForkJoinWorkerThread) Thread.currentThread()) .unpushTask(this); } /** * Returns an estimate of the number of tasks that have been * forked by the current worker thread but not yet executed. This * value may be useful for heuristic decisions about whether to * fork other tasks. * *

This method may be invoked only from within {@code * ForkJoinPool} computations (as may be determined using method * {@link #inForkJoinPool}). Attempts to invoke in other contexts * result in exceptions or errors, possibly including {@code * ClassCastException}. * * @return the number of tasks */ public static int getQueuedTaskCount() { return ((ForkJoinWorkerThread) Thread.currentThread()) .getQueueSize(); } /** * Returns an estimate of how many more locally queued tasks are * held by the current worker thread than there are other worker * threads that might steal them. This value may be useful for * heuristic decisions about whether to fork other tasks. In many * usages of ForkJoinTasks, at steady state, each worker should * aim to maintain a small constant surplus (for example, 3) of * tasks, and to process computations locally if this threshold is * exceeded. * *

This method may be invoked only from within {@code * ForkJoinPool} computations (as may be determined using method * {@link #inForkJoinPool}). Attempts to invoke in other contexts * result in exceptions or errors, possibly including {@code * ClassCastException}. * * @return the surplus number of tasks, which may be negative */ public static int getSurplusQueuedTaskCount() { return ((ForkJoinWorkerThread) Thread.currentThread()) .getEstimatedSurplusTaskCount(); } // Extension methods /** * Returns the result that would be returned by {@link #join}, even * if this task completed abnormally, or {@code null} if this task * is not known to have been completed. This method is designed * to aid debugging, as well as to support extensions. Its use in * any other context is discouraged. * * @return the result, or {@code null} if not completed */ public abstract V getRawResult(); /** * Forces the given value to be returned as a result. This method * is designed to support extensions, and should not in general be * called otherwise. * * @param value the value */ protected abstract void setRawResult(V value); /** * Immediately performs the base action of this task. This method * is designed to support extensions, and should not in general be * called otherwise. The return value controls whether this task * is considered to be done normally. It may return false in * asynchronous actions that require explicit invocations of * {@link #complete} to become joinable. It may also throw an * (unchecked) exception to indicate abnormal exit. * * @return {@code true} if completed normally */ protected abstract boolean exec(); /** * Returns, but does not unschedule or execute, a task queued by * the current thread but not yet executed, if one is immediately * available. There is no guarantee that this task will actually * be polled or executed next. Conversely, this method may return * null even if a task exists but cannot be accessed without * contention with other threads. This method is designed * primarily to support extensions, and is unlikely to be useful * otherwise. * *

This method may be invoked only from within {@code * ForkJoinPool} computations (as may be determined using method * {@link #inForkJoinPool}). Attempts to invoke in other contexts * result in exceptions or errors, possibly including {@code * ClassCastException}. * * @return the next task, or {@code null} if none are available */ protected static ForkJoinTask peekNextLocalTask() { return ((ForkJoinWorkerThread) Thread.currentThread()) .peekTask(); } /** * Unschedules and returns, without executing, the next task * queued by the current thread but not yet executed. This method * is designed primarily to support extensions, and is unlikely to * be useful otherwise. * *

This method may be invoked only from within {@code * ForkJoinPool} computations (as may be determined using method * {@link #inForkJoinPool}). Attempts to invoke in other contexts * result in exceptions or errors, possibly including {@code * ClassCastException}. * * @return the next task, or {@code null} if none are available */ protected static ForkJoinTask pollNextLocalTask() { return ((ForkJoinWorkerThread) Thread.currentThread()) .pollLocalTask(); } /** * Unschedules and returns, without executing, the next task * queued by the current thread but not yet executed, if one is * available, or if not available, a task that was forked by some * other thread, if available. Availability may be transient, so a * {@code null} result does not necessarily imply quiescence * of the pool this task is operating in. This method is designed * primarily to support extensions, and is unlikely to be useful * otherwise. * *

This method may be invoked only from within {@code * ForkJoinPool} computations (as may be determined using method * {@link #inForkJoinPool}). Attempts to invoke in other contexts * result in exceptions or errors, possibly including {@code * ClassCastException}. * * @return a task, or {@code null} if none are available */ protected static ForkJoinTask pollTask() { return ((ForkJoinWorkerThread) Thread.currentThread()) .pollTask(); } /** * Adaptor for Runnables. This implements RunnableFuture * to be compliant with AbstractExecutorService constraints * when used in ForkJoinPool. */ static final class AdaptedRunnable extends ForkJoinTask implements RunnableFuture { final Runnable runnable; final T resultOnCompletion; T result; AdaptedRunnable(Runnable runnable, T result) { if (runnable == null) throw new NullPointerException(); this.runnable = runnable; this.resultOnCompletion = result; } public T getRawResult() { return result; } public void setRawResult(T v) { result = v; } public boolean exec() { runnable.run(); result = resultOnCompletion; return true; } public void run() { invoke(); } private static final long serialVersionUID = 5232453952276885070L; } /** * Adaptor for Callables */ static final class AdaptedCallable extends ForkJoinTask implements RunnableFuture { final Callable callable; T result; AdaptedCallable(Callable callable) { if (callable == null) throw new NullPointerException(); this.callable = callable; } public T getRawResult() { return result; } public void setRawResult(T v) { result = v; } public boolean exec() { try { result = callable.call(); return true; } catch (Error err) { throw err; } catch (RuntimeException rex) { throw rex; } catch (Exception ex) { throw new RuntimeException(ex); } } public void run() { invoke(); } private static final long serialVersionUID = 2838392045355241008L; } /** * Returns a new {@code ForkJoinTask} that performs the {@code run} * method of the given {@code Runnable} as its action, and returns * a null result upon {@link #join}. * * @param runnable the runnable action * @return the task */ public static ForkJoinTask adapt(Runnable runnable) { return new AdaptedRunnable(runnable, null); } /** * Returns a new {@code ForkJoinTask} that performs the {@code run} * method of the given {@code Runnable} as its action, and returns * the given result upon {@link #join}. * * @param runnable the runnable action * @param result the result upon completion * @return the task */ public static ForkJoinTask adapt(Runnable runnable, T result) { return new AdaptedRunnable(runnable, result); } /** * Returns a new {@code ForkJoinTask} that performs the {@code call} * method of the given {@code Callable} as its action, and returns * its result upon {@link #join}, translating any checked exceptions * encountered into {@code RuntimeException}. * * @param callable the callable action * @return the task */ public static ForkJoinTask adapt(Callable callable) { return new AdaptedCallable(callable); } // Serialization support private static final long serialVersionUID = -7721805057305804111L; /** * Saves the state to a stream (that is, serializes it). * * @serialData the current run status and the exception thrown * during execution, or {@code null} if none * @param s the stream */ private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { s.defaultWriteObject(); s.writeObject(getException()); } /** * Reconstitutes the instance from a stream (that is, deserializes it). * * @param s the stream */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { s.defaultReadObject(); Object ex = s.readObject(); if (ex != null) setExceptionalCompletion((Throwable)ex); } // Unsafe mechanics private static final sun.misc.Unsafe UNSAFE; private static final long statusOffset; static { exceptionTableLock = new ReentrantLock(); exceptionTableRefQueue = new ReferenceQueue(); exceptionTable = new ExceptionNode[EXCEPTION_MAP_CAPACITY]; try { UNSAFE = getUnsafe(); statusOffset = UNSAFE.objectFieldOffset (ForkJoinTask.class.getDeclaredField("status")); } catch (Exception e) { throw new Error(e); } } /** * Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. * Replace with a simple call to Unsafe.getUnsafe when integrating * into a jdk. * * @return a sun.misc.Unsafe */ private static sun.misc.Unsafe getUnsafe() { try { return sun.misc.Unsafe.getUnsafe(); } catch (SecurityException se) { try { return java.security.AccessController.doPrivileged (new java.security .PrivilegedExceptionAction() { public sun.misc.Unsafe run() throws Exception { java.lang.reflect.Field f = sun.misc .Unsafe.class.getDeclaredField("theUnsafe"); f.setAccessible(true); return (sun.misc.Unsafe) f.get(null); }}); } catch (java.security.PrivilegedActionException e) { throw new RuntimeException("Could not initialize intrinsics", e.getCause()); } } } } jsr166/src/jsr166y/ForkJoinWorkerThread.java0000644000000000000000000011360311551445506015732 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166y; import java.util.Collection; import java.util.concurrent.RejectedExecutionException; /** * A thread managed by a {@link ForkJoinPool}, which executes * {@link ForkJoinTask}s. * This class is subclassable solely for the sake of adding * functionality -- there are no overridable methods dealing with * scheduling or execution. However, you can override initialization * and termination methods surrounding the main task processing loop. * If you do create such a subclass, you will also need to supply a * custom {@link ForkJoinPool.ForkJoinWorkerThreadFactory} to use it * in a {@code ForkJoinPool}. * * @since 1.7 * @author Doug Lea */ public class ForkJoinWorkerThread extends Thread { /* * Overview: * * ForkJoinWorkerThreads are managed by ForkJoinPools and perform * ForkJoinTasks. This class includes bookkeeping in support of * worker activation, suspension, and lifecycle control described * in more detail in the internal documentation of class * ForkJoinPool. And as described further below, this class also * includes special-cased support for some ForkJoinTask * methods. But the main mechanics involve work-stealing: * * Work-stealing queues are special forms of Deques that support * only three of the four possible end-operations -- push, pop, * and deq (aka steal), under the further constraints that push * and pop are called only from the owning thread, while deq may * be called from other threads. (If you are unfamiliar with * them, you probably want to read Herlihy and Shavit's book "The * Art of Multiprocessor programming", chapter 16 describing these * in more detail before proceeding.) The main work-stealing * queue design is roughly similar to those in the papers "Dynamic * Circular Work-Stealing Deque" by Chase and Lev, SPAA 2005 * (http://research.sun.com/scalable/pubs/index.html) and * "Idempotent work stealing" by Michael, Saraswat, and Vechev, * PPoPP 2009 (http://portal.acm.org/citation.cfm?id=1504186). * The main differences ultimately stem from gc requirements that * we null out taken slots as soon as we can, to maintain as small * a footprint as possible even in programs generating huge * numbers of tasks. To accomplish this, we shift the CAS * arbitrating pop vs deq (steal) from being on the indices * ("queueBase" and "queueTop") to the slots themselves (mainly * via method "casSlotNull()"). So, both a successful pop and deq * mainly entail a CAS of a slot from non-null to null. Because * we rely on CASes of references, we do not need tag bits on * queueBase or queueTop. They are simple ints as used in any * circular array-based queue (see for example ArrayDeque). * Updates to the indices must still be ordered in a way that * guarantees that queueTop == queueBase means the queue is empty, * but otherwise may err on the side of possibly making the queue * appear nonempty when a push, pop, or deq have not fully * committed. Note that this means that the deq operation, * considered individually, is not wait-free. One thief cannot * successfully continue until another in-progress one (or, if * previously empty, a push) completes. However, in the * aggregate, we ensure at least probabilistic non-blockingness. * If an attempted steal fails, a thief always chooses a different * random victim target to try next. So, in order for one thief to * progress, it suffices for any in-progress deq or new push on * any empty queue to complete. * * This approach also enables support for "async mode" where local * task processing is in FIFO, not LIFO order; simply by using a * version of deq rather than pop when locallyFifo is true (as set * by the ForkJoinPool). This allows use in message-passing * frameworks in which tasks are never joined. However neither * mode considers affinities, loads, cache localities, etc, so * rarely provide the best possible performance on a given * machine, but portably provide good throughput by averaging over * these factors. (Further, even if we did try to use such * information, we do not usually have a basis for exploiting * it. For example, some sets of tasks profit from cache * affinities, but others are harmed by cache pollution effects.) * * When a worker would otherwise be blocked waiting to join a * task, it first tries a form of linear helping: Each worker * records (in field currentSteal) the most recent task it stole * from some other worker. Plus, it records (in field currentJoin) * the task it is currently actively joining. Method joinTask uses * these markers to try to find a worker to help (i.e., steal back * a task from and execute it) that could hasten completion of the * actively joined task. In essence, the joiner executes a task * that would be on its own local deque had the to-be-joined task * not been stolen. This may be seen as a conservative variant of * the approach in Wagner & Calder "Leapfrogging: a portable * technique for implementing efficient futures" SIGPLAN Notices, * 1993 (http://portal.acm.org/citation.cfm?id=155354). It differs * in that: (1) We only maintain dependency links across workers * upon steals, rather than use per-task bookkeeping. This may * require a linear scan of workers array to locate stealers, but * usually doesn't because stealers leave hints (that may become * stale/wrong) of where to locate them. This isolates cost to * when it is needed, rather than adding to per-task overhead. * (2) It is "shallow", ignoring nesting and potentially cyclic * mutual steals. (3) It is intentionally racy: field currentJoin * is updated only while actively joining, which means that we * miss links in the chain during long-lived tasks, GC stalls etc * (which is OK since blocking in such cases is usually a good * idea). (4) We bound the number of attempts to find work (see * MAX_HELP) and fall back to suspending the worker and if * necessary replacing it with another. * * Efficient implementation of these algorithms currently relies * on an uncomfortable amount of "Unsafe" mechanics. To maintain * correct orderings, reads and writes of variable queueBase * require volatile ordering. Variable queueTop need not be * volatile because non-local reads always follow those of * queueBase. Similarly, because they are protected by volatile * queueBase reads, reads of the queue array and its slots by * other threads do not need volatile load semantics, but writes * (in push) require store order and CASes (in pop and deq) * require (volatile) CAS semantics. (Michael, Saraswat, and * Vechev's algorithm has similar properties, but without support * for nulling slots.) Since these combinations aren't supported * using ordinary volatiles, the only way to accomplish these * efficiently is to use direct Unsafe calls. (Using external * AtomicIntegers and AtomicReferenceArrays for the indices and * array is significantly slower because of memory locality and * indirection effects.) * * Further, performance on most platforms is very sensitive to * placement and sizing of the (resizable) queue array. Even * though these queues don't usually become all that big, the * initial size must be large enough to counteract cache * contention effects across multiple queues (especially in the * presence of GC cardmarking). Also, to improve thread-locality, * queues are initialized after starting. */ /** * Mask for pool indices encoded as shorts */ private static final int SMASK = 0xffff; /** * Capacity of work-stealing queue array upon initialization. * Must be a power of two. Initial size must be at least 4, but is * padded to minimize cache effects. */ private static final int INITIAL_QUEUE_CAPACITY = 1 << 13; /** * Maximum size for queue array. Must be a power of two * less than or equal to 1 << (31 - width of array entry) to * ensure lack of index wraparound, but is capped at a lower * value to help users trap runaway computations. */ private static final int MAXIMUM_QUEUE_CAPACITY = 1 << 24; // 16M /** * The work-stealing queue array. Size must be a power of two. * Initialized when started (as oposed to when constructed), to * improve memory locality. */ ForkJoinTask[] queue; /** * The pool this thread works in. Accessed directly by ForkJoinTask. */ final ForkJoinPool pool; /** * Index (mod queue.length) of next queue slot to push to or pop * from. It is written only by owner thread, and accessed by other * threads only after reading (volatile) queueBase. Both queueTop * and queueBase are allowed to wrap around on overflow, but * (queueTop - queueBase) still estimates size. */ int queueTop; /** * Index (mod queue.length) of least valid queue slot, which is * always the next position to steal from if nonempty. */ volatile int queueBase; /** * The index of most recent stealer, used as a hint to avoid * traversal in method helpJoinTask. This is only a hint because a * worker might have had multiple steals and this only holds one * of them (usually the most current). Declared non-volatile, * relying on other prevailing sync to keep reasonably current. */ int stealHint; /** * Index of this worker in pool array. Set once by pool before * running, and accessed directly by pool to locate this worker in * its workers array. */ final int poolIndex; /** * Encoded record for pool task waits. Usages are always * surrounded by volatile reads/writes */ int nextWait; /** * Complement of poolIndex, offset by count of entries of task * waits. Accessed by ForkJoinPool to manage event waiters. */ volatile int eventCount; /** * Seed for random number generator for choosing steal victims. * Uses Marsaglia xorshift. Must be initialized as nonzero. */ int seed; /** * Number of steals. Directly accessed (and reset) by pool when * idle. */ int stealCount; /** * True if this worker should or did terminate */ volatile boolean terminate; /** * Set to true before LockSupport.park; false on return */ volatile boolean parked; /** * True if use local fifo, not default lifo, for local polling. * Shadows value from ForkJoinPool. */ final boolean locallyFifo; /** * The task most recently stolen from another worker (or * submission queue). All uses are surrounded by enough volatile * reads/writes to maintain as non-volatile. */ ForkJoinTask currentSteal; /** * The task currently being joined, set only when actively trying * to help other stealers in helpJoinTask. All uses are surrounded * by enough volatile reads/writes to maintain as non-volatile. */ ForkJoinTask currentJoin; /** * Creates a ForkJoinWorkerThread operating in the given pool. * * @param pool the pool this thread works in * @throws NullPointerException if pool is null */ protected ForkJoinWorkerThread(ForkJoinPool pool) { super(pool.nextWorkerName()); this.pool = pool; int k = pool.registerWorker(this); poolIndex = k; eventCount = ~k & SMASK; // clear wait count locallyFifo = pool.locallyFifo; Thread.UncaughtExceptionHandler ueh = pool.ueh; if (ueh != null) setUncaughtExceptionHandler(ueh); setDaemon(true); } // Public methods /** * Returns the pool hosting this thread. * * @return the pool */ public ForkJoinPool getPool() { return pool; } /** * Returns the index number of this thread in its pool. The * returned value ranges from zero to the maximum number of * threads (minus one) that have ever been created in the pool. * This method may be useful for applications that track status or * collect results per-worker rather than per-task. * * @return the index number */ public int getPoolIndex() { return poolIndex; } // Randomization /** * Computes next value for random victim probes and backoffs. * Scans don't require a very high quality generator, but also not * a crummy one. Marsaglia xor-shift is cheap and works well * enough. Note: This is manually inlined in FJP.scan() to avoid * writes inside busy loops. */ private int nextSeed() { int r = seed; r ^= r << 13; r ^= r >>> 17; r ^= r << 5; return seed = r; } // Run State management /** * Initializes internal state after construction but before * processing any tasks. If you override this method, you must * invoke {@code super.onStart()} at the beginning of the method. * Initialization requires care: Most fields must have legal * default values, to ensure that attempted accesses from other * threads work correctly even before this thread starts * processing tasks. */ protected void onStart() { queue = new ForkJoinTask[INITIAL_QUEUE_CAPACITY]; int r = pool.workerSeedGenerator.nextInt(); seed = (r == 0) ? 1 : r; // must be nonzero } /** * Performs cleanup associated with termination of this worker * thread. If you override this method, you must invoke * {@code super.onTermination} at the end of the overridden method. * * @param exception the exception causing this thread to abort due * to an unrecoverable error, or {@code null} if completed normally */ protected void onTermination(Throwable exception) { try { terminate = true; cancelTasks(); pool.deregisterWorker(this, exception); } catch (Throwable ex) { // Shouldn't ever happen if (exception == null) // but if so, at least rethrown exception = ex; } finally { if (exception != null) UNSAFE.throwException(exception); } } /** * This method is required to be public, but should never be * called explicitly. It performs the main run loop to execute * {@link ForkJoinTask}s. */ public void run() { Throwable exception = null; try { onStart(); pool.work(this); } catch (Throwable ex) { exception = ex; } finally { onTermination(exception); } } /* * Intrinsics-based atomic writes for queue slots. These are * basically the same as methods in AtomicReferenceArray, but * specialized for (1) ForkJoinTask elements (2) requirement that * nullness and bounds checks have already been performed by * callers and (3) effective offsets are known not to overflow * from int to long (because of MAXIMUM_QUEUE_CAPACITY). We don't * need corresponding version for reads: plain array reads are OK * because they are protected by other volatile reads and are * confirmed by CASes. * * Most uses don't actually call these methods, but instead * contain inlined forms that enable more predictable * optimization. We don't define the version of write used in * pushTask at all, but instead inline there a store-fenced array * slot write. * * Also in most methods, as a performance (not correctness) issue, * we'd like to encourage compilers not to arbitrarily postpone * setting queueTop after writing slot. Currently there is no * intrinsic for arranging this, but using Unsafe putOrderedInt * may be a preferable strategy on some compilers even though its * main effect is a pre-, not post- fence. To simplify possible * changes, the option is left in comments next to the associated * assignments. */ /** * CASes slot i of array q from t to null. Caller must ensure q is * non-null and index is in range. */ private static final boolean casSlotNull(ForkJoinTask[] q, int i, ForkJoinTask t) { return UNSAFE.compareAndSwapObject(q, (i << ASHIFT) + ABASE, t, null); } /** * Performs a volatile write of the given task at given slot of * array q. Caller must ensure q is non-null and index is in * range. This method is used only during resets and backouts. */ private static final void writeSlot(ForkJoinTask[] q, int i, ForkJoinTask t) { UNSAFE.putObjectVolatile(q, (i << ASHIFT) + ABASE, t); } // queue methods /** * Pushes a task. Call only from this thread. * * @param t the task. Caller must ensure non-null. */ final void pushTask(ForkJoinTask t) { ForkJoinTask[] q; int s, m; if ((q = queue) != null) { // ignore if queue removed long u = (((s = queueTop) & (m = q.length - 1)) << ASHIFT) + ABASE; UNSAFE.putOrderedObject(q, u, t); queueTop = s + 1; // or use putOrderedInt if ((s -= queueBase) <= 2) pool.signalWork(); else if (s == m) growQueue(); } } /** * Creates or doubles queue array. Transfers elements by * emulating steals (deqs) from old array and placing, oldest * first, into new array. */ private void growQueue() { ForkJoinTask[] oldQ = queue; int size = oldQ != null ? oldQ.length << 1 : INITIAL_QUEUE_CAPACITY; if (size > MAXIMUM_QUEUE_CAPACITY) throw new RejectedExecutionException("Queue capacity exceeded"); if (size < INITIAL_QUEUE_CAPACITY) size = INITIAL_QUEUE_CAPACITY; ForkJoinTask[] q = queue = new ForkJoinTask[size]; int mask = size - 1; int top = queueTop; int oldMask; if (oldQ != null && (oldMask = oldQ.length - 1) >= 0) { for (int b = queueBase; b != top; ++b) { long u = ((b & oldMask) << ASHIFT) + ABASE; Object x = UNSAFE.getObjectVolatile(oldQ, u); if (x != null && UNSAFE.compareAndSwapObject(oldQ, u, x, null)) UNSAFE.putObjectVolatile (q, ((b & mask) << ASHIFT) + ABASE, x); } } } /** * Tries to take a task from the base of the queue, failing if * empty or contended. Note: Specializations of this code appear * in locallyDeqTask and elsewhere. * * @return a task, or null if none or contended */ final ForkJoinTask deqTask() { ForkJoinTask t; ForkJoinTask[] q; int b, i; if (queueTop != (b = queueBase) && (q = queue) != null && // must read q after b (i = (q.length - 1) & b) >= 0 && (t = q[i]) != null && queueBase == b && UNSAFE.compareAndSwapObject(q, (i << ASHIFT) + ABASE, t, null)) { queueBase = b + 1; return t; } return null; } /** * Tries to take a task from the base of own queue. Called only * by this thread. * * @return a task, or null if none */ final ForkJoinTask locallyDeqTask() { ForkJoinTask t; int m, b, i; ForkJoinTask[] q = queue; if (q != null && (m = q.length - 1) >= 0) { while (queueTop != (b = queueBase)) { if ((t = q[i = m & b]) != null && queueBase == b && UNSAFE.compareAndSwapObject(q, (i << ASHIFT) + ABASE, t, null)) { queueBase = b + 1; return t; } } } return null; } /** * Returns a popped task, or null if empty. * Called only by this thread. */ private ForkJoinTask popTask() { int m; ForkJoinTask[] q = queue; if (q != null && (m = q.length - 1) >= 0) { for (int s; (s = queueTop) != queueBase;) { int i = m & --s; long u = (i << ASHIFT) + ABASE; // raw offset ForkJoinTask t = q[i]; if (t == null) // lost to stealer break; if (UNSAFE.compareAndSwapObject(q, u, t, null)) { queueTop = s; // or putOrderedInt return t; } } } return null; } /** * Specialized version of popTask to pop only if topmost element * is the given task. Called only by this thread. * * @param t the task. Caller must ensure non-null. */ final boolean unpushTask(ForkJoinTask t) { ForkJoinTask[] q; int s; if ((q = queue) != null && (s = queueTop) != queueBase && UNSAFE.compareAndSwapObject (q, (((q.length - 1) & --s) << ASHIFT) + ABASE, t, null)) { queueTop = s; // or putOrderedInt return true; } return false; } /** * Returns next task, or null if empty or contended. */ final ForkJoinTask peekTask() { int m; ForkJoinTask[] q = queue; if (q == null || (m = q.length - 1) < 0) return null; int i = locallyFifo ? queueBase : (queueTop - 1); return q[i & m]; } // Support methods for ForkJoinPool /** * Runs the given task, plus any local tasks until queue is empty */ final void execTask(ForkJoinTask t) { currentSteal = t; for (;;) { if (t != null) t.doExec(); if (queueTop == queueBase) break; t = locallyFifo ? locallyDeqTask() : popTask(); } ++stealCount; currentSteal = null; } /** * Removes and cancels all tasks in queue. Can be called from any * thread. */ final void cancelTasks() { ForkJoinTask cj = currentJoin; // try to cancel ongoing tasks if (cj != null && cj.status >= 0) cj.cancelIgnoringExceptions(); ForkJoinTask cs = currentSteal; if (cs != null && cs.status >= 0) cs.cancelIgnoringExceptions(); while (queueBase != queueTop) { ForkJoinTask t = deqTask(); if (t != null) t.cancelIgnoringExceptions(); } } /** * Drains tasks to given collection c. * * @return the number of tasks drained */ final int drainTasksTo(Collection> c) { int n = 0; while (queueBase != queueTop) { ForkJoinTask t = deqTask(); if (t != null) { c.add(t); ++n; } } return n; } // Support methods for ForkJoinTask /** * Returns an estimate of the number of tasks in the queue. */ final int getQueueSize() { return queueTop - queueBase; } /** * Gets and removes a local task. * * @return a task, if available */ final ForkJoinTask pollLocalTask() { return locallyFifo ? locallyDeqTask() : popTask(); } /** * Gets and removes a local or stolen task. * * @return a task, if available */ final ForkJoinTask pollTask() { ForkJoinWorkerThread[] ws; ForkJoinTask t = pollLocalTask(); if (t != null || (ws = pool.workers) == null) return t; int n = ws.length; // cheap version of FJP.scan int steps = n << 1; int r = nextSeed(); int i = 0; while (i < steps) { ForkJoinWorkerThread w = ws[(i++ + r) & (n - 1)]; if (w != null && w.queueBase != w.queueTop && w.queue != null) { if ((t = w.deqTask()) != null) return t; i = 0; } } return null; } /** * The maximum stolen->joining link depth allowed in helpJoinTask, * as well as the maximum number of retries (allowing on average * one staleness retry per level) per attempt to instead try * compensation. Depths for legitimate chains are unbounded, but * we use a fixed constant to avoid (otherwise unchecked) cycles * and bound staleness of traversal parameters at the expense of * sometimes blocking when we could be helping. */ private static final int MAX_HELP = 16; /** * Possibly runs some tasks and/or blocks, until joinMe is done. * * @param joinMe the task to join * @return completion status on exit */ final int joinTask(ForkJoinTask joinMe) { ForkJoinTask prevJoin = currentJoin; currentJoin = joinMe; for (int s, retries = MAX_HELP;;) { if ((s = joinMe.status) < 0) { currentJoin = prevJoin; return s; } if (retries > 0) { if (queueTop != queueBase) { if (!localHelpJoinTask(joinMe)) retries = 0; // cannot help } else if (retries == MAX_HELP >>> 1) { --retries; // check uncommon case if (tryDeqAndExec(joinMe) >= 0) Thread.yield(); // for politeness } else retries = helpJoinTask(joinMe) ? MAX_HELP : retries - 1; } else { retries = MAX_HELP; // restart if not done pool.tryAwaitJoin(joinMe); } } } /** * If present, pops and executes the given task, or any other * cancelled task * * @return false if any other non-cancelled task exists in local queue */ private boolean localHelpJoinTask(ForkJoinTask joinMe) { int s, i; ForkJoinTask[] q; ForkJoinTask t; if ((s = queueTop) != queueBase && (q = queue) != null && (i = (q.length - 1) & --s) >= 0 && (t = q[i]) != null) { if (t != joinMe && t.status >= 0) return false; if (UNSAFE.compareAndSwapObject (q, (i << ASHIFT) + ABASE, t, null)) { queueTop = s; // or putOrderedInt t.doExec(); } } return true; } /** * Tries to locate and execute tasks for a stealer of the given * task, or in turn one of its stealers, Traces * currentSteal->currentJoin links looking for a thread working on * a descendant of the given task and with a non-empty queue to * steal back and execute tasks from. The implementation is very * branchy to cope with potential inconsistencies or loops * encountering chains that are stale, unknown, or of length * greater than MAX_HELP links. All of these cases are dealt with * by just retrying by caller. * * @param joinMe the task to join * @param canSteal true if local queue is empty * @return true if ran a task */ private boolean helpJoinTask(ForkJoinTask joinMe) { boolean helped = false; int m = pool.scanGuard & SMASK; ForkJoinWorkerThread[] ws = pool.workers; if (ws != null && ws.length > m && joinMe.status >= 0) { int levels = MAX_HELP; // remaining chain length ForkJoinTask task = joinMe; // base of chain outer:for (ForkJoinWorkerThread thread = this;;) { // Try to find v, the stealer of task, by first using hint ForkJoinWorkerThread v = ws[thread.stealHint & m]; if (v == null || v.currentSteal != task) { for (int j = 0; ;) { // search array if ((v = ws[j]) != null && v.currentSteal == task) { thread.stealHint = j; break; // save hint for next time } if (++j > m) break outer; // can't find stealer } } // Try to help v, using specialized form of deqTask for (;;) { ForkJoinTask[] q; int b, i; if (joinMe.status < 0) break outer; if ((b = v.queueBase) == v.queueTop || (q = v.queue) == null || (i = (q.length-1) & b) < 0) break; // empty long u = (i << ASHIFT) + ABASE; ForkJoinTask t = q[i]; if (task.status < 0) break outer; // stale if (t != null && v.queueBase == b && UNSAFE.compareAndSwapObject(q, u, t, null)) { v.queueBase = b + 1; v.stealHint = poolIndex; ForkJoinTask ps = currentSteal; currentSteal = t; t.doExec(); currentSteal = ps; helped = true; } } // Try to descend to find v's stealer ForkJoinTask next = v.currentJoin; if (--levels > 0 && task.status >= 0 && next != null && next != task) { task = next; thread = v; } else break; // max levels, stale, dead-end, or cyclic } } return helped; } /** * Performs an uncommon case for joinTask: If task t is at base of * some workers queue, steals and executes it. * * @param t the task * @return t's status */ private int tryDeqAndExec(ForkJoinTask t) { int m = pool.scanGuard & SMASK; ForkJoinWorkerThread[] ws = pool.workers; if (ws != null && ws.length > m && t.status >= 0) { for (int j = 0; j <= m; ++j) { ForkJoinTask[] q; int b, i; ForkJoinWorkerThread v = ws[j]; if (v != null && (b = v.queueBase) != v.queueTop && (q = v.queue) != null && (i = (q.length - 1) & b) >= 0 && q[i] == t) { long u = (i << ASHIFT) + ABASE; if (v.queueBase == b && UNSAFE.compareAndSwapObject(q, u, t, null)) { v.queueBase = b + 1; v.stealHint = poolIndex; ForkJoinTask ps = currentSteal; currentSteal = t; t.doExec(); currentSteal = ps; } break; } } } return t.status; } /** * Implements ForkJoinTask.getSurplusQueuedTaskCount(). Returns * an estimate of the number of tasks, offset by a function of * number of idle workers. * * This method provides a cheap heuristic guide for task * partitioning when programmers, frameworks, tools, or languages * have little or no idea about task granularity. In essence by * offering this method, we ask users only about tradeoffs in * overhead vs expected throughput and its variance, rather than * how finely to partition tasks. * * In a steady state strict (tree-structured) computation, each * thread makes available for stealing enough tasks for other * threads to remain active. Inductively, if all threads play by * the same rules, each thread should make available only a * constant number of tasks. * * The minimum useful constant is just 1. But using a value of 1 * would require immediate replenishment upon each steal to * maintain enough tasks, which is infeasible. Further, * partitionings/granularities of offered tasks should minimize * steal rates, which in general means that threads nearer the top * of computation tree should generate more than those nearer the * bottom. In perfect steady state, each thread is at * approximately the same level of computation tree. However, * producing extra tasks amortizes the uncertainty of progress and * diffusion assumptions. * * So, users will want to use values larger, but not much larger * than 1 to both smooth over transient shortages and hedge * against uneven progress; as traded off against the cost of * extra task overhead. We leave the user to pick a threshold * value to compare with the results of this call to guide * decisions, but recommend values such as 3. * * When all threads are active, it is on average OK to estimate * surplus strictly locally. In steady-state, if one thread is * maintaining say 2 surplus tasks, then so are others. So we can * just use estimated queue length (although note that (queueTop - * queueBase) can be an overestimate because of stealers lagging * increments of queueBase). However, this strategy alone leads * to serious mis-estimates in some non-steady-state conditions * (ramp-up, ramp-down, other stalls). We can detect many of these * by further considering the number of "idle" threads, that are * known to have zero queued tasks, so compensate by a factor of * (#idle/#active) threads. */ final int getEstimatedSurplusTaskCount() { return queueTop - queueBase - pool.idlePerActive(); } /** * Runs tasks until {@code pool.isQuiescent()}. We piggyback on * pool's active count ctl maintenance, but rather than blocking * when tasks cannot be found, we rescan until all others cannot * find tasks either. The bracketing by pool quiescerCounts * updates suppresses pool auto-shutdown mechanics that could * otherwise prematurely terminate the pool because all threads * appear to be inactive. */ final void helpQuiescePool() { boolean active = true; ForkJoinTask ps = currentSteal; // to restore below ForkJoinPool p = pool; p.addQuiescerCount(1); for (;;) { ForkJoinWorkerThread[] ws = p.workers; ForkJoinWorkerThread v = null; int n; if (queueTop != queueBase) v = this; else if (ws != null && (n = ws.length) > 1) { ForkJoinWorkerThread w; int r = nextSeed(); // cheap version of FJP.scan int steps = n << 1; for (int i = 0; i < steps; ++i) { if ((w = ws[(i + r) & (n - 1)]) != null && w.queueBase != w.queueTop) { v = w; break; } } } if (v != null) { ForkJoinTask t; if (!active) { active = true; p.addActiveCount(1); } if ((t = (v != this) ? v.deqTask() : locallyFifo ? locallyDeqTask() : popTask()) != null) { currentSteal = t; t.doExec(); currentSteal = ps; } } else { if (active) { active = false; p.addActiveCount(-1); } if (p.isQuiescent()) { p.addActiveCount(1); p.addQuiescerCount(-1); break; } } } } // Unsafe mechanics private static final sun.misc.Unsafe UNSAFE; private static final long ABASE; private static final int ASHIFT; static { int s; try { UNSAFE = getUnsafe(); Class a = ForkJoinTask[].class; ABASE = UNSAFE.arrayBaseOffset(a); s = UNSAFE.arrayIndexScale(a); } catch (Exception e) { throw new Error(e); } if ((s & (s-1)) != 0) throw new Error("data type scale not a power of two"); ASHIFT = 31 - Integer.numberOfLeadingZeros(s); } /** * Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. * Replace with a simple call to Unsafe.getUnsafe when integrating * into a jdk. * * @return a sun.misc.Unsafe */ private static sun.misc.Unsafe getUnsafe() { try { return sun.misc.Unsafe.getUnsafe(); } catch (SecurityException se) { try { return java.security.AccessController.doPrivileged (new java.security .PrivilegedExceptionAction() { public sun.misc.Unsafe run() throws Exception { java.lang.reflect.Field f = sun.misc .Unsafe.class.getDeclaredField("theUnsafe"); f.setAccessible(true); return (sun.misc.Unsafe) f.get(null); }}); } catch (java.security.PrivilegedActionException e) { throw new RuntimeException("Could not initialize intrinsics", e.getCause()); } } } } jsr166/src/jsr166y/TransferQueue.java0000644000000000000000000001372511537741066014470 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166y; import java.util.concurrent.*; /** * A {@link BlockingQueue} in which producers may wait for consumers * to receive elements. A {@code TransferQueue} may be useful for * example in message passing applications in which producers * sometimes (using method {@link #transfer}) await receipt of * elements by consumers invoking {@code take} or {@code poll}, while * at other times enqueue elements (via method {@code put}) without * waiting for receipt. * {@linkplain #tryTransfer(Object) Non-blocking} and * {@linkplain #tryTransfer(Object,long,TimeUnit) time-out} versions of * {@code tryTransfer} are also available. * A {@code TransferQueue} may also be queried, via {@link * #hasWaitingConsumer}, whether there are any threads waiting for * items, which is a converse analogy to a {@code peek} operation. * *

Like other blocking queues, a {@code TransferQueue} may be * capacity bounded. If so, an attempted transfer operation may * initially block waiting for available space, and/or subsequently * block waiting for reception by a consumer. Note that in a queue * with zero capacity, such as {@link SynchronousQueue}, {@code put} * and {@code transfer} are effectively synonymous. * *

This interface is a member of the * * Java Collections Framework. * * @since 1.7 * @author Doug Lea * @param the type of elements held in this collection */ public interface TransferQueue extends BlockingQueue { /** * Transfers the element to a waiting consumer immediately, if possible. * *

More precisely, transfers the specified element immediately * if there exists a consumer already waiting to receive it (in * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), * otherwise returning {@code false} without enqueuing the element. * * @param e the element to transfer * @return {@code true} if the element was transferred, else * {@code false} * @throws ClassCastException if the class of the specified element * prevents it from being added to this queue * @throws NullPointerException if the specified element is null * @throws IllegalArgumentException if some property of the specified * element prevents it from being added to this queue */ boolean tryTransfer(E e); /** * Transfers the element to a consumer, waiting if necessary to do so. * *

More precisely, transfers the specified element immediately * if there exists a consumer already waiting to receive it (in * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), * else waits until the element is received by a consumer. * * @param e the element to transfer * @throws InterruptedException if interrupted while waiting, * in which case the element is not left enqueued * @throws ClassCastException if the class of the specified element * prevents it from being added to this queue * @throws NullPointerException if the specified element is null * @throws IllegalArgumentException if some property of the specified * element prevents it from being added to this queue */ void transfer(E e) throws InterruptedException; /** * Transfers the element to a consumer if it is possible to do so * before the timeout elapses. * *

More precisely, transfers the specified element immediately * if there exists a consumer already waiting to receive it (in * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), * else waits until the element is received by a consumer, * returning {@code false} if the specified wait time elapses * before the element can be transferred. * * @param e the element to transfer * @param timeout how long to wait before giving up, in units of * {@code unit} * @param unit a {@code TimeUnit} determining how to interpret the * {@code timeout} parameter * @return {@code true} if successful, or {@code false} if * the specified waiting time elapses before completion, * in which case the element is not left enqueued * @throws InterruptedException if interrupted while waiting, * in which case the element is not left enqueued * @throws ClassCastException if the class of the specified element * prevents it from being added to this queue * @throws NullPointerException if the specified element is null * @throws IllegalArgumentException if some property of the specified * element prevents it from being added to this queue */ boolean tryTransfer(E e, long timeout, TimeUnit unit) throws InterruptedException; /** * Returns {@code true} if there is at least one consumer waiting * to receive an element via {@link #take} or * timed {@link #poll(long,TimeUnit) poll}. * The return value represents a momentary state of affairs. * * @return {@code true} if there is at least one waiting consumer */ boolean hasWaitingConsumer(); /** * Returns an estimate of the number of consumers waiting to * receive elements via {@link #take} or timed * {@link #poll(long,TimeUnit) poll}. The return value is an * approximation of a momentary state of affairs, that may be * inaccurate if consumers have completed or given up waiting. * The value may be useful for monitoring and heuristics, but * not for synchronization control. Implementations of this * method are likely to be noticeably slower than those for * {@link #hasWaitingConsumer}. * * @return the number of consumers waiting to receive elements */ int getWaitingConsumerCount(); } jsr166/src/jsr166y/ForkJoinPool.java0000644000000000000000000025360011551445506014244 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166y; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Random; import java.util.concurrent.AbstractExecutorService; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RunnableFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.LockSupport; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.Condition; /** * An {@link ExecutorService} for running {@link ForkJoinTask}s. * A {@code ForkJoinPool} provides the entry point for submissions * from non-{@code ForkJoinTask} clients, as well as management and * monitoring operations. * *

A {@code ForkJoinPool} differs from other kinds of {@link * ExecutorService} mainly by virtue of employing * work-stealing: all threads in the pool attempt to find and * execute subtasks created by other active tasks (eventually blocking * waiting for work if none exist). This enables efficient processing * when most tasks spawn other subtasks (as do most {@code * ForkJoinTask}s). When setting asyncMode to true in * constructors, {@code ForkJoinPool}s may also be appropriate for use * with event-style tasks that are never joined. * *

A {@code ForkJoinPool} is constructed with a given target * parallelism level; by default, equal to the number of available * processors. The pool attempts to maintain enough active (or * available) threads by dynamically adding, suspending, or resuming * internal worker threads, even if some tasks are stalled waiting to * join others. However, no such adjustments are guaranteed in the * face of blocked IO or other unmanaged synchronization. The nested * {@link ManagedBlocker} interface enables extension of the kinds of * synchronization accommodated. * *

In addition to execution and lifecycle control methods, this * class provides status check methods (for example * {@link #getStealCount}) that are intended to aid in developing, * tuning, and monitoring fork/join applications. Also, method * {@link #toString} returns indications of pool state in a * convenient form for informal monitoring. * *

As is the case with other ExecutorServices, there are three * main task execution methods summarized in the following * table. These are designed to be used by clients not already engaged * in fork/join computations in the current pool. The main forms of * these methods accept instances of {@code ForkJoinTask}, but * overloaded forms also allow mixed execution of plain {@code * Runnable}- or {@code Callable}- based activities as well. However, * tasks that are already executing in a pool should normally * NOT use these pool execution methods, but instead use the * within-computation forms listed in the table. * * * * * * * * * * * * * * * * * * * * * * *
Call from non-fork/join clients Call from within fork/join computations
Arrange async execution {@link #execute(ForkJoinTask)} {@link ForkJoinTask#fork}
Await and obtain result {@link #invoke(ForkJoinTask)} {@link ForkJoinTask#invoke}
Arrange exec and obtain Future {@link #submit(ForkJoinTask)} {@link ForkJoinTask#fork} (ForkJoinTasks are Futures)
* *

Sample Usage. Normally a single {@code ForkJoinPool} is * used for all parallel task execution in a program or subsystem. * Otherwise, use would not usually outweigh the construction and * bookkeeping overhead of creating a large set of threads. For * example, a common pool could be used for the {@code SortTasks} * illustrated in {@link RecursiveAction}. Because {@code * ForkJoinPool} uses threads in {@linkplain java.lang.Thread#isDaemon * daemon} mode, there is typically no need to explicitly {@link * #shutdown} such a pool upon program exit. * *

 * static final ForkJoinPool mainPool = new ForkJoinPool();
 * ...
 * public void sort(long[] array) {
 *   mainPool.invoke(new SortTask(array, 0, array.length));
 * }
 * 
* *

Implementation notes: This implementation restricts the * maximum number of running threads to 32767. Attempts to create * pools with greater than the maximum number result in * {@code IllegalArgumentException}. * *

This implementation rejects submitted tasks (that is, by throwing * {@link RejectedExecutionException}) only when the pool is shut down * or internal resources have been exhausted. * * @since 1.7 * @author Doug Lea */ public class ForkJoinPool extends AbstractExecutorService { /* * Implementation Overview * * This class provides the central bookkeeping and control for a * set of worker threads: Submissions from non-FJ threads enter * into a submission queue. Workers take these tasks and typically * split them into subtasks that may be stolen by other workers. * Preference rules give first priority to processing tasks from * their own queues (LIFO or FIFO, depending on mode), then to * randomized FIFO steals of tasks in other worker queues, and * lastly to new submissions. * * The main throughput advantages of work-stealing stem from * decentralized control -- workers mostly take tasks from * themselves or each other. We cannot negate this in the * implementation of other management responsibilities. The main * tactic for avoiding bottlenecks is packing nearly all * essentially atomic control state into a single 64bit volatile * variable ("ctl"). This variable is read on the order of 10-100 * times as often as it is modified (always via CAS). (There is * some additional control state, for example variable "shutdown" * for which we can cope with uncoordinated updates.) This * streamlines synchronization and control at the expense of messy * constructions needed to repack status bits upon updates. * Updates tend not to contend with each other except during * bursts while submitted tasks begin or end. In some cases when * they do contend, threads can instead do something else * (usually, scan for tasks) until contention subsides. * * To enable packing, we restrict maximum parallelism to (1<<15)-1 * (which is far in excess of normal operating range) to allow * ids, counts, and their negations (used for thresholding) to fit * into 16bit fields. * * Recording Workers. Workers are recorded in the "workers" array * that is created upon pool construction and expanded if (rarely) * necessary. This is an array as opposed to some other data * structure to support index-based random steals by workers. * Updates to the array recording new workers and unrecording * terminated ones are protected from each other by a seqLock * (scanGuard) but the array is otherwise concurrently readable, * and accessed directly by workers. To simplify index-based * operations, the array size is always a power of two, and all * readers must tolerate null slots. To avoid flailing during * start-up, the array is presized to hold twice #parallelism * workers (which is unlikely to need further resizing during * execution). But to avoid dealing with so many null slots, * variable scanGuard includes a mask for the nearest power of two * that contains all current workers. All worker thread creation * is on-demand, triggered by task submissions, replacement of * terminated workers, and/or compensation for blocked * workers. However, all other support code is set up to work with * other policies. To ensure that we do not hold on to worker * references that would prevent GC, ALL accesses to workers are * via indices into the workers array (which is one source of some * of the messy code constructions here). In essence, the workers * array serves as a weak reference mechanism. Thus for example * the wait queue field of ctl stores worker indices, not worker * references. Access to the workers in associated methods (for * example signalWork) must both index-check and null-check the * IDs. All such accesses ignore bad IDs by returning out early * from what they are doing, since this can only be associated * with termination, in which case it is OK to give up. * * All uses of the workers array, as well as queue arrays, check * that the array is non-null (even if previously non-null). This * allows nulling during termination, which is currently not * necessary, but remains an option for resource-revocation-based * shutdown schemes. * * Wait Queuing. Unlike HPC work-stealing frameworks, we cannot * let workers spin indefinitely scanning for tasks when none can * be found immediately, and we cannot start/resume workers unless * there appear to be tasks available. On the other hand, we must * quickly prod them into action when new tasks are submitted or * generated. We park/unpark workers after placing in an event * wait queue when they cannot find work. This "queue" is actually * a simple Treiber stack, headed by the "id" field of ctl, plus a * 15bit counter value to both wake up waiters (by advancing their * count) and avoid ABA effects. Successors are held in worker * field "nextWait". Queuing deals with several intrinsic races, * mainly that a task-producing thread can miss seeing (and * signalling) another thread that gave up looking for work but * has not yet entered the wait queue. We solve this by requiring * a full sweep of all workers both before (in scan()) and after * (in tryAwaitWork()) a newly waiting worker is added to the wait * queue. During a rescan, the worker might release some other * queued worker rather than itself, which has the same net * effect. Because enqueued workers may actually be rescanning * rather than waiting, we set and clear the "parked" field of * ForkJoinWorkerThread to reduce unnecessary calls to unpark. * (Use of the parked field requires a secondary recheck to avoid * missed signals.) * * Signalling. We create or wake up workers only when there * appears to be at least one task they might be able to find and * execute. When a submission is added or another worker adds a * task to a queue that previously had two or fewer tasks, they * signal waiting workers (or trigger creation of new ones if * fewer than the given parallelism level -- see signalWork). * These primary signals are buttressed by signals during rescans * as well as those performed when a worker steals a task and * notices that there are more tasks too; together these cover the * signals needed in cases when more than two tasks are pushed * but untaken. * * Trimming workers. To release resources after periods of lack of * use, a worker starting to wait when the pool is quiescent will * time out and terminate if the pool has remained quiescent for * SHRINK_RATE nanosecs. This will slowly propagate, eventually * terminating all workers after long periods of non-use. * * Submissions. External submissions are maintained in an * array-based queue that is structured identically to * ForkJoinWorkerThread queues except for the use of * submissionLock in method addSubmission. Unlike the case for * worker queues, multiple external threads can add new * submissions, so adding requires a lock. * * Compensation. Beyond work-stealing support and lifecycle * control, the main responsibility of this framework is to take * actions when one worker is waiting to join a task stolen (or * always held by) another. Because we are multiplexing many * tasks on to a pool of workers, we can't just let them block (as * in Thread.join). We also cannot just reassign the joiner's * run-time stack with another and replace it later, which would * be a form of "continuation", that even if possible is not * necessarily a good idea since we sometimes need both an * unblocked task and its continuation to progress. Instead we * combine two tactics: * * Helping: Arranging for the joiner to execute some task that it * would be running if the steal had not occurred. Method * ForkJoinWorkerThread.joinTask tracks joining->stealing * links to try to find such a task. * * Compensating: Unless there are already enough live threads, * method tryPreBlock() may create or re-activate a spare * thread to compensate for blocked joiners until they * unblock. * * The ManagedBlocker extension API can't use helping so relies * only on compensation in method awaitBlocker. * * It is impossible to keep exactly the target parallelism number * of threads running at any given time. Determining the * existence of conservatively safe helping targets, the * availability of already-created spares, and the apparent need * to create new spares are all racy and require heuristic * guidance, so we rely on multiple retries of each. Currently, * in keeping with on-demand signalling policy, we compensate only * if blocking would leave less than one active (non-waiting, * non-blocked) worker. Additionally, to avoid some false alarms * due to GC, lagging counters, system activity, etc, compensated * blocking for joins is only attempted after rechecks stabilize * (retries are interspersed with Thread.yield, for good * citizenship). The variable blockedCount, incremented before * blocking and decremented after, is sometimes needed to * distinguish cases of waiting for work vs blocking on joins or * other managed sync. Both cases are equivalent for most pool * control, so we can update non-atomically. (Additionally, * contention on blockedCount alleviates some contention on ctl). * * Shutdown and Termination. A call to shutdownNow atomically sets * the ctl stop bit and then (non-atomically) sets each workers * "terminate" status, cancels all unprocessed tasks, and wakes up * all waiting workers. Detecting whether termination should * commence after a non-abrupt shutdown() call requires more work * and bookkeeping. We need consensus about quiesence (i.e., that * there is no more work) which is reflected in active counts so * long as there are no current blockers, as well as possible * re-evaluations during independent changes in blocking or * quiescing workers. * * Style notes: There is a lot of representation-level coupling * among classes ForkJoinPool, ForkJoinWorkerThread, and * ForkJoinTask. Most fields of ForkJoinWorkerThread maintain * data structures managed by ForkJoinPool, so are directly * accessed. Conversely we allow access to "workers" array by * workers, and direct access to ForkJoinTask.status by both * ForkJoinPool and ForkJoinWorkerThread. There is little point * trying to reduce this, since any associated future changes in * representations will need to be accompanied by algorithmic * changes anyway. All together, these low-level implementation * choices produce as much as a factor of 4 performance * improvement compared to naive implementations, and enable the * processing of billions of tasks per second, at the expense of * some ugliness. * * Methods signalWork() and scan() are the main bottlenecks so are * especially heavily micro-optimized/mangled. There are lots of * inline assignments (of form "while ((local = field) != 0)") * which are usually the simplest way to ensure the required read * orderings (which are sometimes critical). This leads to a * "C"-like style of listing declarations of these locals at the * heads of methods or blocks. There are several occurrences of * the unusual "do {} while (!cas...)" which is the simplest way * to force an update of a CAS'ed variable. There are also other * coding oddities that help some methods perform reasonably even * when interpreted (not compiled). * * The order of declarations in this file is: (1) declarations of * statics (2) fields (along with constants used when unpacking * some of them), listed in an order that tends to reduce * contention among them a bit under most JVMs. (3) internal * control methods (4) callbacks and other support for * ForkJoinTask and ForkJoinWorkerThread classes, (5) exported * methods (plus a few little helpers). (6) static block * initializing all statics in a minimally dependent order. */ /** * Factory for creating new {@link ForkJoinWorkerThread}s. * A {@code ForkJoinWorkerThreadFactory} must be defined and used * for {@code ForkJoinWorkerThread} subclasses that extend base * functionality or initialize threads with different contexts. */ public static interface ForkJoinWorkerThreadFactory { /** * Returns a new worker thread operating in the given pool. * * @param pool the pool this thread works in * @throws NullPointerException if the pool is null */ public ForkJoinWorkerThread newThread(ForkJoinPool pool); } /** * Default ForkJoinWorkerThreadFactory implementation; creates a * new ForkJoinWorkerThread. */ static class DefaultForkJoinWorkerThreadFactory implements ForkJoinWorkerThreadFactory { public ForkJoinWorkerThread newThread(ForkJoinPool pool) { return new ForkJoinWorkerThread(pool); } } /** * Creates a new ForkJoinWorkerThread. This factory is used unless * overridden in ForkJoinPool constructors. */ public static final ForkJoinWorkerThreadFactory defaultForkJoinWorkerThreadFactory; /** * Permission required for callers of methods that may start or * kill threads. */ private static final RuntimePermission modifyThreadPermission; /** * If there is a security manager, makes sure caller has * permission to modify threads. */ private static void checkPermission() { SecurityManager security = System.getSecurityManager(); if (security != null) security.checkPermission(modifyThreadPermission); } /** * Generator for assigning sequence numbers as pool names. */ private static final AtomicInteger poolNumberGenerator; /** * Generator for initial random seeds for worker victim * selection. This is used only to create initial seeds. Random * steals use a cheaper xorshift generator per steal attempt. We * don't expect much contention on seedGenerator, so just use a * plain Random. */ static final Random workerSeedGenerator; /** * Array holding all worker threads in the pool. Initialized upon * construction. Array size must be a power of two. Updates and * replacements are protected by scanGuard, but the array is * always kept in a consistent enough state to be randomly * accessed without locking by workers performing work-stealing, * as well as other traversal-based methods in this class, so long * as reads memory-acquire by first reading ctl. All readers must * tolerate that some array slots may be null. */ ForkJoinWorkerThread[] workers; /** * Initial size for submission queue array. Must be a power of * two. In many applications, these always stay small so we use a * small initial cap. */ private static final int INITIAL_QUEUE_CAPACITY = 8; /** * Maximum size for submission queue array. Must be a power of two * less than or equal to 1 << (31 - width of array entry) to * ensure lack of index wraparound, but is capped at a lower * value to help users trap runaway computations. */ private static final int MAXIMUM_QUEUE_CAPACITY = 1 << 24; // 16M /** * Array serving as submission queue. Initialized upon construction. */ private ForkJoinTask[] submissionQueue; /** * Lock protecting submissions array for addSubmission */ private final ReentrantLock submissionLock; /** * Condition for awaitTermination, using submissionLock for * convenience. */ private final Condition termination; /** * Creation factory for worker threads. */ private final ForkJoinWorkerThreadFactory factory; /** * The uncaught exception handler used when any worker abruptly * terminates. */ final Thread.UncaughtExceptionHandler ueh; /** * Prefix for assigning names to worker threads */ private final String workerNamePrefix; /** * Sum of per-thread steal counts, updated only when threads are * idle or terminating. */ private volatile long stealCount; /** * Main pool control -- a long packed with: * AC: Number of active running workers minus target parallelism (16 bits) * TC: Number of total workers minus target parallelism (16bits) * ST: true if pool is terminating (1 bit) * EC: the wait count of top waiting thread (15 bits) * ID: ~poolIndex of top of Treiber stack of waiting threads (16 bits) * * When convenient, we can extract the upper 32 bits of counts and * the lower 32 bits of queue state, u = (int)(ctl >>> 32) and e = * (int)ctl. The ec field is never accessed alone, but always * together with id and st. The offsets of counts by the target * parallelism and the positionings of fields makes it possible to * perform the most common checks via sign tests of fields: When * ac is negative, there are not enough active workers, when tc is * negative, there are not enough total workers, when id is * negative, there is at least one waiting worker, and when e is * negative, the pool is terminating. To deal with these possibly * negative fields, we use casts in and out of "short" and/or * signed shifts to maintain signedness. */ volatile long ctl; // bit positions/shifts for fields private static final int AC_SHIFT = 48; private static final int TC_SHIFT = 32; private static final int ST_SHIFT = 31; private static final int EC_SHIFT = 16; // bounds private static final int MAX_ID = 0x7fff; // max poolIndex private static final int SMASK = 0xffff; // mask short bits private static final int SHORT_SIGN = 1 << 15; private static final int INT_SIGN = 1 << 31; // masks private static final long STOP_BIT = 0x0001L << ST_SHIFT; private static final long AC_MASK = ((long)SMASK) << AC_SHIFT; private static final long TC_MASK = ((long)SMASK) << TC_SHIFT; // units for incrementing and decrementing private static final long TC_UNIT = 1L << TC_SHIFT; private static final long AC_UNIT = 1L << AC_SHIFT; // masks and units for dealing with u = (int)(ctl >>> 32) private static final int UAC_SHIFT = AC_SHIFT - 32; private static final int UTC_SHIFT = TC_SHIFT - 32; private static final int UAC_MASK = SMASK << UAC_SHIFT; private static final int UTC_MASK = SMASK << UTC_SHIFT; private static final int UAC_UNIT = 1 << UAC_SHIFT; private static final int UTC_UNIT = 1 << UTC_SHIFT; // masks and units for dealing with e = (int)ctl private static final int E_MASK = 0x7fffffff; // no STOP_BIT private static final int EC_UNIT = 1 << EC_SHIFT; /** * The target parallelism level. */ final int parallelism; /** * Index (mod submission queue length) of next element to take * from submission queue. Usage is identical to that for * per-worker queues -- see ForkJoinWorkerThread internal * documentation. */ volatile int queueBase; /** * Index (mod submission queue length) of next element to add * in submission queue. Usage is identical to that for * per-worker queues -- see ForkJoinWorkerThread internal * documentation. */ int queueTop; /** * True when shutdown() has been called. */ volatile boolean shutdown; /** * True if use local fifo, not default lifo, for local polling * Read by, and replicated by ForkJoinWorkerThreads */ final boolean locallyFifo; /** * The number of threads in ForkJoinWorkerThreads.helpQuiescePool. * When non-zero, suppresses automatic shutdown when active * counts become zero. */ volatile int quiescerCount; /** * The number of threads blocked in join. */ volatile int blockedCount; /** * Counter for worker Thread names (unrelated to their poolIndex) */ private volatile int nextWorkerNumber; /** * The index for the next created worker. Accessed under scanGuard. */ private int nextWorkerIndex; /** * SeqLock and index masking for updates to workers array. Locked * when SG_UNIT is set. Unlocking clears bit by adding * SG_UNIT. Staleness of read-only operations can be checked by * comparing scanGuard to value before the reads. The low 16 bits * (i.e, anding with SMASK) hold (the smallest power of two * covering all worker indices, minus one, and is used to avoid * dealing with large numbers of null slots when the workers array * is overallocated. */ volatile int scanGuard; private static final int SG_UNIT = 1 << 16; /** * The wakeup interval (in nanoseconds) for a worker waiting for a * task when the pool is quiescent to instead try to shrink the * number of workers. The exact value does not matter too * much. It must be short enough to release resources during * sustained periods of idleness, but not so short that threads * are continually re-created. */ private static final long SHRINK_RATE = 4L * 1000L * 1000L * 1000L; // 4 seconds /** * Top-level loop for worker threads: On each step: if the * previous step swept through all queues and found no tasks, or * there are excess threads, then possibly blocks. Otherwise, * scans for and, if found, executes a task. Returns when pool * and/or worker terminate. * * @param w the worker */ final void work(ForkJoinWorkerThread w) { boolean swept = false; // true on empty scans long c; while (!w.terminate && (int)(c = ctl) >= 0) { int a; // active count if (!swept && (a = (int)(c >> AC_SHIFT)) <= 0) swept = scan(w, a); else if (tryAwaitWork(w, c)) swept = false; } } // Signalling /** * Wakes up or creates a worker. */ final void signalWork() { /* * The while condition is true if: (there is are too few total * workers OR there is at least one waiter) AND (there are too * few active workers OR the pool is terminating). The value * of e distinguishes the remaining cases: zero (no waiters) * for create, negative if terminating (in which case do * nothing), else release a waiter. The secondary checks for * release (non-null array etc) can fail if the pool begins * terminating after the test, and don't impose any added cost * because JVMs must perform null and bounds checks anyway. */ long c; int e, u; while ((((e = (int)(c = ctl)) | (u = (int)(c >>> 32))) & (INT_SIGN|SHORT_SIGN)) == (INT_SIGN|SHORT_SIGN) && e >= 0) { if (e > 0) { // release a waiting worker int i; ForkJoinWorkerThread w; ForkJoinWorkerThread[] ws; if ((ws = workers) == null || (i = ~e & SMASK) >= ws.length || (w = ws[i]) == null) break; long nc = (((long)(w.nextWait & E_MASK)) | ((long)(u + UAC_UNIT) << 32)); if (w.eventCount == e && UNSAFE.compareAndSwapLong(this, ctlOffset, c, nc)) { w.eventCount = (e + EC_UNIT) & E_MASK; if (w.parked) UNSAFE.unpark(w); break; } } else if (UNSAFE.compareAndSwapLong (this, ctlOffset, c, (long)(((u + UTC_UNIT) & UTC_MASK) | ((u + UAC_UNIT) & UAC_MASK)) << 32)) { addWorker(); break; } } } /** * Variant of signalWork to help release waiters on rescans. * Tries once to release a waiter if active count < 0. * * @return false if failed due to contention, else true */ private boolean tryReleaseWaiter() { long c; int e, i; ForkJoinWorkerThread w; ForkJoinWorkerThread[] ws; if ((e = (int)(c = ctl)) > 0 && (int)(c >> AC_SHIFT) < 0 && (ws = workers) != null && (i = ~e & SMASK) < ws.length && (w = ws[i]) != null) { long nc = ((long)(w.nextWait & E_MASK) | ((c + AC_UNIT) & (AC_MASK|TC_MASK))); if (w.eventCount != e || !UNSAFE.compareAndSwapLong(this, ctlOffset, c, nc)) return false; w.eventCount = (e + EC_UNIT) & E_MASK; if (w.parked) UNSAFE.unpark(w); } return true; } // Scanning for tasks /** * Scans for and, if found, executes one task. Scans start at a * random index of workers array, and randomly select the first * (2*#workers)-1 probes, and then, if all empty, resort to 2 * circular sweeps, which is necessary to check quiescence. and * taking a submission only if no stealable tasks were found. The * steal code inside the loop is a specialized form of * ForkJoinWorkerThread.deqTask, followed bookkeeping to support * helpJoinTask and signal propagation. The code for submission * queues is almost identical. On each steal, the worker completes * not only the task, but also all local tasks that this task may * have generated. On detecting staleness or contention when * trying to take a task, this method returns without finishing * sweep, which allows global state rechecks before retry. * * @param w the worker * @param a the number of active workers * @return true if swept all queues without finding a task */ private boolean scan(ForkJoinWorkerThread w, int a) { int g = scanGuard; // mask 0 avoids useless scans if only one active int m = (parallelism == 1 - a && blockedCount == 0) ? 0 : g & SMASK; ForkJoinWorkerThread[] ws = workers; if (ws == null || ws.length <= m) // staleness check return false; for (int r = w.seed, k = r, j = -(m + m); j <= m + m; ++j) { ForkJoinTask t; ForkJoinTask[] q; int b, i; ForkJoinWorkerThread v = ws[k & m]; if (v != null && (b = v.queueBase) != v.queueTop && (q = v.queue) != null && (i = (q.length - 1) & b) >= 0) { long u = (i << ASHIFT) + ABASE; if ((t = q[i]) != null && v.queueBase == b && UNSAFE.compareAndSwapObject(q, u, t, null)) { int d = (v.queueBase = b + 1) - v.queueTop; v.stealHint = w.poolIndex; if (d != 0) signalWork(); // propagate if nonempty w.execTask(t); } r ^= r << 13; r ^= r >>> 17; w.seed = r ^ (r << 5); return false; // store next seed } else if (j < 0) { // xorshift r ^= r << 13; r ^= r >>> 17; k = r ^= r << 5; } else ++k; } if (scanGuard != g) // staleness check return false; else { // try to take submission ForkJoinTask t; ForkJoinTask[] q; int b, i; if ((b = queueBase) != queueTop && (q = submissionQueue) != null && (i = (q.length - 1) & b) >= 0) { long u = (i << ASHIFT) + ABASE; if ((t = q[i]) != null && queueBase == b && UNSAFE.compareAndSwapObject(q, u, t, null)) { queueBase = b + 1; w.execTask(t); } return false; } return true; // all queues empty } } /** * Tries to enqueue worker w in wait queue and await change in * worker's eventCount. If the pool is quiescent and there is * more than one worker, possibly terminates worker upon exit. * Otherwise, before blocking, rescans queues to avoid missed * signals. Upon finding work, releases at least one worker * (which may be the current worker). Rescans restart upon * detected staleness or failure to release due to * contention. Note the unusual conventions about Thread.interrupt * here and elsewhere: Because interrupts are used solely to alert * threads to check termination, which is checked here anyway, we * clear status (using Thread.interrupted) before any call to * park, so that park does not immediately return due to status * being set via some other unrelated call to interrupt in user * code. * * @param w the calling worker * @param c the ctl value on entry * @return true if waited or another thread was released upon enq */ private boolean tryAwaitWork(ForkJoinWorkerThread w, long c) { int v = w.eventCount; w.nextWait = (int)c; // w's successor record long nc = (long)(v & E_MASK) | ((c - AC_UNIT) & (AC_MASK|TC_MASK)); if (ctl != c || !UNSAFE.compareAndSwapLong(this, ctlOffset, c, nc)) { long d = ctl; // return true if lost to a deq, to force scan return (int)d != (int)c && ((d - c) & AC_MASK) >= 0L; } for (int sc = w.stealCount; sc != 0;) { // accumulate stealCount long s = stealCount; if (UNSAFE.compareAndSwapLong(this, stealCountOffset, s, s + sc)) sc = w.stealCount = 0; else if (w.eventCount != v) return true; // update next time } if ((!shutdown || !tryTerminate(false)) && (int)c != 0 && parallelism + (int)(nc >> AC_SHIFT) == 0 && blockedCount == 0 && quiescerCount == 0) idleAwaitWork(w, nc, c, v); // quiescent for (boolean rescanned = false;;) { if (w.eventCount != v) return true; if (!rescanned) { int g = scanGuard, m = g & SMASK; ForkJoinWorkerThread[] ws = workers; if (ws != null && m < ws.length) { rescanned = true; for (int i = 0; i <= m; ++i) { ForkJoinWorkerThread u = ws[i]; if (u != null) { if (u.queueBase != u.queueTop && !tryReleaseWaiter()) rescanned = false; // contended if (w.eventCount != v) return true; } } } if (scanGuard != g || // stale (queueBase != queueTop && !tryReleaseWaiter())) rescanned = false; if (!rescanned) Thread.yield(); // reduce contention else Thread.interrupted(); // clear before park } else { w.parked = true; // must recheck if (w.eventCount != v) { w.parked = false; return true; } LockSupport.park(this); rescanned = w.parked = false; } } } /** * If inactivating worker w has caused pool to become * quiescent, check for pool termination, and wait for event * for up to SHRINK_RATE nanosecs (rescans are unnecessary in * this case because quiescence reflects consensus about lack * of work). On timeout, if ctl has not changed, terminate the * worker. Upon its termination (see deregisterWorker), it may * wake up another worker to possibly repeat this process. * * @param w the calling worker * @param currentCtl the ctl value after enqueuing w * @param prevCtl the ctl value if w terminated * @param v the eventCount w awaits change */ private void idleAwaitWork(ForkJoinWorkerThread w, long currentCtl, long prevCtl, int v) { if (w.eventCount == v) { if (shutdown) tryTerminate(false); ForkJoinTask.helpExpungeStaleExceptions(); // help clean weak refs while (ctl == currentCtl) { long startTime = System.nanoTime(); w.parked = true; if (w.eventCount == v) // must recheck LockSupport.parkNanos(this, SHRINK_RATE); w.parked = false; if (w.eventCount != v) break; else if (System.nanoTime() - startTime < SHRINK_RATE - (SHRINK_RATE / 10)) // timing slop Thread.interrupted(); // spurious wakeup else if (UNSAFE.compareAndSwapLong(this, ctlOffset, currentCtl, prevCtl)) { w.terminate = true; // restore previous w.eventCount = ((int)currentCtl + EC_UNIT) & E_MASK; break; } } } } // Submissions /** * Enqueues the given task in the submissionQueue. Same idea as * ForkJoinWorkerThread.pushTask except for use of submissionLock. * * @param t the task */ private void addSubmission(ForkJoinTask t) { final ReentrantLock lock = this.submissionLock; lock.lock(); try { ForkJoinTask[] q; int s, m; if ((q = submissionQueue) != null) { // ignore if queue removed long u = (((s = queueTop) & (m = q.length-1)) << ASHIFT)+ABASE; UNSAFE.putOrderedObject(q, u, t); queueTop = s + 1; if (s - queueBase == m) growSubmissionQueue(); } } finally { lock.unlock(); } signalWork(); } // (pollSubmission is defined below with exported methods) /** * Creates or doubles submissionQueue array. * Basically identical to ForkJoinWorkerThread version. */ private void growSubmissionQueue() { ForkJoinTask[] oldQ = submissionQueue; int size = oldQ != null ? oldQ.length << 1 : INITIAL_QUEUE_CAPACITY; if (size > MAXIMUM_QUEUE_CAPACITY) throw new RejectedExecutionException("Queue capacity exceeded"); if (size < INITIAL_QUEUE_CAPACITY) size = INITIAL_QUEUE_CAPACITY; ForkJoinTask[] q = submissionQueue = new ForkJoinTask[size]; int mask = size - 1; int top = queueTop; int oldMask; if (oldQ != null && (oldMask = oldQ.length - 1) >= 0) { for (int b = queueBase; b != top; ++b) { long u = ((b & oldMask) << ASHIFT) + ABASE; Object x = UNSAFE.getObjectVolatile(oldQ, u); if (x != null && UNSAFE.compareAndSwapObject(oldQ, u, x, null)) UNSAFE.putObjectVolatile (q, ((b & mask) << ASHIFT) + ABASE, x); } } } // Blocking support /** * Tries to increment blockedCount, decrement active count * (sometimes implicitly) and possibly release or create a * compensating worker in preparation for blocking. Fails * on contention or termination. * * @return true if the caller can block, else should recheck and retry */ private boolean tryPreBlock() { int b = blockedCount; if (UNSAFE.compareAndSwapInt(this, blockedCountOffset, b, b + 1)) { int pc = parallelism; do { ForkJoinWorkerThread[] ws; ForkJoinWorkerThread w; int e, ac, tc, rc, i; long c = ctl; int u = (int)(c >>> 32); if ((e = (int)c) < 0) { // skip -- terminating } else if ((ac = (u >> UAC_SHIFT)) <= 0 && e != 0 && (ws = workers) != null && (i = ~e & SMASK) < ws.length && (w = ws[i]) != null) { long nc = ((long)(w.nextWait & E_MASK) | (c & (AC_MASK|TC_MASK))); if (w.eventCount == e && UNSAFE.compareAndSwapLong(this, ctlOffset, c, nc)) { w.eventCount = (e + EC_UNIT) & E_MASK; if (w.parked) UNSAFE.unpark(w); return true; // release an idle worker } } else if ((tc = (short)(u >>> UTC_SHIFT)) >= 0 && ac + pc > 1) { long nc = ((c - AC_UNIT) & AC_MASK) | (c & ~AC_MASK); if (UNSAFE.compareAndSwapLong(this, ctlOffset, c, nc)) return true; // no compensation needed } else if (tc + pc < MAX_ID) { long nc = ((c + TC_UNIT) & TC_MASK) | (c & ~TC_MASK); if (UNSAFE.compareAndSwapLong(this, ctlOffset, c, nc)) { addWorker(); return true; // create a replacement } } // try to back out on any failure and let caller retry } while (!UNSAFE.compareAndSwapInt(this, blockedCountOffset, b = blockedCount, b - 1)); } return false; } /** * Decrements blockedCount and increments active count */ private void postBlock() { long c; do {} while (!UNSAFE.compareAndSwapLong(this, ctlOffset, // no mask c = ctl, c + AC_UNIT)); int b; do {} while (!UNSAFE.compareAndSwapInt(this, blockedCountOffset, b = blockedCount, b - 1)); } /** * Possibly blocks waiting for the given task to complete, or * cancels the task if terminating. Fails to wait if contended. * * @param joinMe the task */ final void tryAwaitJoin(ForkJoinTask joinMe) { int s; Thread.interrupted(); // clear interrupts before checking termination if (joinMe.status >= 0) { if (tryPreBlock()) { joinMe.tryAwaitDone(0L); postBlock(); } else if ((ctl & STOP_BIT) != 0L) joinMe.cancelIgnoringExceptions(); } } /** * Possibly blocks the given worker waiting for joinMe to * complete or timeout * * @param joinMe the task * @param millis the wait time for underlying Object.wait */ final void timedAwaitJoin(ForkJoinTask joinMe, long nanos) { while (joinMe.status >= 0) { Thread.interrupted(); if ((ctl & STOP_BIT) != 0L) { joinMe.cancelIgnoringExceptions(); break; } if (tryPreBlock()) { long last = System.nanoTime(); while (joinMe.status >= 0) { long millis = TimeUnit.NANOSECONDS.toMillis(nanos); if (millis <= 0) break; joinMe.tryAwaitDone(millis); if (joinMe.status < 0) break; if ((ctl & STOP_BIT) != 0L) { joinMe.cancelIgnoringExceptions(); break; } long now = System.nanoTime(); nanos -= now - last; last = now; } postBlock(); break; } } } /** * If necessary, compensates for blocker, and blocks */ private void awaitBlocker(ManagedBlocker blocker) throws InterruptedException { while (!blocker.isReleasable()) { if (tryPreBlock()) { try { do {} while (!blocker.isReleasable() && !blocker.block()); } finally { postBlock(); } break; } } } // Creating, registering and deregistring workers /** * Tries to create and start a worker; minimally rolls back counts * on failure. */ private void addWorker() { Throwable ex = null; ForkJoinWorkerThread t = null; try { t = factory.newThread(this); } catch (Throwable e) { ex = e; } if (t == null) { // null or exceptional factory return long c; // adjust counts do {} while (!UNSAFE.compareAndSwapLong (this, ctlOffset, c = ctl, (((c - AC_UNIT) & AC_MASK) | ((c - TC_UNIT) & TC_MASK) | (c & ~(AC_MASK|TC_MASK))))); // Propagate exception if originating from an external caller if (!tryTerminate(false) && ex != null && !(Thread.currentThread() instanceof ForkJoinWorkerThread)) UNSAFE.throwException(ex); } else t.start(); } /** * Callback from ForkJoinWorkerThread constructor to assign a * public name */ final String nextWorkerName() { for (int n;;) { if (UNSAFE.compareAndSwapInt(this, nextWorkerNumberOffset, n = nextWorkerNumber, ++n)) return workerNamePrefix + n; } } /** * Callback from ForkJoinWorkerThread constructor to * determine its poolIndex and record in workers array. * * @param w the worker * @return the worker's pool index */ final int registerWorker(ForkJoinWorkerThread w) { /* * In the typical case, a new worker acquires the lock, uses * next available index and returns quickly. Since we should * not block callers (ultimately from signalWork or * tryPreBlock) waiting for the lock needed to do this, we * instead help release other workers while waiting for the * lock. */ for (int g;;) { ForkJoinWorkerThread[] ws; if (((g = scanGuard) & SG_UNIT) == 0 && UNSAFE.compareAndSwapInt(this, scanGuardOffset, g, g | SG_UNIT)) { int k = nextWorkerIndex; try { if ((ws = workers) != null) { // ignore on shutdown int n = ws.length; if (k < 0 || k >= n || ws[k] != null) { for (k = 0; k < n && ws[k] != null; ++k) ; if (k == n) ws = workers = Arrays.copyOf(ws, n << 1); } ws[k] = w; nextWorkerIndex = k + 1; int m = g & SMASK; g = (k > m) ? ((m << 1) + 1) & SMASK : g + (SG_UNIT<<1); } } finally { scanGuard = g; } return k; } else if ((ws = workers) != null) { // help release others for (ForkJoinWorkerThread u : ws) { if (u != null && u.queueBase != u.queueTop) { if (tryReleaseWaiter()) break; } } } } } /** * Final callback from terminating worker. Removes record of * worker from array, and adjusts counts. If pool is shutting * down, tries to complete termination. * * @param w the worker */ final void deregisterWorker(ForkJoinWorkerThread w, Throwable ex) { int idx = w.poolIndex; int sc = w.stealCount; int steps = 0; // Remove from array, adjust worker counts and collect steal count. // We can intermix failed removes or adjusts with steal updates do { long s, c; int g; if (steps == 0 && ((g = scanGuard) & SG_UNIT) == 0 && UNSAFE.compareAndSwapInt(this, scanGuardOffset, g, g |= SG_UNIT)) { ForkJoinWorkerThread[] ws = workers; if (ws != null && idx >= 0 && idx < ws.length && ws[idx] == w) ws[idx] = null; // verify nextWorkerIndex = idx; scanGuard = g + SG_UNIT; steps = 1; } if (steps == 1 && UNSAFE.compareAndSwapLong(this, ctlOffset, c = ctl, (((c - AC_UNIT) & AC_MASK) | ((c - TC_UNIT) & TC_MASK) | (c & ~(AC_MASK|TC_MASK))))) steps = 2; if (sc != 0 && UNSAFE.compareAndSwapLong(this, stealCountOffset, s = stealCount, s + sc)) sc = 0; } while (steps != 2 || sc != 0); if (!tryTerminate(false)) { if (ex != null) // possibly replace if died abnormally signalWork(); else tryReleaseWaiter(); } } // Shutdown and termination /** * Possibly initiates and/or completes termination. * * @param now if true, unconditionally terminate, else only * if shutdown and empty queue and no active workers * @return true if now terminating or terminated */ private boolean tryTerminate(boolean now) { long c; while (((c = ctl) & STOP_BIT) == 0) { if (!now) { if ((int)(c >> AC_SHIFT) != -parallelism) return false; if (!shutdown || blockedCount != 0 || quiescerCount != 0 || queueBase != queueTop) { if (ctl == c) // staleness check return false; continue; } } if (UNSAFE.compareAndSwapLong(this, ctlOffset, c, c | STOP_BIT)) startTerminating(); } if ((short)(c >>> TC_SHIFT) == -parallelism) { // signal when 0 workers final ReentrantLock lock = this.submissionLock; lock.lock(); try { termination.signalAll(); } finally { lock.unlock(); } } return true; } /** * Runs up to three passes through workers: (0) Setting * termination status for each worker, followed by wakeups up to * queued workers; (1) helping cancel tasks; (2) interrupting * lagging threads (likely in external tasks, but possibly also * blocked in joins). Each pass repeats previous steps because of * potential lagging thread creation. */ private void startTerminating() { cancelSubmissions(); for (int pass = 0; pass < 3; ++pass) { ForkJoinWorkerThread[] ws = workers; if (ws != null) { for (ForkJoinWorkerThread w : ws) { if (w != null) { w.terminate = true; if (pass > 0) { w.cancelTasks(); if (pass > 1 && !w.isInterrupted()) { try { w.interrupt(); } catch (SecurityException ignore) { } } } } } terminateWaiters(); } } } /** * Polls and cancels all submissions. Called only during termination. */ private void cancelSubmissions() { while (queueBase != queueTop) { ForkJoinTask task = pollSubmission(); if (task != null) { try { task.cancel(false); } catch (Throwable ignore) { } } } } /** * Tries to set the termination status of waiting workers, and * then wakes them up (after which they will terminate). */ private void terminateWaiters() { ForkJoinWorkerThread[] ws = workers; if (ws != null) { ForkJoinWorkerThread w; long c; int i, e; int n = ws.length; while ((i = ~(e = (int)(c = ctl)) & SMASK) < n && (w = ws[i]) != null && w.eventCount == (e & E_MASK)) { if (UNSAFE.compareAndSwapLong(this, ctlOffset, c, (long)(w.nextWait & E_MASK) | ((c + AC_UNIT) & AC_MASK) | (c & (TC_MASK|STOP_BIT)))) { w.terminate = true; w.eventCount = e + EC_UNIT; if (w.parked) UNSAFE.unpark(w); } } } } // misc ForkJoinWorkerThread support /** * Increment or decrement quiescerCount. Needed only to prevent * triggering shutdown if a worker is transiently inactive while * checking quiescence. * * @param delta 1 for increment, -1 for decrement */ final void addQuiescerCount(int delta) { int c; do {} while (!UNSAFE.compareAndSwapInt(this, quiescerCountOffset, c = quiescerCount, c + delta)); } /** * Directly increment or decrement active count without * queuing. This method is used to transiently assert inactivation * while checking quiescence. * * @param delta 1 for increment, -1 for decrement */ final void addActiveCount(int delta) { long d = delta < 0 ? -AC_UNIT : AC_UNIT; long c; do {} while (!UNSAFE.compareAndSwapLong(this, ctlOffset, c = ctl, ((c + d) & AC_MASK) | (c & ~AC_MASK))); } /** * Returns the approximate (non-atomic) number of idle threads per * active thread. */ final int idlePerActive() { // Approximate at powers of two for small values, saturate past 4 int p = parallelism; int a = p + (int)(ctl >> AC_SHIFT); return (a > (p >>>= 1) ? 0 : a > (p >>>= 1) ? 1 : a > (p >>>= 1) ? 2 : a > (p >>>= 1) ? 4 : 8); } // Exported methods // Constructors /** * Creates a {@code ForkJoinPool} with parallelism equal to {@link * java.lang.Runtime#availableProcessors}, using the {@linkplain * #defaultForkJoinWorkerThreadFactory default thread factory}, * no UncaughtExceptionHandler, and non-async LIFO processing mode. * * @throws SecurityException if a security manager exists and * the caller is not permitted to modify threads * because it does not hold {@link * java.lang.RuntimePermission}{@code ("modifyThread")} */ public ForkJoinPool() { this(Runtime.getRuntime().availableProcessors(), defaultForkJoinWorkerThreadFactory, null, false); } /** * Creates a {@code ForkJoinPool} with the indicated parallelism * level, the {@linkplain * #defaultForkJoinWorkerThreadFactory default thread factory}, * no UncaughtExceptionHandler, and non-async LIFO processing mode. * * @param parallelism the parallelism level * @throws IllegalArgumentException if parallelism less than or * equal to zero, or greater than implementation limit * @throws SecurityException if a security manager exists and * the caller is not permitted to modify threads * because it does not hold {@link * java.lang.RuntimePermission}{@code ("modifyThread")} */ public ForkJoinPool(int parallelism) { this(parallelism, defaultForkJoinWorkerThreadFactory, null, false); } /** * Creates a {@code ForkJoinPool} with the given parameters. * * @param parallelism the parallelism level. For default value, * use {@link java.lang.Runtime#availableProcessors}. * @param factory the factory for creating new threads. For default value, * use {@link #defaultForkJoinWorkerThreadFactory}. * @param handler the handler for internal worker threads that * terminate due to unrecoverable errors encountered while executing * tasks. For default value, use {@code null}. * @param asyncMode if true, * establishes local first-in-first-out scheduling mode for forked * tasks that are never joined. This mode may be more appropriate * than default locally stack-based mode in applications in which * worker threads only process event-style asynchronous tasks. * For default value, use {@code false}. * @throws IllegalArgumentException if parallelism less than or * equal to zero, or greater than implementation limit * @throws NullPointerException if the factory is null * @throws SecurityException if a security manager exists and * the caller is not permitted to modify threads * because it does not hold {@link * java.lang.RuntimePermission}{@code ("modifyThread")} */ public ForkJoinPool(int parallelism, ForkJoinWorkerThreadFactory factory, Thread.UncaughtExceptionHandler handler, boolean asyncMode) { checkPermission(); if (factory == null) throw new NullPointerException(); if (parallelism <= 0 || parallelism > MAX_ID) throw new IllegalArgumentException(); this.parallelism = parallelism; this.factory = factory; this.ueh = handler; this.locallyFifo = asyncMode; long np = (long)(-parallelism); // offset ctl counts this.ctl = ((np << AC_SHIFT) & AC_MASK) | ((np << TC_SHIFT) & TC_MASK); this.submissionQueue = new ForkJoinTask[INITIAL_QUEUE_CAPACITY]; // initialize workers array with room for 2*parallelism if possible int n = parallelism << 1; if (n >= MAX_ID) n = MAX_ID; else { // See Hackers Delight, sec 3.2, where n < (1 << 16) n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; } workers = new ForkJoinWorkerThread[n + 1]; this.submissionLock = new ReentrantLock(); this.termination = submissionLock.newCondition(); StringBuilder sb = new StringBuilder("ForkJoinPool-"); sb.append(poolNumberGenerator.incrementAndGet()); sb.append("-worker-"); this.workerNamePrefix = sb.toString(); } // Execution methods /** * Performs the given task, returning its result upon completion. * If the computation encounters an unchecked Exception or Error, * it is rethrown as the outcome of this invocation. Rethrown * exceptions behave in the same way as regular exceptions, but, * when possible, contain stack traces (as displayed for example * using {@code ex.printStackTrace()}) of both the current thread * as well as the thread actually encountering the exception; * minimally only the latter. * * @param task the task * @return the task's result * @throws NullPointerException if the task is null * @throws RejectedExecutionException if the task cannot be * scheduled for execution */ public T invoke(ForkJoinTask task) { Thread t = Thread.currentThread(); if (task == null) throw new NullPointerException(); if (shutdown) throw new RejectedExecutionException(); if ((t instanceof ForkJoinWorkerThread) && ((ForkJoinWorkerThread)t).pool == this) return task.invoke(); // bypass submit if in same pool else { addSubmission(task); return task.join(); } } /** * Unless terminating, forks task if within an ongoing FJ * computation in the current pool, else submits as external task. */ private void forkOrSubmit(ForkJoinTask task) { ForkJoinWorkerThread w; Thread t = Thread.currentThread(); if (shutdown) throw new RejectedExecutionException(); if ((t instanceof ForkJoinWorkerThread) && (w = (ForkJoinWorkerThread)t).pool == this) w.pushTask(task); else addSubmission(task); } /** * Arranges for (asynchronous) execution of the given task. * * @param task the task * @throws NullPointerException if the task is null * @throws RejectedExecutionException if the task cannot be * scheduled for execution */ public void execute(ForkJoinTask task) { if (task == null) throw new NullPointerException(); forkOrSubmit(task); } // AbstractExecutorService methods /** * @throws NullPointerException if the task is null * @throws RejectedExecutionException if the task cannot be * scheduled for execution */ public void execute(Runnable task) { if (task == null) throw new NullPointerException(); ForkJoinTask job; if (task instanceof ForkJoinTask) // avoid re-wrap job = (ForkJoinTask) task; else job = ForkJoinTask.adapt(task, null); forkOrSubmit(job); } /** * Submits a ForkJoinTask for execution. * * @param task the task to submit * @return the task * @throws NullPointerException if the task is null * @throws RejectedExecutionException if the task cannot be * scheduled for execution */ public ForkJoinTask submit(ForkJoinTask task) { if (task == null) throw new NullPointerException(); forkOrSubmit(task); return task; } /** * @throws NullPointerException if the task is null * @throws RejectedExecutionException if the task cannot be * scheduled for execution */ public ForkJoinTask submit(Callable task) { if (task == null) throw new NullPointerException(); ForkJoinTask job = ForkJoinTask.adapt(task); forkOrSubmit(job); return job; } /** * @throws NullPointerException if the task is null * @throws RejectedExecutionException if the task cannot be * scheduled for execution */ public ForkJoinTask submit(Runnable task, T result) { if (task == null) throw new NullPointerException(); ForkJoinTask job = ForkJoinTask.adapt(task, result); forkOrSubmit(job); return job; } /** * @throws NullPointerException if the task is null * @throws RejectedExecutionException if the task cannot be * scheduled for execution */ public ForkJoinTask submit(Runnable task) { if (task == null) throw new NullPointerException(); ForkJoinTask job; if (task instanceof ForkJoinTask) // avoid re-wrap job = (ForkJoinTask) task; else job = ForkJoinTask.adapt(task, null); forkOrSubmit(job); return job; } /** * @throws NullPointerException {@inheritDoc} * @throws RejectedExecutionException {@inheritDoc} */ public List> invokeAll(Collection> tasks) { ArrayList> forkJoinTasks = new ArrayList>(tasks.size()); for (Callable task : tasks) forkJoinTasks.add(ForkJoinTask.adapt(task)); invoke(new InvokeAll(forkJoinTasks)); @SuppressWarnings({"unchecked", "rawtypes"}) List> futures = (List>) (List) forkJoinTasks; return futures; } static final class InvokeAll extends RecursiveAction { final ArrayList> tasks; InvokeAll(ArrayList> tasks) { this.tasks = tasks; } public void compute() { try { invokeAll(tasks); } catch (Exception ignore) {} } private static final long serialVersionUID = -7914297376763021607L; } /** * Returns the factory used for constructing new workers. * * @return the factory used for constructing new workers */ public ForkJoinWorkerThreadFactory getFactory() { return factory; } /** * Returns the handler for internal worker threads that terminate * due to unrecoverable errors encountered while executing tasks. * * @return the handler, or {@code null} if none */ public Thread.UncaughtExceptionHandler getUncaughtExceptionHandler() { return ueh; } /** * Returns the targeted parallelism level of this pool. * * @return the targeted parallelism level of this pool */ public int getParallelism() { return parallelism; } /** * Returns the number of worker threads that have started but not * yet terminated. The result returned by this method may differ * from {@link #getParallelism} when threads are created to * maintain parallelism when others are cooperatively blocked. * * @return the number of worker threads */ public int getPoolSize() { return parallelism + (short)(ctl >>> TC_SHIFT); } /** * Returns {@code true} if this pool uses local first-in-first-out * scheduling mode for forked tasks that are never joined. * * @return {@code true} if this pool uses async mode */ public boolean getAsyncMode() { return locallyFifo; } /** * Returns an estimate of the number of worker threads that are * not blocked waiting to join tasks or for other managed * synchronization. This method may overestimate the * number of running threads. * * @return the number of worker threads */ public int getRunningThreadCount() { int r = parallelism + (int)(ctl >> AC_SHIFT); return (r <= 0) ? 0 : r; // suppress momentarily negative values } /** * Returns an estimate of the number of threads that are currently * stealing or executing tasks. This method may overestimate the * number of active threads. * * @return the number of active threads */ public int getActiveThreadCount() { int r = parallelism + (int)(ctl >> AC_SHIFT) + blockedCount; return (r <= 0) ? 0 : r; // suppress momentarily negative values } /** * Returns {@code true} if all worker threads are currently idle. * An idle worker is one that cannot obtain a task to execute * because none are available to steal from other threads, and * there are no pending submissions to the pool. This method is * conservative; it might not return {@code true} immediately upon * idleness of all threads, but will eventually become true if * threads remain inactive. * * @return {@code true} if all threads are currently idle */ public boolean isQuiescent() { return parallelism + (int)(ctl >> AC_SHIFT) + blockedCount == 0; } /** * Returns an estimate of the total number of tasks stolen from * one thread's work queue by another. The reported value * underestimates the actual total number of steals when the pool * is not quiescent. This value may be useful for monitoring and * tuning fork/join programs: in general, steal counts should be * high enough to keep threads busy, but low enough to avoid * overhead and contention across threads. * * @return the number of steals */ public long getStealCount() { return stealCount; } /** * Returns an estimate of the total number of tasks currently held * in queues by worker threads (but not including tasks submitted * to the pool that have not begun executing). This value is only * an approximation, obtained by iterating across all threads in * the pool. This method may be useful for tuning task * granularities. * * @return the number of queued tasks */ public long getQueuedTaskCount() { long count = 0; ForkJoinWorkerThread[] ws; if ((short)(ctl >>> TC_SHIFT) > -parallelism && (ws = workers) != null) { for (ForkJoinWorkerThread w : ws) if (w != null) count -= w.queueBase - w.queueTop; // must read base first } return count; } /** * Returns an estimate of the number of tasks submitted to this * pool that have not yet begun executing. This method may take * time proportional to the number of submissions. * * @return the number of queued submissions */ public int getQueuedSubmissionCount() { return -queueBase + queueTop; } /** * Returns {@code true} if there are any tasks submitted to this * pool that have not yet begun executing. * * @return {@code true} if there are any queued submissions */ public boolean hasQueuedSubmissions() { return queueBase != queueTop; } /** * Removes and returns the next unexecuted submission if one is * available. This method may be useful in extensions to this * class that re-assign work in systems with multiple pools. * * @return the next submission, or {@code null} if none */ protected ForkJoinTask pollSubmission() { ForkJoinTask t; ForkJoinTask[] q; int b, i; while ((b = queueBase) != queueTop && (q = submissionQueue) != null && (i = (q.length - 1) & b) >= 0) { long u = (i << ASHIFT) + ABASE; if ((t = q[i]) != null && queueBase == b && UNSAFE.compareAndSwapObject(q, u, t, null)) { queueBase = b + 1; return t; } } return null; } /** * Removes all available unexecuted submitted and forked tasks * from scheduling queues and adds them to the given collection, * without altering their execution status. These may include * artificially generated or wrapped tasks. This method is * designed to be invoked only when the pool is known to be * quiescent. Invocations at other times may not remove all * tasks. A failure encountered while attempting to add elements * to collection {@code c} may result in elements being in * neither, either or both collections when the associated * exception is thrown. The behavior of this operation is * undefined if the specified collection is modified while the * operation is in progress. * * @param c the collection to transfer elements into * @return the number of elements transferred */ protected int drainTasksTo(Collection> c) { int count = 0; while (queueBase != queueTop) { ForkJoinTask t = pollSubmission(); if (t != null) { c.add(t); ++count; } } ForkJoinWorkerThread[] ws; if ((short)(ctl >>> TC_SHIFT) > -parallelism && (ws = workers) != null) { for (ForkJoinWorkerThread w : ws) if (w != null) count += w.drainTasksTo(c); } return count; } /** * Returns a string identifying this pool, as well as its state, * including indications of run state, parallelism level, and * worker and task counts. * * @return a string identifying this pool, as well as its state */ public String toString() { long st = getStealCount(); long qt = getQueuedTaskCount(); long qs = getQueuedSubmissionCount(); int pc = parallelism; long c = ctl; int tc = pc + (short)(c >>> TC_SHIFT); int rc = pc + (int)(c >> AC_SHIFT); if (rc < 0) // ignore transient negative rc = 0; int ac = rc + blockedCount; String level; if ((c & STOP_BIT) != 0) level = (tc == 0) ? "Terminated" : "Terminating"; else level = shutdown ? "Shutting down" : "Running"; return super.toString() + "[" + level + ", parallelism = " + pc + ", size = " + tc + ", active = " + ac + ", running = " + rc + ", steals = " + st + ", tasks = " + qt + ", submissions = " + qs + "]"; } /** * Initiates an orderly shutdown in which previously submitted * tasks are executed, but no new tasks will be accepted. * Invocation has no additional effect if already shut down. * Tasks that are in the process of being submitted concurrently * during the course of this method may or may not be rejected. * * @throws SecurityException if a security manager exists and * the caller is not permitted to modify threads * because it does not hold {@link * java.lang.RuntimePermission}{@code ("modifyThread")} */ public void shutdown() { checkPermission(); shutdown = true; tryTerminate(false); } /** * Attempts to cancel and/or stop all tasks, and reject all * subsequently submitted tasks. Tasks that are in the process of * being submitted or executed concurrently during the course of * this method may or may not be rejected. This method cancels * both existing and unexecuted tasks, in order to permit * termination in the presence of task dependencies. So the method * always returns an empty list (unlike the case for some other * Executors). * * @return an empty list * @throws SecurityException if a security manager exists and * the caller is not permitted to modify threads * because it does not hold {@link * java.lang.RuntimePermission}{@code ("modifyThread")} */ public List shutdownNow() { checkPermission(); shutdown = true; tryTerminate(true); return Collections.emptyList(); } /** * Returns {@code true} if all tasks have completed following shut down. * * @return {@code true} if all tasks have completed following shut down */ public boolean isTerminated() { long c = ctl; return ((c & STOP_BIT) != 0L && (short)(c >>> TC_SHIFT) == -parallelism); } /** * Returns {@code true} if the process of termination has * commenced but not yet completed. This method may be useful for * debugging. A return of {@code true} reported a sufficient * period after shutdown may indicate that submitted tasks have * ignored or suppressed interruption, or are waiting for IO, * causing this executor not to properly terminate. (See the * advisory notes for class {@link ForkJoinTask} stating that * tasks should not normally entail blocking operations. But if * they do, they must abort them on interrupt.) * * @return {@code true} if terminating but not yet terminated */ public boolean isTerminating() { long c = ctl; return ((c & STOP_BIT) != 0L && (short)(c >>> TC_SHIFT) != -parallelism); } /** * Returns true if terminating or terminated. Used by ForkJoinWorkerThread. */ final boolean isAtLeastTerminating() { return (ctl & STOP_BIT) != 0L; } /** * Returns {@code true} if this pool has been shut down. * * @return {@code true} if this pool has been shut down */ public boolean isShutdown() { return shutdown; } /** * Blocks until all tasks have completed execution after a shutdown * request, or the timeout occurs, or the current thread is * interrupted, whichever happens first. * * @param timeout the maximum time to wait * @param unit the time unit of the timeout argument * @return {@code true} if this executor terminated and * {@code false} if the timeout elapsed before termination * @throws InterruptedException if interrupted while waiting */ public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { long nanos = unit.toNanos(timeout); final ReentrantLock lock = this.submissionLock; lock.lock(); try { for (;;) { if (isTerminated()) return true; if (nanos <= 0) return false; nanos = termination.awaitNanos(nanos); } } finally { lock.unlock(); } } /** * Interface for extending managed parallelism for tasks running * in {@link ForkJoinPool}s. * *

A {@code ManagedBlocker} provides two methods. Method * {@code isReleasable} must return {@code true} if blocking is * not necessary. Method {@code block} blocks the current thread * if necessary (perhaps internally invoking {@code isReleasable} * before actually blocking). These actions are performed by any * thread invoking {@link ForkJoinPool#managedBlock}. The * unusual methods in this API accommodate synchronizers that may, * but don't usually, block for long periods. Similarly, they * allow more efficient internal handling of cases in which * additional workers may be, but usually are not, needed to * ensure sufficient parallelism. Toward this end, * implementations of method {@code isReleasable} must be amenable * to repeated invocation. * *

For example, here is a ManagedBlocker based on a * ReentrantLock: *

 {@code
     * class ManagedLocker implements ManagedBlocker {
     *   final ReentrantLock lock;
     *   boolean hasLock = false;
     *   ManagedLocker(ReentrantLock lock) { this.lock = lock; }
     *   public boolean block() {
     *     if (!hasLock)
     *       lock.lock();
     *     return true;
     *   }
     *   public boolean isReleasable() {
     *     return hasLock || (hasLock = lock.tryLock());
     *   }
     * }}
* *

Here is a class that possibly blocks waiting for an * item on a given queue: *

 {@code
     * class QueueTaker implements ManagedBlocker {
     *   final BlockingQueue queue;
     *   volatile E item = null;
     *   QueueTaker(BlockingQueue q) { this.queue = q; }
     *   public boolean block() throws InterruptedException {
     *     if (item == null)
     *       item = queue.take();
     *     return true;
     *   }
     *   public boolean isReleasable() {
     *     return item != null || (item = queue.poll()) != null;
     *   }
     *   public E getItem() { // call after pool.managedBlock completes
     *     return item;
     *   }
     * }}
*/ public static interface ManagedBlocker { /** * Possibly blocks the current thread, for example waiting for * a lock or condition. * * @return {@code true} if no additional blocking is necessary * (i.e., if isReleasable would return true) * @throws InterruptedException if interrupted while waiting * (the method is not required to do so, but is allowed to) */ boolean block() throws InterruptedException; /** * Returns {@code true} if blocking is unnecessary. */ boolean isReleasable(); } /** * Blocks in accord with the given blocker. If the current thread * is a {@link ForkJoinWorkerThread}, this method possibly * arranges for a spare thread to be activated if necessary to * ensure sufficient parallelism while the current thread is blocked. * *

If the caller is not a {@link ForkJoinTask}, this method is * behaviorally equivalent to *

 {@code
     * while (!blocker.isReleasable())
     *   if (blocker.block())
     *     return;
     * }
* * If the caller is a {@code ForkJoinTask}, then the pool may * first be expanded to ensure parallelism, and later adjusted. * * @param blocker the blocker * @throws InterruptedException if blocker.block did so */ public static void managedBlock(ManagedBlocker blocker) throws InterruptedException { Thread t = Thread.currentThread(); if (t instanceof ForkJoinWorkerThread) { ForkJoinWorkerThread w = (ForkJoinWorkerThread) t; w.pool.awaitBlocker(blocker); } else { do {} while (!blocker.isReleasable() && !blocker.block()); } } // AbstractExecutorService overrides. These rely on undocumented // fact that ForkJoinTask.adapt returns ForkJoinTasks that also // implement RunnableFuture. protected RunnableFuture newTaskFor(Runnable runnable, T value) { return (RunnableFuture) ForkJoinTask.adapt(runnable, value); } protected RunnableFuture newTaskFor(Callable callable) { return (RunnableFuture) ForkJoinTask.adapt(callable); } // Unsafe mechanics private static final sun.misc.Unsafe UNSAFE; private static final long ctlOffset; private static final long stealCountOffset; private static final long blockedCountOffset; private static final long quiescerCountOffset; private static final long scanGuardOffset; private static final long nextWorkerNumberOffset; private static final long ABASE; private static final int ASHIFT; static { poolNumberGenerator = new AtomicInteger(); workerSeedGenerator = new Random(); modifyThreadPermission = new RuntimePermission("modifyThread"); defaultForkJoinWorkerThreadFactory = new DefaultForkJoinWorkerThreadFactory(); int s; try { UNSAFE = getUnsafe(); Class k = ForkJoinPool.class; ctlOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("ctl")); stealCountOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("stealCount")); blockedCountOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("blockedCount")); quiescerCountOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("quiescerCount")); scanGuardOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("scanGuard")); nextWorkerNumberOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("nextWorkerNumber")); Class a = ForkJoinTask[].class; ABASE = UNSAFE.arrayBaseOffset(a); s = UNSAFE.arrayIndexScale(a); } catch (Exception e) { throw new Error(e); } if ((s & (s-1)) != 0) throw new Error("data type scale not a power of two"); ASHIFT = 31 - Integer.numberOfLeadingZeros(s); } /** * Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. * Replace with a simple call to Unsafe.getUnsafe when integrating * into a jdk. * * @return a sun.misc.Unsafe */ private static sun.misc.Unsafe getUnsafe() { try { return sun.misc.Unsafe.getUnsafe(); } catch (SecurityException se) { try { return java.security.AccessController.doPrivileged (new java.security .PrivilegedExceptionAction() { public sun.misc.Unsafe run() throws Exception { java.lang.reflect.Field f = sun.misc .Unsafe.class.getDeclaredField("theUnsafe"); f.setAccessible(true); return (sun.misc.Unsafe) f.get(null); }}); } catch (java.security.PrivilegedActionException e) { throw new RuntimeException("Could not initialize intrinsics", e.getCause()); } } } } jsr166/src/test/0000755000000000000000000000000011652013243010542 5ustar jsr166/src/test/jtreg/0000755000000000000000000000000011652013242011654 5ustar jsr166/src/test/jtreg/util/0000755000000000000000000000000011652013243012632 5ustar jsr166/src/test/jtreg/util/LinkedHashMap/0000755000000000000000000000000011652013243015302 5ustar jsr166/src/test/jtreg/util/LinkedHashMap/Cache.java0000644000000000000000000000342511441006143017151 0ustar /* * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4245809 * @summary Basic test of removeEldestElement method. */ import java.util.*; public class Cache { private static final int MAP_SIZE = 10; private static final int NUM_KEYS = 100; public static void main(String[] args) throws Exception { Map m = new LinkedHashMap() { protected boolean removeEldestEntry(Map.Entry eldest) { return size() > MAP_SIZE; } }; for (int i = 0; i < NUM_KEYS; i++) { m.put(new Integer(i), ""); int eldest = ((Integer) m.keySet().iterator().next()).intValue(); if (eldest != Math.max(i-9, 0)) throw new RuntimeException("i = " + i + ", eldest = " +eldest); } } } jsr166/src/test/jtreg/util/LinkedHashMap/Basic.java0000644000000000000000000002135711557356701017213 0ustar /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4245809 * @summary Basic test for LinkedHashMap. (Based on MapBash) */ import java.util.*; import java.io.*; public class Basic { static Random rnd = new Random(666); static Object nil = new Integer(0); public static void main(String[] args) throws Exception { int numItr = 500; int mapSize = 500; // Linked List test for (int i=0; i=0; i--) { Integer x = (Integer) l.get(i); if (!m.get(x).equals(x)) throw new Exception("Wrong value: "+i+", "+m.get(x)+", "+x); } if (!new ArrayList(m.keySet()).equals(l)) throw new Exception("Insertion order not preserved after read."); for (int i=mapSize-1; i>=0; i--) { Integer x = (Integer) l.get(i); m.put(x, x); } if (!new ArrayList(m.keySet()).equals(l)) throw new Exception("Insert order not preserved after reinsert."); m2 = (Map) ((LinkedHashMap)m).clone(); if (!m.equals(m2)) throw new Exception("Insert-order Map != clone."); List l2 = new ArrayList(l); Collections.shuffle(l2); for (int i=0; i i ? Integer.parseInt(args[i]) : defaultValue; } // Pass -Dthorough=true for more exhaustive testing static final boolean thorough = Boolean.getBoolean("thorough"); static boolean maybe(int n) { return rnd.nextInt(n) == 0; } static void realMain(String[] args) { size = intArg(args, 0, DEFAULT_SIZE); lockSteps(new TreeMap(), new ConcurrentSkipListMap()); lockSteps(new TreeMap(reverseOrder()), new ConcurrentSkipListMap(reverseOrder())); lockSteps(new TreeSet(), new ConcurrentSkipListSet()); lockSteps(new TreeSet(reverseOrder()), new ConcurrentSkipListSet(reverseOrder())); } static void lockSteps(NavigableMap m1, NavigableMap m2) { if (maybe(4)) m1 = serialClone(m1); if (maybe(4)) m2 = serialClone(m2); lockStep(m1, m2); lockStep(m1.descendingMap(), m2.descendingMap()); lockStep(fullSubMap(m1), fullSubMap(m2)); lockStep(fullSubMap(m1.descendingMap()), fullSubMap(m2.descendingMap())); lockStep(fullHeadMap(m1), fullHeadMap(m2)); lockStep(fullHeadMap(m1.descendingMap()), fullHeadMap(m2.descendingMap())); lockStep(fullTailMap(m1), fullTailMap(m2)); lockStep(fullTailMap(m1.descendingMap()), fullTailMap(m2.descendingMap())); } static void lockSteps(NavigableSet s1, NavigableSet s2) { if (maybe(4)) s1 = serialClone(s1); if (maybe(4)) s2 = serialClone(s2); lockStep(s1, s2); lockStep(s1.descendingSet(), s2.descendingSet()); lockStep(fullSubSet(s1), fullSubSet(s2)); lockStep(fullSubSet(s1.descendingSet()), fullSubSet(s2.descendingSet())); lockStep(fullHeadSet(s1), fullHeadSet(s2)); lockStep(fullHeadSet(s1.descendingSet()), fullHeadSet(s2.descendingSet())); lockStep(fullTailSet(s1), fullTailSet(s2)); lockStep(fullTailSet(s1.descendingSet()), fullTailSet(s2.descendingSet())); } static boolean isAscending(NavigableMap m) { Comparator cmp = m.comparator(); return (cmp == null || cmp.compare(1, 2) < 0); } static NavigableMap fullSubMap(NavigableMap m) { return isAscending(m) ? m.subMap(Integer.MIN_VALUE, true, Integer.MAX_VALUE, true) : m.subMap(Integer.MAX_VALUE, true, Integer.MIN_VALUE, true); } static NavigableMap fullHeadMap(NavigableMap m) { return isAscending(m) ? m.headMap(Integer.MAX_VALUE, true) : m.headMap(Integer.MIN_VALUE, true); } static NavigableMap fullTailMap(NavigableMap m) { return isAscending(m) ? m.tailMap(Integer.MIN_VALUE, true) : m.tailMap(Integer.MAX_VALUE, true); } static boolean isAscending(NavigableSet s) { Comparator cmp = s.comparator(); return (cmp == null || cmp.compare(1, 2) < 0); } static NavigableSet fullSubSet(NavigableSet s) { return isAscending(s) ? s.subSet(Integer.MIN_VALUE, true, Integer.MAX_VALUE, true) : s.subSet(Integer.MAX_VALUE, true, Integer.MIN_VALUE, true); } static NavigableSet fullHeadSet(NavigableSet s) { return isAscending(s) ? s.headSet(Integer.MAX_VALUE, true) : s.headSet(Integer.MIN_VALUE, true); } static NavigableSet fullTailSet(NavigableSet s) { return isAscending(s) ? s.tailSet(Integer.MIN_VALUE, true) : s.tailSet(Integer.MAX_VALUE, true); } static void testEmptyCollection(Collection c) { check(c.isEmpty()); equal(c.size(), 0); equal(c.toString(),"[]"); equal(c.toArray().length, 0); equal(c.toArray(new Object[0]).length, 0); Object[] a = new Object[1]; a[0] = Boolean.TRUE; equal(c.toArray(a), a); equal(a[0], null); check(! c.iterator().hasNext()); } static void testEmptySet(Set c) { testEmptyCollection(c); equal(c.hashCode(), 0); equal2(c, Collections.emptySet()); } static void testEmptyMap(final Map m) { check(m.isEmpty()); equal(m.size(), 0); equal(m.toString(),"{}"); equal(m.hashCode(), 0); testEmptySet(m.keySet()); testEmptySet(m.entrySet()); testEmptyCollection(m.values()); } static final Random rnd = new Random(); static void equalNext(final Iterator it, Object expected) { if (maybe(2)) check(it.hasNext()); equal(it.next(), expected); } static Comparator comparator(NavigableSet s) { Comparator cmp = s.comparator(); return cmp != null ? cmp : new Comparator() { public int compare(Object o1, Object o2) { return ((Comparable) o1).compareTo(o2); }}; } static Comparator comparator(NavigableMap m) { Comparator cmp = m.comparator(); return cmp != null ? cmp : new Comparator() { public int compare(Object o1, Object o2) { return ((Comparable) o1).compareTo(o2); }}; } static void checkNavigableSet(final NavigableSet s) { if (s.comparator() == null) check(s.descendingSet().descendingSet().comparator() == null); equal(s.isEmpty(), s.size() == 0); equal2(s, s.descendingSet()); if (maybe(4) && s instanceof Serializable) equal2(s, serialClone(s)); Comparator cmp = comparator(s); if (s.isEmpty()) { THROWS(NoSuchElementException.class, new Fun(){void f(){ s.first(); }}, new Fun(){void f(){ s.last(); }}); equal(null, s.lower(1)); equal(null, s.floor(1)); equal(null, s.ceiling(1)); equal(null, s.higher(1)); } else { Object a = s.first(); Object z = s.last(); equal(s.lower(a), null); equal(s.higher(z), null); equal2(s, s.tailSet(a)); equal2(s, s.headSet(z, true)); equal2(s, s.subSet(a, true, z, true)); testEmptySet(s.subSet(a, true, a, false)); testEmptySet(s.subSet(z, true, z, false)); testEmptySet(s.headSet(a, false)); testEmptySet(s.tailSet(z, false)); equal2(s.headSet(a, true), singleton(a)); equal2(s.tailSet(z, true), singleton(z)); } Iterator[] its = new Iterator[] { s.iterator(), s.descendingSet().descendingSet().iterator(), }; for (final Iterator it : its) if (maybe(4)) THROWS(IllegalStateException.class, new Fun(){void f(){ it.remove(); }}); Object prev = null; for (Object e : s) { check(s.contains(e)); for (Iterator it : its) equalNext(it, e); equal(e, s.ceiling(e)); equal(e, s.floor(e)); check(s.higher(e) == null || cmp.compare(e, s.higher(e)) < 0); equal(s.lower(e), prev); if (prev == null) { } else { check(cmp.compare(prev, e) < 0); } prev = e; } for (final Iterator it : its) { if (maybe(2)) check(! it.hasNext()); Fun fun = new Fun(){void f(){ it.next(); }}; THROWS(NoSuchElementException.class, fun, fun, fun); } } static void equalIterators(final Iterator it1, final Iterator it2) { while (it1.hasNext()) { if (maybe(2)) check(it2.hasNext()); equal(it1.next(), it2.next()); } check(! it2.hasNext()); } static void equalNavigableSetsLeaf(final NavigableSet s1, final NavigableSet s2) { equal2(s1, s2); equal( s1.size(), s2.size()); equal( s1.isEmpty(), s2.isEmpty()); equal( s1.hashCode(), s2.hashCode()); equal( s1.toString(), s2.toString()); if (! s1.isEmpty()) { equal(s1.first(), s2.first()); equal(s1.last(), s2.last()); } equalIterators(s1.iterator(), s2.iterator()); equalIterators(s1.descendingIterator(), s2.descendingIterator()); checkNavigableSet(s1); checkNavigableSet(s2); } static void equalNavigableSets(final NavigableSet s1, final NavigableSet s2) { equalNavigableSetsLeaf(s1, s2); equalNavigableSetsLeaf(s1.descendingSet(), s2.descendingSet()); equalNavigableSetsLeaf(s1.descendingSet().descendingSet(), s2); Object min = s1.isEmpty() ? Integer.MIN_VALUE : s1.first(); Object max = s2.isEmpty() ? Integer.MAX_VALUE : s2.last(); if (s1.comparator() != null && s1.comparator().compare(min, max) > 0) { Object tmp = min; min = max; max = tmp; } equalNavigableSetsLeaf(s1.subSet(min, true, max, true), s2.subSet(min, true, max, true)); equalNavigableSetsLeaf(s1.tailSet(min, true), s2.tailSet(min, true)); equalNavigableSetsLeaf(s1.headSet(max, true), s2.headSet(max, true)); equalNavigableSetsLeaf((NavigableSet) s1.subSet(min, max), (NavigableSet) s2.subSet(min, max)); equalNavigableSetsLeaf((NavigableSet) s1.tailSet(min), (NavigableSet) s2.tailSet(min)); equalNavigableSetsLeaf((NavigableSet) s1.headSet(max), (NavigableSet) s2.headSet(max)); } // Destined for a Collections.java near you? static T[] concat(T[]... arrays) { int len = 0; for (int i = 0; i < arrays.length; i++) len += arrays[i].length; T[] a = (T[])java.lang.reflect.Array .newInstance(arrays[0].getClass().getComponentType(), len); int k = 0; for (int i = 0; i < arrays.length; i++) { T[] array = arrays[i]; System.arraycopy(array, 0, a, k, array.length); k += array.length; } return a; } static void checkNavigableMap(final NavigableMap m) { if (m.comparator() == null) { check(m.descendingMap().descendingMap().comparator() == null); check(m.descendingKeySet().descendingSet().comparator() == null); } equal(m.isEmpty(), m.size() == 0); equal2(m, m.descendingMap()); if (maybe(4)) equal2(m, serialClone(m)); equal2(m.keySet(), m.descendingKeySet()); Comparator cmp = comparator(m); if (m.isEmpty()) { THROWS(NoSuchElementException.class, new Fun(){void f(){ m.firstKey(); }}, new Fun(){void f(){ m.lastKey(); }}); equal(null, m.firstEntry()); equal(null, m.lastEntry()); equal(null, m.pollFirstEntry()); equal(null, m.pollLastEntry()); equal(null, m.lowerKey(1)); equal(null, m.floorKey(1)); equal(null, m.ceilingKey(1)); equal(null, m.higherKey(1)); equal(null, m.lowerEntry(1)); equal(null, m.floorEntry(1)); equal(null, m.ceilingEntry(1)); equal(null, m.higherEntry(1)); } else { Object a = m.firstKey(); Object z = m.lastKey(); equal(m.lowerKey(a), null); equal(m.higherKey(z), null); equal(a, m.firstEntry().getKey()); equal(z, m.lastEntry().getKey()); equal2(m, m.tailMap(a)); equal2(m, m.headMap(z, true)); equal2(m, m.subMap(a, true, z, true)); testEmptyMap(m.subMap(a, true, a, false)); testEmptyMap(m.subMap(z, true, z, false)); testEmptyMap(m.headMap(a, false)); testEmptyMap(m.tailMap(z, false)); equal2(m.headMap(a, true), singletonMap(a, m.get(a))); equal2(m.tailMap(z, true), singletonMap(z, m.get(z))); } Iterator[] kits = new Iterator[] { m.keySet().iterator(), m.descendingMap().descendingKeySet().iterator(), m.descendingKeySet().descendingSet().iterator(), }; Iterator[] vits = new Iterator[] { m.values().iterator(), m.descendingMap().descendingMap().values().iterator(), }; Iterator[] eits = new Iterator[] { m.entrySet().iterator(), m.descendingMap().descendingMap().entrySet().iterator(), }; Iterator[] its = concat(kits, vits, eits); for (final Iterator it : its) if (maybe(4)) THROWS(IllegalStateException.class, new Fun(){void f(){ it.remove(); }}); Map.Entry prev = null; for (Map.Entry e : (Set) m.entrySet()) { Object k = e.getKey(); Object v = e.getValue(); check(m.containsKey(k)); check(m.containsValue(v)); for (Iterator kit : kits) equalNext(kit, k); for (Iterator vit : vits) equalNext(vit, v); for (Iterator eit : eits) equalNext(eit, e); equal(k, m.ceilingKey(k)); equal(k, m.ceilingEntry(k).getKey()); equal(k, m.floorKey(k)); equal(k, m.floorEntry(k).getKey()); check(m.higherKey(k) == null || cmp.compare(k, m.higherKey(k)) < 0); check(m.lowerKey(k) == null || cmp.compare(k, m.lowerKey(k)) > 0); equal(m.lowerEntry(k), prev); if (prev == null) { equal(m.lowerKey(k), null); } else { equal(m.lowerKey(k), prev.getKey()); check(cmp.compare(prev.getKey(), e.getKey()) < 0); } prev = e; } for (final Iterator it : its) { if (maybe(2)) check(! it.hasNext()); Fun fun = new Fun(){void f(){ it.next(); }}; THROWS(NoSuchElementException.class, fun, fun, fun); } } static void equalNavigableMapsLeaf(final NavigableMap m1, final NavigableMap m2) { equal2(m1, m2); equal( m1.size(), m2.size()); equal( m1.isEmpty(), m2.isEmpty()); equal( m1.hashCode(), m2.hashCode()); equal( m1.toString(), m2.toString()); equal2(m1.firstEntry(), m2.firstEntry()); equal2(m1.lastEntry(), m2.lastEntry()); checkNavigableMap(m1); checkNavigableMap(m2); } static void equalNavigableMaps(NavigableMap m1, NavigableMap m2) { equalNavigableMapsLeaf(m1, m2); equalNavigableSetsLeaf((NavigableSet) m1.keySet(), (NavigableSet) m2.keySet()); equalNavigableSets(m1.navigableKeySet(), m2.navigableKeySet()); equalNavigableSets(m1.descendingKeySet(), m2.descendingKeySet()); equal2(m1.entrySet(), m2.entrySet()); equalNavigableMapsLeaf(m1.descendingMap(), m2.descendingMap()); equalNavigableMapsLeaf(m1.descendingMap().descendingMap(), m2); equalNavigableSetsLeaf((NavigableSet) m1.descendingMap().keySet(), (NavigableSet) m2.descendingMap().keySet()); equalNavigableSetsLeaf(m1.descendingMap().descendingKeySet(), m2.descendingMap().descendingKeySet()); equal2(m1.descendingMap().entrySet(), m2.descendingMap().entrySet()); //---------------------------------------------------------------- // submaps //---------------------------------------------------------------- Object min = Integer.MIN_VALUE; Object max = Integer.MAX_VALUE; if (m1.comparator() != null && m1.comparator().compare(min, max) > 0) { Object tmp = min; min = max; max = tmp; } switch (rnd.nextInt(6)) { case 0: equalNavigableMapsLeaf(m1.subMap(min, true, max, true), m2.subMap(min, true, max, true)); break; case 1: equalNavigableMapsLeaf(m1.tailMap(min, true), m2.tailMap(min, true)); break; case 2: equalNavigableMapsLeaf(m1.headMap(max, true), m2.headMap(max, true)); break; case 3: equalNavigableMapsLeaf((NavigableMap) m1.subMap(min, max), (NavigableMap) m2.subMap(min, max)); break; case 4: equalNavigableMapsLeaf((NavigableMap) m1.tailMap(min), (NavigableMap) m2.tailMap(min)); break; case 5: equalNavigableMapsLeaf((NavigableMap) m1.headMap(max), (NavigableMap) m2.headMap(max)); break; } } abstract static class MapFrobber { abstract void frob(NavigableMap m); } abstract static class SetFrobber { abstract void frob(NavigableSet m); } static MapFrobber randomAdder(NavigableMap m) { final Integer k = unusedKey(m); final MapFrobber[] randomAdders = { new MapFrobber() {void frob(NavigableMap m) { equal(m.put(k, k+1), null); equal(m.get(k), k+1); if (maybe(4)) { equal(m.put(k, k+1), k+1); equal(m.get(k), k+1);}}}, new MapFrobber() {void frob(NavigableMap m) { m.descendingMap().put(k, k+1); equal(m.get(k), k+1);}}, new MapFrobber() {void frob(NavigableMap m) { m.tailMap(k,true).headMap(k,true).put(k,k+1);}}, new MapFrobber() {void frob(NavigableMap m) { m.tailMap(k,true).headMap(k,true).descendingMap().put(k,k+1);}} }; return new MapFrobber() {void frob(NavigableMap m) { randomAdders[rnd.nextInt(randomAdders.length)].frob(m); if (maybe(2)) equal(m.get(k), k+1); if (maybe(4)) { equal(m.put(k, k+1), k+1); equal(m.get(k), k+1);}}}; } static SetFrobber randomAdder(NavigableSet s) { final Integer e = unusedElt(s); final SetFrobber[] randomAdders = { new SetFrobber() {void frob(NavigableSet s) { check(s.add(e));}}, new SetFrobber() {void frob(NavigableSet s) { s.descendingSet().add(e);}}, new SetFrobber() {void frob(NavigableSet s) { s.tailSet(e,true).headSet(e,true).add(e);}}, new SetFrobber() {void frob(NavigableSet s) { s.descendingSet().tailSet(e,true).headSet(e,true).add(e);}} }; return new SetFrobber() {void frob(NavigableSet s) { if (maybe(2)) check(! s.contains(e)); randomAdders[rnd.nextInt(randomAdders.length)].frob(s); if (maybe(2)) check(! s.add(e)); if (maybe(2)) check(s.contains(e));}}; } static Integer unusedElt(NavigableSet s) { Integer e; do { e = rnd.nextInt(1024); } while (s.contains(e)); return e; } static Integer unusedKey(NavigableMap m) { Integer k; do { k = rnd.nextInt(1024); } while (m.containsKey(k)); return k; } static Integer usedKey(NavigableMap m) { Integer x = rnd.nextInt(1024); Integer floor = (Integer) m.floorKey(x); Integer ceiling = (Integer) m.ceilingKey(x); if (floor != null) return floor; check(ceiling != null); return ceiling; } static Integer usedElt(NavigableSet s) { Integer x = rnd.nextInt(1024); Integer floor = (Integer) s.floor(x); Integer ceiling = (Integer) s.ceiling(x); if (floor != null) return floor; check(ceiling != null); return ceiling; } static void checkUnusedKey(NavigableMap m, Object k) { check(! m.containsKey(k)); equal(m.get(k), null); if (maybe(2)) equal(m.remove(k), null); } static void checkUnusedElt(NavigableSet s, Object e) { if (maybe(2)) check(! s.contains(e)); if (maybe(2)) { check(s.ceiling(e) != e); check(s.floor(e) != e); } if (maybe(2)) check(! s.remove(e)); } static Fun remover(final Iterator it) { return new Fun(){void f(){ it.remove(); }}; } static MapFrobber randomRemover(NavigableMap m) { final Integer k = usedKey(m); final MapFrobber[] randomRemovers = { new MapFrobber() {void frob(NavigableMap m) { Map.Entry e = m.firstEntry(); equal(m.pollFirstEntry(), e); checkUnusedKey(m, e.getKey());}}, new MapFrobber() {void frob(NavigableMap m) { Map.Entry e = m.lastEntry(); equal(m.pollLastEntry(), e); checkUnusedKey(m, e.getKey());}}, new MapFrobber() {void frob(NavigableMap m) { check(m.remove(k) != null); checkUnusedKey(m, k);}}, new MapFrobber() {void frob(NavigableMap m) { m.subMap(k, true, k, true).clear(); checkUnusedKey(m, k);}}, new MapFrobber() {void frob(NavigableMap m) { m.descendingMap().subMap(k, true, k, true).clear(); checkUnusedKey(m, k);}}, new MapFrobber() {void frob(NavigableMap m) { final Iterator it = m.keySet().iterator(); while (it.hasNext()) if (it.next().equals(k)) { it.remove(); if (maybe(2)) THROWS(IllegalStateException.class, new Fun(){void f(){ it.remove(); }}); } checkUnusedKey(m, k);}}, new MapFrobber() {void frob(NavigableMap m) { final Iterator it = m.navigableKeySet().descendingIterator(); while (it.hasNext()) if (it.next().equals(k)) { it.remove(); if (maybe(2)) THROWS(IllegalStateException.class, new Fun(){void f(){ it.remove(); }}); } checkUnusedKey(m, k);}}, new MapFrobber() {void frob(NavigableMap m) { final Iterator it = m.entrySet().iterator(); while (it.hasNext()) if (it.next().getKey().equals(k)) { it.remove(); if (maybe(2)) THROWS(IllegalStateException.class, remover(it)); } checkUnusedKey(m, k);}}, }; return randomRemovers[rnd.nextInt(randomRemovers.length)]; } static SetFrobber randomRemover(NavigableSet s) { final Integer e = usedElt(s); final SetFrobber[] randomRemovers = { new SetFrobber() {void frob(NavigableSet s) { Object e = s.first(); equal(s.pollFirst(), e); checkUnusedElt(s, e);}}, new SetFrobber() {void frob(NavigableSet s) { Object e = s.last(); equal(s.pollLast(), e); checkUnusedElt(s, e);}}, new SetFrobber() {void frob(NavigableSet s) { check(s.remove(e)); checkUnusedElt(s, e);}}, new SetFrobber() {void frob(NavigableSet s) { s.subSet(e, true, e, true).clear(); checkUnusedElt(s, e);}}, new SetFrobber() {void frob(NavigableSet s) { s.descendingSet().subSet(e, true, e, true).clear(); checkUnusedElt(s, e);}}, new SetFrobber() {void frob(NavigableSet s) { final Iterator it = s.iterator(); while (it.hasNext()) if (it.next().equals(e)) { it.remove(); if (maybe(2)) THROWS(IllegalStateException.class, new Fun(){void f(){ it.remove(); }}); } checkUnusedElt(s, e);}}, new SetFrobber() {void frob(NavigableSet s) { final Iterator it = s.descendingSet().iterator(); while (it.hasNext()) if (it.next().equals(e)) { it.remove(); if (maybe(2)) THROWS(IllegalStateException.class, new Fun(){void f(){ it.remove(); }}); } checkUnusedElt(s, e);}}, new SetFrobber() {void frob(NavigableSet s) { final Iterator it = s.descendingIterator(); while (it.hasNext()) if (it.next().equals(e)) { it.remove(); if (maybe(2)) THROWS(IllegalStateException.class, new Fun(){void f(){ it.remove(); }}); } checkUnusedElt(s, e);}} }; return randomRemovers[rnd.nextInt(randomRemovers.length)]; } static void lockStep(NavigableMap m1, NavigableMap m2) { if (! (thorough || maybe(3))) return; if (maybe(4)) m1 = serialClone(m1); if (maybe(4)) m2 = serialClone(m2); List maps = Arrays.asList(m1, m2); for (NavigableMap m : maps) testEmptyMap(m); final Set ints = new HashSet(); while (ints.size() < size) ints.add(rnd.nextInt(1024)); final Integer[] elts = ints.toArray(new Integer[size]); for (int i = 0; i < size; i++) { MapFrobber adder = randomAdder(m1); for (final NavigableMap m : maps) { adder.frob(m); equal(m.size(), i+1); } equalNavigableMaps(m1, m2); } for (final NavigableMap m : maps) { final Object e = usedKey(m); THROWS(IllegalArgumentException.class, new Fun(){void f(){m.subMap(e,true,e,false) .subMap(e,true,e,true);}}, new Fun(){void f(){m.subMap(e,false,e,true) .subMap(e,true,e,true);}}, new Fun(){void f(){m.tailMap(e,false).tailMap(e,true);}}, new Fun(){void f(){m.headMap(e,false).headMap(e,true);}}); } //System.out.printf("%s%n", m1); for (int i = size; i > 0; i--) { MapFrobber remover = randomRemover(m1); for (final NavigableMap m : maps) { remover.frob(m); equal(m.size(), i-1); } equalNavigableMaps(m1, m2); } for (NavigableMap m : maps) testEmptyMap(m); } static void lockStep(NavigableSet s1, NavigableSet s2) { if (! (thorough || maybe(3))) return; if (maybe(4)) s1 = serialClone(s1); if (maybe(4)) s2 = serialClone(s2); List sets = Arrays.asList(s1, s2); for (NavigableSet s : sets) testEmptySet(s); final Set ints = new HashSet(); while (ints.size() < size) ints.add(rnd.nextInt(1024)); final Integer[] elts = ints.toArray(new Integer[size]); for (int i = 0; i < size; i++) { SetFrobber adder = randomAdder(s1); for (final NavigableSet s : sets) { adder.frob(s); equal(s.size(), i+1); } equalNavigableSets(s1, s2); } for (final NavigableSet s : sets) { final Object e = usedElt(s); THROWS(IllegalArgumentException.class, new Fun(){void f(){s.subSet(e,true,e,false) .subSet(e,true,e,true);}}, new Fun(){void f(){s.subSet(e,false,e,true) .subSet(e,true,e,true);}}, new Fun(){void f(){s.tailSet(e,false).tailSet(e,true);}}, new Fun(){void f(){s.headSet(e,false).headSet(e,true);}}); } //System.out.printf("%s%n", s1); for (int i = size; i > 0; i--) { SetFrobber remover = randomRemover(s1); for (final NavigableSet s : sets) { remover.frob(s); equal(s.size(), i-1); } equalNavigableSets(s1, s2); } for (NavigableSet s : sets) testEmptySet(s); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() { passed++; } static void fail() { failed++; Thread.dumpStack(); } static void fail(String msg) { System.out.println(msg); fail(); } static void unexpected(Throwable t) { failed++; t.printStackTrace(); } static void check(boolean cond) { if (cond) pass(); else fail(); } static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else {System.out.println(x + " not equal to " + y); fail();}} static void equal2(Object x, Object y) {equal(x, y); equal(y, x);} public static void main(String[] args) throws Throwable { try { realMain(args); } catch (Throwable t) { unexpected(t); } System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Exception("Some tests failed"); } abstract static class Fun {abstract void f() throws Throwable;} static void THROWS(Class k, Fun... fs) { for (Fun f : fs) try { f.f(); fail("Expected " + k.getName() + " not thrown"); } catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} static byte[] serializedForm(Object obj) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); new ObjectOutputStream(baos).writeObject(obj); return baos.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); }} static Object readObject(byte[] bytes) throws IOException, ClassNotFoundException { InputStream is = new ByteArrayInputStream(bytes); return new ObjectInputStream(is).readObject();} @SuppressWarnings("unchecked") static T serialClone(T obj) { try { return (T) readObject(serializedForm(obj)); } catch (Exception e) { throw new RuntimeException(e); }} } jsr166/src/test/jtreg/util/Hashtable/0000755000000000000000000000000011652013243014525 5ustar jsr166/src/test/jtreg/util/Hashtable/IllegalLoadFactor.java0000644000000000000000000001115711456346034020716 0ustar /* * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* @test @bug 4093817 4189594 @summary Test for an illegalargumentexception on loadFactor */ import java.util.*; /** * This class tests to see if creating a hash table with an * illegal value of loadFactor results in an IllegalArgumentException */ public class IllegalLoadFactor { public static void main(String argv[]) throws Exception { boolean testSucceeded = false; try { // this should generate an IllegalArgumentException Hashtable bad1 = new Hashtable(100, -3); } catch (IllegalArgumentException e1) { testSucceeded = true; } if (!testSucceeded) throw new Exception("Hashtable, negative load factor"); testSucceeded = false; try { // this should generate an IllegalArgumentException Hashtable bad1 = new Hashtable(100, Float.NaN); } catch (IllegalArgumentException e1) { testSucceeded = true; } if (!testSucceeded) throw new Exception("Hashtable, NaN load factor"); testSucceeded = false; try { // this should generate an IllegalArgumentException HashMap bad1 = new HashMap(100, -3); } catch (IllegalArgumentException e1) { testSucceeded = true; } if (!testSucceeded) throw new Exception("HashMap, negative load factor"); testSucceeded = false; try { // this should generate an IllegalArgumentException HashMap bad1 = new HashMap(100, Float.NaN); } catch (IllegalArgumentException e1) { testSucceeded = true; } if (!testSucceeded) throw new Exception("HashMap, NaN load factor"); testSucceeded = false; try { // this should generate an IllegalArgumentException HashSet bad1 = new HashSet(100, -3); } catch (IllegalArgumentException e1) { testSucceeded = true; } if (!testSucceeded) throw new Exception("HashSet, negative load factor"); testSucceeded = false; try { // this should generate an IllegalArgumentException HashSet bad1 = new HashSet(100, Float.NaN); } catch (IllegalArgumentException e1) { testSucceeded = true; } if (!testSucceeded) throw new Exception("HashSet, NaN load factor"); testSucceeded = false; try { // this should generate an IllegalArgumentException WeakHashMap bad1 = new WeakHashMap(100, -3); } catch (IllegalArgumentException e1) { testSucceeded = true; } if (!testSucceeded) throw new Exception("WeakHashMap, negative load factor"); testSucceeded = false; try { // this should generate an IllegalArgumentException WeakHashMap bad1 = new WeakHashMap(100, Float.NaN); } catch (IllegalArgumentException e1) { testSucceeded = true; } if (!testSucceeded) throw new Exception("WeakHashMap, NaN load factor"); // Make sure that legal creates don't throw exceptions Map goodMap = new Hashtable(100, .69f); goodMap = new HashMap(100, .69f); Set goodSet = new HashSet(100, .69f); goodMap = new WeakHashMap(100, .69f); } } jsr166/src/test/jtreg/util/Hashtable/SelfRef.java0000644000000000000000000000400211441006143016707 0ustar /* * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4421469 6282555 * @summary Hashtable's toString method should detect self-referential * hash tables rather than throwing a StackOverflowException. * @author Josh Bloch, Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class SelfRef { public static void main(String[] args) { testMap(new Hashtable()); testMap(new HashMap()); testMap(new LinkedHashMap()); testMap(new ConcurrentHashMap()); } private static void testMap(Map m) { if (! (m.toString().equals("{}"))) throw new Error(); m.put("Harvey", m); if (! (m.toString().equals("{Harvey=(this Map)}"))) throw new Error(); m.clear(); m.put(m, "Harvey"); if (! (m.toString().equals("{(this Map)=Harvey}"))) throw new Error(); m.clear(); m.hashCode(); } } jsr166/src/test/jtreg/util/Hashtable/ReadObject.java0000644000000000000000000000674611441006143017404 0ustar /* * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4652911 * @summary test Hashtable readObject for invocation of overridable put method */ import java.util.Hashtable; import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import java.io.ByteArrayInputStream; import java.io.ObjectInputStream; import java.io.Serializable; /** * Class that extends Hashtable to demonstrate bug when * subclass wraps the values put into the Hashtable. */ public class ReadObject extends Hashtable { /** * Wraps the values put into MyHashtable objects */ class ValueWrapper implements Serializable { private Object mValue; ValueWrapper(Object value) { mValue = value; } Object getValue() { return mValue; } }; public Object get(Object key) { ValueWrapper valueWrapper = (ValueWrapper)super.get(key); Object value = valueWrapper.getValue(); if (value instanceof ValueWrapper) throw new RuntimeException("Hashtable.get bug"); return value; } public Object put(Object key, Object value) { if (value instanceof ValueWrapper) throw new RuntimeException( "Hashtable.put bug: value is already wrapped"); ValueWrapper valueWrapper = new ValueWrapper(value); super.put(key, valueWrapper); return value; } private static Object copyObject(Object oldObj) { Object newObj = null; try { //Create a stream in which to serialize the object. ByteArrayOutputStream ostream = new ByteArrayOutputStream(); ObjectOutputStream p = new ObjectOutputStream(ostream); //Serialize the object into the stream p.writeObject(oldObj); //Create an input stream from which to deserialize the object byte[] byteArray = ostream.toByteArray(); ByteArrayInputStream istream = new ByteArrayInputStream(byteArray); ObjectInputStream q = new ObjectInputStream(istream); //Deserialize the object newObj = q.readObject(); } catch (Exception ex) { ex.printStackTrace(); } return newObj; } public static void main(String[] args) { ReadObject myHashtable = new ReadObject(); myHashtable.put("key", "value"); ReadObject myHashtableCopy = (ReadObject)copyObject(myHashtable); String value = (String)myHashtableCopy.get("key"); } }; jsr166/src/test/jtreg/util/Hashtable/HashCode.java0000644000000000000000000000307711441006143017052 0ustar /* * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4559052 * @summary Hashtable's hashCode method always returns zero(!) * @author Josh Bloch */ import java.util.*; public class HashCode { public static void main(String[] args) throws Exception { Map m = new Hashtable(); if (m.hashCode() != 0) throw new Exception("Empty Hashtable has nonzero hashCode."); m.put("Joe", "Blow"); if (m.hashCode() != ("Joe".hashCode() ^ "Blow".hashCode())) throw new Exception("Non-empty Hashtable has wrong hashCode."); } } jsr166/src/test/jtreg/util/Hashtable/EqualsCast.java0000644000000000000000000000353711441006143017442 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4208530 * @summary Hashtable was less robust to extension that it could have been * because the equals and Hashcode methods used internals * unnecessarily. (java.security.Provider tickled this sensitivity.) */ import java.util.*; import java.security.Provider; public class EqualsCast { public static void main(String[] args) throws Exception { Map m1 = new MyProvider("foo", 69, "baz"); Map m2 = new MyProvider("foo", 69, "baz"); m1.equals(m2); } } class MyProvider extends Provider { private String name; public MyProvider(String name, double version, String info) { super(name, version, info); this.name = name; put("Signature.sigalg", "sigimpl"); } public String getName() { return this.name; } } jsr166/src/test/jtreg/util/LinkedList/0000755000000000000000000000000011652013243014674 5ustar jsr166/src/test/jtreg/util/LinkedList/AddAll.java0000644000000000000000000000310111441006144016651 0ustar /* * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4163207 * @summary AddAll was prepending instead of appending! */ import java.util.*; public class AddAll { public static void main(String[] args) throws Exception { List head = Collections.nCopies(7, "deadly sin"); List tail = Collections.nCopies(4, "basic food group"); List l1 = new ArrayList(head); List l2 = new LinkedList(head); l1.addAll(tail); l2.addAll(tail); if (!l1.equals(l2)) throw new RuntimeException("addAll is broken."); } } jsr166/src/test/jtreg/util/LinkedList/ComodifiedRemove.java0000644000000000000000000000355711456346034021002 0ustar /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4308549 * @summary Due to a bug in LinkedList's ListIterator's remove(), * the ListIterator would not check for comodification before remove. * @author Konstantin Kladko */ import java.util.*; import java.util.ListIterator; import java.util.ConcurrentModificationException; public class ComodifiedRemove { public static void main(String[] args) { List list = new LinkedList(); Object o1 = new Integer(1); list.add(o1); ListIterator e = list.listIterator(); e.next(); Object o2 = new Integer(2); list.add(o2); try { e.remove(); } catch (ConcurrentModificationException cme) { return; } throw new RuntimeException( "LinkedList ListIterator.remove() comodification check failed."); } } jsr166/src/test/jtreg/util/LinkedList/Remove.java0000644000000000000000000000326411441006144016777 0ustar /* * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4147946 * @summary Due to a bug in LinkedList's ListIterator's remove() logic, the List would * get screwed up by a remove() following a previous(). */ import java.util.LinkedList; import java.util.ListIterator; public class Remove { public static void main(String[] args) { LinkedList list = new LinkedList(); ListIterator e = list.listIterator(); Object o = new Integer(1); e.add(o); e.previous(); e.next(); e.remove(); e.add(o); if (!o.equals(list.get(0))) throw new RuntimeException("LinkedList ListIterator remove failed."); } } jsr166/src/test/jtreg/util/LinkedList/Clone.java0000644000000000000000000000633511441006144016604 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4216997 * @summary Cloning a subclass of LinkedList results in an object that isn't * an instance of the subclass. The same applies to TreeSet and * TreeMap. */ import java.util.*; public class Clone { public static void main(String[] args) { LinkedList2 l = new LinkedList2(); LinkedList2 lClone = (LinkedList2) l.clone(); if (!(l.equals(lClone) && lClone.equals(l))) throw new RuntimeException("LinkedList.clone() is broken 1."); l.add("a"); lClone = (LinkedList2) l.clone(); if (!(l.equals(lClone) && lClone.equals(l))) throw new RuntimeException("LinkedList.clone() is broken 2."); l.add("b"); lClone = (LinkedList2) l.clone(); if (!(l.equals(lClone) && lClone.equals(l))) throw new RuntimeException("LinkedList.clone() is broken 2."); TreeSet2 s = new TreeSet2(); TreeSet2 sClone = (TreeSet2) s.clone(); if (!(s.equals(sClone) && sClone.equals(s))) throw new RuntimeException("TreeSet.clone() is broken."); s.add("a"); sClone = (TreeSet2) s.clone(); if (!(s.equals(sClone) && sClone.equals(s))) throw new RuntimeException("TreeSet.clone() is broken."); s.add("b"); sClone = (TreeSet2) s.clone(); if (!(s.equals(sClone) && sClone.equals(s))) throw new RuntimeException("TreeSet.clone() is broken."); TreeMap2 m = new TreeMap2(); TreeMap2 mClone = (TreeMap2) m.clone(); if (!(m.equals(mClone) && mClone.equals(m))) throw new RuntimeException("TreeMap.clone() is broken."); m.put("a", "b"); mClone = (TreeMap2) m.clone(); if (!(m.equals(mClone) && mClone.equals(m))) throw new RuntimeException("TreeMap.clone() is broken."); m.put("c", "d"); mClone = (TreeMap2) m.clone(); if (!(m.equals(mClone) && mClone.equals(m))) throw new RuntimeException("TreeMap.clone() is broken."); } private static class LinkedList2 extends LinkedList {}; private static class TreeSet2 extends TreeSet {}; private static class TreeMap2 extends TreeMap {}; } jsr166/src/test/jtreg/util/Vector/0000755000000000000000000000000011652013243014074 5ustar jsr166/src/test/jtreg/util/Vector/LastIndexOf.java0000644000000000000000000000277611456346034017144 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* @test @bug 4271588 @summary Vector.lastIndex(Object, int) used to let you look outside the valid range in the backing array */ import java.util.*; public class LastIndexOf { public static void main(String argv[]) throws Exception { Vector v = new Vector(10); try { int i = v.lastIndexOf(null, 5); throw new Exception("lastIndexOf(5/10) " + i); } catch (IndexOutOfBoundsException e) { } } } jsr166/src/test/jtreg/util/Vector/CopyInto.java0000644000000000000000000000472311441006144016507 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4936876 * @summary Vector.copyInto should throw ArrayStoreException * @author Martin Buchholz */ import java.io.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; public class CopyInto { private static void realMain(String[] args) throws Throwable { try { Vector v = new Vector(); v.add("foo"); v.copyInto(new Integer[3]); fail("Expected ArrayStoreException"); } catch (ArrayStoreException e) { pass(); } catch (Throwable t) { unexpected(t); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/Vector/ComodifiedRemoveAllElements.java0000644000000000000000000000326511456346034022324 0ustar /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4298133 * @summary Due to a bug in Vector's removeAllElements(), * the modification counter would not get incremented. * @author Konstantin Kladko */ import java.util.*; public class ComodifiedRemoveAllElements { public static void main(String[] args) { Vector v = new Vector(); v.addElement(null); Iterator it = v.iterator(); v.removeAllElements(); try { it.next(); } catch (ConcurrentModificationException cme) { return; } throw new RuntimeException( "Vector.RemoveAllElements() modCount increment failed."); } } jsr166/src/test/jtreg/util/Vector/IllegalConstructorArgs.java0000644000000000000000000000344211456346034021407 0ustar /* * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4061897 * @summary Test for illegal argument exception */ import java.util.*; /** * This is a simple test class created to check for * an exception when a new Vector is constructed with * illegal arguments */ public class IllegalConstructorArgs { public static void main(String argv[]) { int testSucceeded=0; try { // this should generate an IllegalArgumentException Vector bad1 = new Vector(-100, 10); } catch (IllegalArgumentException e1) { testSucceeded =1; } catch (NegativeArraySizeException e2) { testSucceeded =0; } if (testSucceeded == 0) throw new RuntimeException("Wrong exception thrown."); } } jsr166/src/test/jtreg/util/Vector/SyncLastIndexOf.java0000644000000000000000000000361611444312631017764 0ustar /* * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4334376 * @summary Vector's lastIndexOf(Object) was lacking synchronization * @author Konstantin Kladko */ import java.util.*; public class SyncLastIndexOf { static Vector v = new Vector(); static class RemovingThread extends Thread { public void run() { synchronized (v) { try { sleep(200); } catch (InterruptedException e) { } v.removeElementAt(0); } } } public static void main(String args[]) { Integer x = new Integer(1); v.addElement(x); new RemovingThread().start(); try { v.lastIndexOf(x); } catch (IndexOutOfBoundsException e) { throw new RuntimeException( "Vector.lastIndexOf() synchronization failed."); } } } jsr166/src/test/jtreg/util/HashMap/0000755000000000000000000000000011652013243014153 5ustar jsr166/src/test/jtreg/util/HashMap/SetValue.java0000644000000000000000000000325411441006143016547 0ustar /* * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4627516 * @summary HashMap.Entry.setValue() returns new value (as opposed to old) * @author jbloch */ import java.util.*; public class SetValue { static final String key = "key"; static final String oldValue = "old"; static final String newValue = "new"; public static void main(String args[]) throws Exception { Map m = new HashMap(); m.put(key, oldValue); Map.Entry e = (Map.Entry) m.entrySet().iterator().next(); Object returnVal = e.setValue(newValue); if (!returnVal.equals(oldValue)) throw new RuntimeException("Return value: " + returnVal); } } jsr166/src/test/jtreg/util/HashMap/ToString.java0000644000000000000000000000262611441006143016572 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4189821 * @summary HashMap's entry.toString threw a null pointer exc if the HashMap * contained null keys or values. */ import java.util.*; public class ToString { public static void main(String[] args) throws Exception { Map m = new HashMap(); m.put(null, null); m.entrySet().iterator().next().toString(); } } jsr166/src/test/jtreg/util/HashMap/KeySetRemove.java0000644000000000000000000000307211441006143017377 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4286765 * @summary HashMap and TreeMap entrySet().remove(k) spuriously returned * false if the Map previously mapped k to null. */ import java.util.*; public class KeySetRemove { public static void main(String args[]) throws Exception { Map m[] = {new HashMap(), new TreeMap()}; for (int i=0; i()); testMap(new HashMap()); testMap(new IdentityHashMap()); testMap(new LinkedHashMap()); testMap(new ConcurrentHashMap()); testMap(new WeakHashMap()); testMap(new TreeMap()); testMap(new ConcurrentSkipListMap()); } private static void put(Map m, Character key, Boolean value, Boolean oldValue) { if (oldValue != null) { check(m.containsValue(oldValue)); check(m.values().contains(oldValue)); } equal(m.put(key, value), oldValue); equal(m.get(key), value); check(m.containsKey(key)); check(m.keySet().contains(key)); check(m.containsValue(value)); check(m.values().contains(value)); check(! m.isEmpty()); } private static void testMap(Map m) { // We verify following assertions in get(Object) method javadocs boolean permitsNullKeys = (! (m instanceof ConcurrentMap || m instanceof Hashtable || m instanceof SortedMap)); boolean permitsNullValues = (! (m instanceof ConcurrentMap || m instanceof Hashtable)); boolean usesIdentity = m instanceof IdentityHashMap; System.out.println(m.getClass()); put(m, 'A', true, null); put(m, 'A', false, true); // Guaranteed identical by JLS put(m, 'B', true, null); put(m, new Character('A'), false, usesIdentity ? null : false); if (permitsNullKeys) { try { put(m, null, true, null); put(m, null, false, true); } catch (Throwable t) { unexpected(t); } } else { try { m.get(null); fail(); } catch (NullPointerException e) {} catch (Throwable t) { unexpected(t); } try { m.put(null, true); fail(); } catch (NullPointerException e) {} catch (Throwable t) { unexpected(t); } } if (permitsNullValues) { try { put(m, 'C', null, null); put(m, 'C', true, null); put(m, 'C', null, true); } catch (Throwable t) { unexpected(t); } } else { try { m.put('A', null); fail(); } catch (NullPointerException e) {} catch (Throwable t) { unexpected(t); } try { m.put('C', null); fail(); } catch (NullPointerException e) {} catch (Throwable t) { unexpected(t); } } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() { passed++; } static void fail() { failed++; Thread.dumpStack(); } static void fail(String msg) { System.out.println(msg); fail(); } static void unexpected(Throwable t) { failed++; t.printStackTrace(); } static void check(boolean cond) { if (cond) pass(); else fail(); } static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else {System.out.println(x + " not equal to " + y); fail(); }} public static void main(String[] args) throws Throwable { try { realMain(args); } catch (Throwable t) { unexpected(t); } System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Exception("Some tests failed"); } } jsr166/src/test/jtreg/util/Map/LockStep.java0000644000000000000000000001053511441006144015740 0ustar /* * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6612102 * @summary Test Map implementations for mutual compatibility */ import java.util.*; import java.util.concurrent.*; /** * Based on the strange scenario required to reproduce * (coll) IdentityHashMap.iterator().remove() might decrement size twice * * It would be good to add more "Lockstep-style" tests to this file. */ public class LockStep { void mapsEqual(Map m1, Map m2) { equal(m1, m2); equal(m2, m1); equal(m1.size(), m2.size()); equal(m1.isEmpty(), m2.isEmpty()); equal(m1.keySet(), m2.keySet()); equal(m2.keySet(), m1.keySet()); } void mapsEqual(List maps) { Map first = maps.get(0); for (Map map : maps) mapsEqual(first, map); } void put(List maps, Object key, Object val) { for (Map map : maps) map.put(key, val); mapsEqual(maps); } void removeLastTwo(List maps) { Map first = maps.get(0); int size = first.size(); Iterator fit = first.keySet().iterator(); for (int j = 0; j < size - 2; j++) fit.next(); Object x1 = fit.next(); Object x2 = fit.next(); for (Map map : maps) { Iterator it = map.keySet().iterator(); while (it.hasNext()) { Object x = it.next(); if (x == x1 || x == x2) it.remove(); } } mapsEqual(maps); } void remove(Map m, Iterator it) { int size = m.size(); it.remove(); if (m.size() != size-1) throw new Error(String.format("Incorrect size!%nmap=%s, size=%d%n", m.toString(), m.size())); } void test(String[] args) throws Throwable { final int iterations = 100; final Random r = new Random(); for (int i = 0; i < iterations; i++) { List maps = Arrays.asList( new Map[] { new IdentityHashMap(11), new HashMap(16), new LinkedHashMap(16), new WeakHashMap(16), new Hashtable(16), new TreeMap(), new ConcurrentHashMap(16), new ConcurrentSkipListMap() }); for (int j = 0; j < 10; j++) put(maps, r.nextInt(100), r.nextInt(100)); removeLastTwo(maps); } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new LockStep().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/AbstractCollection/0000755000000000000000000000000011652013242016410 5ustar jsr166/src/test/jtreg/util/AbstractCollection/ToString.java0000644000000000000000000000615311441006143021027 0ustar /* * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4486049 6282555 6318622 * @summary toString method fails if size changes in between a call to size * and an attempt to iterate. * @author Josh Bloch, Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class ToString { private static void realMain(String[] args) { testCollection(new LinkedHashSet() { public int size() { return super.size() + 1; // Lies, lies, all lies! }}); testCollection(new ArrayList()); testCollection(new Vector()); testCollection(new CopyOnWriteArrayList()); testCollection(new CopyOnWriteArraySet()); } private static void testCollection(Collection c) { System.out.println(c.getClass()); equal(c.toString(), "[]"); check(c.add("x")); equal(c.toString(), "[x]"); check(c.add("y")); equal(c.toString(), "[x, y]"); check(c.add(null)); equal(c.toString(), "[x, y, null]"); if (c instanceof AbstractCollection) { check(c.add(c)); equal(c.toString(), "[x, y, null, (this Collection)]"); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() { passed++; } static void fail() { failed++; Thread.dumpStack(); } static void fail(String msg) { System.out.println(msg); fail(); } static void unexpected(Throwable t) { failed++; t.printStackTrace(); } static void check(boolean cond) { if (cond) pass(); else fail(); } static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else {System.out.println(x + " not equal to " + y); fail(); }} public static void main(String[] args) throws Throwable { try { realMain(args); } catch (Throwable t) { unexpected(t); } System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Exception("Some tests failed"); } } jsr166/src/test/jtreg/util/concurrent/0000755000000000000000000000000011652013243015014 5ustar jsr166/src/test/jtreg/util/concurrent/ExecutorService/0000755000000000000000000000000011652013243020133 5ustar jsr166/src/test/jtreg/util/concurrent/ExecutorService/Invoke.java0000644000000000000000000000604111441006144022230 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6267833 * @summary Tests for invokeAny, invokeAll * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; public class Invoke { static volatile int passed = 0, failed = 0; static void fail(String msg) { failed++; new AssertionError(msg).printStackTrace(); } static void pass() { passed++; } static void unexpected(Throwable t) { failed++; t.printStackTrace(); } static void check(boolean condition, String msg) { if (condition) pass(); else fail(msg); } static void check(boolean condition) { check(condition, "Assertion failure"); } public static void main(String[] args) { try { final AtomicLong count = new AtomicLong(0); ExecutorService fixed = Executors.newFixedThreadPool(5); class Inc implements Callable { public Long call() throws Exception { Thread.sleep(200); // Catch IE from possible cancel return count.incrementAndGet(); } } List tasks = Arrays.asList(new Inc(), new Inc(), new Inc()); List> futures = fixed.invokeAll(tasks); check(futures.size() == tasks.size()); check(count.get() == tasks.size()); long gauss = 0; for (Future future : futures) gauss += future.get(); check(gauss == ((tasks.size()+1)*tasks.size())/2); ExecutorService single = Executors.newSingleThreadExecutor(); long save = count.get(); check(single.invokeAny(tasks) == save + 1); check(count.get() == save + 1); fixed.shutdown(); single.shutdown(); } catch (Throwable t) { unexpected(t); } System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Error("Some tests failed"); } } jsr166/src/test/jtreg/util/concurrent/Phaser/0000755000000000000000000000000011652013243016236 5ustar jsr166/src/test/jtreg/util/concurrent/Phaser/TieredArriveLoops.java0000644000000000000000000000612411537741070022516 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @summary stress test for arrivals in a tiered phaser * @run main TieredArriveLoops 300 */ import java.util.*; import java.util.concurrent.*; public class TieredArriveLoops { final long testDurationMillisDefault = 10L * 1000L; final long testDurationMillis; final long quittingTimeNanos; TieredArriveLoops(String[] args) { testDurationMillis = (args.length > 0) ? Long.valueOf(args[0]) : testDurationMillisDefault; quittingTimeNanos = System.nanoTime() + testDurationMillis * 1000L * 1000L; } Runnable runner(final Phaser p) { return new CheckedRunnable() { public void realRun() { int prevPhase = p.register(); while (!p.isTerminated()) { int phase = p.awaitAdvance(p.arrive()); if (phase < 0) return; equal(phase, (prevPhase + 1) & Integer.MAX_VALUE); int ph = p.getPhase(); check(ph < 0 || ph == phase); prevPhase = phase; } }}; } void test(String[] args) throws Throwable { final Phaser parent = new Phaser(); final Phaser child1 = new Phaser(parent); final Phaser child2 = new Phaser(parent); Thread t1 = new Thread(runner(child1)); Thread t2 = new Thread(runner(child2)); t1.start(); t2.start(); for (int prevPhase = 0, phase; ; prevPhase = phase) { phase = child2.getPhase(); check(phase >= prevPhase); if (System.nanoTime() - quittingTimeNanos > 0) { System.err.printf("phase=%d%n", phase); child1.forceTermination(); break; } } t1.join(); t2.join(); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new TieredArriveLoops(args).instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class CheckedRunnable implements Runnable { protected abstract void realRun() throws Throwable; public final void run() { try {realRun();} catch (Throwable t) {unexpected(t);} } } } jsr166/src/test/jtreg/util/concurrent/Phaser/Arrive.java0000644000000000000000000000503411537741070020343 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6445158 * @summary tests for Phaser.arrive() */ import java.util.ArrayList; import java.util.List; import java.util.concurrent.Phaser; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicInteger; public class Arrive { void test(String[] args) throws Throwable { final int n = ThreadLocalRandom.current().nextInt(1, 10); final int nthreads = n*3/2; final Phaser startingGate = new Phaser(nthreads); final Phaser phaser = new Phaser(n); final List threads = new ArrayList(); final AtomicInteger count0 = new AtomicInteger(0); final AtomicInteger count1 = new AtomicInteger(0); final Runnable task = new Runnable() { public void run() { equal(startingGate.getPhase(), 0); startingGate.arriveAndAwaitAdvance(); equal(startingGate.getPhase(), 1); int phase = phaser.arrive(); if (phase == 0) count0.getAndIncrement(); else if (phase == 1) count1.getAndIncrement(); else fail(); }}; for (int i = 0; i < nthreads; i++) threads.add(new Thread(task)); for (Thread thread : threads) thread.start(); for (Thread thread : threads) thread.join(); equal(count0.get(), n); equal(count1.get(), nthreads-n); equal(phaser.getPhase(), 1); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new Arrive().instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/Phaser/PhaseOverflow.java0000644000000000000000000001137211537741070021701 0ustar /* * Written by Martin Buchholz and Doug Lea with assistance from * members of JCP JSR-166 Expert Group and released to the public * domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @summary Test Phaser phase integer overflow behavior */ import java.util.concurrent.Phaser; import java.lang.reflect.Field; public class PhaseOverflow { Field stateField; void checkState(Phaser phaser, int phase, int parties, int unarrived) { equal(phase, phaser.getPhase()); equal(parties, phaser.getRegisteredParties()); equal(unarrived, phaser.getUnarrivedParties()); } void test(String[] args) throws Throwable { stateField = Phaser.class.getDeclaredField("state"); stateField.setAccessible(true); testLeaf(); testTiered(); } void testLeaf() throws Throwable { Phaser phaser = new Phaser(); // this is extremely dependent on internal representation stateField.setLong(phaser, ((Integer.MAX_VALUE - 1L) << 32) | 1L); checkState(phaser, Integer.MAX_VALUE - 1, 0, 0); phaser.register(); checkState(phaser, Integer.MAX_VALUE - 1, 1, 1); phaser.arrive(); checkState(phaser, Integer.MAX_VALUE, 1, 1); phaser.arrive(); checkState(phaser, 0, 1, 1); phaser.arrive(); checkState(phaser, 1, 1, 1); } int phaseInc(int phase) { return (phase + 1) & Integer.MAX_VALUE; } void testTiered() throws Throwable { Phaser root = new Phaser(); // this is extremely dependent on internal representation stateField.setLong(root, ((Integer.MAX_VALUE - 1L) << 32) | 1L); checkState(root, Integer.MAX_VALUE - 1, 0, 0); Phaser p1 = new Phaser(root, 1); checkState(root, Integer.MAX_VALUE - 1, 1, 1); checkState(p1, Integer.MAX_VALUE - 1, 1, 1); Phaser p2 = new Phaser(root, 2); checkState(root, Integer.MAX_VALUE - 1, 2, 2); checkState(p2, Integer.MAX_VALUE - 1, 2, 2); int ph = Integer.MAX_VALUE - 1; for (int k = 0; k < 5; k++) { checkState(root, ph, 2, 2); checkState(p1, ph, 1, 1); checkState(p2, ph, 2, 2); p1.arrive(); checkState(root, ph, 2, 1); checkState(p1, ph, 1, 0); checkState(p2, ph, 2, 2); p2.arrive(); checkState(root, ph, 2, 1); checkState(p1, ph, 1, 0); checkState(p2, ph, 2, 1); p2.arrive(); ph = phaseInc(ph); checkState(root, ph, 2, 2); checkState(p1, ph, 1, 1); checkState(p2, ph, 2, 2); } equal(3, ph); } void xtestTiered() throws Throwable { Phaser root = new Phaser(); stateField.setLong(root, ((Integer.MAX_VALUE - 1L) << 32) | 1L); checkState(root, Integer.MAX_VALUE - 1, 0, 0); Phaser p1 = new Phaser(root, 1); checkState(root, Integer.MAX_VALUE - 1, 1, 1); checkState(p1, Integer.MAX_VALUE - 1, 1, 1); Phaser p2 = new Phaser(root, 2); checkState(root, Integer.MAX_VALUE - 1, 2, 2); checkState(p2, Integer.MAX_VALUE - 1, 2, 2); int ph = Integer.MAX_VALUE - 1; for (int k = 0; k < 5; k++) { checkState(root, ph, 2, 2); checkState(p1, ph, 1, 1); checkState(p2, ph, 2, 2); p1.arrive(); checkState(root, ph, 2, 1); checkState(p1, ph, 1, 0); checkState(p2, ph, 2, 2); p2.arrive(); checkState(root, ph, 2, 1); checkState(p1, ph, 1, 0); checkState(p2, ph, 2, 1); p2.arrive(); ph = phaseInc(ph); checkState(root, ph, 2, 2); checkState(p1, ph, 1, 1); checkState(p2, ph, 2, 2); } equal(3, ph); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new PhaseOverflow().instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/Phaser/Basic.java0000644000000000000000000003647711537741070020153 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6445158 * @summary Basic tests for Phaser * @author Chris Hegarty */ import java.util.Iterator; import java.util.LinkedList; import java.util.concurrent.Phaser; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; import static java.util.concurrent.TimeUnit.*; public class Basic { private static void checkTerminated(final Phaser phaser) { check(phaser.isTerminated()); int unarriverParties = phaser.getUnarrivedParties(); int registeredParties = phaser.getRegisteredParties(); int phase = phaser.getPhase(); check(phase < 0); equal(phase, phaser.arrive()); equal(phase, phaser.arriveAndDeregister()); equal(phase, phaser.arriveAndAwaitAdvance()); equal(phase, phaser.bulkRegister(10)); equal(phase, phaser.register()); try { equal(phase, phaser.awaitAdvanceInterruptibly(0)); equal(phase, phaser.awaitAdvanceInterruptibly(0, 10, SECONDS)); } catch (Exception ie) { unexpected(ie); } equal(phaser.getUnarrivedParties(), unarriverParties); equal(phaser.getRegisteredParties(), registeredParties); } private static void checkResult(Arriver a, Class c) { Throwable t = a.result(); if (! ((t == null && c == null) || (c != null && c.isInstance(t)))) { // t.printStackTrace(); fail("Mismatch in thread " + a.getName() + ": " + t + ", " + (c == null ? "" : c.getName())); } else { pass(); } } //---------------------------------------------------------------- // Mechanism to get all test threads into "running" mode. //---------------------------------------------------------------- private static Phaser atTheStartingGate = new Phaser(3); private static void toTheStartingGate() { try { boolean expectNextPhase = false; if (atTheStartingGate.getUnarrivedParties() == 1) { expectNextPhase = true; } int phase = atTheStartingGate.getPhase(); equal(phase, atTheStartingGate.arrive()); int awaitPhase = atTheStartingGate.awaitAdvanceInterruptibly (phase, 10, SECONDS); if (expectNextPhase) check(awaitPhase == (phase + 1)); pass(); } catch (Throwable t) { unexpected(t); // reset(atTheStartingGate); throw new Error(t); } } //---------------------------------------------------------------- // Convenience methods for creating threads that call arrive, // awaitAdvance, arriveAndAwaitAdvance, awaitAdvanceInterruptibly //---------------------------------------------------------------- private static abstract class Arriver extends Thread { static AtomicInteger count = new AtomicInteger(1); Arriver() { this("Arriver"); } Arriver(String name) { this.setName(name + ":" + count.getAndIncrement()); this.setDaemon(true); } private volatile Throwable result; private volatile int phase; protected void result(Throwable result) { this.result = result; } public Throwable result() { return this.result; } protected void phase(int phase) { this.phase = phase; } public int phase() { return this.phase; } } private static abstract class Awaiter extends Arriver { Awaiter() { super("Awaiter"); } Awaiter(String name) { super(name); } } private static Arriver arriver(final Phaser phaser) { return new Arriver() { public void run() { toTheStartingGate(); try { phase(phaser.arrive()); } catch (Throwable result) { result(result); }}}; } private static AtomicInteger cycleArriveAwaitAdvance = new AtomicInteger(1); private static Awaiter awaiter(final Phaser phaser) { return new Awaiter() { public void run() { toTheStartingGate(); try { if (cycleArriveAwaitAdvance.getAndIncrement() % 2 == 0) phase(phaser.awaitAdvance(phaser.arrive())); else phase(phaser.arriveAndAwaitAdvance()); } catch (Throwable result) { result(result); }}}; } private static Awaiter awaiter(final Phaser phaser, final long timeout, final TimeUnit unit) { return new Awaiter("InterruptibleWaiter") { public void run() { toTheStartingGate(); try { if (timeout < 0) phase(phaser.awaitAdvanceInterruptibly(phaser.arrive())); else phase(phaser.awaitAdvanceInterruptibly(phaser.arrive(), timeout, unit)); } catch (Throwable result) { result(result); }}}; } // Returns an infinite lazy list of all possible arriver/awaiter combinations. private static Iterator arriverIterator(final Phaser phaser) { return new Iterator() { int i = 0; public boolean hasNext() { return true; } public Arriver next() { switch ((i++)&7) { case 0: case 4: return arriver(phaser); case 1: case 5: return awaiter(phaser); case 2: case 6: case 7: return awaiter(phaser, -1, SECONDS); default: return awaiter(phaser, 10, SECONDS); }} public void remove() {throw new UnsupportedOperationException();}}; } // Returns an infinite lazy list of all possible awaiter only combinations. private static Iterator awaiterIterator(final Phaser phaser) { return new Iterator() { int i = 0; public boolean hasNext() { return true; } public Awaiter next() { switch ((i++)&7) { case 1: case 4: case 7: return awaiter(phaser); case 2: case 5: return awaiter(phaser, -1, SECONDS); default: return awaiter(phaser, 10, SECONDS); }} public void remove() {throw new UnsupportedOperationException();}}; } private static void realMain(String[] args) throws Throwable { Thread.currentThread().setName("mainThread"); //---------------------------------------------------------------- // Normal use //---------------------------------------------------------------- try { Phaser phaser = new Phaser(3); equal(phaser.getRegisteredParties(), 3); equal(phaser.getArrivedParties(), 0); equal(phaser.getPhase(), 0); check(phaser.getRoot().equals(phaser)); equal(phaser.getParent(), null); check(!phaser.isTerminated()); Iterator arrivers = arriverIterator(phaser); int phase = 0; for (int i = 0; i < 10; i++) { equal(phaser.getPhase(), phase++); Arriver a1 = arrivers.next(); a1.start(); Arriver a2 = arrivers.next(); a2.start(); toTheStartingGate(); phaser.arriveAndAwaitAdvance(); a1.join(); a2.join(); checkResult(a1, null); checkResult(a2, null); check(!phaser.isTerminated()); equal(phaser.getRegisteredParties(), 3); equal(phaser.getArrivedParties(), 0); } } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- // One thread interrupted //---------------------------------------------------------------- try { Phaser phaser = new Phaser(3); Iterator arrivers = arriverIterator(phaser); int phase = phaser.getPhase(); for (int i = 0; i < 4; i++) { check(phaser.getPhase() == phase); Awaiter a1 = awaiter(phaser, 10, SECONDS); a1.start(); Arriver a2 = arrivers.next(); a2.start(); toTheStartingGate(); a1.interrupt(); a1.join(); phaser.arriveAndAwaitAdvance(); a2.join(); checkResult(a1, InterruptedException.class); checkResult(a2, null); check(!phaser.isTerminated()); equal(phaser.getRegisteredParties(), 3); equal(phaser.getArrivedParties(), 0); phase++; } } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- // Phaser is terminated while threads are waiting //---------------------------------------------------------------- try { for (int i = 0; i < 4; i++) { Phaser phaser = new Phaser(3); Iterator awaiters = awaiterIterator(phaser); Arriver a1 = awaiters.next(); a1.start(); Arriver a2 = awaiters.next(); a2.start(); toTheStartingGate(); while (phaser.getArrivedParties() < 2) Thread.yield(); equal(0, phaser.getPhase()); phaser.forceTermination(); a1.join(); a2.join(); equal(0 + Integer.MIN_VALUE, a1.phase); equal(0 + Integer.MIN_VALUE, a2.phase); int arrivedParties = phaser.getArrivedParties(); checkTerminated(phaser); equal(phaser.getArrivedParties(), arrivedParties); } } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- // Adds new unarrived parties to this phaser //---------------------------------------------------------------- try { Phaser phaser = new Phaser(1); Iterator arrivers = arriverIterator(phaser); LinkedList arriverList = new LinkedList(); int phase = phaser.getPhase(); for (int i = 1; i < 5; i++) { atTheStartingGate = new Phaser(1+(3*i)); check(phaser.getPhase() == phase); // register 3 more phaser.register(); phaser.register(); phaser.register(); for (int z=0; z<(3*i); z++) { arriverList.add(arrivers.next()); } for (Arriver arriver : arriverList) arriver.start(); toTheStartingGate(); phaser.arriveAndAwaitAdvance(); for (Arriver arriver : arriverList) { arriver.join(); checkResult(arriver, null); } equal(phaser.getRegisteredParties(), 1 + (3*i)); equal(phaser.getArrivedParties(), 0); arriverList.clear(); phase++; } atTheStartingGate = new Phaser(3); } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- // One thread timed out //---------------------------------------------------------------- try { Phaser phaser = new Phaser(3); Iterator arrivers = arriverIterator(phaser); for (long timeout : new long[] { 0L, 5L }) { for (int i = 0; i < 2; i++) { Awaiter a1 = awaiter(phaser, timeout, SECONDS); a1.start(); Arriver a2 = arrivers.next(); a2.start(); toTheStartingGate(); a1.join(); checkResult(a1, TimeoutException.class); phaser.arrive(); a2.join(); checkResult(a2, null); check(!phaser.isTerminated()); } } } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- // Barrier action completed normally //---------------------------------------------------------------- try { final AtomicInteger count = new AtomicInteger(0); final Phaser[] kludge = new Phaser[1]; Phaser phaser = new Phaser(3) { @Override protected boolean onAdvance(int phase, int registeredParties) { int countPhase = count.getAndIncrement(); equal(countPhase, phase); equal(kludge[0].getPhase(), phase); equal(kludge[0].getRegisteredParties(), registeredParties); if (phase >= 3) return true; // terminate return false; } }; kludge[0] = phaser; equal(phaser.getRegisteredParties(), 3); Iterator awaiters = awaiterIterator(phaser); for (int i = 0; i < 4; i++) { Awaiter a1 = awaiters.next(); a1.start(); Awaiter a2 = awaiters.next(); a2.start(); toTheStartingGate(); while (phaser.getArrivedParties() < 2) Thread.yield(); phaser.arrive(); a1.join(); a2.join(); checkResult(a1, null); checkResult(a2, null); equal(count.get(), i+1); if (i < 3) { check(!phaser.isTerminated()); equal(phaser.getRegisteredParties(), 3); equal(phaser.getArrivedParties(), 0); equal(phaser.getUnarrivedParties(), 3); equal(phaser.getPhase(), count.get()); } else checkTerminated(phaser); } } catch (Throwable t) { unexpected(t); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/Phaser/FickleRegister.java0000644000000000000000000001057411537741070022022 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @summary stress test for register/arriveAndDeregister * @run main FickleRegister 300 */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; public class FickleRegister { final AtomicLong count = new AtomicLong(0); final long testDurationMillisDefault = 10L * 1000L; final long testDurationMillis; final long quittingTimeNanos; final int chunkSize = 1000; FickleRegister(String[] args) { testDurationMillis = (args.length > 0) ? Long.valueOf(args[0]) : testDurationMillisDefault; quittingTimeNanos = System.nanoTime() + testDurationMillis * 1000L * 1000L; } class Runner extends CheckedRunnable { final Phaser p; Runner(Phaser phaser) { p = phaser; } public void realRun() { int prevPhase = -1; for (int k = 1;; k++) { for (int i = 0; i < chunkSize; i++) { int phase = p.register(); if (phase < 0) break; check(phase > prevPhase); prevPhase = phase; equal(phase, p.arriveAndDeregister()); check(phase < p.awaitAdvance(phase)); } if (System.nanoTime() - quittingTimeNanos > 0) { count.getAndAdd(k * chunkSize); break; } } } } void test(String[] args) throws Throwable { final Phaser parent = new Phaser() { protected boolean onAdvance(int phase, int parties) { return false; } }; final Phaser child1 = new Phaser(parent); final Phaser child2 = new Phaser(parent); final Phaser subchild1 = new Phaser(child1); final Phaser subchild2 = new Phaser(child2); final Phaser[] phasers = { parent, child1, child2, subchild1, subchild2 }; int reps = 4; ArrayList threads = new ArrayList(); for (int j = 0; j < reps; ++j) { threads.add(new Thread(new Runner(subchild1))); threads.add(new Thread(new Runner(child1))); threads.add(new Thread(new Runner(parent))); threads.add(new Thread(new Runner(child2))); threads.add(new Thread(new Runner(subchild2))); } for (Thread thread : threads) thread.start(); for (Thread thread : threads) thread.join(); System.out.println("Parent: " + parent); System.out.println("Child1: " + child1); System.out.println("Child2: " + child2); System.out.println("Subchild1: " + subchild1); System.out.println("Subchild2: " + subchild2); System.out.println("Iterations:" + count.get()); for (Phaser phaser : phasers) { check(phaser.getPhase() > 0); equal(0, phaser.getRegisteredParties()); equal(0, phaser.getUnarrivedParties()); equal(parent.getPhase(), phaser.getPhase()); } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new FickleRegister(args).instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class CheckedRunnable implements Runnable { protected abstract void realRun() throws Throwable; public final void run() { try {realRun();} catch (Throwable t) {unexpected(t);} } } } jsr166/src/test/jtreg/util/concurrent/CopyOnWriteArrayList/0000755000000000000000000000000011652013243021071 5ustar jsr166/src/test/jtreg/util/concurrent/CopyOnWriteArrayList/EqualsRace.java0000644000000000000000000000576011450166503023775 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6318638 6325166 6330307 * @summary CopyOnWriteArrayList.equals should be thread-safe * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class EqualsRace { private static void realMain(String[] args) throws Throwable { final int iterations = 100000; final List list = new CopyOnWriteArrayList(); final Integer one = Integer.valueOf(1); final List oneElementList = Arrays.asList(one); final Thread t = new CheckedThread() { public void realRun() { for (int i = 0; i < iterations; i++) { list.add(one); list.remove(one); }}}; t.start(); for (int i = 0; i < iterations; i++) { list.equals(oneElementList); list.equals(Collections.EMPTY_LIST); } t.join(); check(list.size() == 0); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class CheckedThread extends Thread { public abstract void realRun() throws Throwable; public void run() { try { realRun(); } catch (Throwable t) { unexpected(t); }}} } jsr166/src/test/jtreg/util/concurrent/CopyOnWriteArraySet/0000755000000000000000000000000011652013243020711 5ustar jsr166/src/test/jtreg/util/concurrent/CopyOnWriteArraySet/RacingCows.java0000644000000000000000000001215011450166503023616 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6330307 6355645 * @summary Check for race conditions in COWArray classes * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class RacingCows { private static void realMain(String[] args) throws Throwable { final int iterations = 100000; final Integer two = Integer.valueOf(2); final Integer three = Integer.valueOf(3); //------------ CopyOnWriteArraySet ------------------------------- final Set s1 = new CopyOnWriteArraySet(); final Set s2 = new CopyOnWriteArraySet(); s1.add(1); final Thread t1 = new CheckedThread() { public void realRun() { for (int i = 0; i < iterations; i++) { s2.add(two); s2.remove(two); }}}; t1.start(); for (int i = 0; i < iterations; i++) { check(! s1.equals(s2)); check(! s2.equals(s1)); } t1.join(); //------------ CopyOnWriteArrayList ------------------------------ final List l1 = new CopyOnWriteArrayList(); final List l2 = new CopyOnWriteArrayList(); final List l3 = new CopyOnWriteArrayList(); l1.add(1); final Thread t2 = new CheckedThread() { public void realRun() { for (int i = 0; i < iterations; i++) { switch (i%2) { case 0: l2.add(two); break; case 1: l2.add(0, two); break; } switch (i%3) { case 0: l2.remove(two); break; case 1: l2.remove(0); break; case 2: l2.clear(); break; }}}}; t2.start(); final Thread t3 = new CheckedThread() { public void realRun() { l3.add(three); for (int i = 0; i < iterations; i++) { switch (i%2) { case 0: l3.add(two); break; case 1: l3.add(0, two); break; } switch (i%2) { case 0: l3.remove(two); break; case 1: l3.remove(0); break; }}}}; t3.start(); for (int i = 0; i < iterations; i++) { check(! l1.equals(l2)); check(! l2.equals(l1)); // CopyOnWriteArrayList(mutatingCollection) try { new CopyOnWriteArrayList(l2); } catch (Throwable t) { unexpected(t); } // addAllAbsent(mutatingCollection) try { new CopyOnWriteArrayList().addAllAbsent(l3); } catch (Throwable t) { unexpected(t); } // addAll(mutatingCollection) try { new CopyOnWriteArrayList().addAll(l3); } catch (Throwable t) { unexpected(t); } // addAll(int, mutatingCollection) try { new CopyOnWriteArrayList().addAll(0,l3); } catch (Throwable t) { unexpected(t); } } t2.join(); t3.join(); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class CheckedThread extends Thread { public abstract void realRun() throws Throwable; public void run() { try { realRun(); } catch (Throwable t) { unexpected(t); }}} } jsr166/src/test/jtreg/util/concurrent/CountDownLatch/0000755000000000000000000000000011652013243017710 5ustar jsr166/src/test/jtreg/util/concurrent/CountDownLatch/Basic.java0000644000000000000000000001746611441006144021610 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6332435 * @summary Basic tests for CountDownLatch * @author Seetharam Avadhanam, Martin Buchholz */ import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; interface AwaiterFactory { Awaiter getAwaiter(); } abstract class Awaiter extends Thread { private volatile Throwable result = null; protected void result(Throwable result) { this.result = result; } public Throwable result() { return this.result; } } public class Basic { private void toTheStartingGate(CountDownLatch gate) { try { gate.await(); } catch (Throwable t) { fail(t); } } private Awaiter awaiter(final CountDownLatch latch, final CountDownLatch gate) { return new Awaiter() { public void run() { System.out.println("without millis: " + latch.toString()); gate.countDown(); try { latch.await(); System.out.println("without millis - ComingOut"); } catch (Throwable result) { result(result); }}}; } private Awaiter awaiter(final CountDownLatch latch, final CountDownLatch gate, final long millis) { return new Awaiter() { public void run() { System.out.println("with millis: "+latch.toString()); gate.countDown(); try { latch.await(millis, TimeUnit.MILLISECONDS); System.out.println("with millis - ComingOut"); } catch (Throwable result) { result(result); }}}; } private AwaiterFactory awaiterFactories(final CountDownLatch latch, final CountDownLatch gate, final int i) { if (i == 1) return new AwaiterFactory() { public Awaiter getAwaiter() { return awaiter(latch, gate); }}; return new AwaiterFactory() { public Awaiter getAwaiter() { return awaiter(latch, gate, 10000); }}; } //---------------------------------------------------------------- // Normal use //---------------------------------------------------------------- public static void normalUse() throws Throwable { int count = 0; Basic test = new Basic(); CountDownLatch latch = new CountDownLatch(3); Awaiter a[] = new Awaiter[12]; for (int i = 0; i < 3; i++) { CountDownLatch gate = new CountDownLatch(4); AwaiterFactory factory1 = test.awaiterFactories(latch, gate, 1); AwaiterFactory factory2 = test.awaiterFactories(latch, gate, 0); a[count] = factory1.getAwaiter(); a[count++].start(); a[count] = factory1.getAwaiter(); a[count++].start(); a[count] = factory2.getAwaiter(); a[count++].start(); a[count] = factory2.getAwaiter(); a[count++].start(); test.toTheStartingGate(gate); System.out.println("Main Thread: " + latch.toString()); latch.countDown(); checkCount(latch, 2-i); } for (int i = 0; i < 12; i++) a[i].join(); for (int i = 0; i < 12; i++) checkResult(a[i], null); } //---------------------------------------------------------------- // One thread interrupted //---------------------------------------------------------------- public static void threadInterrupted() throws Throwable{ int count = 0; Basic test = new Basic(); CountDownLatch latch = new CountDownLatch(3); Awaiter a[] = new Awaiter[12]; for (int i = 0; i < 3; i++) { CountDownLatch gate = new CountDownLatch(4); AwaiterFactory factory1 = test.awaiterFactories(latch, gate, 1); AwaiterFactory factory2 = test.awaiterFactories(latch, gate, 0); a[count] = factory1.getAwaiter(); a[count++].start(); a[count] = factory1.getAwaiter(); a[count++].start(); a[count] = factory2.getAwaiter(); a[count++].start(); a[count] = factory2.getAwaiter(); a[count++].start(); a[count-1].interrupt(); test.toTheStartingGate(gate); System.out.println("Main Thread: " + latch.toString()); latch.countDown(); checkCount(latch, 2-i); } for (int i = 0; i < 12; i++) a[i].join(); for (int i = 0; i < 12; i++) checkResult(a[i], (i % 4) == 3 ? InterruptedException.class : null); } //---------------------------------------------------------------- // One thread timed out //---------------------------------------------------------------- public static void timeOut() throws Throwable { int count =0; Basic test = new Basic(); CountDownLatch latch = new CountDownLatch(3); Awaiter a[] = new Awaiter[12]; long[] timeout = { 0L, 5L, 10L }; for (int i = 0; i < 3; i++) { CountDownLatch gate = new CountDownLatch(4); AwaiterFactory factory1 = test.awaiterFactories(latch, gate, 1); AwaiterFactory factory2 = test.awaiterFactories(latch, gate, 0); a[count] = test.awaiter(latch, gate, timeout[i]); a[count++].start(); a[count] = factory1.getAwaiter(); a[count++].start(); a[count] = factory2.getAwaiter(); a[count++].start(); a[count] = factory2.getAwaiter(); a[count++].start(); test.toTheStartingGate(gate); System.out.println("Main Thread: " + latch.toString()); latch.countDown(); checkCount(latch, 2-i); } for (int i = 0; i < 12; i++) a[i].join(); for (int i = 0; i < 12; i++) checkResult(a[i], null); } public static void main(String[] args) throws Throwable { normalUse(); threadInterrupted(); timeOut(); if (failures.get() > 0L) throw new AssertionError(failures.get() + " failures"); } private static final AtomicInteger failures = new AtomicInteger(0); private static void fail(String msg) { fail(new AssertionError(msg)); } private static void fail(Throwable t) { t.printStackTrace(); failures.getAndIncrement(); } private static void checkCount(CountDownLatch b, int expected) { if (b.getCount() != expected) fail("Count = " + b.getCount() + ", expected = " + expected); } private static void checkResult(Awaiter a, Class c) { Throwable t = a.result(); if (! ((t == null && c == null) || c.isInstance(t))) { System.out.println("Mismatch: " + t + ", " + c.getName()); failures.getAndIncrement(); } } } jsr166/src/test/jtreg/util/concurrent/ScheduledThreadPoolExecutor/0000755000000000000000000000000011652013243022415 5ustar jsr166/src/test/jtreg/util/concurrent/ScheduledThreadPoolExecutor/DecorateTask.java0000644000000000000000000001134011441006144025626 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6560953 * @summary Test ScheduledThreadPoolExecutor.decorateTask */ import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; public class DecorateTask { Runnable countDownTask(final CountDownLatch latch) { return new Runnable() { public void run() { latch.countDown(); if (latch.getCount() <= 0) throw new RuntimeException("done"); }};} void test(String[] args) throws Throwable { final int jobs = 100; final AtomicInteger decoratorCount = new AtomicInteger(0); final ScheduledThreadPoolExecutor pool = new ScheduledThreadPoolExecutor(10) { protected RunnableScheduledFuture decorateTask( final Runnable runnable, final RunnableScheduledFuture task) { return new RunnableScheduledFuture() { public void run() { decoratorCount.incrementAndGet(); task.run(); } public boolean isPeriodic() { return task.isPeriodic(); } public boolean cancel(boolean mayInterruptIfRunning) { return task.cancel(mayInterruptIfRunning); } public boolean isCancelled() { return task.isCancelled(); } public boolean isDone() { return task.isDone(); } public V get() throws InterruptedException, ExecutionException { return task.get(); } public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return task.get(timeout, unit); } public long getDelay(TimeUnit unit) { return task.getDelay(unit); } public int compareTo(Delayed o) { return task.compareTo(o); }};}}; final CountDownLatch latch1 = new CountDownLatch(jobs); final CountDownLatch latch2 = new CountDownLatch(jobs); pool.scheduleAtFixedRate(countDownTask(latch1), 0L, 1L, TimeUnit.NANOSECONDS); pool.scheduleWithFixedDelay(countDownTask(latch2), 0L, 1L, TimeUnit.NANOSECONDS); latch1.await(); latch2.await(); pool.shutdown(); pool.awaitTermination(1L, TimeUnit.MINUTES); equal(decoratorCount.get(), 2 * jobs); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new DecorateTask().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java0000644000000000000000000001300611537741071026053 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6725789 * @summary Check for long overflow in task time comparison. */ import java.util.concurrent.*; public class DelayOverflow { static void waitForNanoTimeTick() { for (long t0 = System.nanoTime(); t0 == System.nanoTime(); ) ; } void scheduleNow(ScheduledThreadPoolExecutor pool, Runnable r, int how) { switch (how) { case 0: pool.schedule(r, 0, TimeUnit.MILLISECONDS); break; case 1: pool.schedule(Executors.callable(r), 0, TimeUnit.DAYS); break; case 2: pool.scheduleWithFixedDelay(r, 0, 1000, TimeUnit.NANOSECONDS); break; case 3: pool.scheduleAtFixedRate(r, 0, 1000, TimeUnit.MILLISECONDS); break; default: fail(String.valueOf(how)); } } void scheduleAtTheEndOfTime(ScheduledThreadPoolExecutor pool, Runnable r, int how) { switch (how) { case 0: pool.schedule(r, Long.MAX_VALUE, TimeUnit.MILLISECONDS); break; case 1: pool.schedule(Executors.callable(r), Long.MAX_VALUE, TimeUnit.DAYS); break; case 2: pool.scheduleWithFixedDelay(r, Long.MAX_VALUE, 1000, TimeUnit.NANOSECONDS); break; case 3: pool.scheduleAtFixedRate(r, Long.MAX_VALUE, 1000, TimeUnit.MILLISECONDS); break; default: fail(String.valueOf(how)); } } /** * Attempts to test exhaustively and deterministically, all 20 * possible ways that one task can be scheduled in the maximal * distant future, while at the same time an existing tasks's time * has already expired. */ void test(String[] args) throws Throwable { for (int nowHow = 0; nowHow < 4; nowHow++) { for (int thenHow = 0; thenHow < 4; thenHow++) { final ScheduledThreadPoolExecutor pool = new ScheduledThreadPoolExecutor(1); final CountDownLatch runLatch = new CountDownLatch(1); final CountDownLatch busyLatch = new CountDownLatch(1); final CountDownLatch proceedLatch = new CountDownLatch(1); final Runnable notifier = new Runnable() { public void run() { runLatch.countDown(); }}; final Runnable neverRuns = new Runnable() { public void run() { fail(); }}; final Runnable keepPoolBusy = new Runnable() { public void run() { try { busyLatch.countDown(); proceedLatch.await(); } catch (Throwable t) { unexpected(t); } }}; pool.schedule(keepPoolBusy, 0, TimeUnit.SECONDS); busyLatch.await(); scheduleNow(pool, notifier, nowHow); waitForNanoTimeTick(); scheduleAtTheEndOfTime(pool, neverRuns, thenHow); proceedLatch.countDown(); check(runLatch.await(10L, TimeUnit.SECONDS)); equal(runLatch.getCount(), 0L); pool.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); pool.shutdown(); } final int nowHowCopy = nowHow; final ScheduledThreadPoolExecutor pool = new ScheduledThreadPoolExecutor(1); final CountDownLatch runLatch = new CountDownLatch(1); final Runnable notifier = new Runnable() { public void run() { runLatch.countDown(); }}; final Runnable scheduleNowScheduler = new Runnable() { public void run() { try { scheduleNow(pool, notifier, nowHowCopy); waitForNanoTimeTick(); } catch (Throwable t) { unexpected(t); } }}; pool.scheduleWithFixedDelay(scheduleNowScheduler, 0, Long.MAX_VALUE, TimeUnit.NANOSECONDS); check(runLatch.await(10L, TimeUnit.SECONDS)); equal(runLatch.getCount(), 0L); pool.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); pool.shutdown(); } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new DelayOverflow().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/ScheduledThreadPoolExecutor/BasicCancelTest.java0000644000000000000000000001063011441006144026245 0ustar /* * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6602600 * @run main/othervm -Xmx8m BasicCancelTest * @summary Check effectiveness of RemoveOnCancelPolicy */ import java.util.concurrent.*; import java.util.Random; /** * Simple timer cancellation test. Submits tasks to a scheduled executor * service and immediately cancels them. */ public class BasicCancelTest { void checkShutdown(final ExecutorService es) { final Runnable nop = new Runnable() {public void run() {}}; try { if (new Random().nextBoolean()) { check(es.isShutdown()); if (es instanceof ThreadPoolExecutor) check(((ThreadPoolExecutor) es).isTerminating() || es.isTerminated()); THROWS(RejectedExecutionException.class, new F(){void f(){es.execute(nop);}}); } } catch (Throwable t) { unexpected(t); } } void checkTerminated(final ThreadPoolExecutor tpe) { try { checkShutdown(tpe); check(tpe.getQueue().isEmpty()); check(tpe.isTerminated()); check(! tpe.isTerminating()); equal(tpe.getActiveCount(), 0); equal(tpe.getPoolSize(), 0); equal(tpe.getTaskCount(), tpe.getCompletedTaskCount()); check(tpe.awaitTermination(0, TimeUnit.SECONDS)); } catch (Throwable t) { unexpected(t); } } void test(String[] args) throws Throwable { final ScheduledThreadPoolExecutor pool = new ScheduledThreadPoolExecutor(1); // Needed to avoid OOME pool.setRemoveOnCancelPolicy(true); final long moreThanYouCanChew = Runtime.getRuntime().freeMemory() / 4; System.out.printf("moreThanYouCanChew=%d%n", moreThanYouCanChew); Runnable noopTask = new Runnable() { public void run() {}}; for (long i = 0; i < moreThanYouCanChew; i++) pool.schedule(noopTask, 10, TimeUnit.MINUTES).cancel(true); pool.shutdown(); check(pool.awaitTermination(1L, TimeUnit.DAYS)); checkTerminated(pool); equal(pool.getTaskCount(), 0L); equal(pool.getCompletedTaskCount(), 0L); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new BasicCancelTest().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} void THROWS(Class k, F... fs) { for (F f : fs) try {f.f(); fail("Expected " + k.getName() + " not thrown");} catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/concurrent/ScheduledThreadPoolExecutor/Stress.java0000644000000000000000000000357111441006144024547 0ustar /* * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import java.util.concurrent.*; /** * This is not a regression test, but a stress benchmark test for * 6602600: Fast removal of cancelled scheduled thread pool tasks * * This runs in the same wall clock time, but much reduced cpu time, * with the changes for 6602600. */ public class Stress { public static void main(String[] args) throws Throwable { final CountDownLatch count = new CountDownLatch(1000); final ScheduledThreadPoolExecutor pool = new ScheduledThreadPoolExecutor(100); pool.prestartAllCoreThreads(); final Runnable incTask = new Runnable() { public void run() { count.countDown(); }}; pool.scheduleAtFixedRate(incTask, 0, 10, TimeUnit.MILLISECONDS); count.await(); pool.shutdown(); pool.awaitTermination(1L, TimeUnit.DAYS); } } jsr166/src/test/jtreg/util/concurrent/forkjoin/0000755000000000000000000000000011652013243016635 5ustar jsr166/src/test/jtreg/util/concurrent/forkjoin/NQueensCS.java0000644000000000000000000001125211537741071021316 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6865571 * @summary Solve NQueens using fork/join * @run main NQueensCS maxBoardSize=11 reps=1 * @run main NQueensCS maxBoardSize=11 reps=1 procs=8 */ import java.util.Arrays; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.RecursiveAction; public class NQueensCS extends RecursiveAction { static long lastStealCount; static int boardSize; static final int[] expectedSolutions = new int[] { 0, 1, 0, 0, 2, 10, 4, 40, 92, 352, 724, 2680, 14200, 73712, 365596, 2279184, 14772512, 95815104, 666090624 }; // see http://www.durangobill.com/N_Queens.html static String keywordValue(String[] args, String keyword) { for (String arg : args) if (arg.startsWith(keyword)) return arg.substring(keyword.length() + 1); return null; } static int intArg(String[] args, String keyword, int defaultValue) { String val = keywordValue(args, keyword); return (val == null) ? defaultValue : Integer.parseInt(val); } /** for time conversion */ static final long NPS = (1000L * 1000L * 1000L); /** * Usage: NQueensCS [minBoardSize=N] [maxBoardSize=N] [procs=N] [reps=N] */ public static void main(String[] args) throws Exception { // Board sizes too small: hard to measure well. // Board sizes too large: take too long to run. final int minBoardSize = intArg(args, "minBoardSize", 8); final int maxBoardSize = intArg(args, "maxBoardSize", 15); final int procs = intArg(args, "procs", 0); for (int reps = intArg(args, "reps", 10); reps > 0; reps--) { ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); lastStealCount = g.getStealCount(); for (int i = minBoardSize; i <= maxBoardSize; i++) test(g, i); System.out.println(g); g.shutdown(); } } static void test(ForkJoinPool g, int i) throws Exception { boardSize = i; int ps = g.getParallelism(); long start = System.nanoTime(); NQueensCS task = new NQueensCS(new int[0]); g.invoke(task); int solutions = task.solutions; long time = System.nanoTime() - start; double secs = (double) time / NPS; if (solutions != expectedSolutions[i]) throw new Error(); System.out.printf("NQueensCS %3d", i); System.out.printf(" Time: %7.3f", secs); long sc = g.getStealCount(); long ns = sc - lastStealCount; lastStealCount = sc; System.out.printf(" Steals/t: %5d", ns/ps); System.out.println(); } // Boards are represented as arrays where each cell // holds the column number of the queen in that row final int[] sofar; NQueensCS nextSubtask; // to link subtasks int solutions; NQueensCS(int[] a) { this.sofar = a; } public final void compute() { NQueensCS subtasks; int bs = boardSize; if (sofar.length >= bs) solutions = 1; else if ((subtasks = explore(sofar, bs)) != null) solutions = processSubtasks(subtasks); } private static NQueensCS explore(int[] array, int bs) { int row = array.length; NQueensCS s = null; // subtask list outer: for (int q = 0; q < bs; ++q) { for (int i = 0; i < row; i++) { int p = array[i]; if (q == p || q == p - (row - i) || q == p + (row - i)) continue outer; // attacked } NQueensCS first = s; // lag forks to ensure 1 kept if (first != null) first.fork(); int[] next = Arrays.copyOf(array, row+1); next[row] = q; NQueensCS subtask = new NQueensCS(next); subtask.nextSubtask = first; s = subtask; } return s; } private static int processSubtasks(NQueensCS s) { // Always run first the task held instead of forked s.compute(); int ns = s.solutions; s = s.nextSubtask; // Then the unstolen ones while (s != null && s.tryUnfork()) { s.compute(); ns += s.solutions; s = s.nextSubtask; } // Then wait for the stolen ones while (s != null) { s.join(); ns += s.solutions; s = s.nextSubtask; } return ns; } } jsr166/src/test/jtreg/util/concurrent/forkjoin/Integrate.java0000644000000000000000000001716011537741071021440 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6865571 * @summary Numerical Integration using fork/join * @run main Integrate reps=1 forkPolicy=dynamic * @run main Integrate reps=1 forkPolicy=serial * @run main Integrate reps=1 forkPolicy=fork */ import java.util.concurrent.ForkJoinPool; import java.util.concurrent.RecursiveAction; /** * Sample program using Gaussian Quadrature for numerical integration. * This version uses a simplified hardwired function. Inspired by a * * Filaments demo program. */ public final class Integrate { static final double errorTolerance = 1.0e-11; /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static final int SERIAL = -1; static final int DYNAMIC = 0; static final int FORK = 1; // the function to integrate static double computeFunction(double x) { return (x * x + 1.0) * x; } static final double start = 0.0; static final double end = 1536.0; /* * The number of recursive calls for * integrate from start to end. * (Empirically determined) */ static final int calls = 263479047; static String keywordValue(String[] args, String keyword) { for (String arg : args) if (arg.startsWith(keyword)) return arg.substring(keyword.length() + 1); return null; } static int intArg(String[] args, String keyword, int defaultValue) { String val = keywordValue(args, keyword); return (val == null) ? defaultValue : Integer.parseInt(val); } static int policyArg(String[] args, String keyword, int defaultPolicy) { String val = keywordValue(args, keyword); if (val == null) return defaultPolicy; if (val.equals("dynamic")) return DYNAMIC; if (val.equals("serial")) return SERIAL; if (val.equals("fork")) return FORK; throw new Error(); } /** * Usage: Integrate [procs=N] [reps=N] forkPolicy=serial|dynamic|fork */ public static void main(String[] args) throws Exception { final int procs = intArg(args, "procs", Runtime.getRuntime().availableProcessors()); final int forkPolicy = policyArg(args, "forkPolicy", DYNAMIC); ForkJoinPool g = new ForkJoinPool(procs); System.out.println("Integrating from " + start + " to " + end + " forkPolicy = " + forkPolicy); long lastTime = System.nanoTime(); for (int reps = intArg(args, "reps", 10); reps > 0; reps--) { double a; if (forkPolicy == SERIAL) a = SQuad.computeArea(g, start, end); else if (forkPolicy == FORK) a = FQuad.computeArea(g, start, end); else a = DQuad.computeArea(g, start, end); long now = System.nanoTime(); double s = (double) (now - lastTime) / NPS; lastTime = now; System.out.printf("Calls/sec: %12d", (long) (calls / s)); System.out.printf(" Time: %7.3f", s); System.out.printf(" Area: %12.1f", a); System.out.println(); } System.out.println(g); g.shutdown(); } // Sequential version static final class SQuad extends RecursiveAction { static double computeArea(ForkJoinPool pool, double l, double r) { SQuad q = new SQuad(l, r, 0); pool.invoke(q); return q.area; } final double left; // lower bound final double right; // upper bound double area; SQuad(double l, double r, double a) { this.left = l; this.right = r; this.area = a; } public final void compute() { double l = left; double r = right; area = recEval(l, r, (l * l + 1.0) * l, (r * r + 1.0) * r, area); } static final double recEval(double l, double r, double fl, double fr, double a) { double h = (r - l) * 0.5; double c = l + h; double fc = (c * c + 1.0) * c; double hh = h * 0.5; double al = (fl + fc) * hh; double ar = (fr + fc) * hh; double alr = al + ar; if (Math.abs(alr - a) <= errorTolerance) return alr; else return recEval(c, r, fc, fr, ar) + recEval(l, c, fl, fc, al); } } //.................................... // ForkJoin version static final class FQuad extends RecursiveAction { static double computeArea(ForkJoinPool pool, double l, double r) { FQuad q = new FQuad(l, r, 0); pool.invoke(q); return q.area; } final double left; // lower bound final double right; // upper bound double area; FQuad(double l, double r, double a) { this.left = l; this.right = r; this.area = a; } public final void compute() { double l = left; double r = right; area = recEval(l, r, (l * l + 1.0) * l, (r * r + 1.0) * r, area); } static final double recEval(double l, double r, double fl, double fr, double a) { double h = (r - l) * 0.5; double c = l + h; double fc = (c * c + 1.0) * c; double hh = h * 0.5; double al = (fl + fc) * hh; double ar = (fr + fc) * hh; double alr = al + ar; if (Math.abs(alr - a) <= errorTolerance) return alr; FQuad q = new FQuad(l, c, al); q.fork(); ar = recEval(c, r, fc, fr, ar); if (!q.tryUnfork()) { q.quietlyJoin(); return ar + q.area; } return ar + recEval(l, c, fl, fc, al); } } // ........................... // Version using on-demand Fork static final class DQuad extends RecursiveAction { static double computeArea(ForkJoinPool pool, double l, double r) { DQuad q = new DQuad(l, r, 0); pool.invoke(q); return q.area; } final double left; // lower bound final double right; // upper bound double area; DQuad(double l, double r, double a) { this.left = l; this.right = r; this.area = a; } public final void compute() { double l = left; double r = right; area = recEval(l, r, (l * l + 1.0) * l, (r * r + 1.0) * r, area); } static final double recEval(double l, double r, double fl, double fr, double a) { double h = (r - l) * 0.5; double c = l + h; double fc = (c * c + 1.0) * c; double hh = h * 0.5; double al = (fl + fc) * hh; double ar = (fr + fc) * hh; double alr = al + ar; if (Math.abs(alr - a) <= errorTolerance) return alr; DQuad q = null; if (getSurplusQueuedTaskCount() <= 3) (q = new DQuad(l, c, al)).fork(); ar = recEval(c, r, fc, fr, ar); if (q != null && !q.tryUnfork()) { q.quietlyJoin(); return ar + q.area; } return ar + recEval(l, c, fl, fc, al); } } } jsr166/src/test/jtreg/util/concurrent/SynchronousQueue/0000755000000000000000000000000011652013243020353 5ustar jsr166/src/test/jtreg/util/concurrent/SynchronousQueue/Fairness.java0000644000000000000000000000545211441006144022774 0ustar /* * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4992438 6633113 * @summary Checks that fairness setting is respected. */ import java.util.concurrent.*; import java.util.concurrent.locks.*; public class Fairness { private static void testFairness(boolean fair, final BlockingQueue q) throws Throwable { final ReentrantLock lock = new ReentrantLock(); final Condition ready = lock.newCondition(); final int threadCount = 10; final Throwable[] badness = new Throwable[1]; lock.lock(); for (int i = 0; i < threadCount; i++) { final Integer I = i; Thread t = new Thread() { public void run() { try { lock.lock(); ready.signal(); lock.unlock(); q.put(I); } catch (Throwable t) { badness[0] = t; }}}; t.start(); ready.await(); // Probably unnecessary, but should be bullet-proof while (t.getState() == Thread.State.RUNNABLE) Thread.yield(); } for (int i = 0; i < threadCount; i++) { int j = q.take(); // Non-fair queues are lifo in our implementation if (fair ? j != i : j != threadCount - 1 - i) throw new Error(String.format("fair=%b i=%d j=%d%n", fair, i, j)); } if (badness[0] != null) throw new Error(badness[0]); } public static void main(String[] args) throws Throwable { testFairness(false, new SynchronousQueue()); testFairness(false, new SynchronousQueue(false)); testFairness(true, new SynchronousQueue(true)); } } jsr166/src/test/jtreg/util/concurrent/ThreadPoolExecutor/0000755000000000000000000000000011652013243020574 5ustar jsr166/src/test/jtreg/util/concurrent/ThreadPoolExecutor/ThrowingTasks.java0000644000000000000000000002416411450166503024261 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6450200 6450205 6450207 6450211 * @summary Test proper handling of tasks that terminate abruptly * @run main/othervm -XX:-UseVMInterruptibleIO ThrowingTasks * @author Martin Buchholz */ import java.security.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; public class ThrowingTasks { static final Random rnd = new Random(); @SuppressWarnings("serial") static class UncaughtExceptions extends ConcurrentHashMap, Integer> { void inc(Class key) { for (;;) { Integer i = get(key); if (i == null) { if (putIfAbsent(key, 1) == null) return; } else { if (replace(key, i, i + 1)) return; } } } } @SuppressWarnings("serial") static class UncaughtExceptionsTable extends Hashtable, Integer> { synchronized void inc(Class key) { Integer i = get(key); put(key, (i == null) ? 1 : i + 1); } } static final UncaughtExceptions uncaughtExceptions = new UncaughtExceptions(); static final UncaughtExceptionsTable uncaughtExceptionsTable = new UncaughtExceptionsTable(); static final AtomicLong totalUncaughtExceptions = new AtomicLong(0); static final CountDownLatch uncaughtExceptionsLatch = new CountDownLatch(24); static final Thread.UncaughtExceptionHandler handler = new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { check(! Thread.currentThread().isInterrupted()); totalUncaughtExceptions.getAndIncrement(); uncaughtExceptions.inc(e.getClass()); uncaughtExceptionsTable.inc(e.getClass()); uncaughtExceptionsLatch.countDown(); }}; static final ThreadGroup tg = new ThreadGroup("Flaky"); static final ThreadFactory tf = new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = new Thread(tg, r); t.setUncaughtExceptionHandler(handler); return t; }}; static final RuntimeException rte = new RuntimeException(); static final Error error = new Error(); static final Throwable weird = new Throwable(); static final Exception checkedException = new Exception(); static class Thrower implements Runnable { Throwable t; Thrower(Throwable t) { this.t = t; } @SuppressWarnings("deprecation") public void run() { if (t != null) Thread.currentThread().stop(t); } } static final Thrower noThrower = new Thrower(null); static final Thrower rteThrower = new Thrower(rte); static final Thrower errorThrower = new Thrower(error); static final Thrower weirdThrower = new Thrower(weird); static final Thrower checkedThrower = new Thrower(checkedException); static final List throwers = Arrays.asList( noThrower, rteThrower, errorThrower, weirdThrower, checkedThrower); static class Flaky implements Runnable { final Runnable beforeExecute; final Runnable execute; Flaky(Runnable beforeExecute, Runnable execute) { this.beforeExecute = beforeExecute; this.execute = execute; } public void run() { execute.run(); } } static final List flakes = new ArrayList(); static { for (Thrower x : throwers) for (Thrower y : throwers) flakes.add(new Flaky(x, y)); Collections.shuffle(flakes); } static final CountDownLatch allStarted = new CountDownLatch(flakes.size()); static final CountDownLatch allContinue = new CountDownLatch(1); static class PermissiveSecurityManger extends SecurityManager { public void checkPermission(Permission p) { /* bien sur, Monsieur */ } } static void checkTerminated(ThreadPoolExecutor tpe) { try { check(tpe.getQueue().isEmpty()); check(tpe.isShutdown()); check(tpe.isTerminated()); check(! tpe.isTerminating()); equal(tpe.getActiveCount(), 0); equal(tpe.getPoolSize(), 0); equal(tpe.getTaskCount(), tpe.getCompletedTaskCount()); check(tpe.awaitTermination(0, TimeUnit.SECONDS)); } catch (Throwable t) { unexpected(t); } } static class CheckingExecutor extends ThreadPoolExecutor { CheckingExecutor() { super(10, 10, 1L, TimeUnit.HOURS, new LinkedBlockingQueue(), tf); } @Override protected void beforeExecute(Thread t, Runnable r) { allStarted.countDown(); if (allStarted.getCount() < getCorePoolSize()) try { allContinue.await(); } catch (InterruptedException x) { unexpected(x); } beforeExecuteCount.getAndIncrement(); check(! isTerminated()); ((Flaky)r).beforeExecute.run(); } @Override protected void afterExecute(Runnable r, Throwable t) { //System.out.println(tg.activeCount()); afterExecuteCount.getAndIncrement(); check(((Thrower)((Flaky)r).execute).t == t); check(! isTerminated()); } @Override protected void terminated() { try { terminatedCount.getAndIncrement(); if (rnd.nextBoolean()) { check(isShutdown()); check(isTerminating()); check(! isTerminated()); check(! awaitTermination(0L, TimeUnit.MINUTES)); } } catch (Throwable t) { unexpected(t); } } } static final AtomicInteger beforeExecuteCount = new AtomicInteger(0); static final AtomicInteger afterExecuteCount = new AtomicInteger(0); static final AtomicInteger terminatedCount = new AtomicInteger(0); private static void realMain(String[] args) throws Throwable { if (rnd.nextBoolean()) System.setSecurityManager(new PermissiveSecurityManger()); CheckingExecutor tpe = new CheckingExecutor(); for (Runnable task : flakes) tpe.execute(task); if (rnd.nextBoolean()) { allStarted.await(); equal(tpe.getTaskCount(), (long) flakes.size()); equal(tpe.getCompletedTaskCount(), (long) flakes.size() - tpe.getCorePoolSize()); } allContinue.countDown(); //System.out.printf("thread count = %d%n", tg.activeCount()); uncaughtExceptionsLatch.await(); while (tg.activeCount() != tpe.getCorePoolSize() || tg.activeCount() != tpe.getCorePoolSize()) Thread.sleep(10); equal(tg.activeCount(), tpe.getCorePoolSize()); tpe.shutdown(); check(tpe.awaitTermination(10L, TimeUnit.MINUTES)); checkTerminated(tpe); //while (tg.activeCount() > 0) Thread.sleep(10); //System.out.println(uncaughtExceptions); List, Integer>> maps = new ArrayList, Integer>>(); maps.add(uncaughtExceptions); maps.add(uncaughtExceptionsTable); for (Map, Integer> map : maps) { equal(map.get(Exception.class), throwers.size()); equal(map.get(weird.getClass()), throwers.size()); equal(map.get(Error.class), throwers.size() + 1 + 2); equal(map.get(RuntimeException.class), throwers.size() + 1); equal(map.size(), 4); } equal(totalUncaughtExceptions.get(), 4L*throwers.size() + 4L); equal(beforeExecuteCount.get(), flakes.size()); equal(afterExecuteCount.get(), throwers.size()); equal(tpe.getCompletedTaskCount(), (long) flakes.size()); equal(terminatedCount.get(), 1); // check for termination operation idempotence tpe.shutdown(); tpe.shutdownNow(); check(tpe.awaitTermination(10L, TimeUnit.MINUTES)); checkTerminated(tpe); equal(terminatedCount.get(), 1); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/ThreadPoolExecutor/ShutdownNowExecuteRace.java0000644000000000000000000000776711450166503026101 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6523756 * @summary Race task submission against shutdownNow * @author Martin Buchholz */ // For extra chances to detect shutdownNow vs. execute races, // crank up the iterations to, say 1<<22 and // add a call to Thread.yield() before the call to t.start() // in ThreadPoolExecutor.addWorker. import java.util.*; import java.util.concurrent.*; public class ShutdownNowExecuteRace { static volatile boolean quit = false; static volatile ThreadPoolExecutor pool = null; static final Runnable sleeper = new Runnable() { public void run() { final long ONE_HOUR = 1000L * 60L * 60L; try { Thread.sleep(ONE_HOUR); } catch (InterruptedException ie) {} catch (Throwable t) { unexpected(t); }}}; static void realMain(String[] args) throws Throwable { final int iterations = 1 << 8; Thread thread = new Thread() { public void run() { while (! quit) { ThreadPoolExecutor pool = ShutdownNowExecuteRace.pool; if (pool != null) try { pool.execute(sleeper); } catch (RejectedExecutionException e) {/* OK */} catch (Throwable t) { unexpected(t); }}}}; thread.start(); for (int i = 0; i < iterations; i++) { pool = new ThreadPoolExecutor( 10, 10, 3L, TimeUnit.DAYS, new ArrayBlockingQueue(10)); pool.shutdownNow(); check(pool.awaitTermination(3L, TimeUnit.MINUTES)); } quit = true; thread.join(); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class Fun {abstract void f() throws Throwable;} static void THROWS(Class k, Fun... fs) { for (Fun f : fs) try { f.f(); fail("Expected " + k.getName() + " not thrown"); } catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} private abstract static class CheckedThread extends Thread { abstract void realRun() throws Throwable; public void run() { try {realRun();} catch (Throwable t) {unexpected(t);}}} } jsr166/src/test/jtreg/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java0000644000000000000000000000634111441006144024206 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6458662 * @summary poolSize might shrink below corePoolSize after timeout * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class TimeOutShrink { static void checkPoolSizes(ThreadPoolExecutor pool, int size, int core, int max) { equal(pool.getPoolSize(), size); equal(pool.getCorePoolSize(), core); equal(pool.getMaximumPoolSize(), max); } private static void realMain(String[] args) throws Throwable { final int n = 4; final CyclicBarrier barrier = new CyclicBarrier(2*n+1); final ThreadPoolExecutor pool = new ThreadPoolExecutor(n, 2*n, 1L, TimeUnit.SECONDS, new SynchronousQueue()); final Runnable r = new Runnable() { public void run() { try { barrier.await(); barrier.await(); } catch (Throwable t) { unexpected(t); }}}; for (int i = 0; i < 2*n; i++) pool.execute(r); barrier.await(); checkPoolSizes(pool, 2*n, n, 2*n); barrier.await(); while (pool.getPoolSize() > n) Thread.sleep(100); Thread.sleep(100); checkPoolSizes(pool, n, n, 2*n); pool.shutdown(); pool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/ThreadPoolExecutor/ScheduledTickleService.java0000644000000000000000000001642011450166503026023 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6362121 * @summary Test one ScheduledThreadPoolExecutor extension scenario * @author Martin Buchholz */ // based on a test kindly provided by Holger Hoffstaette import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; public class ScheduledTickleService { // We get intermittent ClassCastException if greater than 1 // because of calls to compareTo private static final int concurrency = 2; // Record when tasks are done public static final CountDownLatch done = new CountDownLatch(concurrency); public static void realMain(String... args) throws InterruptedException { // our tickle service ScheduledExecutorService tickleService = new ScheduledThreadPoolExecutor(concurrency) { // We override decorateTask() to return a custom // RunnableScheduledFuture which explicitly removes // itself from the queue after cancellation. protected RunnableScheduledFuture decorateTask(Runnable runnable, RunnableScheduledFuture task) { final ScheduledThreadPoolExecutor exec = this; return new CustomRunnableScheduledFuture(task) { // delegate to wrapped task, except for: public boolean cancel(boolean b) { // cancel wrapped task & remove myself from the queue return (task().cancel(b) && exec.remove(this));}};}}; for (int i = 0; i < concurrency; i++) new ScheduledTickle(i, tickleService) .setUpdateInterval(25, MILLISECONDS); done.await(); tickleService.shutdown(); pass(); } // our Runnable static class ScheduledTickle implements Runnable { public volatile int failures = 0; // my tickle service private final ScheduledExecutorService service; // remember my own scheduled ticket private ScheduledFuture ticket = null; // remember the number of times I've been tickled private int numTickled = 0; // my private name private final String name; public ScheduledTickle(int i, ScheduledExecutorService service) { super(); this.name = "Tickler-"+i; this.service = service; } // set my tickle interval; 0 to disable further tickling. public synchronized void setUpdateInterval(long interval, TimeUnit unit) { // cancel & remove previously created ticket if (ticket != null) { ticket.cancel(false); ticket = null; } if (interval > 0 && ! service.isShutdown()) { // requeue with new interval ticket = service.scheduleAtFixedRate(this, interval, interval, unit); } } public synchronized void run() { try { check(numTickled < 6); numTickled++; System.out.println(name + ": Run " + numTickled); // tickle 3 times and then slow down if (numTickled == 3) { System.out.println(name + ": slower please!"); this.setUpdateInterval(100, MILLISECONDS); } // ..but only 5 times max. else if (numTickled == 5) { System.out.println(name + ": OK that's enough."); this.setUpdateInterval(0, MILLISECONDS); ScheduledTickleService.done.countDown(); } } catch (Throwable t) { unexpected(t); } } } // This is just a generic wrapper to make up for the private ScheduledFutureTask static class CustomRunnableScheduledFuture implements RunnableScheduledFuture { // the wrapped future private RunnableScheduledFuture task; public CustomRunnableScheduledFuture(RunnableScheduledFuture task) { super(); this.task = task; } public RunnableScheduledFuture task() { return task; } // Forwarding methods public boolean isPeriodic() { return task.isPeriodic(); } public boolean isCancelled() { return task.isCancelled(); } public boolean isDone() { return task.isDone(); } public boolean cancel(boolean b) { return task.cancel(b); } public long getDelay(TimeUnit unit) { return task.getDelay(unit); } public void run() { task.run(); } public V get() throws InterruptedException, ExecutionException { return task.get(); } public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return task.get(timeout, unit); } public int compareTo(Delayed other) { if (this == other) return 0; else if (other instanceof CustomRunnableScheduledFuture) return task.compareTo(((CustomRunnableScheduledFuture)other).task()); else return task.compareTo(other); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/ThreadPoolExecutor/ConfigChanges.java0000644000000000000000000002245211450166503024146 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6450200 * @summary Test proper handling of pool state changes * @run main/othervm ConfigChanges * @author Martin Buchholz */ import java.security.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import static java.util.concurrent.TimeUnit.*; public class ConfigChanges { static final ThreadGroup tg = new ThreadGroup("pool"); static final Random rnd = new Random(); static void report(ThreadPoolExecutor tpe) { try { System.out.printf( "active=%d submitted=%d completed=%d queued=%d sizes=%d/%d/%d%n", tg.activeCount(), tpe.getTaskCount(), tpe.getCompletedTaskCount(), tpe.getQueue().size(), tpe.getPoolSize(), tpe.getCorePoolSize(), tpe.getMaximumPoolSize()); } catch (Throwable t) { unexpected(t); } } static void report(String label, ThreadPoolExecutor tpe) { System.out.printf("%10s ", label); report(tpe); } static class PermissiveSecurityManger extends SecurityManager { public void checkPermission(Permission p) { /* bien sur, Monsieur */ } } static void checkShutdown(final ExecutorService es) { final Runnable nop = new Runnable() {public void run() {}}; try { if (new Random().nextBoolean()) { check(es.isShutdown()); if (es instanceof ThreadPoolExecutor) check(((ThreadPoolExecutor) es).isTerminating() || es.isTerminated()); THROWS(RejectedExecutionException.class, new Fun() {void f() {es.execute(nop);}}); } } catch (Throwable t) { unexpected(t); } } static void checkTerminated(final ThreadPoolExecutor tpe) { try { checkShutdown(tpe); check(tpe.getQueue().isEmpty()); check(tpe.isTerminated()); check(! tpe.isTerminating()); equal(tpe.getActiveCount(), 0); equal(tpe.getPoolSize(), 0); equal(tpe.getTaskCount(), tpe.getCompletedTaskCount()); check(tpe.awaitTermination(0, SECONDS)); } catch (Throwable t) { unexpected(t); } } static Runnable waiter(final CyclicBarrier barrier) { return new Runnable() { public void run() { try { barrier.await(); barrier.await(); } catch (Throwable t) { unexpected(t); }}}; } static volatile Runnable runnableDuJour; private static void realMain(String[] args) throws Throwable { if (rnd.nextBoolean()) System.setSecurityManager(new PermissiveSecurityManger()); final boolean prestart = rnd.nextBoolean(); final Thread.UncaughtExceptionHandler handler = new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { check(! Thread.currentThread().isInterrupted()); unexpected(e); }}; final int n = 3; final ThreadPoolExecutor tpe = new ThreadPoolExecutor(n, 3*n, 3L, MINUTES, new ArrayBlockingQueue(3*n)); tpe.setThreadFactory(new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = new Thread(tg, r); t.setUncaughtExceptionHandler(handler); return t; }}); if (prestart) { tpe.prestartAllCoreThreads(); equal(tg.activeCount(), n); equal(tg.activeCount(), tpe.getCorePoolSize()); } final Runnable runRunnableDuJour = new Runnable() { public void run() { // Delay choice of action till last possible moment. runnableDuJour.run(); }}; final CyclicBarrier pumpedUp = new CyclicBarrier(3*n + 1); runnableDuJour = waiter(pumpedUp); if (prestart) { for (int i = 0; i < 1*n; i++) tpe.execute(runRunnableDuJour); // Wait for prestarted threads to dequeue their initial tasks. while (! tpe.getQueue().isEmpty()) Thread.sleep(10); for (int i = 0; i < 5*n; i++) tpe.execute(runRunnableDuJour); } else { for (int i = 0; i < 6*n; i++) tpe.execute(runRunnableDuJour); } //report("submitted", tpe); pumpedUp.await(); equal(tg.activeCount(), 3*n); equal(tg.activeCount(), tpe.getMaximumPoolSize()); equal(tpe.getCorePoolSize(), n); //report("pumped up", tpe); equal(tpe.getMaximumPoolSize(), 3*n); tpe.setMaximumPoolSize(4*n); equal(tpe.getMaximumPoolSize(), 4*n); //report("pumped up2", tpe); final CyclicBarrier pumpedUp2 = new CyclicBarrier(n + 1); runnableDuJour = waiter(pumpedUp2); for (int i = 0; i < 1*n; i++) tpe.execute(runRunnableDuJour); pumpedUp2.await(); equal(tg.activeCount(), 4*n); equal(tg.activeCount(), tpe.getMaximumPoolSize()); equal(tpe.getCompletedTaskCount(), 0L); //report("pumped up2", tpe); runnableDuJour = new Runnable() { public void run() {}}; tpe.setMaximumPoolSize(2*n); //report("after set", tpe); pumpedUp2.await(); pumpedUp.await(); // while (tg.activeCount() != n && // tg.activeCount() != n) // Thread.sleep(10); // equal(tg.activeCount(), n); // equal(tg.activeCount(), tpe.getCorePoolSize()); while (tg.activeCount() != 2*n && tg.activeCount() != 2*n) Thread.sleep(10); equal(tg.activeCount(), 2*n); equal(tg.activeCount(), tpe.getMaximumPoolSize()); //report("draining", tpe); while (tpe.getCompletedTaskCount() < 7*n && tpe.getCompletedTaskCount() < 7*n) Thread.sleep(10); //equal(tg.activeCount(), n); //equal(tg.activeCount(), tpe.getCorePoolSize()); equal(tg.activeCount(), 2*n); equal(tg.activeCount(), tpe.getMaximumPoolSize()); equal(tpe.getTaskCount(), 7L*n); equal(tpe.getCompletedTaskCount(), 7L*n); equal(tpe.getKeepAliveTime(MINUTES), 3L); tpe.setKeepAliveTime(7L, MILLISECONDS); equal(tpe.getKeepAliveTime(MILLISECONDS), 7L); while (tg.activeCount() > n && tg.activeCount() > n) Thread.sleep(10); equal(tg.activeCount(), n); //report("idle", tpe); check(! tpe.allowsCoreThreadTimeOut()); tpe.allowCoreThreadTimeOut(true); check(tpe.allowsCoreThreadTimeOut()); while (tg.activeCount() > 0 && tg.activeCount() > 0) Thread.sleep(10); equal(tg.activeCount(), 0); //report("idle", tpe); tpe.shutdown(); checkShutdown(tpe); check(tpe.awaitTermination(3L, MINUTES)); checkTerminated(tpe); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class Fun {abstract void f() throws Throwable;} static void THROWS(Class k, Fun... fs) { for (Fun f : fs) try { f.f(); fail("Expected " + k.getName() + " not thrown"); } catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java0000644000000000000000000001043111473045602024772 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6233235 6268386 * @summary Test allowsCoreThreadTimeOut * @author Martin Buchholz */ import java.util.concurrent.*; public class CoreThreadTimeOut { static class IdentifiableThreadFactory implements ThreadFactory { static ThreadFactory defaultThreadFactory = Executors.defaultThreadFactory(); public Thread newThread(Runnable r) { Thread t = defaultThreadFactory.newThread(r); t.setName("CoreThreadTimeOut-" + t.getName()); return t; } } int countExecutorThreads() { Thread[] threads = new Thread[Thread.activeCount()+100]; Thread.enumerate(threads); int count = 0; for (Thread t : threads) if (t != null && t.getName().matches ("CoreThreadTimeOut-pool-[0-9]+-thread-[0-9]+")) count++; return count; } long millisElapsedSince(long t0) { return (System.nanoTime() - t0) / (1000L * 1000L); } void test(String[] args) throws Throwable { final int threadCount = 10; final int timeoutMillis = 30; BlockingQueue q = new ArrayBlockingQueue(2*threadCount); ThreadPoolExecutor tpe = new ThreadPoolExecutor(threadCount, threadCount, timeoutMillis, TimeUnit.MILLISECONDS, q, new IdentifiableThreadFactory()); equal(tpe.getCorePoolSize(), threadCount); check(! tpe.allowsCoreThreadTimeOut()); tpe.allowCoreThreadTimeOut(true); check(tpe.allowsCoreThreadTimeOut()); equal(countExecutorThreads(), 0); long t0 = System.nanoTime(); for (int i = 0; i < threadCount; i++) tpe.submit(new Runnable() { public void run() {}}); int count = countExecutorThreads(); if (millisElapsedSince(t0) < timeoutMillis) equal(count, threadCount); while (countExecutorThreads() > 0 && millisElapsedSince(t0) < 10 * 1000); equal(countExecutorThreads(), 0); tpe.shutdown(); check(tpe.allowsCoreThreadTimeOut()); check(tpe.awaitTermination(10, TimeUnit.SECONDS)); System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Exception("Some tests failed"); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new CoreThreadTimeOut().instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/ThreadPoolExecutor/ModifyCorePoolSize.java0000644000000000000000000000572311441006144025171 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6522773 * @summary Test changes to STPE core pool size * @author Martin Buchholz */ import java.util.concurrent.*; public class ModifyCorePoolSize { static void awaitPoolSize(ThreadPoolExecutor pool, int n) { while (pool.getPoolSize() != n) Thread.yield(); pass(); } static void setCorePoolSize(ThreadPoolExecutor pool, int n) { pool.setCorePoolSize(n); equal(pool.getCorePoolSize(), n); awaitPoolSize(pool, n); } static void realMain(String[] args) throws Throwable { final int size = 10; final ScheduledThreadPoolExecutor pool = new ScheduledThreadPoolExecutor(size); final Runnable nop = new Runnable() { public void run() {}}; for (int i = 0; i < size; i++) pool.scheduleAtFixedRate(nop, 100L * (i + 1), 1000L, TimeUnit.MILLISECONDS); awaitPoolSize(pool, size); setCorePoolSize(pool, size - 3); setCorePoolSize(pool, size + 3); pool.shutdownNow(); check(pool.awaitTermination(1L, TimeUnit.DAYS)); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/ThreadPoolExecutor/Custom.java0000644000000000000000000001107111450166503022715 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6277663 * @summary Test TPE extensibility framework * @author Martin Buchholz */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; public class Custom { static volatile int passed = 0, failed = 0; static void pass() { passed++; } static void fail() { failed++; Thread.dumpStack(); } static void unexpected(Throwable t) { failed++; t.printStackTrace(); } static void check(boolean cond) { if (cond) pass(); else fail(); } static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else {System.out.println(x + " not equal to " + y); fail(); }} private static class CustomTask extends FutureTask { public static final AtomicInteger births = new AtomicInteger(0); CustomTask(Callable c) { super(c); births.getAndIncrement(); } CustomTask(Runnable r, V v) { super(r, v); births.getAndIncrement(); } } private static class CustomTPE extends ThreadPoolExecutor { CustomTPE() { super(threadCount, threadCount, 30, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(2*threadCount)); } protected RunnableFuture newTaskFor(Callable c) { return new CustomTask(c); } protected RunnableFuture newTaskFor(Runnable r, V v) { return new CustomTask(r, v); } } private static class CustomSTPE extends ScheduledThreadPoolExecutor { public static final AtomicInteger decorations = new AtomicInteger(0); CustomSTPE() { super(threadCount); } protected RunnableScheduledFuture decorateTask( Runnable r, RunnableScheduledFuture task) { decorations.getAndIncrement(); return task; } protected RunnableScheduledFuture decorateTask( Callable c, RunnableScheduledFuture task) { decorations.getAndIncrement(); return task; } } static int countExecutorThreads() { Thread[] threads = new Thread[Thread.activeCount()+100]; Thread.enumerate(threads); int count = 0; for (Thread t : threads) if (t != null && t.getName().matches("pool-[0-9]+-thread-[0-9]+")) count++; return count; } private static final int threadCount = 10; public static void main(String[] args) throws Throwable { CustomTPE tpe = new CustomTPE(); equal(tpe.getCorePoolSize(), threadCount); equal(countExecutorThreads(), 0); for (int i = 0; i < threadCount; i++) tpe.submit(new Runnable() { public void run() {}}); equal(countExecutorThreads(), threadCount); equal(CustomTask.births.get(), threadCount); tpe.shutdown(); tpe.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); Thread.sleep(10); equal(countExecutorThreads(), 0); CustomSTPE stpe = new CustomSTPE(); for (int i = 0; i < threadCount; i++) stpe.submit(new Runnable() { public void run() {}}); equal(CustomSTPE.decorations.get(), threadCount); equal(countExecutorThreads(), threadCount); stpe.shutdown(); stpe.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); Thread.sleep(10); equal(countExecutorThreads(), 0); System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Exception("Some tests failed"); } } jsr166/src/test/jtreg/util/concurrent/ThreadPoolExecutor/SelfInterrupt.java0000644000000000000000000000641211441006144024246 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6576792 * @summary non-idle worker threads should not be interrupted */ import java.util.concurrent.*; public class SelfInterrupt { void test(String[] args) throws Throwable { final int n = 100; final ThreadPoolExecutor pool = new ThreadPoolExecutor(n, n, 1L, TimeUnit.NANOSECONDS, new SynchronousQueue()); final CountDownLatch startingGate = new CountDownLatch(n); final CountDownLatch finishLine = new CountDownLatch(n); equal(pool.getCorePoolSize(), n); equal(pool.getPoolSize(), 0); for (int i = 0; i < n; i++) pool.execute(new Runnable() { public void run() { try { startingGate.countDown(); startingGate.await(); equal(pool.getPoolSize(), n); pool.setCorePoolSize(n); pool.setCorePoolSize(1); check(! Thread.interrupted()); equal(pool.getPoolSize(), n); finishLine.countDown(); finishLine.await(); check(! Thread.interrupted()); } catch (Throwable t) { unexpected(t); }}}); finishLine.await(); pool.shutdown(); check(pool.awaitTermination(1000L, TimeUnit.SECONDS)); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new SelfInterrupt().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/LinkedBlockingQueue/0000755000000000000000000000000011652013243020700 5ustar jsr166/src/test/jtreg/util/concurrent/LinkedBlockingQueue/ToArray.java0000644000000000000000000000271511441006144023127 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6307455 * @summary toArray(a) must set "after-end" element to null * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class ToArray { public static void main(String[] args) throws Throwable { Collection c = new LinkedBlockingQueue(); if (c.toArray(new Integer[]{42})[0] != null) throw new Error("should be null"); } } jsr166/src/test/jtreg/util/concurrent/locks/0000755000000000000000000000000011652013243016127 5ustar jsr166/src/test/jtreg/util/concurrent/locks/ReentrantLock/0000755000000000000000000000000011652013243020702 5ustar jsr166/src/test/jtreg/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java0000644000000000000000000000712611537741071026526 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 SimpleReentrantLockLoops.java * @run main/timeout=4500 SimpleReentrantLockLoops * @summary multiple threads using a single lock */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class SimpleReentrantLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 1000000; public static void main(String[] args) throws Exception { int maxThreads = 5; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; int reps = 2; for (int i = 1; i <= maxThreads; i += (i+1) >>> 1) { int n = reps; if (reps > 1) --reps; while (n-- > 0) { System.out.print("Threads: " + i); new ReentrantLockLoop(i).test(); Thread.sleep(100); } } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long)iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double)(time) / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v; int x = 0; int n = iters; do { lock.lock(); try { if ((n & 255) == 0) v = x = LoopHelpers.compute2(LoopHelpers.compute1(v)); else v = x += ~(v - n); } finally { lock.unlock(); } // Once in a while, do something more expensive if ((~n & 255) == 0) { sum += LoopHelpers.compute1(LoopHelpers.compute2(x)); } else sum += sum ^ x; } while (n-- > 0); barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/jtreg/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java0000644000000000000000000000750311537741071025037 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 5031862 * @compile -source 1.5 TimeoutLockLoops.java * @run main TimeoutLockLoops * @summary Checks for responsiveness of locks to timeouts. * Runs under the assumption that ITERS computations require more than * TIMEOUT msecs to complete, which seems to be a safe assumption for * another decade. */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class TimeoutLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static final int ITERS = Integer.MAX_VALUE; static final long TIMEOUT = 100; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; for (int i = 1; i <= maxThreads; i += (i+1) >>> 1) { System.out.print("Threads: " + i); new ReentrantLockLoop(i).test(); Thread.sleep(10); } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile boolean completed; private volatile int result = 17; private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) { lock.lock(); pool.execute(this); lock.unlock(); } barrier.await(); Thread.sleep(TIMEOUT); while (!lock.tryLock()); // Jam lock // lock.lock(); barrier.await(); if (print) { long time = timer.getTime(); double secs = (double)(time) / 1000000000.0; System.out.println("\t " + secs + "s run time"); } if (completed) throw new Error("Some thread completed instead of timing out"); int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v; int x = 17; int n = ITERS; final ReentrantLock lock = this.lock; for (;;) { if (x != 0) { if (n-- <= 0) break; } if (!lock.tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) break; try { v = x = LoopHelpers.compute1(v); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } if (n <= 0) completed = true; barrier.await(); result += sum; } catch (Exception ex) { ex.printStackTrace(); return; } } } } jsr166/src/test/jtreg/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java0000644000000000000000000001055011537741071025257 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 CancelledLockLoops.java * @run main/timeout=2800 CancelledLockLoops * @summary tests lockInterruptibly. * Checks for responsiveness of locks to interrupts. Runs under that * assumption that ITERS_VALUE computations require more than TIMEOUT * msecs to complete. */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class CancelledLockLoops { static final Random rng = new Random(); static boolean print = false; static final int ITERS = 1000000; static final long TIMEOUT = 100; public static void main(String[] args) throws Exception { int maxThreads = 5; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; for (int i = 2; i <= maxThreads; i += (i+1) >>> 1) { System.out.print("Threads: " + i); try { new ReentrantLockLoop(i).test(); } catch (BrokenBarrierException bb) { // OK, ignore } Thread.sleep(TIMEOUT); } } static final class ReentrantLockLoop implements Runnable { private int v = rng.nextInt(); private int completed; private volatile int result = 17; private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { Thread[] threads = new Thread[nthreads]; for (int i = 0; i < threads.length; ++i) threads[i] = new Thread(this); for (int i = 0; i < threads.length; ++i) threads[i].start(); Thread[] cancels = (Thread[]) (threads.clone()); Collections.shuffle(Arrays.asList(cancels), rng); barrier.await(); Thread.sleep(TIMEOUT); for (int i = 0; i < cancels.length-2; ++i) { cancels[i].interrupt(); // make sure all OK even when cancellations spaced out if ( (i & 3) == 0) Thread.sleep(1 + rng.nextInt(10)); } barrier.await(); if (print) { long time = timer.getTime(); double secs = (double)(time) / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int c; lock.lock(); try { c = completed; } finally { lock.unlock(); } if (c != 2) throw new Error("Completed != 2"); int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v; int x = 0; int n = ITERS; boolean done = false; do { try { lock.lockInterruptibly(); } catch (InterruptedException ie) { break; } try { v = x = LoopHelpers.compute1(v); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } while (n-- > 0); if (n <= 0) { lock.lock(); try { ++completed; } finally { lock.unlock(); } } barrier.await(); result += sum; } catch (Exception ex) { ex.printStackTrace(); return; } } } } jsr166/src/test/jtreg/util/concurrent/locks/ReentrantLock/LoopHelpers.java0000644000000000000000000000542611537741071024021 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; class LoopHelpers { // Some mindless computation to do between synchronizations... /** * generates 32 bit pseudo-random numbers. * Adapted from http://www.snippets.org */ public static int compute1(int x) { int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } return lo; } /** * Computes a linear congruential random number a random number * of times. */ public static int compute2(int x) { int loops = (x >>> 4) & 7; while (loops-- > 0) { x = (x * 2147483647) % 16807; } return x; } /** * An actually useful random number generator, but unsynchronized. * Basically same as java.util.Random. */ public static class SimpleRandom { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong(1); private long seed = System.nanoTime() + seq.getAndIncrement(); public void setSeed(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } } public static class BarrierTimer implements Runnable { public volatile long startTime; public volatile long endTime; public void run() { long t = System.nanoTime(); if (startTime == 0) startTime = t; else endTime = t; } public void clear() { startTime = 0; endTime = 0; } public long getTime() { return endTime - startTime; } } public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; String num = Long.toString(n); if (num.length() >= field.length()) return num; StringBuffer b = new StringBuffer(field); b.replace(b.length()-num.length(), b.length(), num); return b.toString(); } } jsr166/src/test/jtreg/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java0000644000000000000000000000657211537741071026101 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 LockOncePerThreadLoops.java * @run main/timeout=15000 LockOncePerThreadLoops * @summary Checks for missed signals by locking and unlocking each of an array of locks once per thread */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class LockOncePerThreadLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int nlocks = 50000; static int nthreads = 100; static int replications = 5; public static void main(String[] args) throws Exception { if (args.length > 0) replications = Integer.parseInt(args[0]); if (args.length > 1) nlocks = Integer.parseInt(args[1]); print = true; for (int i = 0; i < replications; ++i) { System.out.print("Iteration: " + i); new ReentrantLockLoop().test(); Thread.sleep(100); } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; final ReentrantLock[]locks = new ReentrantLock[nlocks]; private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; ReentrantLockLoop() { barrier = new CyclicBarrier(nthreads+1, timer); for (int i = 0; i < nlocks; ++i) locks[i] = new ReentrantLock(); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); double secs = (double)(time) / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v; int x = 0; for (int i = 0; i < locks.length; ++i) { locks[i].lock(); try { v = x += ~(v - i); } finally { locks[i].unlock(); } // Once in a while, do something more expensive if ((~i & 255) == 0) { sum += LoopHelpers.compute1(LoopHelpers.compute2(x)); } else sum += sum ^ x; } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/jtreg/util/concurrent/locks/Lock/0000755000000000000000000000000011652013243017017 5ustar jsr166/src/test/jtreg/util/concurrent/locks/Lock/FlakyMutex.java0000644000000000000000000001344011441006144021753 0ustar /* * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6503247 6574123 * @summary Test resilience to tryAcquire methods that throw * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; /** * This uses a variant of the standard Mutex demo, except with a * tryAcquire method that randomly throws various Throwable * subclasses. */ @SuppressWarnings({"deprecation", "serial"}) public class FlakyMutex implements Lock { static class MyError extends Error {} static class MyException extends Exception {} static class MyRuntimeException extends RuntimeException {} static final Random rnd = new Random(); static void maybeThrow() { switch (rnd.nextInt(10)) { case 0: throw new MyError(); case 1: throw new MyRuntimeException(); case 2: Thread.currentThread().stop(new MyException()); break; default: /* Do nothing */ break; } } static void checkThrowable(Throwable t) { check((t instanceof MyError) || (t instanceof MyException) || (t instanceof MyRuntimeException)); } static void realMain(String[] args) throws Throwable { final int nThreads = 3; final CyclicBarrier barrier = new CyclicBarrier(nThreads + 1); final FlakyMutex m = new FlakyMutex(); final ExecutorService es = Executors.newFixedThreadPool(nThreads); for (int i = 0; i < nThreads; i++) { es.submit(new Runnable() { public void run() { try { barrier.await(); for (int i = 0; i < 10000; i++) { for (;;) { try { m.lock(); break; } catch (Throwable t) { checkThrowable(t); } } try { check(! m.tryLock()); } catch (Throwable t) { checkThrowable(t); } try { check(! m.tryLock(1, TimeUnit.MICROSECONDS)); } catch (Throwable t) { checkThrowable(t); } m.unlock(); } } catch (Throwable t) { unexpected(t); }}});} barrier.await(); es.shutdown(); check(es.awaitTermination(10, TimeUnit.SECONDS)); } private static class FlakySync extends AbstractQueuedLongSynchronizer { private static final long serialVersionUID = -1L; public boolean isHeldExclusively() { return getState() == 1; } public boolean tryAcquire(long acquires) { // Sneak in some tests for queue state if (hasQueuedPredecessors()) check(getFirstQueuedThread() != Thread.currentThread()); if (getFirstQueuedThread() == Thread.currentThread()) { check(hasQueuedThreads()); check(!hasQueuedPredecessors()); } else { // Might be true, but only transiently do {} while (hasQueuedPredecessors() != hasQueuedThreads()); } maybeThrow(); return compareAndSetState(0, 1); } public boolean tryRelease(long releases) { setState(0); return true; } Condition newCondition() { return new ConditionObject(); } } private final FlakySync sync = new FlakySync(); public void lock() { sync.acquire(1); } public boolean tryLock() { return sync.tryAcquire(1); } public void lockInterruptibly() throws InterruptedException { sync.acquireInterruptibly(1); } public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException { return sync.tryAcquireNanos(1, unit.toNanos(timeout)); } public void unlock() { sync.release(1); } public Condition newCondition() { return sync.newCondition(); } public boolean isLocked() { return sync.isHeldExclusively(); } public boolean hasQueuedThreads() { return sync.hasQueuedThreads(); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/locks/Lock/TimedAcquire.java0000644000000000000000000000332611441006144022240 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* @test * @bug 6241823 * @summary Repeated timed tryAcquire shouldn't hang. */ import java.util.concurrent.*; public class TimedAcquire { public static void main(String[] args) throws Exception { for (Semaphore sem : new Semaphore[]{ new Semaphore(0), new Semaphore(0, false), new Semaphore(0, true)}) for (int delay : new int[] {0, 1}) for (int i = 0; i < 3; i++) if (sem.tryAcquire(delay, TimeUnit.MILLISECONDS)) throw new Error("Acquired Semaphore with no permits!"); System.out.println("Done!"); } } jsr166/src/test/jtreg/util/concurrent/locks/Lock/TimedAcquireLeak.java0000644000000000000000000002555211450166503023050 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6460501 6236036 6500694 6490770 * @summary Repeated failed timed waits shouldn't leak memory * @author Martin Buchholz */ import java.util.*; import java.util.regex.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; import static java.util.concurrent.TimeUnit.*; import java.io.*; public class TimedAcquireLeak { static String javahome() { String jh = System.getProperty("java.home"); return (jh.endsWith("jre")) ? jh.substring(0, jh.length() - 4) : jh; } static final File bin = new File(javahome(), "bin"); static String javaProgramPath(String programName) { return new File(bin, programName).getPath(); } static final String java = javaProgramPath("java"); static final String jmap = javaProgramPath("jmap"); static final String jps = javaProgramPath("jps"); static String outputOf(Reader r) throws IOException { final StringBuilder sb = new StringBuilder(); final char[] buf = new char[1024]; int n; while ((n = r.read(buf)) > 0) sb.append(buf, 0, n); return sb.toString(); } static String outputOf(InputStream is) throws IOException { return outputOf(new InputStreamReader(is, "UTF-8")); } static final ExecutorService drainers = Executors.newFixedThreadPool(12); static Future futureOutputOf(final InputStream is) { return drainers.submit( new Callable() { public String call() throws IOException { return outputOf(is); }});} static String outputOf(final Process p) { try { Future outputFuture = futureOutputOf(p.getInputStream()); Future errorFuture = futureOutputOf(p.getErrorStream()); final String output = outputFuture.get(); final String error = errorFuture.get(); // Check for successful process completion equal(error, ""); equal(p.waitFor(), 0); equal(p.exitValue(), 0); return output; } catch (Throwable t) { unexpected(t); throw new Error(t); } } static String commandOutputOf(String... cmd) { try { return outputOf(new ProcessBuilder(cmd).start()); } catch (Throwable t) { unexpected(t); throw new Error(t); } } // To be called exactly twice by the parent process static T rendezvousParent(Process p, Callable callable) throws Throwable { p.getInputStream().read(); T result = callable.call(); OutputStream os = p.getOutputStream(); os.write((byte)'\n'); os.flush(); return result; } // To be called exactly twice by the child process public static void rendezvousChild() { try { for (int i = 0; i < 100; i++) { System.gc(); System.runFinalization(); Thread.sleep(50); } System.out.write((byte)'\n'); System.out.flush(); System.in.read(); } catch (Throwable t) { throw new Error(t); } } static String match(String s, String regex, int group) { Matcher matcher = Pattern.compile(regex).matcher(s); matcher.find(); return matcher.group(group); } static int objectsInUse(final Process child, final String childPid, final String className) { final String regex = "(?m)^ *[0-9]+: +([0-9]+) +[0-9]+ +\\Q"+className+"\\E$"; final Callable objectsInUse = new Callable() { public Integer call() { Integer i = Integer.parseInt( match(commandOutputOf(jmap, "-histo:live", childPid), regex, 1)); if (i > 100) System.out.print( commandOutputOf(jmap, "-dump:file=dump,format=b", childPid)); return i; }}; try { return rendezvousParent(child, objectsInUse); } catch (Throwable t) { unexpected(t); return -1; } } static void realMain(String[] args) throws Throwable { // jmap doesn't work on Windows if (System.getProperty("os.name").startsWith("Windows")) return; final String childClassName = Job.class.getName(); final String classToCheckForLeaks = Job.classToCheckForLeaks(); final String uniqueID = String.valueOf(new Random().nextInt(Integer.MAX_VALUE)); final String[] jobCmd = { java, "-Xmx8m", "-classpath", System.getProperty("test.classes", "."), childClassName, uniqueID }; final Process p = new ProcessBuilder(jobCmd).start(); final String childPid = match(commandOutputOf(jps, "-m"), "(?m)^ *([0-9]+) +\\Q"+childClassName+"\\E *"+uniqueID+"$", 1); final int n0 = objectsInUse(p, childPid, classToCheckForLeaks); final int n1 = objectsInUse(p, childPid, classToCheckForLeaks); equal(p.waitFor(), 0); equal(p.exitValue(), 0); failed += p.exitValue(); // Check that no objects were leaked. System.out.printf("%d -> %d%n", n0, n1); check(Math.abs(n1 - n0) < 2); // Almost always n0 == n1 check(n1 < 20); drainers.shutdown(); } //---------------------------------------------------------------- // The main class of the child process. // Job's job is to: // - provide the name of a class to check for leaks. // - call rendezvousChild exactly twice, while quiescent. // - in between calls to rendezvousChild, run code that may leak. //---------------------------------------------------------------- public static class Job { static String classToCheckForLeaks() { return "java.util.concurrent.locks.AbstractQueuedSynchronizer$Node"; } public static void main(String[] args) throws Throwable { final ReentrantLock lock = new ReentrantLock(); lock.lock(); final ReentrantReadWriteLock rwlock = new ReentrantReadWriteLock(); final ReentrantReadWriteLock.ReadLock readLock = rwlock.readLock(); final ReentrantReadWriteLock.WriteLock writeLock = rwlock.writeLock(); rwlock.writeLock().lock(); final BlockingQueue q = new LinkedBlockingQueue(); final Semaphore fairSem = new Semaphore(0, true); final Semaphore unfairSem = new Semaphore(0, false); //final int threads = //rnd.nextInt(Runtime.getRuntime().availableProcessors() + 1) + 1; final int threads = 3; // On Linux, this test runs very slowly for some reason, // so use a smaller number of iterations. // Solaris can handle 1 << 18. // On the other hand, jmap is much slower on Solaris... final int iterations = 1 << 8; final CyclicBarrier cb = new CyclicBarrier(threads+1); for (int i = 0; i < threads; i++) new Thread() { public void run() { try { final Random rnd = new Random(); for (int j = 0; j < iterations; j++) { if (j == iterations/10 || j == iterations - 1) { cb.await(); // Quiesce cb.await(); // Resume } //int t = rnd.nextInt(2000); int t = rnd.nextInt(900); check(! lock.tryLock(t, NANOSECONDS)); check(! readLock.tryLock(t, NANOSECONDS)); check(! writeLock.tryLock(t, NANOSECONDS)); equal(null, q.poll(t, NANOSECONDS)); check(! fairSem.tryAcquire(t, NANOSECONDS)); check(! unfairSem.tryAcquire(t, NANOSECONDS)); } } catch (Throwable t) { unexpected(t); } }}.start(); cb.await(); // Quiesce rendezvousChild(); // Measure cb.await(); // Resume cb.await(); // Quiesce rendezvousChild(); // Measure cb.await(); // Resume System.exit(failed); } // If something goes wrong, we might never see it, since IO // streams are connected to the parent. So we need a special // purpose print method to debug Jobs. static void debugPrintf(String format, Object... args) { try { new PrintStream(new FileOutputStream("/dev/tty")) .printf(format, args); } catch (Throwable t) { throw new Error(t); } } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void check(boolean cond, String m) {if (cond) pass(); else fail(m);} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/locks/Lock/CheckedLockLoops.java0000644000000000000000000002730711537741071023060 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 CheckedLockLoops.java * @run main/timeout=7200 CheckedLockLoops * @summary basic safety and liveness of ReentrantLocks, and other locks based on them */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class CheckedLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static boolean doBuiltin = false; public static void main(String[] args) throws Exception { int maxThreads = 5; int iters = 100000; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); rng.setSeed(3122688L); print = false; System.out.println("Warmup..."); oneTest(3, 10000); Thread.sleep(1000); oneTest(2, 10000); Thread.sleep(100); oneTest(1, 100000); Thread.sleep(100); oneTest(1, 100000); Thread.sleep(1000); print = true; for (int i = 1; i <= maxThreads; i += (i+1) >>> 1) { System.out.println("Threads:" + i); oneTest(i, iters / i); Thread.sleep(100); } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static void oneTest(int nthreads, int iters) throws Exception { int v = rng.next(); if (doBuiltin) { if (print) System.out.print("builtin lock "); new BuiltinLockLoop().test(v, nthreads, iters); Thread.sleep(10); } if (print) System.out.print("ReentrantLock "); new ReentrantLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("Mutex "); new MutexLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("ReentrantWriteLock "); new ReentrantWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("ReentrantReadWriteLock"); new ReentrantReadWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("Semaphore "); new SemaphoreLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("fair Semaphore "); new FairSemaphoreLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairReentrantLock "); new FairReentrantLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairRWriteLock "); new FairReentrantWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairRReadWriteLock "); new FairReentrantReadWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); } abstract static class LockLoop implements Runnable { int value; int checkValue; int iters; volatile int result; final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier; final int setValue(int v) { checkValue = v ^ 0x55555555; value = v; return v; } final int getValue() { int v = value; if (checkValue != ~(v ^ 0xAAAAAAAA)) throw new Error("lock protection failure"); return v; } final void test(int initialValue, int nthreads, int iters) throws Exception { setValue(initialValue); this.iters = iters; barrier = new CyclicBarrier(nthreads+1, timer); for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); long time = timer.getTime(); if (print) { long tpi = time / (iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per update"); // double secs = (double)(time) / 1000000000.0; // System.out.print("\t " + secs + "s run time"); System.out.println(); } if (result == 0) // avoid overoptimization System.out.println("useless result: " + result); } abstract int loop(int n); public final void run() { try { barrier.await(); result += loop(iters); barrier.await(); } catch (Exception ie) { return; } } } private static class BuiltinLockLoop extends LockLoop { final int loop(int n) { int sum = 0; int x = 0; while (n-- > 0) { synchronized (this) { x = setValue(LoopHelpers.compute1(getValue())); } sum += LoopHelpers.compute2(x); } return sum; } } private static class ReentrantLockLoop extends LockLoop { private final ReentrantLock lock = new ReentrantLock(); final int loop(int n) { final ReentrantLock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class MutexLoop extends LockLoop { private final Mutex lock = new Mutex(); final int loop(int n) { final Mutex lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class FairReentrantLockLoop extends LockLoop { private final ReentrantLock lock = new ReentrantLock(true); final int loop(int n) { final ReentrantLock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class ReentrantWriteLockLoop extends LockLoop { private final Lock lock = new ReentrantReadWriteLock().writeLock(); final int loop(int n) { final Lock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class FairReentrantWriteLockLoop extends LockLoop { final Lock lock = new ReentrantReadWriteLock(true).writeLock(); final int loop(int n) { final Lock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class SemaphoreLoop extends LockLoop { private final Semaphore sem = new Semaphore(1, false); final int loop(int n) { final Semaphore sem = this.sem; int sum = 0; int x = 0; while (n-- > 0) { sem.acquireUninterruptibly(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { sem.release(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class FairSemaphoreLoop extends LockLoop { private final Semaphore sem = new Semaphore(1, true); final int loop(int n) { final Semaphore sem = this.sem; int sum = 0; int x = 0; while (n-- > 0) { sem.acquireUninterruptibly(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { sem.release(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class ReentrantReadWriteLockLoop extends LockLoop { private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final int loop(int n) { final Lock rlock = lock.readLock(); final Lock wlock = lock.writeLock(); int sum = 0; int x = 0; while (n-- > 0) { if ((n & 16) != 0) { rlock.lock(); try { x = LoopHelpers.compute1(getValue()); x = LoopHelpers.compute2(x); } finally { rlock.unlock(); } } else { wlock.lock(); try { setValue(x); } finally { wlock.unlock(); } sum += LoopHelpers.compute2(x); } } return sum; } } private static class FairReentrantReadWriteLockLoop extends LockLoop { private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); final int loop(int n) { final Lock rlock = lock.readLock(); final Lock wlock = lock.writeLock(); int sum = 0; int x = 0; while (n-- > 0) { if ((n & 16) != 0) { rlock.lock(); try { x = LoopHelpers.compute1(getValue()); x = LoopHelpers.compute2(x); } finally { rlock.unlock(); } } else { wlock.lock(); try { setValue(x); } finally { wlock.unlock(); } sum += LoopHelpers.compute2(x); } } return sum; } } } jsr166/src/test/jtreg/util/concurrent/locks/Lock/Mutex.java0000644000000000000000000000347311537741071021004 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.*; import java.io.*; /** * A sample user extension of AbstractQueuedSynchronizer. */ public class Mutex implements Lock, java.io.Serializable { private static class Sync extends AbstractQueuedSynchronizer { public boolean isHeldExclusively() { return getState() == 1; } public boolean tryAcquire(int acquires) { assert acquires == 1; // Does not use multiple acquires return compareAndSetState(0, 1); } public boolean tryRelease(int releases) { setState(0); return true; } Condition newCondition() { return new ConditionObject(); } private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); setState(0); // reset to unlocked state } } private final Sync sync = new Sync(); public void lock() { sync.acquire(1); } public boolean tryLock() { return sync.tryAcquire(1); } public void lockInterruptibly() throws InterruptedException { sync.acquireInterruptibly(1); } public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException { return sync.tryAcquireNanos(1, unit.toNanos(timeout)); } public void unlock() { sync.release(1); } public Condition newCondition() { return sync.newCondition(); } public boolean isLocked() { return sync.isHeldExclusively(); } public boolean hasQueuedThreads() { return sync.hasQueuedThreads(); } } jsr166/src/test/jtreg/util/concurrent/locks/Lock/LoopHelpers.java0000644000000000000000000000542711537741071022137 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; class LoopHelpers { // Some mindless computation to do between synchronizations... /** * generates 32 bit pseudo-random numbers. * Adapted from http://www.snippets.org */ public static int compute1(int x) { int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } return lo; } /** * Computes a linear congruential random number a random number * of times. */ public static int compute2(int x) { int loops = (x >>> 4) & 7; while (loops-- > 0) { x = (x * 2147483647) % 16807; } return x; } /** * An actually useful random number generator, but unsynchronized. * Basically same as java.util.Random. */ public static class SimpleRandom { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong(1); private long seed = System.nanoTime() + seq.getAndIncrement(); public void setSeed(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } } public static class BarrierTimer implements Runnable { public volatile long startTime; public volatile long endTime; public void run() { long t = System.nanoTime(); if (startTime == 0) startTime = t; else endTime = t; } public void clear() { startTime = 0; endTime = 0; } public long getTime() { return endTime - startTime; } } public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; String num = Long.toString(n); if (num.length() >= field.length()) return num; StringBuffer b = new StringBuffer(field); b.replace(b.length()-num.length(), b.length(), num); return b.toString(); } } jsr166/src/test/jtreg/util/concurrent/locks/ReentrantReadWriteLock/0000755000000000000000000000000011652013243022511 5ustar jsr166/src/test/jtreg/util/concurrent/locks/ReentrantReadWriteLock/Bug6571733.java0000644000000000000000000000516511441006144024656 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6571733 6460501 * @summary Check that regaining a read lock succeeds after a write * lock attempt times out */ import java.util.concurrent.locks.*; import java.util.concurrent.*; public class Bug6571733 { void test(String[] args) throws Throwable { test(true); test(false); } void test(boolean fairness) throws Throwable { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(fairness); // obtain read lock lock.readLock().lock(); Thread thread = new Thread() { public void run() { try { check(! lock.writeLock().tryLock(0, TimeUnit.DAYS)); lock.readLock().lock(); lock.readLock().unlock(); } catch (Throwable t) { unexpected(t); }}}; thread.start(); thread.join(); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} public static void main(String[] args) throws Throwable { new Bug6571733().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/locks/ReentrantReadWriteLock/RWMap.java0000644000000000000000000000554011537741071024357 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; /** * This is an incomplete implementation of a wrapper class * that places read-write locks around unsynchronized Maps. * Exists as a sample input for MapLoops test. */ public class RWMap implements Map { private final Map m; private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); public RWMap(Map m) { if (m == null) throw new NullPointerException(); this.m = m; } public RWMap() { this(new TreeMap()); // use TreeMap by default } public int size() { rwl.readLock().lock(); try { return m.size(); } finally { rwl.readLock().unlock(); } } public boolean isEmpty() { rwl.readLock().lock(); try { return m.isEmpty(); } finally { rwl.readLock().unlock(); } } public Object get(Object key) { rwl.readLock().lock(); try { return m.get(key); } finally { rwl.readLock().unlock(); } } public boolean containsKey(Object key) { rwl.readLock().lock(); try { return m.containsKey(key); } finally { rwl.readLock().unlock(); } } public boolean containsValue(Object value) { rwl.readLock().lock(); try { return m.containsValue(value); } finally { rwl.readLock().unlock(); } } public Set keySet() { // Not implemented return null; } public Set entrySet() { // Not implemented return null; } public Collection values() { // Not implemented return null; } public boolean equals(Object o) { rwl.readLock().lock(); try { return m.equals(o); } finally { rwl.readLock().unlock(); } } public int hashCode() { rwl.readLock().lock(); try { return m.hashCode(); } finally { rwl.readLock().unlock(); } } public String toString() { rwl.readLock().lock(); try { return m.toString(); } finally { rwl.readLock().unlock(); } } public Object put(Object key, Object value) { rwl.writeLock().lock(); try { return m.put(key, value); } finally { rwl.writeLock().unlock(); } } public Object remove(Object key) { rwl.writeLock().lock(); try { return m.remove(key); } finally { rwl.writeLock().unlock(); } } public void putAll(Map map) { rwl.writeLock().lock(); try { m.putAll(map); } finally { rwl.writeLock().unlock(); } } public void clear() { rwl.writeLock().lock(); try { m.clear(); } finally { rwl.writeLock().unlock(); } } } jsr166/src/test/jtreg/util/concurrent/locks/ReentrantReadWriteLock/Count.java0000644000000000000000000002015611441006144024446 0ustar /* * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6207928 6328220 6378321 6625723 * @summary Recursive lock invariant sanity checks * @author Martin Buchholz */ import java.io.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; // I am the Cownt, and I lahve to cownt. public class Count { final Random rnd = new Random(); void lock(Lock lock) { try { switch (rnd.nextInt(4)) { case 0: lock.lock(); break; case 1: lock.lockInterruptibly(); break; case 2: check(lock.tryLock()); break; case 3: check(lock.tryLock(45, TimeUnit.MINUTES)); break; } } catch (Throwable t) { unexpected(t); } } void test(String[] args) throws Throwable { for (boolean fair : new boolean[] { true, false }) for (boolean serialClone : new boolean[] { true, false }) { testReentrantLocks(fair, serialClone); testConcurrentReadLocks(fair, serialClone); } } void testConcurrentReadLocks(final boolean fair, final boolean serialClone) throws Throwable { final int nThreads = 10; final CyclicBarrier barrier = new CyclicBarrier(nThreads); final ExecutorService es = Executors.newFixedThreadPool(nThreads); final ReentrantReadWriteLock rwl = serialClone ? serialClone(new ReentrantReadWriteLock(fair)) : new ReentrantReadWriteLock(fair); for (int i = 0; i < nThreads; i++) { es.submit(new Runnable() { public void run() { try { int n = 5; for (int i = 0; i < n; i++) { barrier.await(); equal(rwl.getReadHoldCount(), i); equal(rwl.getWriteHoldCount(), 0); check(! rwl.isWriteLocked()); equal(rwl.getReadLockCount(), nThreads * i); barrier.await(); lock(rwl.readLock()); } for (int i = 0; i < n; i++) { rwl.readLock().unlock(); barrier.await(); equal(rwl.getReadHoldCount(), n-i-1); equal(rwl.getReadLockCount(), nThreads*(n-i-1)); equal(rwl.getWriteHoldCount(), 0); check(! rwl.isWriteLocked()); barrier.await(); } THROWS(IllegalMonitorStateException.class, new F(){void f(){rwl.readLock().unlock();}}, new F(){void f(){rwl.writeLock().unlock();}}); barrier.await(); } catch (Throwable t) { unexpected(t); }}});} es.shutdown(); check(es.awaitTermination(10, TimeUnit.SECONDS)); } void testReentrantLocks(final boolean fair, final boolean serialClone) throws Throwable { final ReentrantLock rl = serialClone ? serialClone(new ReentrantLock(fair)) : new ReentrantLock(fair); final ReentrantReadWriteLock rwl = serialClone ? serialClone(new ReentrantReadWriteLock(fair)) : new ReentrantReadWriteLock(fair); final int depth = 10; equal(rl.isFair(), fair); equal(rwl.isFair(), fair); check(! rl.isLocked()); check(! rwl.isWriteLocked()); check(! rl.isHeldByCurrentThread()); check(! rwl.isWriteLockedByCurrentThread()); check(! rwl.writeLock().isHeldByCurrentThread()); for (int i = 0; i < depth; i++) { equal(rl.getHoldCount(), i); equal(rwl.getReadLockCount(), i); equal(rwl.getReadHoldCount(), i); equal(rwl.getWriteHoldCount(), i); equal(rwl.writeLock().getHoldCount(), i); equal(rl.isLocked(), i > 0); equal(rwl.isWriteLocked(), i > 0); lock(rl); lock(rwl.writeLock()); lock(rwl.readLock()); } for (int i = depth; i > 0; i--) { check(! rl.hasQueuedThreads()); check(! rwl.hasQueuedThreads()); check(! rl.hasQueuedThread(Thread.currentThread())); check(! rwl.hasQueuedThread(Thread.currentThread())); check(rl.isLocked()); check(rwl.isWriteLocked()); check(rl.isHeldByCurrentThread()); check(rwl.isWriteLockedByCurrentThread()); check(rwl.writeLock().isHeldByCurrentThread()); equal(rl.getQueueLength(), 0); equal(rwl.getQueueLength(), 0); equal(rwl.getReadLockCount(), i); equal(rl.getHoldCount(), i); equal(rwl.getReadHoldCount(), i); equal(rwl.getWriteHoldCount(), i); equal(rwl.writeLock().getHoldCount(), i); rwl.readLock().unlock(); rwl.writeLock().unlock(); rl.unlock(); } THROWS(IllegalMonitorStateException.class, new F(){void f(){rl.unlock();}}, new F(){void f(){rwl.readLock().unlock();}}, new F(){void f(){rwl.writeLock().unlock();}}); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new Count().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} void THROWS(Class k, F... fs) { for (F f : fs) try {f.f(); fail("Expected " + k.getName() + " not thrown");} catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} static byte[] serializedForm(Object obj) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); new ObjectOutputStream(baos).writeObject(obj); return baos.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); }} static Object readObject(byte[] bytes) throws IOException, ClassNotFoundException { InputStream is = new ByteArrayInputStream(bytes); return new ObjectInputStream(is).readObject();} @SuppressWarnings("unchecked") static T serialClone(T obj) { try { return (T) readObject(serializedForm(obj)); } catch (Exception e) { throw new RuntimeException(e); }} } jsr166/src/test/jtreg/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java0000644000000000000000000000542611537741071025630 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; class LoopHelpers { // Some mindless computation to do between synchronizations... /** * generates 32 bit pseudo-random numbers. * Adapted from http://www.snippets.org */ public static int compute1(int x) { int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } return lo; } /** * Computes a linear congruential random number a random number * of times. */ public static int compute2(int x) { int loops = (x >>> 4) & 7; while (loops-- > 0) { x = (x * 2147483647) % 16807; } return x; } /** * An actually useful random number generator, but unsynchronized. * Basically same as java.util.Random. */ public static class SimpleRandom { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong(1); private long seed = System.nanoTime() + seq.getAndIncrement(); public void setSeed(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } } public static class BarrierTimer implements Runnable { public volatile long startTime; public volatile long endTime; public void run() { long t = System.nanoTime(); if (startTime == 0) startTime = t; else endTime = t; } public void clear() { startTime = 0; endTime = 0; } public long getTime() { return endTime - startTime; } } public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; String num = Long.toString(n); if (num.length() >= field.length()) return num; StringBuffer b = new StringBuffer(field); b.replace(b.length()-num.length(), b.length(), num); return b.toString(); } } jsr166/src/test/jtreg/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java0000644000000000000000000001271611537741071025126 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 MapLoops.java * @run main/timeout=4700 MapLoops * @summary Exercise multithreaded maps, by default ConcurrentHashMap. * Multithreaded hash table test. Each thread does a random walk * though elements of "key" array. On each iteration, it checks if * table includes key. If absent, with probability pinsert it * inserts it, and if present, with probability premove it removes * it. (pinsert and premove are expressed as percentages to simplify * parsing from command line.) */ import java.util.*; import java.util.concurrent.*; public class MapLoops { static final int NKEYS = 100000; static int pinsert = 60; static int premove = 2; static int maxThreads = 5; static int nops = 1000000; static int removesPerMaxRandom; static int insertsPerMaxRandom; static final ExecutorService pool = Executors.newCachedThreadPool(); public static void main(String[] args) throws Exception { Class mapClass = null; if (args.length > 0) { try { mapClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } else mapClass = RWMap.class; if (args.length > 1) maxThreads = Integer.parseInt(args[1]); if (args.length > 2) nops = Integer.parseInt(args[2]); if (args.length > 3) pinsert = Integer.parseInt(args[3]); if (args.length > 4) premove = Integer.parseInt(args[4]); // normalize probabilities wrt random number generator removesPerMaxRandom = (int)(((double)premove/100.0 * 0x7FFFFFFFL)); insertsPerMaxRandom = (int)(((double)pinsert/100.0 * 0x7FFFFFFFL)); System.out.println("Using " + mapClass.getName()); Random rng = new Random(315312); Integer[] key = new Integer[NKEYS]; for (int i = 0; i < key.length; ++i) key[i] = new Integer(rng.nextInt()); // warmup System.out.println("Warmup..."); for (int k = 0; k < 2; ++k) { Map map = (Map)mapClass.newInstance(); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(1, timer); new Runner(map, key, barrier).run(); map.clear(); Thread.sleep(100); } for (int i = 1; i <= maxThreads; i += (i+1) >>> 1) { System.out.print("Threads: " + i + "\t:"); Map map = (Map)mapClass.newInstance(); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(i+1, timer); for (int k = 0; k < i; ++k) pool.execute(new Runner(map, key, barrier)); barrier.await(); barrier.await(); long time = timer.getTime(); long tpo = time / (i * (long)nops); System.out.print(LoopHelpers.rightJustify(tpo) + " ns per op"); double secs = (double)(time) / 1000000000.0; System.out.println("\t " + secs + "s run time"); map.clear(); } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static class Runner implements Runnable { final Map map; final Integer[] key; final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); final CyclicBarrier barrier; int position; int total; Runner(Map map, Integer[] key, CyclicBarrier barrier) { this.map = map; this.key = key; this.barrier = barrier; position = key.length / 2; } int step() { // random-walk around key positions, bunching accesses int r = rng.next(); position += (r & 7) - 3; while (position >= key.length) position -= key.length; while (position < 0) position += key.length; Integer k = key[position]; Integer x = map.get(k); if (x != null) { if (x.intValue() != k.intValue()) throw new Error("bad mapping: " + x + " to " + k); if (r < removesPerMaxRandom) { // get awy from this position position = r % key.length; map.remove(k); return 2; } else total += LoopHelpers.compute2(LoopHelpers.compute1(x.intValue())); } else { if (r < insertsPerMaxRandom) { map.put(k, k); return 2; } } return 1; } public void run() { try { barrier.await(); int ops = nops; while (ops > 0) ops -= step(); barrier.await(); } catch (Exception ex) { ex.printStackTrace(); } } } } jsr166/src/test/jtreg/util/concurrent/ConcurrentMap/0000755000000000000000000000000011652013243017574 5ustar jsr166/src/test/jtreg/util/concurrent/ConcurrentMap/ConcurrentModification.java0000644000000000000000000000626111441006144025112 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6312056 4155650 4294891 4904074 * @summary Reasonable things should happen if mutating while iterating. */ import java.util.*; import java.util.concurrent.*; public class ConcurrentModification { static volatile int passed = 0, failed = 0; static void fail(String msg) { failed++; new AssertionError(msg).printStackTrace(); } static void unexpected(Throwable t) { failed++; t.printStackTrace(); } static void check(boolean condition, String msg) { if (condition) passed++; else fail(msg); } static void check(boolean condition) { check(condition, "Assertion failed"); } private static void test(ConcurrentMap m) { try { m.clear(); check(m.isEmpty()); m.put(1,2); Iterator> it = m.entrySet().iterator(); if (it.hasNext()) { m.remove(1); // sneaky Map.Entry e = it.next(); check(m.isEmpty()); check(e.getKey() == 1); check(e.getValue() == 2); } } catch (Throwable t) {unexpected(t);} try { m.clear(); check(m.isEmpty()); m.put(1,2); Iterator> it = m.entrySet().iterator(); if (it.hasNext()) { m.put(1,3); // sneaky Map.Entry e = it.next(); check(e.getKey() == 1); check(e.getValue() == 2 || e.getValue() == 3); if (m instanceof ConcurrentHashMap) { e.setValue(4); check(m.get(1) == 4); } } } catch (Throwable t) {unexpected(t);} } public static void main(String[] args) { test(new ConcurrentHashMap()); test(new ConcurrentSkipListMap()); System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Error("Some tests failed"); } } jsr166/src/test/jtreg/util/concurrent/Semaphore/0000755000000000000000000000000011652013243016737 5ustar jsr166/src/test/jtreg/util/concurrent/Semaphore/PermitOverflow.java0000644000000000000000000000457111537741071022606 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6941130 * @summary Numeric overflow/underflow of permits causes Error throw */ import java.util.concurrent.Semaphore; public class PermitOverflow { public static void main(String[] args) throws Throwable { for (boolean fair : new boolean[] { true, false }) { Semaphore sem = new Semaphore(Integer.MAX_VALUE - 1, fair); if (sem.availablePermits() != Integer.MAX_VALUE - 1) throw new RuntimeException(); try { sem.release(2); throw new RuntimeException(); } catch (Error expected) { } sem.release(1); if (sem.availablePermits() != Integer.MAX_VALUE) throw new RuntimeException(); try { sem.release(1); throw new RuntimeException(); } catch (Error expected) { } try { sem.release(Integer.MAX_VALUE); throw new RuntimeException(); } catch (Error expected) { } } class Sem extends Semaphore { public Sem(int permits, boolean fair) { super(permits, fair); } public void reducePermits(int reduction) { super.reducePermits(reduction); } } for (boolean fair : new boolean[] { true, false }) { Sem sem = new Sem(Integer.MIN_VALUE + 1, fair); if (sem.availablePermits() != Integer.MIN_VALUE + 1) throw new RuntimeException(); try { sem.reducePermits(2); throw new RuntimeException(); } catch (Error expected) { } sem.reducePermits(1); if (sem.availablePermits() != Integer.MIN_VALUE) throw new RuntimeException(); try { sem.reducePermits(1); throw new RuntimeException(); } catch (Error expected) { } try { sem.reducePermits(Integer.MAX_VALUE); throw new RuntimeException(); } catch (Error expected) { } } } } jsr166/src/test/jtreg/util/concurrent/Semaphore/RacingReleases.java0000644000000000000000000000646711537741071022517 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6801020 6803402 * @summary Try to tickle race conditions in * AbstractQueuedSynchronizer "shared" code */ import java.util.concurrent.Semaphore; public class RacingReleases { /** Increase this for better chance of tickling races */ static final int iterations = 1000; public static void test(final boolean fair, final boolean interruptibly) throws Throwable { for (int i = 0; i < iterations; i++) { final Semaphore sem = new Semaphore(0, fair); final Throwable[] badness = new Throwable[1]; Runnable blocker = interruptibly ? new Runnable() { public void run() { try { sem.acquire(); } catch (Throwable t) { badness[0] = t; throw new Error(t); }}} : new Runnable() { public void run() { try { sem.acquireUninterruptibly(); } catch (Throwable t) { badness[0] = t; throw new Error(t); }}}; Thread b1 = new Thread(blocker); Thread b2 = new Thread(blocker); Runnable signaller = new Runnable() { public void run() { try { sem.release(); } catch (Throwable t) { badness[0] = t; throw new Error(t); }}}; Thread s1 = new Thread(signaller); Thread s2 = new Thread(signaller); Thread[] threads = { b1, b2, s1, s2 }; java.util.Collections.shuffle(java.util.Arrays.asList(threads)); for (Thread thread : threads) thread.start(); for (Thread thread : threads) { thread.join(60 * 1000); if (thread.isAlive()) throw new Error (String.format ("Semaphore stuck: permits %d, thread waiting %s%n", sem.availablePermits(), sem.hasQueuedThreads() ? "true" : "false")); } if (badness[0] != null) throw new Error(badness[0]); if (sem.availablePermits() != 0) throw new Error(String.valueOf(sem.availablePermits())); if (sem.hasQueuedThreads()) throw new Error(String.valueOf(sem.hasQueuedThreads())); if (sem.getQueueLength() != 0) throw new Error(String.valueOf(sem.getQueueLength())); if (sem.isFair() != fair) throw new Error(String.valueOf(sem.isFair())); } } public static void main(String[] args) throws Throwable { for (boolean fair : new boolean[] { true, false }) for (boolean interruptibly : new boolean[] { true, false }) test(fair, interruptibly); } } jsr166/src/test/jtreg/util/concurrent/ConcurrentHashMap/0000755000000000000000000000000011652013243020400 5ustar jsr166/src/test/jtreg/util/concurrent/ConcurrentHashMap/toArray.java0000644000000000000000000000547411441006144022674 0ustar /* * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4486658 * @summary thread safety of toArray methods of subCollections * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class toArray { public static void main(String[] args) throws Throwable { final Throwable throwable[] = new Throwable[1]; final int maxSize = 1000; final ConcurrentHashMap m = new ConcurrentHashMap(); final Thread t1 = new Thread() { public void run() { for (int i = 0; i < maxSize; i++) m.put(i,i);}}; final Thread t2 = new Thread() { public Throwable exception = null; private int prevSize = 0; private boolean checkProgress(Object[] a) { int size = a.length; if (size < prevSize) throw new RuntimeException("WRONG WAY"); if (size > maxSize) throw new RuntimeException("OVERSHOOT"); if (size == maxSize) return true; prevSize = size; return false; } public void run() { try { Integer[] empty = new Integer[0]; while (true) { if (checkProgress(m.values().toArray())) return; if (checkProgress(m.keySet().toArray())) return; if (checkProgress(m.values().toArray(empty))) return; if (checkProgress(m.keySet().toArray(empty))) return; } } catch (Throwable t) { throwable[0] = t; }}}; t2.start(); t1.start(); t1.join(); t2.join(); if (throwable[0] != null) throw throwable[0]; } } jsr166/src/test/jtreg/util/concurrent/ConcurrentHashMap/MapCheck.java0000644000000000000000000004215411537741070022734 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 MapCheck.java * @run main/timeout=240 MapCheck * @summary Times and checks basic map operations */ import java.util.*; import java.io.*; public class MapCheck { static final int absentSize = 1 << 17; static final int absentMask = absentSize - 1; static Object[] absent = new Object[absentSize]; static final Object MISSING = new Object(); static TestTimer timer = new TestTimer(); static void reallyAssert(boolean b) { if (!b) throw new Error("Failed Assertion"); } public static void main(String[] args) throws Exception { Class mapClass = java.util.concurrent.ConcurrentHashMap.class; int numTests = 8; int size = 50000; if (args.length > 0) { try { mapClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } if (args.length > 1) numTests = Integer.parseInt(args[1]); if (args.length > 2) size = Integer.parseInt(args[2]); boolean doSerializeTest = args.length > 3; System.out.println("Testing " + mapClass.getName() + " trials: " + numTests + " size: " + size); for (int i = 0; i < absentSize; ++i) absent[i] = new Object(); Object[] key = new Object[size]; for (int i = 0; i < size; ++i) key[i] = new Object(); forceMem(size * 8); for (int rep = 0; rep < numTests; ++rep) { runTest(newMap(mapClass), key); } TestTimer.printStats(); if (doSerializeTest) stest(newMap(mapClass), size); } static Map newMap(Class cl) { try { Map m = (Map)cl.newInstance(); return m; } catch (Exception e) { throw new RuntimeException("Can't instantiate " + cl + ": " + e); } } static void runTest(Map s, Object[] key) { shuffle(key); int size = key.length; long startTime = System.currentTimeMillis(); test(s, key); long time = System.currentTimeMillis() - startTime; } static void forceMem(int n) { // force enough memory Long[] junk = new Long[n]; for (int i = 0; i < junk.length; ++i) junk[i] = new Long(i); int sum = 0; for (int i = 0; i < junk.length; ++i) sum += (int)(junk[i].longValue() + i); if (sum == 0) System.out.println("Useless number = " + sum); junk = null; // System.gc(); } static void t1(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; int iters = 4; timer.start(nm, n * iters); for (int j = 0; j < iters; ++j) { for (int i = 0; i < n; i++) { if (s.get(key[i]) != null) ++sum; } } timer.finish(); reallyAssert(sum == expect * iters); } static void t2(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.remove(key[i]) != null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t3(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.put(key[i], absent[i & absentMask]) == null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t4(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.containsKey(key[i])) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t5(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; timer.start(nm, n/2); for (int i = n-2; i >= 0; i-=2) { if (s.remove(key[i]) != null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t6(String nm, int n, Map s, Object[] k1, Object[] k2) { int sum = 0; timer.start(nm, n * 2); for (int i = 0; i < n; i++) { if (s.get(k1[i]) != null) ++sum; if (s.get(k2[i & absentMask]) != null) ++sum; } timer.finish(); reallyAssert(sum == n); } static void t7(String nm, int n, Map s, Object[] k1, Object[] k2) { int sum = 0; timer.start(nm, n * 2); for (int i = 0; i < n; i++) { if (s.containsKey(k1[i])) ++sum; if (s.containsKey(k2[i & absentMask])) ++sum; } timer.finish(); reallyAssert(sum == n); } static void t8(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.get(key[i]) != null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t9(Map s) { int sum = 0; int iters = 20; timer.start("ContainsValue (/n) ", iters * s.size()); int step = absentSize / iters; for (int i = 0; i < absentSize; i += step) if (s.containsValue(absent[i])) ++sum; timer.finish(); reallyAssert(sum != 0); } static void ktest(Map s, int size, Object[] key) { timer.start("ContainsKey ", size); Set ks = s.keySet(); int sum = 0; for (int i = 0; i < size; i++) { if (ks.contains(key[i])) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest1(Map s, int size) { int sum = 0; timer.start("Iter Key ", size); for (Iterator it = s.keySet().iterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest2(Map s, int size) { int sum = 0; timer.start("Iter Value ", size); for (Iterator it = s.values().iterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest3(Map s, int size) { int sum = 0; timer.start("Iter Entry ", size); for (Iterator it = s.entrySet().iterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest4(Map s, int size, int pos) { IdentityHashMap seen = new IdentityHashMap(size); reallyAssert(s.size() == size); int sum = 0; timer.start("Iter XEntry ", size); Iterator it = s.entrySet().iterator(); Object k = null; Object v = null; for (int i = 0; i < size-pos; ++i) { Map.Entry x = (Map.Entry)(it.next()); k = x.getKey(); v = x.getValue(); seen.put(k, k); if (x != MISSING) ++sum; } reallyAssert(s.containsKey(k)); it.remove(); reallyAssert(!s.containsKey(k)); while (it.hasNext()) { Map.Entry x = (Map.Entry)(it.next()); Object k2 = x.getKey(); seen.put(k2, k2); if (x != MISSING) ++sum; } reallyAssert(s.size() == size-1); s.put(k, v); reallyAssert(seen.size() == size); timer.finish(); reallyAssert(sum == size); reallyAssert(s.size() == size); } static void ittest(Map s, int size) { ittest1(s, size); ittest2(s, size); ittest3(s, size); // for (int i = 0; i < size-1; ++i) // ittest4(s, size, i); } static void entest1(Hashtable ht, int size) { int sum = 0; timer.start("Iter Enumeration Key ", size); for (Enumeration en = ht.keys(); en.hasMoreElements(); ) { if (en.nextElement() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void entest2(Hashtable ht, int size) { int sum = 0; timer.start("Iter Enumeration Value ", size); for (Enumeration en = ht.elements(); en.hasMoreElements(); ) { if (en.nextElement() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void entest3(Hashtable ht, int size) { int sum = 0; timer.start("Iterf Enumeration Key ", size); Enumeration en = ht.keys(); for (int i = 0; i < size; ++i) { if (en.nextElement() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void entest4(Hashtable ht, int size) { int sum = 0; timer.start("Iterf Enumeration Value", size); Enumeration en = ht.elements(); for (int i = 0; i < size; ++i) { if (en.nextElement() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void entest(Map s, int size) { if (s instanceof Hashtable) { Hashtable ht = (Hashtable)s; // entest3(ht, size); // entest4(ht, size); entest1(ht, size); entest2(ht, size); entest1(ht, size); entest2(ht, size); entest1(ht, size); entest2(ht, size); } } static void rtest(Map s, int size) { timer.start("Remove (iterator) ", size); for (Iterator it = s.keySet().iterator(); it.hasNext(); ) { it.next(); it.remove(); } timer.finish(); } static void rvtest(Map s, int size) { timer.start("Remove (iterator) ", size); for (Iterator it = s.values().iterator(); it.hasNext(); ) { it.next(); it.remove(); } timer.finish(); } static void dtest(Map s, int size, Object[] key) { timer.start("Put (putAll) ", size * 2); Map s2 = null; try { s2 = (Map) (s.getClass().newInstance()); s2.putAll(s); } catch (Exception e) { e.printStackTrace(); return; } timer.finish(); timer.start("Iter Equals ", size * 2); boolean eqt = s2.equals(s) && s.equals(s2); reallyAssert(eqt); timer.finish(); timer.start("Iter HashCode ", size * 2); int shc = s.hashCode(); int s2hc = s2.hashCode(); reallyAssert(shc == s2hc); timer.finish(); timer.start("Put (present) ", size); s2.putAll(s); timer.finish(); timer.start("Iter EntrySet contains ", size * 2); Set es2 = s2.entrySet(); int sum = 0; for (Iterator i1 = s.entrySet().iterator(); i1.hasNext(); ) { Object entry = i1.next(); if (es2.contains(entry)) ++sum; } timer.finish(); reallyAssert(sum == size); t6("Get ", size, s2, key, absent); Object hold = s2.get(key[size-1]); s2.put(key[size-1], absent[0]); timer.start("Iter Equals ", size * 2); eqt = s2.equals(s) && s.equals(s2); reallyAssert(!eqt); timer.finish(); timer.start("Iter HashCode ", size * 2); int s1h = s.hashCode(); int s2h = s2.hashCode(); reallyAssert(s1h != s2h); timer.finish(); s2.put(key[size-1], hold); timer.start("Remove (iterator) ", size * 2); Iterator s2i = s2.entrySet().iterator(); Set es = s.entrySet(); while (s2i.hasNext()) es.remove(s2i.next()); timer.finish(); reallyAssert(s.isEmpty()); timer.start("Clear ", size); s2.clear(); timer.finish(); reallyAssert(s2.isEmpty() && s.isEmpty()); } static void stest(Map s, int size) throws Exception { if (!(s instanceof Serializable)) return; System.out.print("Serialize : "); for (int i = 0; i < size; i++) { s.put(new Integer(i), Boolean.TRUE); } long startTime = System.currentTimeMillis(); FileOutputStream fs = new FileOutputStream("MapCheck.dat"); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(fs)); out.writeObject(s); out.close(); FileInputStream is = new FileInputStream("MapCheck.dat"); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(is)); Map m = (Map)in.readObject(); long endTime = System.currentTimeMillis(); long time = endTime - startTime; System.out.print(time + "ms"); if (s instanceof IdentityHashMap) return; reallyAssert(s.equals(m)); } static void test(Map s, Object[] key) { int size = key.length; t3("Put (absent) ", size, s, key, size); t3("Put (present) ", size, s, key, 0); t7("ContainsKey ", size, s, key, absent); t4("ContainsKey ", size, s, key, size); ktest(s, size, key); t4("ContainsKey ", absentSize, s, absent, 0); t6("Get ", size, s, key, absent); t1("Get (present) ", size, s, key, size); t1("Get (absent) ", absentSize, s, absent, 0); t2("Remove (absent) ", absentSize, s, absent, 0); t5("Remove (present) ", size, s, key, size / 2); t3("Put (half present) ", size, s, key, size / 2); ittest(s, size); entest(s, size); t9(s); rtest(s, size); t4("ContainsKey ", size, s, key, 0); t2("Remove (absent) ", size, s, key, 0); t3("Put (presized) ", size, s, key, size); dtest(s, size, key); } static class TestTimer { private String name; private long numOps; private long startTime; private String cname; static final java.util.TreeMap accum = new java.util.TreeMap(); static void printStats() { for (Iterator it = accum.entrySet().iterator(); it.hasNext(); ) { Map.Entry e = (Map.Entry)(it.next()); Stats stats = ((Stats)(e.getValue())); int n = stats.number; double t; if (n > 0) t = stats.sum / n; else t = stats.least; long nano = Math.round(1000000.0 * t); System.out.println(e.getKey() + ": " + nano); } } void start(String name, long numOps) { this.name = name; this.cname = classify(); this.numOps = numOps; startTime = System.currentTimeMillis(); } String classify() { if (name.startsWith("Get")) return "Get "; else if (name.startsWith("Put")) return "Put "; else if (name.startsWith("Remove")) return "Remove "; else if (name.startsWith("Iter")) return "Iter "; else return null; } void finish() { long endTime = System.currentTimeMillis(); long time = endTime - startTime; double timePerOp = ((double)time)/numOps; Object st = accum.get(name); if (st == null) accum.put(name, new Stats(timePerOp)); else { Stats stats = (Stats) st; stats.sum += timePerOp; stats.number++; if (timePerOp < stats.least) stats.least = timePerOp; } if (cname != null) { st = accum.get(cname); if (st == null) accum.put(cname, new Stats(timePerOp)); else { Stats stats = (Stats) st; stats.sum += timePerOp; stats.number++; if (timePerOp < stats.least) stats.least = timePerOp; } } } } static class Stats { double sum = 0; double least; int number = 0; Stats(double t) { least = t; } } static Random rng = new Random(); static void shuffle(Object[] keys) { int size = keys.length; for (int i=size; i>1; i--) { int r = rng.nextInt(i); Object t = keys[i-1]; keys[i-1] = keys[r]; keys[r] = t; } } } jsr166/src/test/jtreg/util/concurrent/ConcurrentHashMap/LoopHelpers.java0000644000000000000000000000542711537741070023517 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; class LoopHelpers { // Some mindless computation to do between synchronizations... /** * generates 32 bit pseudo-random numbers. * Adapted from http://www.snippets.org */ public static int compute1(int x) { int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } return lo; } /** * Computes a linear congruential random number a random number * of times. */ public static int compute2(int x) { int loops = (x >>> 4) & 7; while (loops-- > 0) { x = (x * 2147483647) % 16807; } return x; } /** * An actually useful random number generator, but unsynchronized. * Basically same as java.util.Random. */ public static class SimpleRandom { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong(1); private long seed = System.nanoTime() + seq.getAndIncrement(); public void setSeed(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } } public static class BarrierTimer implements Runnable { public volatile long startTime; public volatile long endTime; public void run() { long t = System.nanoTime(); if (startTime == 0) startTime = t; else endTime = t; } public void clear() { startTime = 0; endTime = 0; } public long getTime() { return endTime - startTime; } } public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; String num = Long.toString(n); if (num.length() >= field.length()) return num; StringBuffer b = new StringBuffer(field); b.replace(b.length()-num.length(), b.length(), num); return b.toString(); } } jsr166/src/test/jtreg/util/concurrent/ConcurrentHashMap/MapLoops.java0000644000000000000000000001554711537741070023021 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 MapLoops.java * @run main/timeout=1600 MapLoops * @summary Exercise multithreaded maps, by default ConcurrentHashMap. * Multithreaded hash table test. Each thread does a random walk * though elements of "key" array. On each iteration, it checks if * table includes key. If absent, with probability pinsert it * inserts it, and if present, with probability premove it removes * it. (pinsert and premove are expressed as percentages to simplify * parsing from command line.) */ import java.util.*; import java.util.concurrent.*; public class MapLoops { static int nkeys = 10000; static int pinsert = 60; static int premove = 2; static int maxThreads = 100; static int nops = 100000; static int removesPerMaxRandom; static int insertsPerMaxRandom; static final ExecutorService pool = Executors.newCachedThreadPool(); static final List throwables = new CopyOnWriteArrayList(); public static void main(String[] args) throws Exception { Class mapClass = null; if (args.length > 0) { try { mapClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } else mapClass = java.util.concurrent.ConcurrentHashMap.class; if (args.length > 1) maxThreads = Integer.parseInt(args[1]); if (args.length > 2) nkeys = Integer.parseInt(args[2]); if (args.length > 3) pinsert = Integer.parseInt(args[3]); if (args.length > 4) premove = Integer.parseInt(args[4]); if (args.length > 5) nops = Integer.parseInt(args[5]); // normalize probabilities wrt random number generator removesPerMaxRandom = (int)(((double)premove/100.0 * 0x7FFFFFFFL)); insertsPerMaxRandom = (int)(((double)pinsert/100.0 * 0x7FFFFFFFL)); System.out.print("Class: " + mapClass.getName()); System.out.print(" threads: " + maxThreads); System.out.print(" size: " + nkeys); System.out.print(" ins: " + pinsert); System.out.print(" rem: " + premove); System.out.print(" ops: " + nops); System.out.println(); int k = 1; int warmups = 2; for (int i = 1; i <= maxThreads;) { Thread.sleep(100); test(i, nkeys, mapClass); if (warmups > 0) --warmups; else if (i == k) { k = i << 1; i = i + (i >>> 1); } else if (i == 1 && k == 2) { i = k; warmups = 1; } else i = k; } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); if (! throwables.isEmpty()) throw new Error (throwables.size() + " thread(s) terminated abruptly."); } static Integer[] makeKeys(int n) { LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); Integer[] key = new Integer[n]; for (int i = 0; i < key.length; ++i) key[i] = new Integer(rng.next()); return key; } static void shuffleKeys(Integer[] key) { Random rng = new Random(); for (int i = key.length; i > 1; --i) { int j = rng.nextInt(i); Integer tmp = key[j]; key[j] = key[i-1]; key[i-1] = tmp; } } static void test(int i, int nkeys, Class mapClass) throws Exception { System.out.print("Threads: " + i + "\t:"); Map map = (Map)mapClass.newInstance(); Integer[] key = makeKeys(nkeys); // Uncomment to start with a non-empty table // for (int j = 0; j < nkeys; j += 4) // start 1/4 occupied // map.put(key[j], key[j]); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(i+1, timer); for (int t = 0; t < i; ++t) pool.execute(new Runner(map, key, barrier)); barrier.await(); barrier.await(); long time = timer.getTime(); long tpo = time / (i * (long)nops); System.out.print(LoopHelpers.rightJustify(tpo) + " ns per op"); double secs = (double)(time) / 1000000000.0; System.out.println("\t " + secs + "s run time"); map.clear(); } static class Runner implements Runnable { final Map map; final Integer[] key; final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); final CyclicBarrier barrier; int position; int total; Runner(Map map, Integer[] key, CyclicBarrier barrier) { this.map = map; this.key = key; this.barrier = barrier; position = key.length / 2; } int step() { // random-walk around key positions, bunching accesses int r = rng.next(); position += (r & 7) - 3; while (position >= key.length) position -= key.length; while (position < 0) position += key.length; Integer k = key[position]; Integer x = map.get(k); if (x != null) { if (x.intValue() != k.intValue()) throw new Error("bad mapping: " + x + " to " + k); if (r < removesPerMaxRandom) { if (map.remove(k) != null) { position = total % key.length; // move from position return 2; } } } else if (r < insertsPerMaxRandom) { ++position; map.put(k, k); return 2; } // Uncomment to add a little computation between accesses // total += LoopHelpers.compute1(k.intValue()); total += r; return 1; } public void run() { try { barrier.await(); int ops = nops; while (ops > 0) ops -= step(); barrier.await(); } catch (Throwable throwable) { synchronized (System.err) { System.err.println("--------------------------------"); throwable.printStackTrace(); } throwables.add(throwable); } } } } jsr166/src/test/jtreg/util/concurrent/Executors/0000755000000000000000000000000011652013243016775 5ustar jsr166/src/test/jtreg/util/concurrent/Executors/Throws.java0000644000000000000000000001375411450166503021144 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6398290 * @summary Check Executors/STPE Exception specifications * @author Martin Buchholz */ import java.io.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.Executors.*; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; public class Throws { private static void realMain(String[] args) throws Throwable { final ThreadFactory fac = defaultThreadFactory(); final ThreadFactory nullFactory = null; final RejectedExecutionHandler reh = new RejectedExecutionHandler() { public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {}}; final RejectedExecutionHandler nullHandler = null; THROWS( NullPointerException.class, new Fun(){void f(){ newFixedThreadPool(3, null); }}, new Fun(){void f(){ newCachedThreadPool(null); }}, new Fun(){void f(){ newSingleThreadScheduledExecutor(null); }}, new Fun(){void f(){ newScheduledThreadPool(0, null); }}, new Fun(){void f(){ unconfigurableExecutorService(null); }}, new Fun(){void f(){ unconfigurableScheduledExecutorService(null); }}, new Fun(){void f(){ callable(null, "foo"); }}, new Fun(){void f(){ callable((Runnable) null); }}, new Fun(){void f(){ callable((PrivilegedAction) null); }}, new Fun(){void f(){ callable((PrivilegedExceptionAction) null); }}, new Fun(){void f(){ privilegedCallable((Callable) null); }}, new Fun(){void f(){ new ScheduledThreadPoolExecutor(0, nullFactory); }}, new Fun(){void f(){ new ScheduledThreadPoolExecutor(0, nullFactory, reh); }}, new Fun(){void f(){ new ScheduledThreadPoolExecutor(0, fac, nullHandler); }}); THROWS( IllegalArgumentException.class, new Fun(){void f(){ newFixedThreadPool(-42); }}, new Fun(){void f(){ newFixedThreadPool(0) ; }}, new Fun(){void f(){ newFixedThreadPool(-42, fac); }}, new Fun(){void f(){ newFixedThreadPool(0, fac); }}, new Fun(){void f(){ newScheduledThreadPool(-42); }}, new Fun(){void f(){ new ScheduledThreadPoolExecutor(-42); }}, new Fun(){void f(){ new ScheduledThreadPoolExecutor(-42, reh); }}, new Fun(){void f(){ new ScheduledThreadPoolExecutor(-42, fac, reh); }}); try { newFixedThreadPool(1).shutdownNow(); pass(); } catch (Throwable t) { unexpected(t); } try { newFixedThreadPool(1, fac).shutdownNow(); pass(); } catch (Throwable t) { unexpected(t); } try { newSingleThreadExecutor().shutdownNow(); pass(); } catch (Throwable t) { unexpected(t); } try { newCachedThreadPool().shutdownNow(); pass(); } catch (Throwable t) { unexpected(t); } try { newSingleThreadScheduledExecutor().shutdownNow(); pass(); } catch (Throwable t) { unexpected(t); } try { newSingleThreadScheduledExecutor(fac).shutdownNow(); pass(); } catch (Throwable t) { unexpected(t); } try { newScheduledThreadPool(0).shutdownNow(); pass(); } catch (Throwable t) { unexpected(t); } try { newScheduledThreadPool(0, fac).shutdownNow(); pass(); } catch (Throwable t) { unexpected(t); } try { new ScheduledThreadPoolExecutor(0).shutdownNow(); pass(); } catch (Throwable t) { unexpected(t); } try { new ScheduledThreadPoolExecutor(0, fac).shutdownNow(); pass(); } catch (Throwable t) { unexpected(t); } try { new ScheduledThreadPoolExecutor(0, fac, reh).shutdownNow(); pass(); } catch (Throwable t) { unexpected(t); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class Fun {abstract void f() throws Throwable;} static void THROWS(Class k, Fun... fs) { for (Fun f : fs) try { f.f(); fail("Expected " + k.getName() + " not thrown"); } catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/concurrent/Executors/PrivilegedCallables.java0000644000000000000000000001370011441006144023534 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6552961 6558429 * @summary Test privilegedCallable, privilegedCallableUsingCurrentClassLoader * @run main/othervm PrivilegedCallables * @author Martin Buchholz */ import java.util.concurrent.*; import java.util.*; import java.security.*; import static java.util.concurrent.Executors.*; public class PrivilegedCallables { Callable real; final Callable realCaller = new Callable() { public Integer call() throws Exception { return real.call(); }}; final Random rnd = new Random(); @SuppressWarnings("serial") Throwable[] throwables = { new Exception() {}, new RuntimeException() {}, new Error() {} }; Throwable randomThrowable() { return throwables[rnd.nextInt(throwables.length)]; } //---------------------------------------------------------------- // A Policy class designed to make permissions fiddling very easy. //---------------------------------------------------------------- static class Policy extends java.security.Policy { private Permissions perms; public void setPermissions(Permission...permissions) { perms = new Permissions(); for (Permission permission : permissions) perms.add(permission); } public Policy() { setPermissions(/* Nothing */); } public PermissionCollection getPermissions(CodeSource cs) { return perms; } public PermissionCollection getPermissions(ProtectionDomain pd) { return perms; } public boolean implies(ProtectionDomain pd, Permission p) { return perms.implies(p); } public void refresh() {} } void test(String[] args) { testPrivileged(); final Policy policy = new Policy(); Policy.setPolicy(policy); policy.setPermissions(new RuntimePermission("getClassLoader"), new RuntimePermission("setContextClassLoader"), new RuntimePermission("stopThread")); System.setSecurityManager(new SecurityManager()); testPrivileged(); policy.setPermissions(/* Nothing */); THROWS(AccessControlException.class, new F() {void f(){ privilegedCallableUsingCurrentClassLoader(realCaller); }}, new F() {void f(){ privilegedThreadFactory(); }}); policy.setPermissions(new RuntimePermission("setSecurityManager")); System.setSecurityManager(null); } void testPrivileged() { try { test(privilegedCallable(realCaller)); } catch (Throwable t) { unexpected(t); } try { test(privilegedCallableUsingCurrentClassLoader(realCaller)); } catch (Throwable t) { unexpected(t); } try { privilegedThreadFactory(); } catch (Throwable t) { unexpected(t); } } void test(final Callable c) throws Throwable { for (int i = 0; i < 20; i++) if (rnd.nextBoolean()) { final Throwable t = randomThrowable(); real = new Callable() { @SuppressWarnings("deprecation") public Integer call() throws Exception { Thread.currentThread().stop(t); return null; }}; try { c.call(); fail("Expected exception not thrown"); } catch (Throwable tt) { check(t == tt); } } else { final int n = rnd.nextInt(); real = new Callable() { public Integer call() { return n; }}; equal(c.call(), n); } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new PrivilegedCallables().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} void THROWS(Class k, F... fs) { for (F f : fs) try {f.f(); fail("Expected " + k.getName() + " not thrown");} catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/concurrent/Executors/AutoShutdown.java0000644000000000000000000000653111514077775022332 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6399443 * @run main/othervm AutoShutdown * @summary Check for auto-shutdown and gc of singleThreadExecutors * @author Martin Buchholz */ import java.io.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.Executors.*; import java.util.concurrent.Phaser; public class AutoShutdown { private static void waitForFinalizersToRun() { for (int i = 0; i < 2; i++) tryWaitForFinalizersToRun(); } private static void tryWaitForFinalizersToRun() { System.gc(); final CountDownLatch fin = new CountDownLatch(1); new Object() { protected void finalize() { fin.countDown(); }}; System.gc(); try { fin.await(); } catch (InterruptedException ie) { throw new Error(ie); } } private static void realMain(String[] args) throws Throwable { final Phaser phaser = new Phaser(3); Runnable trivialRunnable = new Runnable() { public void run() { phaser.arriveAndAwaitAdvance(); } }; int count0 = Thread.activeCount(); Executor e1 = newSingleThreadExecutor(); Executor e2 = newSingleThreadExecutor(defaultThreadFactory()); e1.execute(trivialRunnable); e2.execute(trivialRunnable); phaser.arriveAndAwaitAdvance(); equal(Thread.activeCount(), count0 + 2); e1 = e2 = null; for (int i = 0; i < 10 && Thread.activeCount() > count0; i++) tryWaitForFinalizersToRun(); equal(Thread.activeCount(), count0); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/FutureTask/0000755000000000000000000000000011652013243017111 5ustar jsr166/src/test/jtreg/util/concurrent/FutureTask/Customized.java0000644000000000000000000001700611450166503022112 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6464365 * @summary Test state transitions; check protected methods are called * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; public class Customized { static final AtomicLong doneCount = new AtomicLong(0); static final AtomicLong setCount = new AtomicLong(0); static final AtomicLong setExceptionCount = new AtomicLong(0); static void equal(long expected, AtomicLong actual) { equal(expected, actual.get()); } static void equalCounts(long x, long y, long z) { equal(x, doneCount); equal(y, setCount); equal(z, setExceptionCount); } static class MyFutureTask extends FutureTask { MyFutureTask(Runnable r, V result) { super(r, result); } protected void done() { doneCount.getAndIncrement(); super.done(); } protected void set(V v) { setCount.getAndIncrement(); super.set(v); } protected void setException(Throwable t) { setExceptionCount.getAndIncrement(); super.setException(t); } public boolean runAndReset() { return super.runAndReset(); } } static void checkReady(final FutureTask task) { check(! task.isDone()); check(! task.isCancelled()); THROWS(TimeoutException.class, new Fun(){void f() throws Throwable { task.get(0L, TimeUnit.SECONDS); }}); } static void checkDone(final FutureTask task) { try { check(task.isDone()); check(! task.isCancelled()); check(task.get() != null); } catch (Throwable t) { unexpected(t); } } static void checkCancelled(final FutureTask task) { check(task.isDone()); check(task.isCancelled()); THROWS(CancellationException.class, new Fun(){void f() throws Throwable { task.get(0L, TimeUnit.SECONDS); }}, new Fun(){void f() throws Throwable { task.get(); }}); } static void checkThrew(final FutureTask task) { check(task.isDone()); check(! task.isCancelled()); THROWS(ExecutionException.class, new Fun(){void f() throws Throwable { task.get(0L, TimeUnit.SECONDS); }}, new Fun(){void f() throws Throwable { task.get(); }}); } static void cancel(FutureTask task, boolean mayInterruptIfRunning) { task.cancel(mayInterruptIfRunning); checkCancelled(task); } static void run(FutureTask task) { boolean isCancelled = task.isCancelled(); task.run(); check(task.isDone()); equal(isCancelled, task.isCancelled()); } static void realMain(String[] args) throws Throwable { final Runnable nop = new Runnable() { public void run() {}}; final Runnable bad = new Runnable() { public void run() { throw new Error(); }}; try { final MyFutureTask task = new MyFutureTask(nop, 42L); checkReady(task); equalCounts(0,0,0); check(task.runAndReset()); checkReady(task); equalCounts(0,0,0); run(task); checkDone(task); equalCounts(1,1,0); equal(42L, task.get()); run(task); checkDone(task); equalCounts(1,1,0); equal(42L, task.get()); } catch (Throwable t) { unexpected(t); } try { final MyFutureTask task = new MyFutureTask(nop, 42L); cancel(task, false); equalCounts(2,1,0); cancel(task, false); equalCounts(2,1,0); run(task); equalCounts(2,1,0); check(! task.runAndReset()); } catch (Throwable t) { unexpected(t); } try { final MyFutureTask task = new MyFutureTask(bad, 42L); checkReady(task); run(task); checkThrew(task); equalCounts(3,1,1); run(task); equalCounts(3,1,1); } catch (Throwable t) { unexpected(t); } try { final MyFutureTask task = new MyFutureTask(nop, 42L); checkReady(task); task.set(99L); checkDone(task); equalCounts(4,2,1); run(task); equalCounts(4,2,1); task.setException(new Throwable()); checkDone(task); equalCounts(4,2,2); } catch (Throwable t) { unexpected(t); } try { final MyFutureTask task = new MyFutureTask(nop, 42L); checkReady(task); task.setException(new Throwable()); checkThrew(task); equalCounts(5,2,3); run(task); equalCounts(5,2,3); task.set(99L); checkThrew(task); equalCounts(5,3,3); } catch (Throwable t) { unexpected(t); } System.out.printf("doneCount=%d%n", doneCount.get()); System.out.printf("setCount=%d%n", setCount.get()); System.out.printf("setExceptionCount=%d%n", setExceptionCount.get()); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class Fun {abstract void f() throws Throwable;} static void THROWS(Class k, Fun... fs) { for (Fun f : fs) try { f.f(); fail("Expected " + k.getName() + " not thrown"); } catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/concurrent/FutureTask/BlockingTaskExecutor.java0000644000000000000000000001267211441355624024066 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6431315 * @summary ExecutorService.invokeAll might hang * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; /** * Adapted from Doug Lea, which was... * adapted from a posting by Tom Sugden tom at epcc.ed.ac.uk */ public class BlockingTaskExecutor { static void realMain(String[] args) throws Throwable { for (int i = 1; i <= 100; i++) { System.out.print("."); test(); } } static void test() throws Throwable { final ExecutorService executor = Executors.newCachedThreadPool(); final NotificationReceiver notifiee1 = new NotificationReceiver(); final NotificationReceiver notifiee2 = new NotificationReceiver(); final Collection> tasks = new ArrayList>(); tasks.add(new BlockingTask(notifiee1)); tasks.add(new BlockingTask(notifiee2)); tasks.add(new NonBlockingTask()); // start a thread to invoke the tasks Thread thread = new Thread() { public void run() { try { executor.invokeAll(tasks); } catch (RejectedExecutionException t) {/* OK */} catch (Throwable t) { unexpected(t); }}}; thread.start(); // Wait until tasks begin execution notifiee1.waitForNotification(); notifiee2.waitForNotification(); // Now try to shutdown the executor service while tasks // are blocked. This should cause the tasks to be // interrupted. executor.shutdownNow(); if (! executor.awaitTermination(5, TimeUnit.SECONDS)) throw new Error("Executor stuck"); // Wait for the invocation thread to complete. thread.join(1000); if (thread.isAlive()) { thread.interrupt(); thread.join(1000); throw new Error("invokeAll stuck"); } } /** * A helper class with a method to wait for a notification. * * The notification is received via the * {@code sendNotification} method. */ static class NotificationReceiver { /** Has the notifiee been notified? */ boolean notified = false; /** * Notify the notification receiver. */ public synchronized void sendNotification() { notified = true; notifyAll(); } /** * Waits until a notification has been received. * * @throws InterruptedException if the wait is interrupted */ public synchronized void waitForNotification() throws InterruptedException { while (! notified) wait(); } } /** * A callable task that blocks until it is interrupted. * This task sends a notification to a notification receiver when * it is first called. */ static class BlockingTask implements Callable { private final NotificationReceiver notifiee; BlockingTask(NotificationReceiver notifiee) { this.notifiee = notifiee; } public Object call() throws InterruptedException { notifiee.sendNotification(); // wait indefinitely until task is interrupted while (true) { synchronized (this) { wait(); } } } } /** * A callable task that simply returns a string result. */ static class NonBlockingTask implements Callable { public Object call() { return "NonBlockingTaskResult"; } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/FutureTask/Throw.java0000644000000000000000000001261411441006144021061 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6415572 * @summary Check exceptional behavior in run and done methods */ import java.util.concurrent.*; public class Throw { @SuppressWarnings("deprecation") static void THROW(final Throwable t) { if (t != null) Thread.currentThread().stop(t); } Callable thrower(final Throwable t) { return new Callable() { public Void call() { THROW(t); return null; }}; } @SuppressWarnings("serial") private static class DoneError extends Error {} @SuppressWarnings("serial") private static class DoneException extends RuntimeException {} static class MyFutureTask extends FutureTask { MyFutureTask(Callable task) { super(task); } public boolean runAndReset() { return super.runAndReset(); } } MyFutureTask checkTask(final MyFutureTask task) { check(! task.isCancelled()); check(! task.isDone()); return task; } MyFutureTask taskFor(final Throwable callableThrowable, final Throwable doneThrowable) { return checkTask( new MyFutureTask(thrower(callableThrowable)) { protected void done() { THROW(doneThrowable); }}); } void test(String[] args) throws Throwable { final Throwable[] callableThrowables = { null, new Exception(), new Error(), new RuntimeException() }; final Throwable[] doneThrowables = { new DoneError(), new DoneException() }; for (final Throwable c : callableThrowables) { for (final Throwable d : doneThrowables) { THROWS(d.getClass(), new F(){void f(){ taskFor(c, d).cancel(false);}}, new F(){void f(){ taskFor(c, d).run();}}); if (c != null) THROWS(d.getClass(), new F(){void f(){ taskFor(c, d).runAndReset();}}); } try { final MyFutureTask task = taskFor(c, null); check(task.cancel(false)); THROWS(CancellationException.class, new F(){void f() throws Throwable { task.get(); }}); } catch (Throwable t) { unexpected(t); } if (c != null) { final MyFutureTask task = taskFor(c, null); task.run(); try { task.get(); fail("Expected ExecutionException"); } catch (ExecutionException ee) { equal(c.getClass(), ee.getCause().getClass()); } catch (Throwable t) { unexpected(t); } } if (c != null) { final MyFutureTask task = taskFor(c, null); task.runAndReset(); try { task.get(); fail("Expected ExecutionException"); } catch (ExecutionException ee) { check(c.getClass().isInstance(ee.getCause())); } catch (Throwable t) { unexpected(t); } } } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new Throw().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} void THROWS(Class k, F... fs) { for (F f : fs) try {f.f(); fail("Expected " + k.getName() + " not thrown");} catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/concurrent/FutureTask/LoopHelpers.java0000644000000000000000000000542611537741070022227 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; class LoopHelpers { // Some mindless computation to do between synchronizations... /** * generates 32 bit pseudo-random numbers. * Adapted from http://www.snippets.org */ public static int compute1(int x) { int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } return lo; } /** * Computes a linear congruential random number a random number * of times. */ public static int compute2(int x) { int loops = (x >>> 4) & 7; while (loops-- > 0) { x = (x * 2147483647) % 16807; } return x; } /** * An actually useful random number generator, but unsynchronized. * Basically same as java.util.Random. */ public static class SimpleRandom { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong(1); private long seed = System.nanoTime() + seq.getAndIncrement(); public void setSeed(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } } public static class BarrierTimer implements Runnable { public volatile long startTime; public volatile long endTime; public void run() { long t = System.nanoTime(); if (startTime == 0) startTime = t; else endTime = t; } public void clear() { startTime = 0; endTime = 0; } public long getTime() { return endTime - startTime; } } public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; String num = Long.toString(n); if (num.length() >= field.length()) return num; StringBuffer b = new StringBuffer(field); b.replace(b.length()-num.length(), b.length(), num); return b.toString(); } } jsr166/src/test/jtreg/util/concurrent/FutureTask/CancelledFutureLoops.java0000644000000000000000000000743711537741070024061 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 CancelledFutureLoops.java * @run main/timeout=2000 CancelledFutureLoops * @summary Checks for responsiveness of futures to cancellation. * Runs under the assumption that ITERS computations require more than * TIMEOUT msecs to complete. */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class CancelledFutureLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static final int ITERS = 1000000; static final long TIMEOUT = 100; public static void main(String[] args) throws Exception { int maxThreads = 5; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; for (int i = 2; i <= maxThreads; i += (i+1) >>> 1) { System.out.print("Threads: " + i); try { new FutureLoop(i).test(); } catch (BrokenBarrierException bb) { // OK; ignore } catch (ExecutionException ee) { // OK; ignore } Thread.sleep(TIMEOUT); } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static final class FutureLoop implements Callable { private int v = rng.next(); private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; FutureLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { Future[] futures = new Future[nthreads]; for (int i = 0; i < nthreads; ++i) futures[i] = pool.submit(this); barrier.await(); Thread.sleep(TIMEOUT); boolean tooLate = false; for (int i = 1; i < nthreads; ++i) { if (!futures[i].cancel(true)) tooLate = true; // Unbunch some of the cancels if ( (i & 3) == 0) Thread.sleep(1 + rng.next() % 10); } Object f0 = futures[0].get(); if (!tooLate) { for (int i = 1; i < nthreads; ++i) { if (!futures[i].isDone() || !futures[i].isCancelled()) throw new Error("Only one thread should complete"); } } else System.out.print("(cancelled too late) "); long endTime = System.nanoTime(); long time = endTime - timer.startTime; if (print) { double secs = (double)(time) / 1000000000.0; System.out.println("\t " + secs + "s run time"); } } public final Object call() throws Exception { barrier.await(); int sum = v; int x = 0; int n = ITERS; while (n-- > 0) { lock.lockInterruptibly(); try { v = x = LoopHelpers.compute1(v); } finally { lock.unlock(); } sum += LoopHelpers.compute2(LoopHelpers.compute2(x)); } return new Integer(sum); } } } jsr166/src/test/jtreg/util/concurrent/ConcurrentQueues/0000755000000000000000000000000011652013243020326 5ustar jsr166/src/test/jtreg/util/concurrent/ConcurrentQueues/GCRetention.java0000644000000000000000000001160611537741070023366 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6785442 * @summary Benchmark that tries to GC-tenure head, followed by * many add/remove operations. * @run main GCRetention 12345 */ import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.PriorityBlockingQueue; import java.util.LinkedList; import java.util.PriorityQueue; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Queue; import java.util.Map; public class GCRetention { // Suitable for benchmarking. Overriden by args[0] for testing. int count = 1024 * 1024; final Map results = new ConcurrentHashMap(); Collection> queues() { List> queues = new ArrayList>(); queues.add(new ConcurrentLinkedDeque()); queues.add(new ConcurrentLinkedQueue()); queues.add(new ArrayBlockingQueue(count, false)); queues.add(new ArrayBlockingQueue(count, true)); queues.add(new LinkedBlockingQueue()); queues.add(new LinkedBlockingDeque()); queues.add(new PriorityBlockingQueue()); queues.add(new PriorityQueue()); queues.add(new LinkedList()); queues.add(new LinkedTransferQueue()); // Following additional implementations are available from: // http://gee.cs.oswego.edu/dl/concurrency-interest/index.html // queues.add(new SynchronizedLinkedListQueue()); // Avoid "first fast, second slow" benchmark effect. Collections.shuffle(queues); return queues; } void prettyPrintResults() { List classNames = new ArrayList(results.keySet()); Collections.sort(classNames); int maxClassNameLength = 0; int maxNanosLength = 0; for (String name : classNames) { if (maxClassNameLength < name.length()) maxClassNameLength = name.length(); if (maxNanosLength < results.get(name).length()) maxNanosLength = results.get(name).length(); } String format = String.format("%%%ds %%%ds nanos/item%%n", maxClassNameLength, maxNanosLength); for (String name : classNames) System.out.printf(format, name, results.get(name)); } void test(String[] args) { if (args.length > 0) count = Integer.valueOf(args[0]); // Warmup for (Queue queue : queues()) test(queue); results.clear(); for (Queue queue : queues()) test(queue); prettyPrintResults(); } void test(Queue q) { long t0 = System.nanoTime(); for (int i = 0; i < count; i++) check(q.add(Boolean.TRUE)); System.gc(); System.gc(); Boolean x; while ((x = q.poll()) != null) equal(x, Boolean.TRUE); check(q.isEmpty()); for (int i = 0; i < 10 * count; i++) { for (int k = 0; k < 3; k++) check(q.add(Boolean.TRUE)); for (int k = 0; k < 3; k++) if (q.poll() != Boolean.TRUE) fail(); } check(q.isEmpty()); String className = q.getClass().getSimpleName(); long elapsed = System.nanoTime() - t0; int nanos = (int) ((double) elapsed / (10 * 3 * count)); results.put(className, String.valueOf(nanos)); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new GCRetention().instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java0000644000000000000000000001541311441006144024427 0ustar /* * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6316155 6595669 6871697 6868712 * @summary Test concurrent offer vs. remove * @run main OfferRemoveLoops 300 * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @SuppressWarnings({"unchecked", "rawtypes", "deprecation"}) public class OfferRemoveLoops { final long testDurationMillisDefault = 10L * 1000L; final long testDurationMillis; OfferRemoveLoops(String[] args) { testDurationMillis = (args.length > 0) ? Long.valueOf(args[0]) : testDurationMillisDefault; } void checkNotContainsNull(Iterable it) { for (Object x : it) check(x != null); } void test(String[] args) throws Throwable { testQueue(new LinkedBlockingQueue(10)); testQueue(new LinkedBlockingQueue()); testQueue(new LinkedBlockingDeque(10)); testQueue(new LinkedBlockingDeque()); testQueue(new ArrayBlockingQueue(10)); testQueue(new PriorityBlockingQueue(10)); testQueue(new ConcurrentLinkedDeque()); testQueue(new ConcurrentLinkedQueue()); testQueue(new LinkedTransferQueue()); } Random getRandom() { return ThreadLocalRandom.current(); } void testQueue(final Queue q) throws Throwable { System.out.println(q.getClass().getSimpleName()); final long testDurationNanos = testDurationMillis * 1000L * 1000L; final long quittingTimeNanos = System.nanoTime() + testDurationNanos; final long timeoutMillis = 10L * 1000L; final int maxChunkSize = 1042; final int maxQueueSize = 10 * maxChunkSize; /** Poor man's bounded buffer. */ final AtomicLong approximateCount = new AtomicLong(0L); abstract class CheckedThread extends Thread { CheckedThread(String name) { super(name); setDaemon(true); start(); } /** Polls for quitting time. */ protected boolean quittingTime() { return System.nanoTime() - quittingTimeNanos > 0; } /** Polls occasionally for quitting time. */ protected boolean quittingTime(long i) { return (i % 1024) == 0 && quittingTime(); } abstract protected void realRun(); public void run() { try { realRun(); } catch (Throwable t) { unexpected(t); } } } Thread offerer = new CheckedThread("offerer") { protected void realRun() { final long chunkSize = getRandom().nextInt(maxChunkSize) + 2; long c = 0; for (long i = 0; ! quittingTime(i); i++) { if (q.offer(Long.valueOf(c))) { if ((++c % chunkSize) == 0) { approximateCount.getAndAdd(chunkSize); while (approximateCount.get() > maxQueueSize) Thread.yield(); } } else { Thread.yield(); }}}}; Thread remover = new CheckedThread("remover") { protected void realRun() { final long chunkSize = getRandom().nextInt(maxChunkSize) + 2; long c = 0; for (long i = 0; ! quittingTime(i); i++) { if (q.remove(Long.valueOf(c))) { if ((++c % chunkSize) == 0) { approximateCount.getAndAdd(-chunkSize); } } else { Thread.yield(); } } q.clear(); approximateCount.set(0); // Releases waiting offerer thread }}; Thread scanner = new CheckedThread("scanner") { protected void realRun() { final Random rnd = getRandom(); while (! quittingTime()) { switch (rnd.nextInt(3)) { case 0: checkNotContainsNull(q); break; case 1: q.size(); break; case 2: checkNotContainsNull (Arrays.asList(q.toArray(new Long[0]))); break; } Thread.yield(); }}}; for (Thread thread : new Thread[] { offerer, remover, scanner }) { thread.join(timeoutMillis + testDurationMillis); if (thread.isAlive()) { System.err.printf("Hung thread: %s%n", thread.getName()); failed++; for (StackTraceElement e : thread.getStackTrace()) System.err.println(e); // Kludge alert thread.stop(); thread.join(timeoutMillis); } } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new OfferRemoveLoops(args).instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/ConcurrentQueues/LoopHelpers.java0000644000000000000000000000542711537741070023445 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; class LoopHelpers { // Some mindless computation to do between synchronizations... /** * generates 32 bit pseudo-random numbers. * Adapted from http://www.snippets.org */ public static int compute1(int x) { int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } return lo; } /** * Computes a linear congruential random number a random number * of times. */ public static int compute2(int x) { int loops = (x >>> 4) & 7; while (loops-- > 0) { x = (x * 2147483647) % 16807; } return x; } /** * An actually useful random number generator, but unsynchronized. * Basically same as java.util.Random. */ public static class SimpleRandom { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong(1); private long seed = System.nanoTime() + seq.getAndIncrement(); public void setSeed(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } } public static class BarrierTimer implements Runnable { public volatile long startTime; public volatile long endTime; public void run() { long t = System.nanoTime(); if (startTime == 0) startTime = t; else endTime = t; } public void clear() { startTime = 0; endTime = 0; } public long getTime() { return endTime - startTime; } } public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; String num = Long.toString(n); if (num.length() >= field.length()) return num; StringBuffer b = new StringBuffer(field); b.replace(b.length()-num.length(), b.length(), num); return b.toString(); } } jsr166/src/test/jtreg/util/concurrent/ConcurrentQueues/RemovePollRace.java0000644000000000000000000001737011537741070024070 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6785442 * @summary Checks race between poll and remove(Object), while * occasionally moonlighting as a microbenchmark. * @run main RemovePollRace 12345 */ import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.atomic.AtomicLong; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Queue; import java.util.Map; public class RemovePollRace { // Suitable for benchmarking. Overriden by args[0] for testing. int count = 1024 * 1024; final Map results = new ConcurrentHashMap(); Collection> concurrentQueues() { List> queues = new ArrayList>(); queues.add(new ConcurrentLinkedDeque()); queues.add(new ConcurrentLinkedQueue()); queues.add(new ArrayBlockingQueue(count, false)); queues.add(new ArrayBlockingQueue(count, true)); queues.add(new LinkedBlockingQueue()); queues.add(new LinkedBlockingDeque()); queues.add(new LinkedTransferQueue()); // Following additional implementations are available from: // http://gee.cs.oswego.edu/dl/concurrency-interest/index.html // queues.add(new SynchronizedLinkedListQueue()); // Avoid "first fast, second slow" benchmark effect. Collections.shuffle(queues); return queues; } void prettyPrintResults() { List classNames = new ArrayList(results.keySet()); Collections.sort(classNames); int maxClassNameLength = 0; int maxNanosLength = 0; for (String name : classNames) { if (maxClassNameLength < name.length()) maxClassNameLength = name.length(); if (maxNanosLength < results.get(name).length()) maxNanosLength = results.get(name).length(); } String format = String.format("%%%ds %%%ds nanos/item%%n", maxClassNameLength, maxNanosLength); for (String name : classNames) System.out.printf(format, name, results.get(name)); } void test(String[] args) throws Throwable { if (args.length > 0) count = Integer.valueOf(args[0]); // Warmup for (Queue queue : concurrentQueues()) test(queue); results.clear(); for (Queue queue : concurrentQueues()) test(queue); prettyPrintResults(); } void await(CountDownLatch latch) { try { latch.await(); } catch (InterruptedException e) { unexpected(e); } } void test(final Queue q) throws Throwable { long t0 = System.nanoTime(); final int SPINS = 5; final AtomicLong removes = new AtomicLong(0); final AtomicLong polls = new AtomicLong(0); final int adderCount = Math.max(1, Runtime.getRuntime().availableProcessors() / 4); final int removerCount = Math.max(1, Runtime.getRuntime().availableProcessors() / 4); final int pollerCount = removerCount; final int threadCount = adderCount + removerCount + pollerCount; final CountDownLatch startingGate = new CountDownLatch(1); final CountDownLatch addersDone = new CountDownLatch(adderCount); final Runnable remover = new Runnable() { public void run() { await(startingGate); int spins = 0; for (;;) { boolean quittingTime = (addersDone.getCount() == 0); if (q.remove(Boolean.TRUE)) removes.getAndIncrement(); else if (quittingTime) break; else if (++spins > SPINS) { Thread.yield(); spins = 0; }}}}; final Runnable poller = new Runnable() { public void run() { await(startingGate); int spins = 0; for (;;) { boolean quittingTime = (addersDone.getCount() == 0); if (q.poll() == Boolean.TRUE) polls.getAndIncrement(); else if (quittingTime) break; else if (++spins > SPINS) { Thread.yield(); spins = 0; }}}}; final Runnable adder = new Runnable() { public void run() { await(startingGate); for (int i = 0; i < count; i++) { for (;;) { try { q.add(Boolean.TRUE); break; } catch (IllegalStateException e) { Thread.yield(); } } } addersDone.countDown(); }}; final List adders = new ArrayList(); final List removers = new ArrayList(); final List pollers = new ArrayList(); for (int i = 0; i < adderCount; i++) adders.add(checkedThread(adder)); for (int i = 0; i < removerCount; i++) removers.add(checkedThread(remover)); for (int i = 0; i < pollerCount; i++) pollers.add(checkedThread(poller)); final List allThreads = new ArrayList(); allThreads.addAll(removers); allThreads.addAll(pollers); allThreads.addAll(adders); for (Thread t : allThreads) t.start(); startingGate.countDown(); for (Thread t : allThreads) t.join(); String className = q.getClass().getSimpleName(); long elapsed = System.nanoTime() - t0; int nanos = (int) ((double) elapsed / (adderCount * count)); results.put(className, String.valueOf(nanos)); if (removes.get() + polls.get() != adderCount * count) { String msg = String.format ("class=%s removes=%s polls=%d count=%d", className, removes.get(), polls.get(), count); fail(msg); } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new RemovePollRace().instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} Thread checkedThread(final Runnable r) { return new Thread() {public void run() { try {r.run();} catch (Throwable t) {unexpected(t);}}};} } jsr166/src/test/jtreg/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java0000644000000000000000000000611411537741070026026 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; /* * @test * @bug 6805775 6815766 * @summary Check weak consistency of concurrent queue iterators */ @SuppressWarnings({"unchecked", "rawtypes"}) public class IteratorWeakConsistency { void test(String[] args) throws Throwable { test(new LinkedBlockingQueue()); test(new LinkedBlockingQueue(20)); test(new LinkedBlockingDeque()); test(new LinkedBlockingDeque(20)); test(new ConcurrentLinkedDeque()); test(new ConcurrentLinkedQueue()); test(new LinkedTransferQueue()); // Other concurrent queues (e.g. ArrayBlockingQueue) do not // currently have weakly consistent iterators. // As of 2010-09, ArrayBlockingQueue passes this test, but // does not fully implement weak consistency. test(new ArrayBlockingQueue(20)); } void test(Queue q) { // TODO: make this more general try { for (int i = 0; i < 10; i++) q.add(i); Iterator it = q.iterator(); q.poll(); q.poll(); q.poll(); q.remove(7); List list = new ArrayList(); while (it.hasNext()) list.add(it.next()); equal(list, Arrays.asList(0, 3, 4, 5, 6, 8, 9)); check(! list.contains(null)); System.out.printf("%s: %s%n", q.getClass().getSimpleName(), list); } catch (Throwable t) { unexpected(t); } try { q.clear(); q.add(1); q.add(2); q.add(3); q.add(4); Iterator it = q.iterator(); it.next(); q.remove(2); q.remove(1); q.remove(3); boolean found4 = false; while (it.hasNext()) { found4 |= it.next().equals(4); } check(found4); } catch (Throwable t) { unexpected(t); } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new IteratorWeakConsistency().instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java0000644000000000000000000001351111537741070025346 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 6785442 * @run main ConcurrentQueueLoops 8 123456 * @summary Checks that a set of threads can repeatedly get and modify items */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; public class ConcurrentQueueLoops { ExecutorService pool; AtomicInteger totalItems; boolean print; // Suitable for benchmarking. Overriden by args[0] for testing. int maxStages = 20; // Suitable for benchmarking. Overriden by args[1] for testing. int items = 1024 * 1024; Collection> concurrentQueues() { List> queues = new ArrayList>(); queues.add(new ConcurrentLinkedDeque()); queues.add(new ConcurrentLinkedQueue()); queues.add(new ArrayBlockingQueue(items, false)); //queues.add(new ArrayBlockingQueue(count, true)); queues.add(new LinkedBlockingQueue()); queues.add(new LinkedBlockingDeque()); queues.add(new LinkedTransferQueue()); // Following additional implementations are available from: // http://gee.cs.oswego.edu/dl/concurrency-interest/index.html // queues.add(new SynchronizedLinkedListQueue()); // Avoid "first fast, second slow" benchmark effect. Collections.shuffle(queues); return queues; } void test(String[] args) throws Throwable { if (args.length > 0) maxStages = Integer.parseInt(args[0]); if (args.length > 1) items = Integer.parseInt(args[1]); for (Queue queue : concurrentQueues()) test(queue); } void test(final Queue q) throws Throwable { System.out.println(q.getClass().getSimpleName()); pool = Executors.newCachedThreadPool(); print = false; print = false; System.out.println("Warmup..."); oneRun(1, items, q); //Thread.sleep(100); oneRun(3, items, q); Thread.sleep(100); print = true; for (int i = 1; i <= maxStages; i += (i+1) >>> 1) { oneRun(i, items, q); } pool.shutdown(); check(pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)); } class Stage implements Callable { final Queue queue; final CyclicBarrier barrier; int items; Stage(Queue q, CyclicBarrier b, int items) { queue = q; barrier = b; this.items = items; } public Integer call() { // Repeatedly take something from queue if possible, // transform it, and put back in. try { barrier.await(); int l = 4321; int takes = 0; for (;;) { Integer item = queue.poll(); if (item != null) { ++takes; l = LoopHelpers.compute2(item.intValue()); } else if (takes != 0) { totalItems.getAndAdd(-takes); takes = 0; } else if (totalItems.get() <= 0) break; l = LoopHelpers.compute1(l); if (items > 0) { --items; queue.offer(new Integer(l)); } else if ( (l & (3 << 5)) == 0) // spinwait Thread.sleep(1); } return new Integer(l); } catch (Throwable t) { unexpected(t); return null; } } } void oneRun(int n, int items, final Queue q) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(n + 1, timer); totalItems = new AtomicInteger(n * items); ArrayList> results = new ArrayList>(n); for (int i = 0; i < n; ++i) results.add(pool.submit(new Stage(q, barrier, items))); if (print) System.out.print("Threads: " + n + "\t:"); barrier.await(); int total = 0; for (int i = 0; i < n; ++i) { Future f = results.get(i); Integer r = f.get(); total += r.intValue(); } long endTime = System.nanoTime(); long time = endTime - timer.startTime; if (print) System.out.println(LoopHelpers.rightJustify(time / (items * n)) + " ns per item"); if (total == 0) // avoid overoptimization System.out.println("useless result: " + total); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new ConcurrentQueueLoops().instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/CyclicBarrier/0000755000000000000000000000000011652013243017531 5ustar jsr166/src/test/jtreg/util/concurrent/CyclicBarrier/Basic.java0000644000000000000000000004400211450166503021421 0ustar /* * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6253848 6366811 * @summary Basic tests for CyclicBarrier * @author Martin Buchholz, David Holmes */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; import static java.util.concurrent.TimeUnit.*; public class Basic { private static void checkBroken(final CyclicBarrier barrier) { check(barrier.isBroken()); equal(barrier.getNumberWaiting(), 0); THROWS(BrokenBarrierException.class, new Fun() { public void f() throws Throwable { barrier.await(); }}, new Fun() { public void f() throws Throwable { barrier.await(100, MILLISECONDS); }}); } private static void reset(CyclicBarrier barrier) { barrier.reset(); check(! barrier.isBroken()); equal(barrier.getNumberWaiting(), 0); } private static void checkResult(Awaiter a, Class c) { Throwable t = a.result(); if (! ((t == null && c == null) || (c != null && c.isInstance(t)))) { // t.printStackTrace(); fail("Mismatch in thread " + a.getName() + ": " + t + ", " + (c == null ? "" : c.getName())); } else { pass(); } } //---------------------------------------------------------------- // Mechanism to get all victim threads into "running" mode. // The fact that this also uses CyclicBarrier is entirely coincidental. //---------------------------------------------------------------- private static final CyclicBarrier atTheStartingGate = new CyclicBarrier(3); private static void toTheStartingGate() { try { atTheStartingGate.await(10, SECONDS); pass(); } catch (Throwable t) { unexpected(t); reset(atTheStartingGate); throw new Error(t); } } //---------------------------------------------------------------- // Convenience methods for creating threads that call CyclicBarrier.await //---------------------------------------------------------------- private abstract static class Awaiter extends Thread { static AtomicInteger count = new AtomicInteger(1); { this.setName("Awaiter:"+count.getAndIncrement()); this.setDaemon(true); } private volatile Throwable result = null; protected void result(Throwable result) { this.result = result; } public Throwable result() { return this.result; } } private static Awaiter awaiter(final CyclicBarrier barrier) { return new Awaiter() { public void run() { toTheStartingGate(); try { barrier.await(); } catch (Throwable result) { result(result); }}}; } private static Awaiter awaiter(final CyclicBarrier barrier, final long millis) { return new Awaiter() { public void run() { toTheStartingGate(); try { barrier.await(millis, MILLISECONDS); } catch (Throwable result) { result(result); }}}; } // Returns an infinite lazy list of all possible awaiter pair combinations. private static Iterator awaiterIterator(final CyclicBarrier barrier) { return new Iterator() { int i = 0; public boolean hasNext() { return true; } public Awaiter next() { switch ((i++)&7) { case 0: case 2: case 4: case 5: return awaiter(barrier); default: return awaiter(barrier, 10 * 1000); }} public void remove() {throw new UnsupportedOperationException();}}; } private static void realMain(String[] args) throws Throwable { Thread.currentThread().setName("mainThread"); //---------------------------------------------------------------- // Normal use //---------------------------------------------------------------- try { CyclicBarrier barrier = new CyclicBarrier(3); equal(barrier.getParties(), 3); Iterator awaiters = awaiterIterator(barrier); for (boolean doReset : new boolean[] {false, true}) for (int i = 0; i < 4; i++) { Awaiter a1 = awaiters.next(); a1.start(); Awaiter a2 = awaiters.next(); a2.start(); toTheStartingGate(); barrier.await(); a1.join(); a2.join(); checkResult(a1, null); checkResult(a2, null); check(! barrier.isBroken()); equal(barrier.getParties(), 3); equal(barrier.getNumberWaiting(), 0); if (doReset) reset(barrier); } } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- // One thread interrupted //---------------------------------------------------------------- try { CyclicBarrier barrier = new CyclicBarrier(3); Iterator awaiters = awaiterIterator(barrier); for (int i = 0; i < 4; i++) { Awaiter a1 = awaiters.next(); a1.start(); Awaiter a2 = awaiters.next(); a2.start(); toTheStartingGate(); a1.interrupt(); a1.join(); a2.join(); checkResult(a1, InterruptedException.class); checkResult(a2, BrokenBarrierException.class); checkBroken(barrier); reset(barrier); } } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- // Barrier is reset while threads are waiting //---------------------------------------------------------------- try { CyclicBarrier barrier = new CyclicBarrier(3); Iterator awaiters = awaiterIterator(barrier); for (int i = 0; i < 4; i++) { Awaiter a1 = awaiters.next(); a1.start(); Awaiter a2 = awaiters.next(); a2.start(); toTheStartingGate(); while (barrier.getNumberWaiting() < 2) Thread.yield(); barrier.reset(); a1.join(); a2.join(); checkResult(a1, BrokenBarrierException.class); checkResult(a2, BrokenBarrierException.class); check(! barrier.isBroken()); equal(barrier.getParties(), 3); equal(barrier.getNumberWaiting(), 0); } } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- // One thread timed out //---------------------------------------------------------------- try { CyclicBarrier barrier = new CyclicBarrier(3); Iterator awaiters = awaiterIterator(barrier); for (long timeout : new long[] { 0L, 10L }) { for (int i = 0; i < 2; i++) { Awaiter a1 = awaiter(barrier, timeout); a1.start(); Awaiter a2 = awaiters.next(); a2.start(); toTheStartingGate(); a1.join(); a2.join(); checkResult(a1, TimeoutException.class); checkResult(a2, BrokenBarrierException.class); checkBroken(barrier); equal(barrier.getParties(), 3); reset(barrier); } } } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- // Barrier action completed normally //---------------------------------------------------------------- try { final AtomicInteger count = new AtomicInteger(0); final CyclicBarrier[] kludge = new CyclicBarrier[1]; Runnable action = new Runnable() { public void run() { count.incrementAndGet(); equal(kludge[0].getNumberWaiting(), kludge[0].getParties()); System.out.println("OK!"); }}; CyclicBarrier barrier = new CyclicBarrier(3, action); kludge[0] = barrier; equal(barrier.getParties(), 3); Iterator awaiters = awaiterIterator(barrier); for (int i = 0; i < 4; i++) { Awaiter a1 = awaiters.next(); a1.start(); Awaiter a2 = awaiters.next(); a2.start(); toTheStartingGate(); while (barrier.getNumberWaiting() < 2) Thread.yield(); try { barrier.await(); } catch (Throwable t) { unexpected(t); } a1.join(); a2.join(); checkResult(a1, null); checkResult(a2, null); check(! barrier.isBroken()); equal(barrier.getNumberWaiting(), 0); reset(barrier); equal(count.get(), i+1); } } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- // Barrier action threw exception //---------------------------------------------------------------- try { Runnable action = new Runnable() { public void run() { throw new Error(); }}; CyclicBarrier barrier = new CyclicBarrier(3, action); Iterator awaiters = awaiterIterator(barrier); for (int i = 0; i < 4; i++) { Awaiter a1 = awaiters.next(); a1.start(); Awaiter a2 = awaiters.next(); a2.start(); toTheStartingGate(); while (barrier.getNumberWaiting() < 2) Thread.yield(); try { barrier.await(); fail("Expected Error not thrown"); } catch (Error e) { pass(); } catch (Throwable t) { unexpected(t); } a1.join(); a2.join(); checkResult(a1, BrokenBarrierException.class); checkResult(a2, BrokenBarrierException.class); checkBroken(barrier); reset(barrier); } } catch (Throwable t) { unexpected(t); } testInterrupts(); } /** * Handling of extra interrupts while waiting - tests for bug 6366811 */ private static void testInterrupts() { final int N = 10; final CyclicBarrier startingGate = new CyclicBarrier(N+1); /** * A version of Awaiter that also records interrupted state. */ class Waiter extends CheckedThread { private boolean timed; private CyclicBarrier barrier; private CountDownLatch doneSignal; private Throwable throwable; private boolean interrupted; public Waiter(boolean timed, CountDownLatch doneSignal, CyclicBarrier barrier) { this.timed = timed; this.doneSignal = doneSignal; this.barrier = barrier; } Throwable throwable() { return this.throwable; } boolean interruptBit() { return this.interrupted; } void realRun() throws Throwable { startingGate.await(10, SECONDS); try { if (timed) barrier.await(10, SECONDS); else barrier.await(); } catch (Throwable throwable) { this.throwable = throwable; } try { doneSignal.await(10, SECONDS); } catch (InterruptedException e) { interrupted = true; } } } //---------------------------------------------------------------- // Interrupt occurs during barrier trip //---------------------------------------------------------------- try { final CountDownLatch doneSignal = new CountDownLatch(1); final List waiters = new ArrayList(N); // work around finality of closed-over variables final Runnable[] realAction = new Runnable[1]; final Runnable delegateAction = new Runnable() {public void run() {realAction[0].run();}}; final CyclicBarrier barrier = new CyclicBarrier(N+1, delegateAction); realAction[0] = new Runnable() { public void run() { try { for (int i = 0; i < N/2; i++) waiters.get(i).interrupt(); // we need to try and ensure that the waiters get // to process their interruption before we do the // signalAll that trips the barrier. Using sleep // seems to work reliably while yield does not. Thread.sleep(100); } catch (Throwable t) { unexpected(t); } }}; for (int i = 0; i < N; i++) { Waiter waiter = new Waiter(i < N/2, doneSignal, barrier); waiter.start(); waiters.add(waiter); } startingGate.await(10, SECONDS); while (barrier.getNumberWaiting() < N) Thread.yield(); barrier.await(); doneSignal.countDown(); int countInterrupted = 0; int countInterruptedException = 0; int countBrokenBarrierException = 0; for (Waiter waiter : waiters) { waiter.join(); equal(waiter.throwable(), null); if (waiter.interruptBit()) countInterrupted++; } equal(countInterrupted, N/2); check(! barrier.isBroken()); } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- // Multiple interrupts occur during barrier await //---------------------------------------------------------------- try { final CountDownLatch doneSignal = new CountDownLatch(1); final CyclicBarrier barrier = new CyclicBarrier(N+1); final List waiters = new ArrayList(N); for (int i = 0; i < N; i++) { Waiter waiter = new Waiter(i < N/2, doneSignal, barrier); waiter.start(); waiters.add(waiter); } startingGate.await(10, SECONDS); while (barrier.getNumberWaiting() < N) Thread.yield(); for (int i = 0; i < N/2; i++) waiters.get(i).interrupt(); doneSignal.countDown(); int countInterrupted = 0; int countInterruptedException = 0; int countBrokenBarrierException = 0; for (Waiter waiter : waiters) { waiter.join(); if (waiter.throwable() instanceof InterruptedException) countInterruptedException++; if (waiter.throwable() instanceof BrokenBarrierException) countBrokenBarrierException++; if (waiter.interruptBit()) countInterrupted++; } equal(countInterrupted, N/2-1); equal(countInterruptedException, 1); equal(countBrokenBarrierException, N-1); checkBroken(barrier); reset(barrier); } catch (Throwable t) { unexpected(t); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract static class Fun { abstract void f() throws Throwable; } private static void THROWS(Class k, Fun... fs) { for (Fun f : fs) try { f.f(); fail("Expected " + k.getName() + " not thrown"); } catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} private abstract static class CheckedThread extends Thread { abstract void realRun() throws Throwable; public void run() { try {realRun();} catch (Throwable t) {unexpected(t);}}} } jsr166/src/test/jtreg/util/concurrent/atomic/0000755000000000000000000000000011652013243016270 5ustar jsr166/src/test/jtreg/util/concurrent/atomic/Lazy.java0000644000000000000000000000662111441006144020055 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6275329 * @summary lazySet methods */ import java.util.concurrent.atomic.*; import java.util.*; public class Lazy { volatile int ii; volatile long ll; volatile Boolean bb; static final Lazy z = new Lazy(); public static void main(String[] args) throws Exception { final AtomicBoolean b = new AtomicBoolean(); final AtomicInteger i = new AtomicInteger(); final AtomicLong l = new AtomicLong(); final AtomicReference r = new AtomicReference(); final AtomicIntegerArray ia = new AtomicIntegerArray(1); final AtomicLongArray la = new AtomicLongArray(1); final AtomicReferenceArray ra = new AtomicReferenceArray(1); final AtomicIntegerFieldUpdater iu = AtomicIntegerFieldUpdater.newUpdater(Lazy.class, "ii"); final AtomicLongFieldUpdater lu = AtomicLongFieldUpdater.newUpdater(Lazy.class, "ll"); final AtomicReferenceFieldUpdater ru = AtomicReferenceFieldUpdater.newUpdater(Lazy.class, Boolean.class, "bb"); Thread[] threads = { new Thread() { public void run() { b.lazySet(true); }}, new Thread() { public void run() { i.lazySet(2); }}, new Thread() { public void run() { l.lazySet(3L); }}, new Thread() { public void run() { r.lazySet(9L); }}, new Thread() { public void run() { ia.lazySet(0,4); }}, new Thread() { public void run() { la.lazySet(0,5L); }}, new Thread() { public void run() { ra.lazySet(0,6L); }}, new Thread() { public void run() { iu.lazySet(z,7); }}, new Thread() { public void run() { lu.lazySet(z,8L); }}, new Thread() { public void run() { ru.lazySet(z,true); }}}; for (Thread t : threads) t.start(); for (Thread t : threads) t.join(); if (! (b.get() == true && i.get() == 2 && l.get() == 3L && r.get() == 9L && ia.get(0) == 4 && la.get(0) == 5L && ra.get(0) == 6L && z.ii == 7 && z.ll == 8L && z.bb == true)) throw new Exception("lazySet failed"); } } jsr166/src/test/jtreg/util/concurrent/atomic/VMSupportsCS8.java0000644000000000000000000000377411441006144021564 0ustar /* * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4992443 4994819 * @compile -source 1.5 VMSupportsCS8.java * @run main VMSupportsCS8 * @summary Checks that the value of VMSupportsCS8 matches system properties. */ import java.lang.reflect.Field; public class VMSupportsCS8 { public static void main(String[] args) throws Exception { if (System.getProperty("sun.cpu.isalist").matches (".*\\b(sparcv9|pentium_pro|ia64|amd64).*") || System.getProperty("os.arch").matches (".*\\b(ia64|amd64).*")) { System.out.println("This system is known to have hardware CS8"); Class klass = Class.forName("java.util.concurrent.atomic.AtomicLong"); Field field = klass.getDeclaredField("VM_SUPPORTS_LONG_CAS"); field.setAccessible(true); boolean VMSupportsCS8 = field.getBoolean(null); if (! VMSupportsCS8) throw new Exception("Unexpected value for VMSupportsCS8"); } } } jsr166/src/test/jtreg/util/concurrent/DelayQueue/0000755000000000000000000000000011652013243017057 5ustar jsr166/src/test/jtreg/util/concurrent/DelayQueue/PollUnexpired.java0000644000000000000000000000515611441006144022521 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6327342 * @summary Try to poll a DelayQueue with only unexpired elements * @author Martin Buchholz */ import java.util.concurrent.*; public class PollUnexpired { private static class Godot implements Delayed { public long getDelay(TimeUnit unit) {return Long.MAX_VALUE;} public int compareTo(Delayed other) {return 0;} } private static void realMain(String[] args) throws Throwable { DelayQueue q = new DelayQueue(); for (int i = 0; i < 3; i++) { equal(q.size(), i); equal(q.poll(), null); equal(q.size(), i); equal(q.poll(100, TimeUnit.MILLISECONDS), null); equal(q.size(), i); q.add(new Godot()); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/DelayQueue/Stress.java0000644000000000000000000000462211441006144021207 0ustar /* * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.*; /** * This is not a regression test, but a stress benchmark test for * 6609775: Reduce context switches in DelayQueue due to signalAll * * This runs in the same wall clock time, but much reduced cpu time, * with the changes for 6609775. */ public class Stress { public static void main(String[] args) throws Throwable { final DelayQueue q = new DelayQueue(); final long t0 = System.nanoTime(); for (long i = 0; i < 1000; i++) { final long expiry = t0 + i*10L*1000L*1000L; q.add(new Delayed() { public long getDelay(TimeUnit unit) { return unit.convert(expiry - System.nanoTime(), NANOSECONDS); } public int compareTo(Delayed x) { long d = getDelay(NANOSECONDS) - x.getDelay(NANOSECONDS); return d < 0 ? -1 : d > 0 ? 1 : 0; }}); } for (int i = 0; i < 300; i++) new Thread() { public void run() { try { while (!q.isEmpty()) q.poll(10L, TimeUnit.SECONDS); } catch (Throwable t) { t.printStackTrace(); } }}.start(); } } jsr166/src/test/jtreg/util/concurrent/DelayQueue/Iterate.java0000644000000000000000000000566111441006144021325 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6355327 * @summary DelayQueue iterators should support concurrent modification * @author Martin Buchholz */ import java.io.*; import java.util.*; import java.util.concurrent.*; public class Iterate { private static class Godot implements Delayed { public long getDelay(TimeUnit unit) {return Long.MAX_VALUE;} public int compareTo(Delayed other) {return 0;} } private static void realMain(String[] args) throws Throwable { Godot[] godots = new Godot[] { new Godot(), new Godot(), new Godot() }; DelayQueue q = new DelayQueue(Arrays.asList(godots)); Iterator it = q.iterator(); q.clear(); check(it.hasNext()); equal(it.next(), godots[0]); it.remove(); check(q.isEmpty()); q.addAll(Arrays.asList(godots)); it = q.iterator(); check(it.hasNext()); it.next(); equal(it.next(), godots[1]); it.remove(); equal(q.size(), 2); check(q.contains(godots[0])); check(q.contains(godots[2])); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/TimeUnit/0000755000000000000000000000000011652013243016552 5ustar jsr166/src/test/jtreg/util/concurrent/TimeUnit/Basic.java0000644000000000000000000001142011441006144020432 0ustar /* * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* @test * @bug 5057341 6363898 * @summary Basic tests for TimeUnit * @author Martin Buchholz */ import java.io.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.*; public class Basic { private static void realMain(String[] args) throws Throwable { for (TimeUnit u : TimeUnit.values()) { System.out.println(u); check(u instanceof TimeUnit); equal(42L, u.convert(42, u)); for (TimeUnit v : TimeUnit.values()) if (u.convert(42, v) >= 42) equal(42L, v.convert(u.convert(42, v), u)); check(readObject(serializedForm(u)) == u); } equal( 24L, HOURS.convert (1, DAYS)); equal( 60L, MINUTES.convert (1, HOURS)); equal( 60L, SECONDS.convert (1, MINUTES)); equal(1000L, MILLISECONDS.convert(1, SECONDS)); equal(1000L, MICROSECONDS.convert(1, MILLISECONDS)); equal(1000L, NANOSECONDS.convert (1, MICROSECONDS)); equal( 24L, DAYS.toHours(1)); equal( 60L, HOURS.toMinutes(1)); equal( 60L, MINUTES.toSeconds(1)); equal(1000L, SECONDS.toMillis(1)); equal(1000L, MILLISECONDS.toMicros(1)); equal(1000L, MICROSECONDS.toNanos(1)); long t0 = System.nanoTime(); MILLISECONDS.sleep(3); /* See windows bug 6313903, might not sleep */ long elapsedMillis = (System.nanoTime() - t0)/(1000L * 1000L); System.out.printf("elapsed=%d%n", elapsedMillis); check(elapsedMillis >= 0); /* Might not sleep on windows: check(elapsedMillis >= 3); */ check(elapsedMillis < 1000); //---------------------------------------------------------------- // Tests for serialized form compatibility with previous release //---------------------------------------------------------------- byte[] serializedForm = /* Generated using tiger */ {-84, -19, 0, 5, '~', 'r', 0, 29, 'j', 'a', 'v', 'a', '.', 'u', 't', 'i', 'l', '.', 'c', 'o', 'n', 'c', 'u', 'r', 'r', 'e', 'n', 't', '.', 'T', 'i', 'm', 'e', 'U', 'n', 'i', 't', 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 'x', 'r', 0, 14, 'j', 'a', 'v', 'a', '.', 'l', 'a', 'n', 'g', '.', 'E', 'n', 'u', 'm', 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 'x', 'p', 't', 0, 7, 'S', 'E', 'C', 'O', 'N', 'D', 'S', }; check(Arrays.equals(serializedForm(SECONDS), serializedForm)); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} static byte[] serializedForm(Object obj) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); new ObjectOutputStream(baos).writeObject(obj); return baos.toByteArray(); } static Object readObject(byte[] bytes) throws IOException, ClassNotFoundException { InputStream is = new ByteArrayInputStream(bytes); return new ObjectInputStream(is).readObject(); } } jsr166/src/test/jtreg/util/concurrent/BlockingQueue/0000755000000000000000000000000011652013243017551 5ustar jsr166/src/test/jtreg/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java0000644000000000000000000001214511537741070026536 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 CancelledProducerConsumerLoops.java * @run main/timeout=7000 CancelledProducerConsumerLoops * @summary Checks for responsiveness of blocking queues to cancellation. * Runs under the assumption that ITERS computations require more than * TIMEOUT msecs to complete. */ import java.util.concurrent.*; public class CancelledProducerConsumerLoops { static final int CAPACITY = 100; static final long TIMEOUT = 100; static final ExecutorService pool = Executors.newCachedThreadPool(); static boolean print = false; public static void main(String[] args) throws Exception { int maxPairs = 8; int iters = 1000000; if (args.length > 0) maxPairs = Integer.parseInt(args[0]); print = true; for (int i = 1; i <= maxPairs; i += (i+1) >>> 1) { System.out.println("Pairs:" + i); try { oneTest(i, iters); } catch (BrokenBarrierException bb) { // OK, ignore } Thread.sleep(100); } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static void oneRun(BlockingQueue q, int npairs, int iters) throws Exception { if (print) System.out.printf("%-18s", q.getClass().getSimpleName()); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(npairs * 2 + 1, timer); Future[] prods = new Future[npairs]; Future[] cons = new Future[npairs]; for (int i = 0; i < npairs; ++i) { prods[i] = pool.submit(new Producer(q, barrier, iters)); cons[i] = pool.submit(new Consumer(q, barrier, iters)); } barrier.await(); Thread.sleep(TIMEOUT); boolean tooLate = false; for (int i = 1; i < npairs; ++i) { if (!prods[i].cancel(true)) tooLate = true; if (!cons[i].cancel(true)) tooLate = true; } Object p0 = prods[0].get(); Object c0 = cons[0].get(); if (!tooLate) { for (int i = 1; i < npairs; ++i) { if (!prods[i].isDone() || !prods[i].isCancelled()) throw new Error("Only one producer thread should complete"); if (!cons[i].isDone() || !cons[i].isCancelled()) throw new Error("Only one consumer thread should complete"); } } else System.out.print("(cancelled too late) "); long endTime = System.nanoTime(); long time = endTime - timer.startTime; if (print) { double secs = (double)(time) / 1000000000.0; System.out.println("\t " + secs + "s run time"); } } static void oneTest(int pairs, int iters) throws Exception { oneRun(new ArrayBlockingQueue(CAPACITY), pairs, iters); oneRun(new LinkedBlockingQueue(CAPACITY), pairs, iters); oneRun(new LinkedBlockingDeque(CAPACITY), pairs, iters); oneRun(new LinkedTransferQueue(), pairs, iters); oneRun(new SynchronousQueue(), pairs, iters / 8); /* PriorityBlockingQueue is unbounded oneRun(new PriorityBlockingQueue(iters / 2 * pairs), pairs, iters / 4); */ } abstract static class Stage implements Callable { final BlockingQueue queue; final CyclicBarrier barrier; final int iters; Stage(BlockingQueue q, CyclicBarrier b, int iters) { queue = q; barrier = b; this.iters = iters; } } static class Producer extends Stage { Producer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public Integer call() throws Exception { barrier.await(); int s = 0; int l = 4321; for (int i = 0; i < iters; ++i) { l = LoopHelpers.compute1(l); s += LoopHelpers.compute2(l); if (!queue.offer(new Integer(l), 1, TimeUnit.SECONDS)) break; } return new Integer(s); } } static class Consumer extends Stage { Consumer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public Integer call() throws Exception { barrier.await(); int l = 0; int s = 0; for (int i = 0; i < iters; ++i) { Integer x = queue.poll(1, TimeUnit.SECONDS); if (x == null) break; l = LoopHelpers.compute1(x.intValue()); s += l; } return new Integer(s); } } } jsr166/src/test/jtreg/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java0000644000000000000000000001210711537741070030002 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 MultipleProducersSingleConsumerLoops.java * @run main/timeout=3600 MultipleProducersSingleConsumerLoops * @summary multiple producers and single consumer using blocking queues */ import java.util.concurrent.*; public class MultipleProducersSingleConsumerLoops { static final int CAPACITY = 100; static final ExecutorService pool = Executors.newCachedThreadPool(); static boolean print = false; static int producerSum; static int consumerSum; static synchronized void addProducerSum(int x) { producerSum += x; } static synchronized void addConsumerSum(int x) { consumerSum += x; } static synchronized void checkSum() { if (producerSum != consumerSum) throw new Error("CheckSum mismatch"); } public static void main(String[] args) throws Exception { int maxProducers = 5; int iters = 100000; if (args.length > 0) maxProducers = Integer.parseInt(args[0]); print = false; System.out.println("Warmup..."); oneTest(1, 10000); Thread.sleep(100); oneTest(2, 10000); Thread.sleep(100); print = true; for (int i = 1; i <= maxProducers; i += (i+1) >>> 1) { System.out.println("----------------------------------------"); System.out.println("Producers:" + i); oneTest(i, iters); Thread.sleep(100); } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static void oneTest(int producers, int iters) throws Exception { oneRun(new ArrayBlockingQueue(CAPACITY), producers, iters); oneRun(new LinkedBlockingQueue(CAPACITY), producers, iters); oneRun(new LinkedBlockingDeque(CAPACITY), producers, iters); oneRun(new LinkedTransferQueue(), producers, iters); // Don't run PBQ since can legitimately run out of memory // if (print) // System.out.print("PriorityBlockingQueue "); // oneRun(new PriorityBlockingQueue(), producers, iters); oneRun(new SynchronousQueue(), producers, iters); if (print) System.out.println("fair implementations:"); oneRun(new SynchronousQueue(true), producers, iters); oneRun(new ArrayBlockingQueue(CAPACITY, true), producers, iters); } abstract static class Stage implements Runnable { final int iters; final BlockingQueue queue; final CyclicBarrier barrier; Stage(BlockingQueue q, CyclicBarrier b, int iters) { queue = q; barrier = b; this.iters = iters; } } static class Producer extends Stage { Producer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public void run() { try { barrier.await(); int s = 0; int l = hashCode(); for (int i = 0; i < iters; ++i) { l = LoopHelpers.compute1(l); l = LoopHelpers.compute2(l); queue.put(new Integer(l)); s += l; } addProducerSum(s); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static class Consumer extends Stage { Consumer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public void run() { try { barrier.await(); int s = 0; for (int i = 0; i < iters; ++i) { s += queue.take().intValue(); } addConsumerSum(s); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static void oneRun(BlockingQueue q, int nproducers, int iters) throws Exception { if (print) System.out.printf("%-18s", q.getClass().getSimpleName()); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(nproducers + 2, timer); for (int i = 0; i < nproducers; ++i) { pool.execute(new Producer(q, barrier, iters)); } pool.execute(new Consumer(q, barrier, iters * nproducers)); barrier.await(); barrier.await(); long time = timer.getTime(); checkSum(); if (print) System.out.println("\t: " + LoopHelpers.rightJustify(time / (iters * nproducers)) + " ns per transfer"); } } jsr166/src/test/jtreg/util/concurrent/BlockingQueue/PollMemoryLeak.java0000644000000000000000000000203211537741070023315 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6236036 6264015 * @compile PollMemoryLeak.java * @run main/othervm -Xmx8m PollMemoryLeak * @summary Checks for OutOfMemoryError when an unbounded * number of aborted timed waits occur without a signal. */ import java.util.concurrent.*; public class PollMemoryLeak { public static void main(String[] args) throws InterruptedException { final BlockingQueue[] qs = { new LinkedBlockingQueue(10), new LinkedTransferQueue(), new ArrayBlockingQueue(10), new SynchronousQueue(), new SynchronousQueue(true), }; final long start = System.currentTimeMillis(); final long end = start + 10 * 1000; while (System.currentTimeMillis() < end) for (BlockingQueue q : qs) q.poll(1, TimeUnit.NANOSECONDS); } } jsr166/src/test/jtreg/util/concurrent/BlockingQueue/OfferDrainToLoops.java0000644000000000000000000001345511537741070023773 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6805775 6815766 * @run main OfferDrainToLoops 300 * @summary Test concurrent offer vs. drainTo */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @SuppressWarnings({"unchecked", "rawtypes", "deprecation"}) public class OfferDrainToLoops { final long testDurationMillisDefault = 10L * 1000L; final long testDurationMillis; OfferDrainToLoops(String[] args) { testDurationMillis = (args.length > 0) ? Long.valueOf(args[0]) : testDurationMillisDefault; } void checkNotContainsNull(Iterable it) { for (Object x : it) check(x != null); } void test(String[] args) throws Throwable { test(new LinkedBlockingQueue()); test(new LinkedBlockingQueue(2000)); test(new LinkedBlockingDeque()); test(new LinkedBlockingDeque(2000)); test(new ArrayBlockingQueue(2000)); test(new LinkedTransferQueue()); } Random getRandom() { return ThreadLocalRandom.current(); } void test(final BlockingQueue q) throws Throwable { System.out.println(q.getClass().getSimpleName()); final long testDurationNanos = testDurationMillis * 1000L * 1000L; final long quittingTimeNanos = System.nanoTime() + testDurationNanos; final long timeoutMillis = 10L * 1000L; /** Poor man's bounded buffer. */ final AtomicLong approximateCount = new AtomicLong(0L); abstract class CheckedThread extends Thread { CheckedThread(String name) { super(name); setDaemon(true); start(); } /** Polls for quitting time. */ protected boolean quittingTime() { return System.nanoTime() - quittingTimeNanos > 0; } /** Polls occasionally for quitting time. */ protected boolean quittingTime(long i) { return (i % 1024) == 0 && quittingTime(); } abstract protected void realRun(); public void run() { try { realRun(); } catch (Throwable t) { unexpected(t); } } } Thread offerer = new CheckedThread("offerer") { protected void realRun() { long c = 0; for (long i = 0; ! quittingTime(i); i++) { if (q.offer(c)) { if ((++c % 1024) == 0) { approximateCount.getAndAdd(1024); while (approximateCount.get() > 10000) Thread.yield(); } } else { Thread.yield(); }}}}; Thread drainer = new CheckedThread("drainer") { protected void realRun() { final Random rnd = getRandom(); while (! quittingTime()) { List list = new ArrayList(); int n = rnd.nextBoolean() ? q.drainTo(list) : q.drainTo(list, 100); approximateCount.getAndAdd(-n); equal(list.size(), n); for (int j = 0; j < n - 1; j++) equal((Long) list.get(j) + 1L, list.get(j + 1)); Thread.yield(); } q.clear(); approximateCount.set(0); // Releases waiting offerer thread }}; Thread scanner = new CheckedThread("scanner") { protected void realRun() { final Random rnd = getRandom(); while (! quittingTime()) { switch (rnd.nextInt(3)) { case 0: checkNotContainsNull(q); break; case 1: q.size(); break; case 2: Long[] a = (Long[]) q.toArray(new Long[0]); int n = a.length; for (int j = 0; j < n - 1; j++) { check(a[j] < a[j+1]); check(a[j] != null); } break; } Thread.yield(); }}}; for (Thread thread : new Thread[] { offerer, drainer, scanner }) { thread.join(timeoutMillis + testDurationMillis); if (thread.isAlive()) { System.err.printf("Hung thread: %s%n", thread.getName()); failed++; for (StackTraceElement e : thread.getStackTrace()) System.err.println(e); // Kludge alert thread.stop(); thread.join(timeoutMillis); } } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new OfferDrainToLoops(args).instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/BlockingQueue/LastElement.java0000644000000000000000000000711311441006144022631 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6215625 * @summary Check correct behavior when last element is removed. * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class LastElement { void test(String[] args) throws Throwable { testQueue(new LinkedBlockingQueue()); testQueue(new LinkedBlockingDeque()); testQueue(new ArrayBlockingQueue(10, true)); testQueue(new ArrayBlockingQueue(10, false)); testQueue(new LinkedTransferQueue()); System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Exception("Some tests failed"); } void testQueue(BlockingQueue q) throws Throwable { Integer one = 1; Integer two = 2; Integer three = 3; // remove(Object) q.put(one); q.put(two); check(! q.isEmpty() && q.size() == 2); check(q.remove(one)); check(q.remove(two)); check(q.isEmpty() && q.size() == 0); q.put(three); try {check(q.take() == three);} catch (Throwable t) {unexpected(t);} check(q.isEmpty() && q.size() == 0); // iterator().remove() q.clear(); q.put(one); check(q.offer(two)); check(! q.isEmpty() && q.size() == 2); Iterator i = q.iterator(); check(i.next() == one); i.remove(); check(i.next() == two); i.remove(); check(q.isEmpty() && q.size() == 0); q.put(three); try {check(q.take() == three);} catch (Throwable t) {unexpected(t);} check(q.isEmpty() && q.size() == 0); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new LastElement().instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/concurrent/BlockingQueue/LoopHelpers.java0000644000000000000000000000542711537741070022670 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; class LoopHelpers { // Some mindless computation to do between synchronizations... /** * generates 32 bit pseudo-random numbers. * Adapted from http://www.snippets.org */ public static int compute1(int x) { int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } return lo; } /** * Computes a linear congruential random number a random number * of times. */ public static int compute2(int x) { int loops = (x >>> 4) & 7; while (loops-- > 0) { x = (x * 2147483647) % 16807; } return x; } /** * An actually useful random number generator, but unsynchronized. * Basically same as java.util.Random. */ public static class SimpleRandom { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong(1); private long seed = System.nanoTime() + seq.getAndIncrement(); public void setSeed(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } } public static class BarrierTimer implements Runnable { public volatile long startTime; public volatile long endTime; public void run() { long t = System.nanoTime(); if (startTime == 0) startTime = t; else endTime = t; } public void clear() { startTime = 0; endTime = 0; } public long getTime() { return endTime - startTime; } } public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; String num = Long.toString(n); if (num.length() >= field.length()) return num; StringBuffer b = new StringBuffer(field); b.replace(b.length()-num.length(), b.length(), num); return b.toString(); } } jsr166/src/test/jtreg/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java0000644000000000000000000001125011537741070027615 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 SingleProducerMultipleConsumerLoops.java * @run main/timeout=600 SingleProducerMultipleConsumerLoops * @summary check ordering for blocking queues with 1 producer and multiple consumers */ import java.util.concurrent.*; public class SingleProducerMultipleConsumerLoops { static final int CAPACITY = 100; static final ExecutorService pool = Executors.newCachedThreadPool(); static boolean print = false; public static void main(String[] args) throws Exception { int maxConsumers = 5; int iters = 10000; if (args.length > 0) maxConsumers = Integer.parseInt(args[0]); print = false; System.out.println("Warmup..."); oneTest(1, 10000); Thread.sleep(100); oneTest(2, 10000); Thread.sleep(100); print = true; for (int i = 1; i <= maxConsumers; i += (i+1) >>> 1) { System.out.println("----------------------------------------"); System.out.println("Consumers: " + i); oneTest(i, iters); Thread.sleep(100); } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static void oneTest(int consumers, int iters) throws Exception { oneRun(new ArrayBlockingQueue(CAPACITY), consumers, iters); oneRun(new LinkedBlockingQueue(CAPACITY), consumers, iters); oneRun(new LinkedBlockingDeque(CAPACITY), consumers, iters); oneRun(new LinkedTransferQueue(), consumers, iters); oneRun(new PriorityBlockingQueue(), consumers, iters); oneRun(new SynchronousQueue(), consumers, iters); if (print) System.out.println("fair implementations:"); oneRun(new SynchronousQueue(true), consumers, iters); oneRun(new ArrayBlockingQueue(CAPACITY, true), consumers, iters); } abstract static class Stage implements Runnable { final int iters; final BlockingQueue queue; final CyclicBarrier barrier; volatile int result; Stage(BlockingQueue q, CyclicBarrier b, int iters) { queue = q; barrier = b; this.iters = iters; } } static class Producer extends Stage { Producer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public void run() { try { barrier.await(); for (int i = 0; i < iters; ++i) { queue.put(new Integer(i)); } barrier.await(); result = 432; } catch (Exception ie) { ie.printStackTrace(); return; } } } static class Consumer extends Stage { Consumer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public void run() { try { barrier.await(); int l = 0; int s = 0; int last = -1; for (int i = 0; i < iters; ++i) { Integer item = queue.take(); int v = item.intValue(); if (v < last) throw new Error("Out-of-Order transfer"); last = v; l = LoopHelpers.compute1(v); s += l; } barrier.await(); result = s; } catch (Exception ie) { ie.printStackTrace(); return; } } } static void oneRun(BlockingQueue q, int nconsumers, int iters) throws Exception { if (print) System.out.printf("%-18s", q.getClass().getSimpleName()); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(nconsumers + 2, timer); pool.execute(new Producer(q, barrier, iters * nconsumers)); for (int i = 0; i < nconsumers; ++i) { pool.execute(new Consumer(q, barrier, iters)); } barrier.await(); barrier.await(); long time = timer.getTime(); if (print) System.out.println("\t: " + LoopHelpers.rightJustify(time / (iters * nconsumers)) + " ns per transfer"); } } jsr166/src/test/jtreg/util/concurrent/BlockingQueue/ProducerConsumerLoops.java0000644000000000000000000001151711537741070024745 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 ProducerConsumerLoops.java * @run main/timeout=3600 ProducerConsumerLoops * @summary multiple producers and consumers using blocking queues */ import java.util.concurrent.*; public class ProducerConsumerLoops { static final int CAPACITY = 100; static final ExecutorService pool = Executors.newCachedThreadPool(); static boolean print = false; static int producerSum; static int consumerSum; static synchronized void addProducerSum(int x) { producerSum += x; } static synchronized void addConsumerSum(int x) { consumerSum += x; } static synchronized void checkSum() { if (producerSum != consumerSum) throw new Error("CheckSum mismatch"); } public static void main(String[] args) throws Exception { int maxPairs = 8; int iters = 10000; if (args.length > 0) maxPairs = Integer.parseInt(args[0]); print = false; System.out.println("Warmup..."); oneTest(1, 10000); Thread.sleep(100); oneTest(2, 10000); Thread.sleep(100); print = true; for (int i = 1; i <= maxPairs; i += (i+1) >>> 1) { System.out.println("----------------------------------------"); System.out.println("Pairs: " + i); oneTest(i, iters); Thread.sleep(100); } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static void oneTest(int pairs, int iters) throws Exception { oneRun(new ArrayBlockingQueue(CAPACITY), pairs, iters); oneRun(new LinkedBlockingQueue(CAPACITY), pairs, iters); oneRun(new LinkedBlockingDeque(CAPACITY), pairs, iters); oneRun(new LinkedTransferQueue(), pairs, iters); oneRun(new PriorityBlockingQueue(), pairs, iters); oneRun(new SynchronousQueue(), pairs, iters); if (print) System.out.println("fair implementations:"); oneRun(new SynchronousQueue(true), pairs, iters); oneRun(new ArrayBlockingQueue(CAPACITY, true), pairs, iters); } abstract static class Stage implements Runnable { final int iters; final BlockingQueue queue; final CyclicBarrier barrier; Stage(BlockingQueue q, CyclicBarrier b, int iters) { queue = q; barrier = b; this.iters = iters; } } static class Producer extends Stage { Producer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public void run() { try { barrier.await(); int s = 0; int l = hashCode(); for (int i = 0; i < iters; ++i) { l = LoopHelpers.compute2(l); queue.put(new Integer(l)); s += LoopHelpers.compute1(l); } addProducerSum(s); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static class Consumer extends Stage { Consumer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public void run() { try { barrier.await(); int l = 0; int s = 0; for (int i = 0; i < iters; ++i) { l = LoopHelpers.compute1(queue.take().intValue()); s += l; } addConsumerSum(s); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static void oneRun(BlockingQueue q, int npairs, int iters) throws Exception { if (print) System.out.printf("%-18s", q.getClass().getSimpleName()); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(npairs * 2 + 1, timer); for (int i = 0; i < npairs; ++i) { pool.execute(new Producer(q, barrier, iters)); pool.execute(new Consumer(q, barrier, iters)); } barrier.await(); barrier.await(); long time = timer.getTime(); checkSum(); if (print) System.out.println("\t: " + LoopHelpers.rightJustify(time / (iters * npairs)) + " ns per transfer"); } } jsr166/src/test/jtreg/util/concurrent/BlockingQueue/Interrupt.java0000644000000000000000000001343311450166503022420 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6384064 * @summary Check proper handling of interrupts * @run main/othervm -XX:-UseVMInterruptibleIO Interrupt * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.*; public class Interrupt { static void checkInterrupted0(Iterable fs, Executor ex) { for (Fun f : fs) { try { ex.execute(new Runnable() { final Thread thisThread = Thread.currentThread(); public void run() { thisThread.interrupt(); }}); f.f(); fail("Expected InterruptedException not thrown"); } catch (InterruptedException e) { check(! Thread.interrupted()); } catch (Throwable t) { unexpected(t); } } } static void checkInterrupted(Iterable fs) { final Executor immediateExecutor = new Executor() { public void execute(Runnable r) { r.run(); }}; final ScheduledThreadPoolExecutor stpe = new ScheduledThreadPoolExecutor(1); final Executor delayedExecutor = new Executor() { public void execute(Runnable r) { stpe.schedule(r, 20, MILLISECONDS); }}; checkInterrupted0(fs, immediateExecutor); checkInterrupted0(fs, delayedExecutor); stpe.shutdown(); } static void testQueue(final BlockingQueue q) { try { final BlockingDeque deq = (q instanceof BlockingDeque) ? (BlockingDeque) q : null; q.clear(); List fs = new ArrayList(); fs.add(new Fun() { void f() throws Throwable { q.take(); }}); fs.add(new Fun() { void f() throws Throwable { q.poll(60, SECONDS); }}); if (deq != null) { fs.add(new Fun() { void f() throws Throwable { deq.takeFirst(); }}); fs.add(new Fun() { void f() throws Throwable { deq.takeLast(); }}); fs.add(new Fun() { void f() throws Throwable { deq.pollFirst(7, SECONDS); }}); fs.add(new Fun() { void f() throws Throwable { deq.pollLast(7, SECONDS); }}); } checkInterrupted(fs); // fill q to capacity, to ensure insertions will block while (q.remainingCapacity() > 0) try { q.put(1); } catch (Throwable t) { unexpected(t); } fs.clear(); fs.add(new Fun() { void f() throws Throwable { q.put(1); }}); fs.add(new Fun() { void f() throws Throwable { q.offer(1, 7, SECONDS); }}); if (deq != null) { fs.add(new Fun() { void f() throws Throwable { deq.putFirst(1); }}); fs.add(new Fun() { void f() throws Throwable { deq.putLast(1); }}); fs.add(new Fun() { void f() throws Throwable { deq.offerFirst(1, 7, SECONDS); }}); fs.add(new Fun() { void f() throws Throwable { deq.offerLast(1, 7, SECONDS); }}); } checkInterrupted(fs); } catch (Throwable t) { System.out.printf("Failed: %s%n", q.getClass().getSimpleName()); unexpected(t); } } private static void realMain(final String[] args) throws Throwable { testQueue(new SynchronousQueue()); testQueue(new ArrayBlockingQueue(1,false)); testQueue(new ArrayBlockingQueue(1,true)); testQueue(new LinkedBlockingQueue(1)); testQueue(new LinkedBlockingDeque(1)); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class Fun {abstract void f() throws Throwable;} } jsr166/src/test/jtreg/util/concurrent/Exchanger/0000755000000000000000000000000011652013243016720 5ustar jsr166/src/test/jtreg/util/concurrent/Exchanger/LoopHelpers.java0000644000000000000000000000542611537741070022036 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; class LoopHelpers { // Some mindless computation to do between synchronizations... /** * generates 32 bit pseudo-random numbers. * Adapted from http://www.snippets.org */ public static int compute1(int x) { int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } return lo; } /** * Computes a linear congruential random number a random number * of times. */ public static int compute2(int x) { int loops = (x >>> 4) & 7; while (loops-- > 0) { x = (x * 2147483647) % 16807; } return x; } /** * An actually useful random number generator, but unsynchronized. * Basically same as java.util.Random. */ public static class SimpleRandom { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong(1); private long seed = System.nanoTime() + seq.getAndIncrement(); public void setSeed(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } } public static class BarrierTimer implements Runnable { public volatile long startTime; public volatile long endTime; public void run() { long t = System.nanoTime(); if (startTime == 0) startTime = t; else endTime = t; } public void clear() { startTime = 0; endTime = 0; } public long getTime() { return endTime - startTime; } } public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; String num = Long.toString(n); if (num.length() >= field.length()) return num; StringBuffer b = new StringBuffer(field); b.replace(b.length()-num.length(), b.length(), num); return b.toString(); } } jsr166/src/test/jtreg/util/concurrent/Exchanger/ExchangeLoops.java0000644000000000000000000000666611537741070022350 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 ExchangeLoops.java * @run main/timeout=720 ExchangeLoops * @summary checks to make sure a pipeline of exchangers passes data. */ import java.util.concurrent.*; public class ExchangeLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static boolean print = false; static class Int { public int value; Int(int i) { value = i; } } public static void main(String[] args) throws Exception { int maxStages = 5; int iters = 10000; if (args.length > 0) maxStages = Integer.parseInt(args[0]); print = false; System.out.println("Warmup..."); oneRun(2, 100000); print = true; for (int i = 2; i <= maxStages; i += (i+1) >>> 1) { System.out.print("Threads: " + i + "\t: "); oneRun(i, iters); } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static class Stage implements Runnable { final int iters; final Exchanger left; final Exchanger right; final CyclicBarrier barrier; volatile int result; Stage(Exchanger left, Exchanger right, CyclicBarrier b, int iters) { this.left = left; this.right = right; barrier = b; this.iters = iters; } public void run() { try { barrier.await(); Int item = new Int(hashCode()); for (int i = 0; i < iters; ++i) { if (left != null) { item.value = LoopHelpers.compute1(item.value); Int other = left.exchange(item); if (other == item || other == null) throw new Error("Failed Exchange"); item = other; } if (right != null) { item.value = LoopHelpers.compute2(item.value); Int other = right.exchange(item); if (other == item || other == null) throw new Error("Failed Exchange"); item = other; } } barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static void oneRun(int nthreads, int iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(nthreads + 1, timer); Exchanger l = null; Exchanger r = new Exchanger(); for (int i = 0; i < nthreads; ++i) { pool.execute(new Stage(l, r, barrier, iters)); l = r; r = (i+2 < nthreads) ? new Exchanger() : null; } barrier.await(); barrier.await(); long time = timer.getTime(); if (print) System.out.println(LoopHelpers.rightJustify(time / (iters * nthreads + iters * (nthreads-2))) + " ns per transfer"); } } jsr166/src/test/jtreg/util/concurrent/ExecutorCompletionService/0000755000000000000000000000000011652013243022165 5ustar jsr166/src/test/jtreg/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java0000644000000000000000000000513511537741070031232 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4965960 * @compile -source 1.5 ExecutorCompletionServiceLoops.java * @run main/timeout=3600 ExecutorCompletionServiceLoops * @summary Exercise ExecutorCompletionServiceLoops */ import java.util.concurrent.*; public class ExecutorCompletionServiceLoops { static final int POOLSIZE = 100; static final ExecutorService pool = Executors.newFixedThreadPool(POOLSIZE); static final ExecutorCompletionService ecs = new ExecutorCompletionService(pool); static boolean print = false; public static void main(String[] args) throws Exception { int max = 8; int base = 10000; if (args.length > 0) max = Integer.parseInt(args[0]); System.out.println("Warmup..."); oneTest( base ); Thread.sleep(100); print = true; for (int i = 1; i <= max; i += (i+1) >>> 1) { System.out.print("n: " + i * base); oneTest(i * base ); Thread.sleep(100); } pool.shutdown(); if (! pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) throw new Error(); } static class Task implements Callable { public Integer call() { int s = 0; int l = System.identityHashCode(this); for (int i = 0; i < 5; ++i) { l = LoopHelpers.compute2(l); s += LoopHelpers.compute1(l); } return new Integer(s); } } static class Producer implements Runnable { final ExecutorCompletionService cs; final int iters; Producer(ExecutorCompletionService ecs, int i) { cs = ecs; iters = i; } public void run() { for (int i = 0; i < iters; ++i) ecs.submit(new Task()); } } static void oneTest(int iters) throws Exception { long startTime = System.nanoTime(); new Thread(new Producer(ecs, iters)).start(); int r = 0; for (int i = 0; i < iters; ++i) r += ecs.take().get().intValue(); long elapsed = System.nanoTime() - startTime; long tpi = elapsed/ iters; if (print) System.out.println("\t: " + LoopHelpers.rightJustify(tpi) + " ns per task"); if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } } jsr166/src/test/jtreg/util/concurrent/ExecutorCompletionService/LoopHelpers.java0000644000000000000000000000542611537741070025303 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; class LoopHelpers { // Some mindless computation to do between synchronizations... /** * generates 32 bit pseudo-random numbers. * Adapted from http://www.snippets.org */ public static int compute1(int x) { int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } return lo; } /** * Computes a linear congruential random number a random number * of times. */ public static int compute2(int x) { int loops = (x >>> 4) & 7; while (loops-- > 0) { x = (x * 2147483647) % 16807; } return x; } /** * An actually useful random number generator, but unsynchronized. * Basically same as java.util.Random. */ public static class SimpleRandom { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong(1); private long seed = System.nanoTime() + seq.getAndIncrement(); public void setSeed(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } } public static class BarrierTimer implements Runnable { public volatile long startTime; public volatile long endTime; public void run() { long t = System.nanoTime(); if (startTime == 0) startTime = t; else endTime = t; } public void clear() { startTime = 0; endTime = 0; } public long getTime() { return endTime - startTime; } } public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; String num = Long.toString(n); if (num.length() >= field.length()) return num; StringBuffer b = new StringBuffer(field); b.replace(b.length()-num.length(), b.length(), num); return b.toString(); } } jsr166/src/test/jtreg/util/LinkedHashSet/0000755000000000000000000000000011652013243015320 5ustar jsr166/src/test/jtreg/util/LinkedHashSet/Basic.java0000644000000000000000000001347611441006143017214 0ustar /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4245809 * @summary Basic test for LinkedHashSet. (Based on SetBash) */ import java.util.*; import java.io.*; public class Basic { static Random rnd = new Random(666); public static void main(String[] args) throws Exception { int numItr = 500; int setSize = 500; for (int i=0; i m = new IdentityHashMap(); Set> es = m.entrySet(); m.put("beer", "good"); Iterator> i = es.iterator(); System.out.println(i); // Used to throw exception i.next(); System.out.println(i); } } jsr166/src/test/jtreg/util/IdentityHashMap/ToArray.java0000644000000000000000000000713011441006143020107 0ustar /* * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4485486 6197726 6232484 * @summary IdentityHashMap's entrySet toArray tests * @author Josh Bloch, Martin Buchholz */ import java.util.*; public class ToArray { public static void main(String[] args) { //---------------------------------------------------------------- // new ArrayList(IdentityHashMap.entrySet()) // used to return bogus entries. //---------------------------------------------------------------- Map mm = new IdentityHashMap(); mm.put("foo", "bar"); mm.put("baz", "quux"); List> lm = new ArrayList>(mm.entrySet()); String s = lm.toString(); if (! (s.equals("[foo=bar, baz=quux]") || s.equals("[baz=quux, foo=bar]"))) throw new Error("bad string"); //---------------------------------------------------------------- // IdentityHashMap's lack of internal entry objects caused // the inherited (AbstractMap) version of toArray to // return garbage when called on the entrySet view. //---------------------------------------------------------------- Map m = new IdentityHashMap(); m.put("french", "connection"); m.put("polish", "sausage"); Object[] mArray = m.entrySet().toArray(); if (mArray[0] == mArray[1]) throw new RuntimeException("Broken"); mArray[0].toString(); mArray[1].toString(); //---------------------------------------------------------------- // IdentityHashMap.entrySet().toArray(T[] a) used to simply // return toArray() ! //---------------------------------------------------------------- IdentityHashMap map = new IdentityHashMap(); Set> es = map.entrySet(); if (es.toArray().length != 0) throw new Error("non-empty"); if (es.toArray(new Object[]{Boolean.TRUE})[0] != null) throw new Error("non-null"); map.put(7,49); if (es.toArray().length != 1) throw new Error("length"); Object[] x = es.toArray(new Object[]{Boolean.TRUE, Boolean.TRUE}); if (x[1] != null) throw new Error("non-null"); Map.Entry e = (Map.Entry) x[0]; if (! e.getKey().equals(new Integer(7))) throw new Error("bad key"); if (! e.getValue().equals(new Integer(49))) throw new Error("bad value"); } } jsr166/src/test/jtreg/util/Random/0000755000000000000000000000000011652013243014052 5ustar jsr166/src/test/jtreg/util/Random/NextIntPowerOfTwoMod.java0000644000000000000000000000307611441006144020746 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4187412 * @summary The FCS release of 1.2 did not special case the Random.nextInt * calculation for a power of two modulus, as mandated by the spec. */ import java.util.Random; public class NextIntPowerOfTwoMod { public static void main(String[] args) throws Exception { Random r = new Random(69); int total = 0; for (int i=0; i<1000; i++) total += r.nextInt(16); if (total != 7639) throw new RuntimeException("Not using correct algorithm."); } } jsr166/src/test/jtreg/util/Random/NextBytes.java0000644000000000000000000000502011441006144016635 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4261170 * @summary Tests for Random.nextBytes * @author Martin Buchholz */ import java.util.*; public class NextBytes { private static void realMain(String[] args) throws Throwable { byte[] expected = new byte[] {27, -105, -24, 83, -77, -29, 119, -74, -106, 68, 54}; Random r = new java.util.Random(2398579034L); for (int i = 0; i <= expected.length; i++) { r.setSeed(2398579034L); byte[] actual = new byte[i]; r.nextBytes(actual); //System.out.println(Arrays.toString(actual)); check(Arrays.equals(actual, Arrays.copyOf(expected,i))); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/Random/DistinctSeeds.java0000644000000000000000000000140111537741070017466 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4949279 * @summary Independent instantiations of Random() have distinct seeds. */ import java.util.Random; public class DistinctSeeds { public static void main(String[] args) throws Exception { // Strictly speaking, it is possible for these to randomly fail, // but the probability should be *extremely* small (< 2**-63). if (new Random().nextLong() == new Random().nextLong() || new Random().nextLong() == new Random().nextLong()) throw new RuntimeException("Random() seeds not unique."); } } jsr166/src/test/jtreg/util/WeakHashMap/0000755000000000000000000000000011652013243014763 5ustar jsr166/src/test/jtreg/util/WeakHashMap/GCDuringIteration.java0000644000000000000000000002262611471021366021163 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6499848 * @ignore until 6842353 is resolved * @summary Check that iterators work properly in the presence of * concurrent finalization and removal of elements. */ import java.util.*; import java.util.concurrent.CountDownLatch; public class GCDuringIteration { private static void waitForFinalizersToRun() { for (int i = 0; i < 2; i++) tryWaitForFinalizersToRun(); } private static void tryWaitForFinalizersToRun() { System.gc(); final CountDownLatch fin = new CountDownLatch(1); new Object() { protected void finalize() { fin.countDown(); }}; System.gc(); try { fin.await(); } catch (InterruptedException ie) { throw new Error(ie); } } // A class with the traditional pessimal hashCode implementation, // to ensure that all instances end up in the same bucket. static class Foo { public int hashCode() { return 42; }} void put(Map map, K k, V v) { check(! map.containsKey(k)); equal(map.get(k), null); equal(map.put(k, v), null); equal(map.get(k), v); check(map.containsKey(k)); equal(map.put(k, v), v); equal(map.get(k), v); check(map.containsKey(k)); check(! map.isEmpty()); equal(map.keySet().iterator().next(), k); equal(map.values().iterator().next(), v); } void checkIterator(final Iterator> it, int first) { final Random rnd = new Random(); for (int i = first; i >= 0; --i) { if (rnd.nextBoolean()) check(it.hasNext()); equal(it.next().getValue(), i); } if (rnd.nextBoolean()) THROWS(NoSuchElementException.class, new F(){void f(){it.next();}}); if (rnd.nextBoolean()) check(! it.hasNext()); } V firstValue(Map map) { return map.values().iterator().next(); } void test(String[] args) throws Throwable { final int n = 10; // Create array of strong refs final Foo[] foos = new Foo[2*n]; final Map map = new WeakHashMap(foos.length); check(map.isEmpty()); equal(map.size(), 0); for (int i = 0; i < foos.length; i++) { Foo foo = new Foo(); foos[i] = foo; put(map, foo, i); } equal(map.size(), foos.length); { int first = firstValue(map); final Iterator> it = map.entrySet().iterator(); foos[first] = null; for (int i = 0; i < 10 && map.size() != first; i++) tryWaitForFinalizersToRun(); equal(map.size(), first); checkIterator(it, first-1); equal(map.size(), first); equal(firstValue(map), first-1); } { int first = firstValue(map); final Iterator> it = map.entrySet().iterator(); it.next(); // protects first entry System.out.println(map.values()); foos[first] = null; tryWaitForFinalizersToRun() equal(map.size(), first+1); System.out.println(map.values()); checkIterator(it, first-1); // first entry no longer protected for (int i = 0; i < 10 && map.size() != first; i++) tryWaitForFinalizersToRun(); equal(map.size(), first); equal(firstValue(map), first-1); } { int first = firstValue(map); final Iterator> it = map.entrySet().iterator(); it.next(); // protects first entry System.out.println(map.values()); foos[first] = foos[first-1] = null; tryWaitForFinalizersToRun(); equal(map.size(), first); equal(firstValue(map), first); System.out.println(map.values()); checkIterator(it, first-2); // first entry no longer protected for (int i = 0; i < 10 && map.size() != first-1; i++) tryWaitForFinalizersToRun(); equal(map.size(), first-1); equal(firstValue(map), first-2); } { int first = firstValue(map); final Iterator> it = map.entrySet().iterator(); it.next(); // protects first entry it.hasNext(); // protects second entry System.out.println(map.values()); foos[first] = foos[first-1] = null; tryWaitForFinalizersToRun(); equal(firstValue(map), first); equal(map.size(), first+1); System.out.println(map.values()); checkIterator(it, first-1); // first entry no longer protected for (int i = 0; i < 10 && map.size() != first-1; i++) tryWaitForFinalizersToRun(); equal(map.size(), first-1); equal(firstValue(map), first-2); } { int first = firstValue(map); final Iterator> it = map.entrySet().iterator(); it.next(); // protects first entry System.out.println(map.values()); foos[first] = foos[first-1] = null; tryWaitForFinalizersToRun(); it.remove(); equal(firstValue(map), first-2); equal(map.size(), first-1); System.out.println(map.values()); checkIterator(it, first-2); // first entry no longer protected for (int i = 0; i < 10 && map.size() != first-1; i++) tryWaitForFinalizersToRun(); equal(map.size(), first-1); equal(firstValue(map), first-2); } { int first = firstValue(map); final Iterator> it = map.entrySet().iterator(); it.next(); // protects first entry it.remove(); it.hasNext(); // protects second entry System.out.println(map.values()); foos[first] = foos[first-1] = null; tryWaitForFinalizersToRun(); equal(firstValue(map), first-1); equal(map.size(), first); System.out.println(map.values()); checkIterator(it, first-1); for (int i = 0; i < 10 && map.size() != first-1; i++) tryWaitForFinalizersToRun(); equal(map.size(), first-1); equal(firstValue(map), first-2); } { int first = firstValue(map); final Iterator> it = map.entrySet().iterator(); it.hasNext(); // protects first entry Arrays.fill(foos, null); tryWaitForFinalizersToRun(); equal(map.size(), 1); System.out.println(map.values()); equal(it.next().getValue(), first); check(! it.hasNext()); for (int i = 0; i < 10 && map.size() != 0; i++) tryWaitForFinalizersToRun(); equal(map.size(), 0); check(map.isEmpty()); } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new GCDuringIteration().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} void THROWS(Class k, F... fs) { for (F f : fs) try {f.f(); fail("Expected " + k.getName() + " not thrown");} catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/WeakHashMap/ZeroInitCap.java0000644000000000000000000000246011441006144020015 0ustar /* * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import java.util.*; /** * @test * @bug 4503146 * @summary Zero initial capacity should be legal * @author Josh Bloch */ public class ZeroInitCap { public static void main(String[] argv) { Map map = new WeakHashMap(0); map.put("a","b"); } } jsr166/src/test/jtreg/util/WeakHashMap/Iteration.java0000644000000000000000000000277211441006144017572 0ustar /* * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4236533 4416923 * @summary Tests to see that memory leak no longer exists. * @author Josh Bloch */ import java.util.*; public class Iteration { public static void main(String[] args) { String s = "iatrogenic"; Map m = new WeakHashMap(); m.put(s, "cucumber"); Iterator i = m.keySet().iterator(); if (i.hasNext() != i.hasNext()) throw new RuntimeException("hasNext advances iterator"); } } jsr166/src/test/jtreg/util/TreeMap/0000755000000000000000000000000011652013243014167 5ustar jsr166/src/test/jtreg/util/TreeMap/SubMapClear.java0000644000000000000000000000344411441006144017173 0ustar /* * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4468802 * @summary Submap clear tickled a bug in an optimization suggested by * Prof. William Collins (Lafayette College) * @author Josh Bloch */ import java.util.*; public class SubMapClear { public static void main(String[] args) { SortedSet treeSet = new TreeSet(); for (int i = 1; i <=10; i++) treeSet.add(new Integer(i)); Set subSet = treeSet.subSet(new Integer(4),new Integer(10)); subSet.clear(); // Used to throw exception int a[] = new int[] {1, 2, 3, 10}; Set s = new TreeSet(); for (int i = 0; i < a.length; i++) s.add(new Integer(a[i])); if (!treeSet.equals(s)) throw new RuntimeException(treeSet.toString()); } } jsr166/src/test/jtreg/util/TreeMap/SubMap.java0000644000000000000000000000574611441006144016233 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4252490 * @summary The firstKey and lastKey */ import java.util.*; public class SubMap { public static void main(String args[]) throws Exception { SortedMap m = new TreeMap(); m.put(new Integer(1), new Integer(1)); m.put(new Integer(2), new Integer(2)); m.put(new Integer(3), new Integer(3)); SortedMap m2 = m.subMap(new Integer(2), new Integer(2)); boolean exc = false; try { m2.firstKey(); } catch (NoSuchElementException e) { exc = true; } if (!exc) throw new Exception("first key"); exc = false; try { m2.lastKey(); } catch (NoSuchElementException e) { exc = true; } if (!exc) throw new Exception("last key"); SortedMap m3 = m.subMap(new Integer(2), new Integer(3)); if (!m3.firstKey().equals(new Integer(2))) throw new Exception("first key wrong"); if (!m3.lastKey().equals(new Integer(2))) throw new Exception("last key wrong"); SortedSet s = new TreeSet(); s.add(new Integer(1)); s.add(new Integer(2)); s.add(new Integer(3)); SortedSet s2 = s.subSet(new Integer(2), new Integer(2)); exc = false; try { s2.first(); } catch (NoSuchElementException e) { exc = true; } if (!exc) throw new Exception("first element"); exc = false; try { s2.last(); } catch (NoSuchElementException e) { exc = true; } if (!exc) throw new Exception("last element"); SortedSet s3 = s.subSet(new Integer(2), new Integer(3)); if (!s3.first().equals(new Integer(2))) throw new Exception("first element wrong"); if (!s3.last().equals(new Integer(2))) throw new Exception("last element wrong"); } } jsr166/src/test/jtreg/util/TreeMap/HeadTailTypeError.java0000644000000000000000000001247611456346034020404 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* @test @bug 4251519 4251520 @summary indexOf and lastIndex of used to let you look outside the valid range in the backing array */ import java.util.*; public class HeadTailTypeError { public static void main(String argv[]) throws Exception { try { SortedMap m = new TreeMap(); m.headMap(new Object()); throw new Exception("headMap, natural ordering"); } catch (ClassCastException e) { } try { SortedMap m = new TreeMap(); m.tailMap(new Object()); throw new Exception("tailMap, natural ordering"); } catch (ClassCastException e) { } try { SortedMap m = new TreeMap(String.CASE_INSENSITIVE_ORDER); m.headMap(new Integer(0)); throw new Exception("headMap, explicit comparator"); } catch (ClassCastException e) { } try { SortedMap m = new TreeMap(String.CASE_INSENSITIVE_ORDER); m.tailMap(new Integer(0)); throw new Exception("tailMap, explicit comparator"); } catch (ClassCastException e) { } try { SortedSet m = new TreeSet(); m.headSet(new Object()); throw new Exception("headSet, natural ordering"); } catch (ClassCastException e) { } try { SortedSet m = new TreeSet(); m.tailSet(new Object()); throw new Exception("tailSet, natural ordering"); } catch (ClassCastException e) { } try { SortedSet m = new TreeSet(String.CASE_INSENSITIVE_ORDER); m.headSet(new Integer(0)); throw new Exception("headSet, explicit comparator"); } catch (ClassCastException e) { } try { SortedSet m = new TreeSet(String.CASE_INSENSITIVE_ORDER); m.tailSet(new Integer(0)); throw new Exception("tailSet, explicit comparator"); } catch (ClassCastException e) { } try { SortedMap m = new TreeMap(); m.headMap(null); throw new Exception("(null endpoint)headMap, natural ordering"); } catch (NullPointerException e) { } try { SortedMap m = new TreeMap(); m.tailMap(null); throw new Exception("(null endpoint)tailMap, natural ordering"); } catch (NullPointerException e) { } try { SortedMap m = new TreeMap(String.CASE_INSENSITIVE_ORDER); m.headMap(null); throw new Exception("(null endpoint)headMap, explicit comparator"); } catch (NullPointerException e) { } try { SortedMap m = new TreeMap(String.CASE_INSENSITIVE_ORDER); m.tailMap(null); throw new Exception("(null endpoint)tailMap, explicit comparator"); } catch (NullPointerException e) { } try { SortedSet m = new TreeSet(); m.headSet(null); throw new Exception("(null endpoint)headSet, natural ordering"); } catch (NullPointerException e) { } try { SortedSet m = new TreeSet(); m.tailSet(null); throw new Exception("(null endpoint)tailSet, natural ordering"); } catch (NullPointerException e) { } try { SortedSet m = new TreeSet(String.CASE_INSENSITIVE_ORDER); m.headSet(null); throw new Exception("(null endpoint)headSet, explicit comparator"); } catch (NullPointerException e) { } try { SortedSet m = new TreeSet(String.CASE_INSENSITIVE_ORDER); m.tailSet(null); throw new Exception("(null endpoint)tailSet, explicit comparator"); } catch (NullPointerException e) { } // These should not fail SortedMap m = new TreeMap(); m.headMap(new Integer(0)); m.tailMap(new Integer(0)); m = new TreeMap(String.CASE_INSENSITIVE_ORDER); m.headMap("llama"); m.tailMap("llama"); SortedSet s = new TreeSet(); s.headSet(new Integer(0)); s.tailSet(new Integer(0)); s = new TreeSet(String.CASE_INSENSITIVE_ORDER); s.headSet("drama"); s.tailSet("drama"); } } jsr166/src/test/jtreg/util/TreeMap/NullAtEnd.java0000644000000000000000000000666511441006144016673 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 5018254 * @summary Test null-allowing Comparators * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class NullAtEnd { static volatile int passed = 0, failed = 0; static void fail(String msg) { failed++; new AssertionError(msg).printStackTrace(); } static void pass() { passed++; } static void unexpected(Throwable t) { failed++; t.printStackTrace(); } static void check(boolean condition, String msg) { if (condition) passed++; else fail(msg); } static void check(boolean condition) { check(condition, "Assertion failure"); } private static boolean eq(Object x, Object y) { return x == null ? y == null : x.equals(y); } private static final Comparator NULL_AT_END = new Comparator() { /** * Allows for nulls. Null is greater than anything non-null. */ public int compare(String x, String y) { if (x == null && y == null) return 0; if (x == null && y != null) return 1; if (x != null && y == null) return -1; return x.compareTo(y); } }; public static void main(String[] args) { try { SortedMap m1 = new TreeMap(NULL_AT_END); check(eq(m1.put("a", "a"), null)); check(eq(m1.put("b", "b"), null)); check(eq(m1.put("c", "c"), null)); check(eq(m1.put(null, "d"), null)); SortedMap m2 = new TreeMap(m1); check(eq(m1.lastKey(), null)); check(eq(m1.get(m1.lastKey()), "d")); check(eq(m1.remove(m1.lastKey()), "d")); check(eq(m1.lastKey(), "c")); check(eq(m2.entrySet().toString(), "[a=a, b=b, c=c, null=d]")); SortedMap m3 = m2.tailMap("b"); check(eq(m3.lastKey(), null)); check(eq(m3.get(m3.lastKey()), "d")); check(eq(m3.remove(m3.lastKey()), "d")); check(eq(m3.lastKey(), "c")); } catch (Throwable t) { unexpected(t); } System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Error("Some tests failed"); } } jsr166/src/test/jtreg/util/TreeMap/NullPermissiveComparator.java0000644000000000000000000001006411441006144022042 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6467933 * @summary Test proper handling of comparators permitting nulls * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.lang.reflect.*; @SuppressWarnings("unchecked") public class NullPermissiveComparator { static void equal(Map m, String s) { equal(m.toString(), s); } static void realMain(String[] args) throws Throwable { final Comparator nullLow = new Comparator() { public int compare(Object x, Object y) { return x == y ? 0 : x == null ? -1 : y == null ? 1 : ((Comparable)x).compareTo(y); }}; final Comparator nullHigh = new Comparator() { public int compare(Object x, Object y) { return x == y ? 0 : x == null ? 1 : y == null ? -1 : ((Comparable)x).compareTo(y); }}; TreeMap m = new TreeMap(nullLow); m.put("a", "A"); m.put("b", "B"); m.put("c", "C"); equal(m, "{a=A, b=B, c=C}"); equal(m.headMap("b"), "{a=A}"); equal(m.tailMap("b"), "{b=B, c=C}"); equal(m.headMap(null), "{}"); equal(m.tailMap(null), "{a=A, b=B, c=C}"); m.put(null, "NULL"); equal(m, "{null=NULL, a=A, b=B, c=C}"); equal(m.headMap("b"), "{null=NULL, a=A}"); equal(m.tailMap("b"), "{b=B, c=C}"); equal(m.headMap(null), "{}"); equal(m.tailMap(null), "{null=NULL, a=A, b=B, c=C}"); m = new TreeMap(nullHigh); m.put("a", "A"); m.put("b", "B"); m.put("c", "C"); equal(m, "{a=A, b=B, c=C}"); equal(m.headMap("b"), "{a=A}"); equal(m.tailMap("b"), "{b=B, c=C}"); equal(m.headMap(null), "{a=A, b=B, c=C}"); equal(m.tailMap(null), "{}"); m.put(null, "NULL"); equal(m, "{a=A, b=B, c=C, null=NULL}"); equal(m.headMap("b"), "{a=A}"); equal(m.tailMap("b"), "{b=B, c=C, null=NULL}"); equal(m.headMap(null), "{a=A, b=B, c=C}"); equal(m.tailMap(null), "{null=NULL}"); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/TreeMap/ContainsValue.java0000644000000000000000000000347511450166503017622 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4212425 * @summary TreeMap.containsValue throws NullPointerExc for empty TreeMap */ import java.util.*; public class ContainsValue { public static void main(String[] args) { Map map = new TreeMap(); if (map.containsValue ("gemutlichkeit")) throw new RuntimeException("containsValue optimistic (non-null)"); if (map.containsValue (null)) throw new RuntimeException("containsValue optimistic (null)"); map.put("a", null); map.put("b", "gemutlichkeit"); if (!map.containsValue ("gemutlichkeit")) throw new RuntimeException("containsValue pessimistic (non-null)"); if (!map.containsValue (null)) throw new RuntimeException("containsValue pessimistic (null)"); } } jsr166/src/test/jtreg/util/AbstractMap/0000755000000000000000000000000011652013242015032 5ustar jsr166/src/test/jtreg/util/AbstractMap/AbstractMapClone.java0000644000000000000000000000420611441006143021057 0ustar /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4328748 * @summary AbstractMap's clone() method is implemented to * reset AbstractMap's private fields after super.clone() * * @author Konstantin Kladko */ import java.util.*; public class AbstractMapClone extends AbstractMap implements Cloneable { private Map map = new HashMap(); public Set entrySet() { return map.entrySet(); } public Object put(Object key, Object value) { return map.put(key, value); } public Object clone() { AbstractMapClone clone = null; try { clone = (AbstractMapClone)super.clone(); } catch (CloneNotSupportedException e) { } clone.map = (Map)((HashMap)map).clone(); return clone; } public static void main(String[] args) { AbstractMapClone m1 = new AbstractMapClone(); m1.put("1", "1"); Set k1 = m1.keySet(); AbstractMapClone m2 = (AbstractMapClone)m1.clone(); Set k2 = m2.keySet(); m2.put("2","2"); if (k1.equals(k2)) { throw new RuntimeException("AbstractMap.clone() failed."); } } } jsr166/src/test/jtreg/util/AbstractMap/ToString.java0000644000000000000000000000351511441006143017450 0ustar /* * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4486049 * @summary toString method fails if size changes in between a call to size * and an attempt to iterate. * @author Josh Bloch */ import java.util.*; public class ToString { public static void main(String[] args) { Map m = new LyingMap(); if (!m.toString().equals("{}")) throw new RuntimeException(m.toString() + "!= {}"); m.put("x", "1"); if (!m.toString().equals("{x=1}")) throw new RuntimeException(m.toString() + "!= {x=1}"); m.put("y", "2"); if (!m.toString().equals("{x=1, y=2}")) throw new RuntimeException(m.toString() + "!= {x=1, y=2}"); } } class LyingMap extends LinkedHashMap { public int size() { return super.size() + 1; // Lies, lies, all lies! } } jsr166/src/test/jtreg/util/AbstractMap/SimpleEntries.java0000644000000000000000000000755111441006143020466 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4904074 6328220 6330389 * @summary Basic tests for SimpleEntry, SimpleImmutableEntry * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; import static java.util.AbstractMap.*; public class SimpleEntries { private static String k = "foo"; private static Long v = 1L; private static Long v2 = 2L; private static void realMain(String[] args) throws Throwable { testEntry(new SimpleEntry(k,v)); testEntry(new SimpleImmutableEntry(k,v)); testNullEntry(new SimpleEntry(null,null)); testNullEntry(new SimpleImmutableEntry(null,null)); } private static void testEntry(Map.Entry e) { equal(e.getKey(), k); equal(e.getValue(), v); equal(e, new SimpleEntry(k,v)); check(! e.equals(new SimpleEntry(k,v2))); check(! e.equals(null)); equal(e, new SimpleImmutableEntry(k,v)); equal(e.toString(), k+"="+v); if (e instanceof SimpleEntry) { equal(e.setValue(v2), v); equal(e.getValue(), v2); equal(e.setValue(null), v2); equal(e.getValue(), null); } else { try { e.setValue(v2); fail(); } catch (UnsupportedOperationException t) {} catch (Throwable t) { unexpected(t); } } } private static void testNullEntry(Map.Entry e) { equal(e.getKey(), null); equal(e.getValue(), null); equal(e, new SimpleEntry(null, null)); equal(e, new SimpleImmutableEntry(null, null)); equal(e.toString(), "null=null"); if (e instanceof SimpleEntry) { equal(e.setValue(v), null); equal(e.getValue(), v); } else { try { e.setValue(null); fail(); } catch (UnsupportedOperationException t) {} catch (Throwable t) { unexpected(t); } } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/AbstractMap/Equals.java0000644000000000000000000000365411441006143017135 0ustar /* * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import java.util.*; /** * @test * @bug 4503672 * @summary AbstractMap.equals and AbstractSet.equals are fragile: they * throw exceptions when they should return false. * @author Josh Bloch */ public class Equals { public static void main(String[] args) { Map m = new HashMap(); m.put(null, ""); Map h = new Hashtable(); h.put("", ""); if (m.equals(h)) throw new RuntimeException("1"); Map m1 = new TreeMap(); m1.put(new Integer(42), "The Answer"); Map m2 = new TreeMap(); m2.put("The Answer", new Integer(42)); if (m1.equals(m2)) throw new RuntimeException("3"); Set s1 = new TreeSet(); s1.add(new Integer(666)); Set s2 = new TreeSet(); s2.add("Great googly moogly!"); if (s1.equals(s2)) throw new RuntimeException("2"); } } jsr166/src/test/jtreg/util/AbstractList/0000755000000000000000000000000011652013242015230 5ustar jsr166/src/test/jtreg/util/AbstractList/HasNextAfterException.java0000644000000000000000000000334611441006143022312 0ustar /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4375048 * @summary AbstractList's ListIterator.hasNext() returns * true, after ListIterator.previous() causes * an exception for an empty list. * @author Konstantin Kladko */ import java.util.*; public class HasNextAfterException { public static void main(String[] args) { List list = new ArrayList(); ListIterator i = list.listIterator(); try { i.previous(); } catch (NoSuchElementException e) { } if (i.hasNext()) { throw new RuntimeException( "ListIterator.hasNext() returns true for an empty " + "List after ListIterator.previous()."); } } } jsr166/src/test/jtreg/util/AbstractList/CheckForComodification.java0000644000000000000000000000360111441006143022425 0ustar /* * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4902078 * @summary concurrent modification not detected on 2nd to last iteration * @author Josh Bloch * * @ignore Bug fix temporarily removed as it uncovered other bugs (4992226) * @compile -source 1.5 CheckForComodification.java * @run main CheckForComodification */ import java.util.*; public class CheckForComodification { private static final int LENGTH = 10; public static void main(String[] args) throws Exception { List list = new ArrayList(); for (int i = 0; i < LENGTH; i++) list.add(i); try { for (int i : list) if (i == LENGTH - 2) list.remove(i); } catch (ConcurrentModificationException e) { return; } throw new RuntimeException("No ConcurrentModificationException"); } } jsr166/src/test/jtreg/util/AbstractList/FailFastIterator.java0000644000000000000000000000530711441006143021301 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4189896 * @summary AbstractList iterators previously checked for co-modificatin * *after* the set/add/remove operations were performed. */ import java.util.*; public class FailFastIterator { public static void main(String[] args) throws Exception { List orig = new ArrayList(100); for (int i=0; i<100; i++) orig.add(new Integer(i)); List copy = new ArrayList(orig); try { ListIterator i = copy.listIterator(); i.next(); copy.remove(99); copy.add(new Integer(99)); i.remove(); throw new Exception("remove: iterator didn't fail fast"); } catch (ConcurrentModificationException e) { } if (!copy.equals(orig)) throw new Exception("remove: iterator didn't fail fast enough"); try { ListIterator i = copy.listIterator(); i.next(); copy.remove(99); copy.add(new Integer(99)); i.set(new Integer(666)); throw new Exception("set: iterator didn't fail fast"); } catch (ConcurrentModificationException e) { } if (!copy.equals(orig)) throw new Exception("set: iterator didn't fail fast enough"); try { ListIterator i = copy.listIterator(); copy.remove(99); copy.add(new Integer(99)); i.add(new Integer(666)); throw new Exception("add: iterator didn't fail fast"); } catch (ConcurrentModificationException e) { } if (!copy.equals(orig)) throw new Exception("add: iterator didn't fail fast enough"); } } jsr166/src/test/jtreg/util/Collections/0000755000000000000000000000000011652013243015110 5ustar jsr166/src/test/jtreg/util/Collections/AddAll.java0000644000000000000000000000457511450166503017113 0ustar /* * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4822887 * @summary Basic test for Collections.addAll * @author Josh Bloch * * @compile -source 1.5 AddAll.java * @run main AddAll */ import java.util.*; public class AddAll { static final int N = 100; public static void main(String args[]) { test(new ArrayList()); test(new LinkedList()); test(new HashSet()); test(new LinkedHashSet()); } private static Random rnd = new Random(); static void test(Collection c) { int x = 0; for (int i = 0; i < N; i++) { int rangeLen = rnd.nextInt(10); if (Collections.addAll(c, range(x, x + rangeLen)) != (rangeLen != 0)) throw new RuntimeException("" + rangeLen); x += rangeLen; } if (c instanceof List) { if (!c.equals(Arrays.asList(range(0, x)))) throw new RuntimeException(x +": "+c); } else { if (!c.equals(new HashSet(Arrays.asList(range(0, x))))) throw new RuntimeException(x +": "+c); } } private static Integer[] range(int from, int to) { Integer[] result = new Integer[to - from]; for (int i = from, j=0; i < to; i++, j++) result[j] = new Integer(i); return result; } } jsr166/src/test/jtreg/util/Collections/ReverseOrder.java0000644000000000000000000000402011441006143020353 0ustar /* * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4593209 * @summary Reverse comparator was subtly broken * @author Josh bloch */ import java.util.*; public class ReverseOrder { public static void main(String[] args) throws Exception { Foo[] a = { new Foo(2), new Foo(3), new Foo(1) }; List list = Arrays.asList(a); Collections.sort(list, Collections.reverseOrder()); Foo[] golden = { new Foo(3), new Foo(2), new Foo(1) }; List goldenList = Arrays.asList(golden); if (!list.equals(goldenList)) throw new Exception(list.toString()); } } class Foo implements Comparable { int val; Foo(int i) { val = i; } public int compareTo(Object o) { Foo f = (Foo)o; return (val < f.val ? Integer.MIN_VALUE : (val == f.val ? 0 : 1)); } public boolean equals(Object o) { return o instanceof Foo && ((Foo)o).val == val; } public int hashCode() { return val; } public String toString() { return Integer.toString(val); } } jsr166/src/test/jtreg/util/Collections/RotateEmpty.java0000644000000000000000000000250111441006143020223 0ustar /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4389747 * @summary Collections.rotate(...) returns ArithmeticException */ import java.util.*; public class RotateEmpty { public static void main(String[] args) throws Exception { List l = new ArrayList(); Collections.rotate(l, 1); } } jsr166/src/test/jtreg/util/Collections/CheckedIdentityMap.java0000644000000000000000000000671611441006143021460 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6585904 * @summary Checked collections with underlying maps with identity comparisons */ import java.util.*; import static java.util.Collections.*; public class CheckedIdentityMap { void test(String[] args) throws Throwable { Map m1 = checkedMap( new IdentityHashMap(), Integer.class, Integer.class); Map m2 = checkedMap( new IdentityHashMap(), Integer.class, Integer.class); m1.put(new Integer(1), new Integer(1)); m2.put(new Integer(1), new Integer(1)); Map.Entry e1 = m1.entrySet().iterator().next(); Map.Entry e2 = m2.entrySet().iterator().next(); check(! e1.equals(e2)); check(e1.hashCode() == hashCode(e1)); check(e2.hashCode() == hashCode(e2)); } int hashCode(Map.Entry e) { return (System.identityHashCode(e.getKey()) ^ System.identityHashCode(e.getValue())); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new CheckedIdentityMap().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} void THROWS(Class k, F... fs) { for (F f : fs) try {f.f(); fail("Expected " + k.getName() + " not thrown");} catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} Thread checkedThread(final Runnable r) { return new Thread() {public void run() { try {r.run();} catch (Throwable t) {unexpected(t);}}};} } jsr166/src/test/jtreg/util/Collections/ReplaceAll.java0000644000000000000000000000421111441006143017752 0ustar /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4323074 * @summary Basic test for new replaceAll algorithm */ import java.util.*; public class ReplaceAll { static final int SIZE = 20; public static void main(String[] args) throws Exception { List a[] = {new ArrayList(), new LinkedList(), new Vector()}; for (int i=0; i 0) throw new Exception("Some tests failed"); } private static void realMain() throws Throwable { try { Map m = new IdentityHashMap(); Set s = Collections.newSetFromMap(m); String foo1 = new String("foo"); String foo2 = new String("foo"); String bar = new String("bar"); check(s.add(foo1)); check(s.add(foo2)); check(s.add(bar)); equal(s.size(), 3); check(s.contains(foo1)); check(s.contains(foo2)); check(! s.contains(new String(foo1))); } catch (Throwable t) { unexpected(t); } } } jsr166/src/test/jtreg/util/Collections/ViewSynch.java0000644000000000000000000000446311441006143017676 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4268780 * @summary Collection-views of submap-views of synchronized-views of * SortedMap objects do not synchronize on the correct object. * (Got that?) */ import java.util.*; public class ViewSynch { static final Integer ZERO = new Integer(0); static final Int INT_ZERO = new Int(0); static final Int INT_ONE = new Int(1); static SortedMap m = Collections.synchronizedSortedMap(new TreeMap()); static Map m2 = m.tailMap(ZERO); static Collection c = m2.values(); public static void main(String[] args) { for (int i=0; i<10000; i++) m.put(new Integer(i), INT_ZERO); new Thread() { public void run() { for (int i=0; i<100; i++) { Thread.yield(); m.remove(ZERO); m.put(ZERO, INT_ZERO); } } }.start(); c.contains(INT_ONE); } } /** * Like Integer, except yields while doing equals comparison, to allow * for interleaving. */ class Int { Integer x; Int(int i) {x = new Integer(i);} public boolean equals(Object o) { Thread.yield(); Int i = (Int)o; return x.equals(i.x); } public int hashCode() {return x.hashCode();} } jsr166/src/test/jtreg/util/Collections/T6433170.java0000644000000000000000000000642011441006143016725 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6433170 * @summary CheckedCollection.addAll should be all-or-nothing */ import java.util.*; import static java.util.Collections.*; @SuppressWarnings("unchecked") public class T6433170 { private void checkEmpty(Collection x) { check(x.isEmpty()); check(x.size() == 0); check(x.toArray().length == 0); } void test(String[] args) throws Throwable { test(checkedList( checkedList(new ArrayList(), String.class), Object.class)); test(checkedSet( checkedSet(new HashSet(), String.class), Object.class)); test(checkedCollection( checkedCollection(new Vector(), String.class), Object.class)); } void test(final Collection checked) { checkEmpty(checked); final List mixedList = Arrays.asList("1", 2, "3"); THROWS(ClassCastException.class, new F(){void f(){ checked.addAll(mixedList); }}); checkEmpty(checked); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new T6433170().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} void THROWS(Class k, F... fs) { for (F f : fs) try {f.f(); fail("Expected " + k.getName() + " not thrown");} catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/Collections/AsLifoQueue.java0000644000000000000000000001005011450166503020135 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6301085 6192552 6365601 * @summary Basic tests for asLifoQueue * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class AsLifoQueue { private static void realMain(String[] args) throws Throwable { try { Deque deq = new ArrayDeque(); check(deq.addAll(Arrays.asList("b", "a", "c"))); equal(deq.toString(), "[b, a, c]"); check(deq.add("d")); equal(deq.toString(), "[b, a, c, d]"); Queue q = Collections.asLifoQueue(deq); check(q.add("e")); equal(deq.toString(),"[e, b, a, c, d]"); } catch (Throwable t) { unexpected(t); } // Inspired by an excellent bug report by Jason Mehrens try { final Queue q = Collections.asLifoQueue(new LinkedBlockingDeque(3)); check(q.isEmpty()); equal(q.size(), 0); check(q.add("a")); check(! q.isEmpty()); equal(q.size(), 1); check(q.offer("b")); check(q.add("c")); equal(q.size(), 3); check(! q.offer("d")); equal(q.size(), 3); THROWS(IllegalStateException.class, new Fun(){void f(){ q.add("d"); }}); equal(q.size(), 3); equal(q.toString(), "[c, b, a]"); equal(q.peek(), "c"); equal(q.element(), "c"); equal(q.remove(), "c"); equal(q.poll(), "b"); equal(q.peek(), "a"); equal(q.remove(), "a"); THROWS(NoSuchElementException.class, new Fun(){void f(){ q.remove(); }}); equal(q.poll(), null); check(q.isEmpty()); equal(q.size(), 0); } catch (Throwable t) { unexpected(t); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract static class Fun { abstract void f() throws Throwable; } private static void THROWS(Class k, Fun... fs) { for (Fun f : fs) try { f.f(); fail("Expected " + k.getName() + " not thrown"); } catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/Collections/Disjoint.java0000644000000000000000000000523411450166503017546 0ustar /* * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4339792 * @summary Basic test for Collections.disjoint * @author Josh Bloch * * @compile -source 1.5 Disjoint.java * @run main Disjoint */ import java.util.*; public class Disjoint { static final int N = 20; public static void main(String args[]) { // Make an array of lists each of which shares a single element // with its "neighbors," and no elements with other lists in the array Random rnd = new Random(); List[] lists = new List[N]; int x = 0; for (int i = 0; i < N; i++) { int size = rnd.nextInt(10) + 2; List list = new ArrayList(size); for (int j = 1; j < size; j++) list.add(x++); list.add(x); Collections.shuffle(list); lists[i] = list; } for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { boolean disjoint = (Math.abs(i - j) > 1); List a = (List) lists[i]; List b = (List) lists[j]; if (Collections.disjoint(a, b) != disjoint) throw new RuntimeException("A: " + i + ", " + j); if (Collections.disjoint(new HashSet(a), b) != disjoint) throw new RuntimeException("B: " + i + ", " + j); if (Collections.disjoint(new HashSet(a), new HashSet(b)) != disjoint) throw new RuntimeException("C: " + i + ", " + j); } } } } jsr166/src/test/jtreg/util/Collections/Ser.java0000644000000000000000000000743111441006143016506 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4190323 * @summary EMPTY_SET, EMPTY_LIST, and the collections returned by * nCopies and singleton were spec'd to be serializable, but weren't. */ import java.io.*; import java.util.*; public class Ser { public static void main(String[] args) throws Exception { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bos); out.writeObject(Collections.EMPTY_SET); out.flush(); ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream(bos.toByteArray())); if (!Collections.EMPTY_SET.equals(in.readObject())) throw new RuntimeException("empty set Ser/Deser failure."); } catch (Exception e) { throw new RuntimeException("Failed to serialize empty set:" + e); } try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bos); out.writeObject(Collections.EMPTY_LIST); out.flush(); ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream(bos.toByteArray())); if (!Collections.EMPTY_LIST.equals(in.readObject())) throw new RuntimeException("empty list Ser/Deser failure."); } catch (Exception e) { throw new RuntimeException("Failed to serialize empty list:" + e); } try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bos); Set gumby = Collections.singleton("gumby"); out.writeObject(gumby); out.flush(); ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream(bos.toByteArray())); if (!gumby.equals(in.readObject())) throw new RuntimeException("Singleton Ser/Deser failure."); } catch (Exception e) { throw new RuntimeException("Failed to serialize singleton:" + e); } try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bos); List gumbies = Collections.nCopies(50, "gumby"); out.writeObject(gumbies); out.flush(); ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream(bos.toByteArray())); if (!gumbies.equals(in.readObject())) throw new RuntimeException("nCopies Ser/Deser failure."); } catch (Exception e) { throw new RuntimeException("Failed to serialize nCopies:" + e); } } } jsr166/src/test/jtreg/util/Collections/WrappedNull.java0000644000000000000000000001412411456346034020223 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4189641 * @summary Wrapping a null collection/array should blow up sooner * rather than later */ import java.util.*; public class WrappedNull { public static void main(String argv[]) throws Exception { boolean testSucceeded = false; try { List l = Arrays.asList(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("Arrays.asList"); testSucceeded = false; try { Collection c = Collections.unmodifiableCollection(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("unmodifiableCollection"); testSucceeded = false; try { Set c = Collections.unmodifiableSet(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("unmodifiableSet"); testSucceeded = false; try { List c = Collections.unmodifiableList(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("unmodifiableList"); testSucceeded = false; try { Map c = Collections.unmodifiableMap(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("unmodifiableMap"); testSucceeded = false; try { SortedSet c = Collections.unmodifiableSortedSet(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("unmodifiableSortedSet"); testSucceeded = false; try { SortedMap c = Collections.unmodifiableSortedMap(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("unmodifiableSortedMap"); testSucceeded = false; try { Collection c = Collections.synchronizedCollection(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("synchronizedCollection"); testSucceeded = false; try { Set c = Collections.synchronizedSet(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("synchronizedSet"); testSucceeded = false; try { List c = Collections.synchronizedList(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("synchronizedList"); testSucceeded = false; try { Map c = Collections.synchronizedMap(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("synchronizedMap"); testSucceeded = false; try { SortedSet c = Collections.synchronizedSortedSet(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("synchronizedSortedSet"); testSucceeded = false; try { SortedMap c = Collections.synchronizedSortedMap(null); } catch (NullPointerException e) { testSucceeded = true; } if (!testSucceeded) throw new Exception("synchronizedSortedMap"); // Make sure that non-null arguments don't throw exc. List l = Arrays.asList(new Object[0]); Collection c = Collections.unmodifiableCollection( Collections.EMPTY_SET); Set s = Collections.unmodifiableSet(Collections.EMPTY_SET); l = Collections.unmodifiableList(Collections.EMPTY_LIST); Map m = Collections.unmodifiableMap(Collections.EMPTY_MAP); SortedSet ss = Collections.unmodifiableSortedSet(new TreeSet()); SortedMap sm = Collections.unmodifiableSortedMap(new TreeMap()); c = Collections.synchronizedCollection(Collections.EMPTY_SET); s = Collections.synchronizedSet(Collections.EMPTY_SET); l = Collections.synchronizedList(Collections.EMPTY_LIST); m = Collections.synchronizedMap(Collections.EMPTY_MAP); ss = Collections.synchronizedSortedSet(new TreeSet()); sm = Collections.synchronizedSortedMap(new TreeMap()); } } jsr166/src/test/jtreg/util/Collections/CheckedListBash.java0000644000000000000000000001767711441006143020752 0ustar /* * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4904067 * @summary Unit test for Collections.checkedList * @author Josh Bloch */ import java.util.*; public class CheckedListBash { static Random rnd = new Random(); public static void main(String[] args) { int numItr = 100; int listSize = 100; for (int i=0; i implements RandomAccess { private Map m = new HashMap(); public Integer get(int i) { if (i < 0) throw new IndexOutOfBoundsException(""+i); Integer v = m.get(i); return (v == null) ? Integer.valueOf(0) : v; } public int size() { return Collections.max(m.keySet()) + 1; } public Integer set(int i, Integer v) { if (i < 0) throw new IndexOutOfBoundsException(""+i); Integer ret = get(i); if (v == 0) m.remove(i); else m.put(i, v); return ret; } } /** Check that binarySearch finds an element where we got it */ private static void checkBinarySearch(List l, int i) { try { equal(i, Collections.binarySearch(l, l.get(i))); } catch (Throwable t) { unexpected(t); } } /** Check that binarySearch finds an element where we got it */ private static void checkBinarySearch(List l, int i, Comparator comparator) { try { equal(i, Collections.binarySearch(l, l.get(i), comparator)); } catch (Throwable t) { unexpected(t); } } private static void realMain(String[] args) throws Throwable { final int n = (1<<30) + 47; System.out.println("binarySearch(List, Integer)"); List big = new SparseIntegerList(); big.set( 0, -44); big.set( 1, -43); big.set(n-2, 43); big.set(n-1, 44); int[] ints = { 0, 1, n-2, n-1 }; Comparator reverse = Collections.reverseOrder(); Comparator natural = Collections.reverseOrder(reverse); for (int i : ints) { checkBinarySearch(big, i); checkBinarySearch(big, i, null); checkBinarySearch(big, i, natural); } for (int i : ints) big.set(i, - big.get(i)); for (int i : ints) checkBinarySearch(big, i, reverse); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/Collections/EmptyIterator.java0000644000000000000000000001272211441006143020564 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 5017904 6356890 * @summary Test empty iterators, enumerations, and collections */ import java.util.*; import static java.util.Collections.*; public class EmptyIterator { void test(String[] args) throws Throwable { testEmptyCollection(Collections.emptyList()); testEmptyCollection(Collections.emptySet()); testEmptyCollection(new java.util.concurrent. SynchronousQueue()); testEmptyMap(Collections.emptyMap()); Hashtable emptyTable = new Hashtable(); testEmptyEnumeration(emptyTable.keys()); testEmptyEnumeration(emptyTable.elements()); testEmptyIterator(emptyTable.keySet().iterator()); testEmptyIterator(emptyTable.values().iterator()); testEmptyIterator(emptyTable.entrySet().iterator()); testEmptyEnumeration(javax.swing.tree.DefaultMutableTreeNode .EMPTY_ENUMERATION); testEmptyEnumeration(javax.swing.text.SimpleAttributeSet .EMPTY.getAttributeNames()); @SuppressWarnings("unchecked") Iterator x = new sun.tools.java.MethodSet() .lookupName(sun.tools.java.Identifier.lookup("")); testEmptyIterator(x); } void testEmptyEnumeration(final Enumeration e) { check(e == emptyEnumeration()); check(! e.hasMoreElements()); THROWS(NoSuchElementException.class, new F(){void f(){ e.nextElement(); }}); } void testEmptyIterator(final Iterator it) { check(it == emptyIterator()); check(! it.hasNext()); THROWS(NoSuchElementException.class, new F(){void f(){ it.next(); }}); THROWS(IllegalStateException.class, new F(){void f(){ it.remove(); }}); } void testEmptyMap(Map m) { check(m == emptyMap()); check(m.entrySet().iterator() == Collections.>emptyIterator()); check(m.values().iterator() == emptyIterator()); check(m.keySet().iterator() == emptyIterator()); equal(m, unmodifiableMap(m)); testEmptyCollection(m.keySet()); testEmptyCollection(m.entrySet()); testEmptyCollection(m.values()); } void testToArray(final Collection c) { Object[] a = c.toArray(); equal(a.length, 0); equal(a.getClass().getComponentType(), Object.class); THROWS(NullPointerException.class, new F(){void f(){ c.toArray((Object[])null); }}); { String[] t = new String[0]; check(c.toArray(t) == t); } { String[] t = nCopies(10, "").toArray(new String[0]); check(c.toArray(t) == t); check(t[0] == null); for (int i=1; i void testEmptyCollection(final Collection c) { testEmptyIterator(c.iterator()); check(c.iterator() == emptyIterator()); if (c instanceof List) check(((List)c).listIterator() == emptyListIterator()); testToArray(c); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new EmptyIterator().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} void THROWS(Class k, F... fs) { for (F f : fs) try {f.f(); fail("Expected " + k.getName() + " not thrown");} catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/Collections/Swap.java0000644000000000000000000000323611441006143016666 0ustar /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4323074 * @summary Basic test for newly public swap algorithm * @author Josh Bloch */ import java.util.*; public class Swap { static final int SIZE = 100; public static void main(String[] args) throws Exception { List l = new ArrayList(Collections.nCopies(100, Boolean.FALSE)); l.set(0, Boolean.TRUE); for (int i=0; i < SIZE-1; i++) Collections.swap(l, i, i+1); List l2 = new ArrayList(Collections.nCopies(100, Boolean.FALSE)); l2.set(SIZE-1, Boolean.TRUE); if (!l.equals(l2)) throw new RuntimeException("Wrong result"); } } jsr166/src/test/jtreg/util/Collections/BinarySearchNullComparator.java0000644000000000000000000000275411441006143023215 0ustar /* * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4528331 5006032 * @summary Test Collections.binarySearch() with a null comparator */ import java.util.*; public class BinarySearchNullComparator { public static void main(String args[]) throws Exception { List list = Arrays.asList(new String[] {"I", "Love", "You"}); int result = Collections.binarySearch(list, "You", null); if (result != 2) throw new Exception("Result: " + result); } } jsr166/src/test/jtreg/util/Collections/Enum.java0000644000000000000000000000314711441006143016661 0ustar /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4323074 * @summary Basic test for new Enumeration -> List converter */ import java.util.*; public class Enum { public static void main(String[] args) throws Exception { int[] sizes = {0, 10, 100}; for (int i=0; i)o).clear(); else ((Map)o).clear(); } @SuppressWarnings("unchecked") void realRun() { // Mutate elLoco wildly forever, checking occasionally for "done" clear(elLoco); if (elLoco instanceof List) { List l = (List) elLoco; for (int i = 0; keepGoing(i); i++) { switch (i%2) { case 0: l.add(two); break; case 1: l.add(0, two); break; } switch (i%2) { case 0: l.remove(two); break; case 1: l.remove(0); break; }}} else if (elLoco instanceof Deque) { Deque q = (Deque) elLoco; for (int i = 0; keepGoing(i); i++) { switch (i%6) { case 0: q.add(two); break; case 1: q.addFirst(two); break; case 2: q.addLast(two); break; case 3: q.offer(two); break; case 4: q.offerFirst(two); break; case 5: q.offerLast(two); break; } switch (i%6) { case 0: q.remove(two); break; case 1: q.removeFirst(); break; case 2: q.removeLast(); break; case 3: q.poll(); break; case 4: q.pollFirst(); break; case 5: q.pollLast(); break; }}} else if (elLoco instanceof Queue) { Queue q = (Queue) elLoco; for (int i = 0; keepGoing(i); i++) { switch (i%2) { case 0: q.add(two); break; case 1: q.offer(two); break; } switch (i%2) { case 0: q.remove(two); break; case 1: q.poll(); break; }}} else if (elLoco instanceof Map) { Map m = (Map) elLoco; for (int i = 0; keepGoing(i); i++) { m.put(two, true); m.remove(two); }} else if (elLoco instanceof Collection) { Collection c = (Collection) elLoco; for (int i = 0; keepGoing(i); i++) { c.add(two); c.remove(two); }} else { throw new Error("Huh? " + elLoco); } } void enoughAlready() { done = true; try { join(); } catch (Throwable t) { unexpected(t); } } } private static void checkEqualSanity(Object theRock, Object elLoco) { //equal(theRock, theRock); equal(elLoco, elLoco); // It would be nice someday to have theRock and elLoco never "equal", // although the meaning of "equal" for mutating collections // is a bit fuzzy. Uncomment when/if we fix: // 6374942: Improve thread safety of collection .equals() methods //notEqual(theRock, elLoco); //notEqual(elLoco, theRock); notEqual(theRock.toString(), elLoco.toString()); } static class Looper { final long quittingTime; int i = 0; Looper() { this(defaultWorkTimeMillis); } Looper(long workTimeMillis) { quittingTime = System.nanoTime() + workTimeMillis * 1024 * 1024; } boolean keepGoing() { return (i++ % 128 != 0) || (System.nanoTime() < quittingTime); } } private static void frob(Object theRock, Object elLoco) { Frobber frobber = new Frobber(elLoco); try { if (theRock instanceof Collection) { @SuppressWarnings("unchecked") Collection c = (Collection) theRock; if (! c.contains(one)) c.add(one); } else { @SuppressWarnings("unchecked") Map m = (Map) theRock; if (! m.containsKey(one)) m.put(one, true); } for (Looper looper = new Looper(); looper.keepGoing(); ) checkEqualSanity(theRock, elLoco); } catch (Throwable t) { unexpected(t); } finally { frobber.enoughAlready(); } } private static List> newConcurrentMaps() { List> list = new ArrayList>(); list.add(new ConcurrentHashMap()); list.add(new ConcurrentSkipListMap()); return list; } private static List> maps() { List> list = newConcurrentMaps(); list.add(new Hashtable()); list.add(new HashMap()); list.add(new TreeMap()); Comparator cmp = new Comparator() { public int compare(Integer x, Integer y) { return x - y; }}; list.add(new TreeMap(Collections.reverseOrder(cmp))); return list; } private static List> newConcurrentSets() { List> list = new ArrayList>(); list.add(new ConcurrentSkipListSet()); list.add(new CopyOnWriteArraySet()); return list; } private static List> newSets() { List> list = newConcurrentSets(); list.add(new HashSet()); list.add(new TreeSet()); list.add(new TreeSet(Collections.reverseOrder())); return list; } private static List> newConcurrentLists() { List> list = new ArrayList>(); list.add(new CopyOnWriteArrayList()); return list; } private static List> newLists() { List> list = newConcurrentLists(); list.add(new Vector()); list.add(new ArrayList()); return list; } private static List> newConcurrentQueues() { List> list = new ArrayList>(newConcurrentDeques()); list.add(new LinkedBlockingQueue(10)); list.add(new LinkedTransferQueue()); list.add(new ConcurrentLinkedQueue()); return list; } private static List> newQueues() { List> list = new ArrayList>(newDeques()); list.add(new LinkedBlockingQueue(10)); return list; } private static List> newConcurrentDeques() { List> list = new ArrayList>(); list.add(new LinkedBlockingDeque(10)); list.add(new ConcurrentLinkedDeque()); return list; } private static List> newDeques() { List> list = newConcurrentDeques(); list.add(new ArrayDeque()); list.add(new LinkedList()); return list; } private static void describe(Class k, Object x, Object y) { if (debug) System.out.printf("%s: %s, %s%n", k.getSimpleName(), x.getClass().getSimpleName(), y.getClass().getSimpleName()); } private static void realMain(String[] args) { for (Map x : maps()) for (Map y : newConcurrentMaps()) { describe(Map.class, x, y); x.put(one, true); frob(x, y); frob(unmodifiableMap(x), y); frob(synchronizedMap(x), y); frob(x, synchronizedMap(y)); frob(checkedMap(x, Integer.class, Boolean.class), y); frob(x, checkedMap(y, Integer.class, Boolean.class)); x.clear(); frob(newSetFromMap(x), newSetFromMap(y)); frob(x.keySet(), newSetFromMap(y)); } for (Set x : newSets()) for (Set y : newConcurrentSets()) { describe(Set.class, x, y); frob(x, y); frob(unmodifiableSet(x), y); frob(synchronizedSet(x), y); frob(x, synchronizedSet(y)); frob(checkedSet(x, Integer.class), y); frob(x, checkedSet(y, Integer.class)); } for (List x : newLists()) for (List y : newConcurrentLists()) { describe(List.class, x, y); frob(x, y); frob(unmodifiableList(x), y); frob(synchronizedList(x), y); frob(x, synchronizedList(y)); frob(checkedList(x, Integer.class), y); frob(x, checkedList(y, Integer.class)); } for (Queue x : newQueues()) for (Queue y : newConcurrentQueues()) { describe(Queue.class, x, y); frob(x, y); } for (Deque x : newDeques()) for (Deque y : newConcurrentDeques()) { describe(Deque.class, x, y); frob(asLifoQueue(x), y); frob(x, asLifoQueue(y)); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static String toString(Object x) { return ((x instanceof Collection) || (x instanceof Map)) ? x.getClass().getName() : x.toString();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(toString(x) + " not equal to " + toString(y));} static void notEqual(Object x, Object y) { if (x == null ? y == null : x.equals(y)) fail(toString(x) + " equal to " + toString(y)); else pass();} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class CheckedThread extends Thread { abstract void realRun() throws Throwable; public void run() { try { realRun(); } catch (Throwable t) { unexpected(t); }}} } jsr166/src/test/jtreg/util/Collections/CheckedSetBash.java0000644000000000000000000001166511441006143020561 0ustar /* * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4904067 * @summary Unit test for Collections.checkedSet * @author Josh Bloch */ import java.util.*; public class CheckedSetBash { static Random rnd = new Random(); public static void main(String[] args) { int numItr = 100; int setSize = 100; for (int i=0; i -1; } } jsr166/src/test/jtreg/util/Collections/Rotate.java0000644000000000000000000000501311441006143017205 0ustar /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4323074 * @summary Basic test for new rotate algorithm */ import java.util.*; public class Rotate { // Should have lots of distinct factors and be > ROTATE_THRESHOLD static final int SIZE = 120; static Random rnd = new Random(); public static void main(String[] args) throws Exception { List a[] = {new ArrayList(), new LinkedList(), new Vector()}; for (int i=0; i()); test(new LinkedList()); } static void test(List list) { for (int i = 0; i < N; i++) for (int j = 0; j < i; j++) list.add(i); Collections.shuffle(list); for (int i = 0; i < N; i++) if (Collections.frequency(list, i) != i) throw new RuntimeException(list.getClass() + ": " + i); } } jsr166/src/test/jtreg/util/Collections/NCopies.java0000644000000000000000000000635411441006143017320 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6267846 6275009 * @summary Test Collections.nCopies * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class NCopies { static volatile int passed = 0, failed = 0; static void fail(String msg) { failed++; new AssertionError(msg).printStackTrace(); } static void pass() { passed++; } static void unexpected(Throwable t) { failed++; t.printStackTrace(); } static void check(boolean condition, String msg) { if (condition) passed++; else fail(msg); } static void check(boolean condition) { check(condition, "Assertion failure"); } private static void checkEmpty(List x) { check(x.isEmpty()); check(x.size() == 0); check(x.indexOf("foo") == -1); check(x.lastIndexOf("foo") == -1); check(x.toArray().length == 0); check(x.toArray().getClass() == Object[].class); } private static void checkFoos(List x) { check(! x.isEmpty()); check(x.indexOf(new String("foo")) == 0); check(x.lastIndexOf(new String("foo")) == x.size()-1); check(x.toArray().length == x.size()); check(x.toArray().getClass() == Object[].class); String[] sa = x.toArray(new String[x.size()]); check(sa.getClass() == String[].class); check(sa[0].equals("foo")); check(sa[sa.length-1].equals("foo")); check(x.get(x.size()/2).equals("foo")); checkEmpty(x.subList(x.size()/2, x.size()/2)); } public static void main(String[] args) { try { List empty = Collections.nCopies(0, "foo"); checkEmpty(empty); checkEmpty(empty.subList(0,0)); List foos = Collections.nCopies(42, "foo"); check(foos.size() == 42); checkFoos(foos.subList(foos.size()/2, foos.size()-1)); } catch (Throwable t) { unexpected(t); } System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Error("Some tests failed"); } } jsr166/src/test/jtreg/util/Collections/ReverseOrder2.java0000644000000000000000000001131311450166503020447 0ustar /* * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4809442 6366832 4974878 6372554 4890211 6483125 * @summary Basic test for Collections.reverseOrder * @author Josh Bloch, Martin Buchholz */ import java.util.*; import java.io.*; public class ReverseOrder2 { static final int N = 100; static void realMain(String[] args) throws Throwable { check(Collections.reverseOrder() == Collections.reverseOrder(null)); check(Collections.reverseOrder() == reincarnate(Collections.reverseOrder())); check(Collections.reverseOrder(Collections.reverseOrder(cmp)) == cmp); equal(Collections.reverseOrder(cmp), Collections.reverseOrder(cmp)); equal(Collections.reverseOrder(cmp).hashCode(), Collections.reverseOrder(cmp).hashCode()); check(Collections.reverseOrder(cmp).hashCode() != cmp.hashCode()); test(new ArrayList()); test(new LinkedList()); test2(new ArrayList()); test2(new LinkedList()); } static void test(List list) { for (int i = 0; i < N; i++) list.add(String.valueOf(i)); Collections.shuffle(list); Collections.sort(list, Collections.reverseOrder(cmp)); equal(list, golden); } private static Comparator cmp = new Comparator () { public int compare(String s1, String s2) { int i1 = Integer.parseInt(s1); int i2 = Integer.parseInt(s2); return (i1 < i2 ? Integer.MIN_VALUE : (i1 == i2 ? 0 : 1)); } }; private static final List golden = new ArrayList(N); static { for (int i = N-1; i >= 0; i--) golden.add(String.valueOf(i)); } static void test2(List list) { for (int i = 0; i < N; i++) list.add(i); Collections.shuffle(list); Collections.sort(list, Collections.reverseOrder(null)); equal(list, golden2); } private static final List golden2 = new ArrayList(N); static { for (int i = N-1; i >= 0; i--) golden2.add(i); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} static byte[] serializedForm(Object obj) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); new ObjectOutputStream(baos).writeObject(obj); return baos.toByteArray(); } catch (IOException e) {throw new RuntimeException(e);}} static Object readObject(byte[] bytes) throws IOException, ClassNotFoundException { InputStream is = new ByteArrayInputStream(bytes); return new ObjectInputStream(is).readObject();} @SuppressWarnings("unchecked") static T reincarnate(T obj) { try {return (T) readObject(serializedForm(obj));} catch (Exception e) {throw new RuntimeException(e);}} } jsr166/src/test/jtreg/util/Collections/CheckedNull.java0000644000000000000000000001504611466055140020147 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6409434 * @summary Test behavior of nulls in checked collections */ import java.util.*; import static java.util.Collections.*; @SuppressWarnings({"unchecked","serial"}) public class CheckedNull { void test(String[] args) throws Throwable { testCollection(Collections.checkedCollection( new ArrayList(), String.class)); testCollection(Collections.checkedList( new ArrayList(), String.class)); testCollection(Collections.checkedSet( new HashSet(), String.class)); final Comparator nullLow = new Comparator() { public int compare(Object x, Object y) { return x == y ? 0 : x == null ? -1 : y == null ? 1 : ((Comparable)x).compareTo(y); }}; testCollection(Collections.checkedSortedSet( new TreeSet(nullLow), String.class)); testMap(Collections.checkedMap( new HashMap(), String.class, String.class)); } ClassCastException cce(F f) { try { f.f(); fail(); return null; } catch (ClassCastException cce) { pass(); return cce; } catch (Throwable t) { unexpected(t); return null; } } void equalCCE(F ... fs) { String detailMessage = null; for (F f : fs) if (detailMessage == null) detailMessage = cce(f).getMessage(); else equal(detailMessage, cce(f).getMessage()); } void add(Collection c, Object o) { int s = c.size(); check(! c.contains(o)); check(c.add(o)); check(c.contains(o)); equal(c.size(), s+1); check(c.remove(o)); check(! c.contains(o)); check(c.addAll(singleton(o))); check(c.contains(o)); equal(c.size(), s+1); check(c.remove(o)); equal(c.size(), s); } void testCollection(final Collection c) { try { check(c.isEmpty()); add(c, null); add(c, "foo"); check(c.add("bar")); add(c, null); add(c, "foo"); equalCCE( new F(){void f(){ c.add(1); }}, new F(){void f(){ c.addAll(singleton(1)); }}); } catch (Throwable t) { unexpected(t); } } void put(Map m, Object k, Object v) { int s = m.size(); check(! m.containsKey(k)); check(! m.containsValue(v)); equal(null, m.put(k, v)); check(m.containsKey(k)); check(m.containsValue(v)); equal(m.size(), s+1); equal(v, m.remove(k)); check(! m.containsKey(k)); check(! m.containsValue(v)); m.putAll(singletonMap(k,v)); check(m.containsKey(k)); check(m.containsValue(v)); equal(m.size(), s+1); equal(v,m.remove(k)); equal(m.size(), s); } void testMap(final Map m) { try { check(m.isEmpty()); put(m, "foo", null); put(m, null, "foo"); put(m, null, null); put(m, "foo", "bar"); m.put("a", "b"); put(m, "foo", null); put(m, null, "foo"); put(m, null, null); put(m, "foo", "bar"); equalCCE( new F(){void f(){ m.put(1, "foo"); }}, new F(){void f(){ m.putAll(singletonMap(1, "foo")); }}); final Collection cheater = new ArrayList() { public boolean contains(Object o) { if (o instanceof Map.Entry) ((Map.Entry)o).setValue(1); return false; }}; equalCCE( new F(){void f(){ m.put("foo", 1); }}, new F(){void f(){ m.putAll(singletonMap("foo", 1)); }}, new F(){void f(){ ((Map.Entry)m.entrySet().iterator().next()).setValue(1); }}, new F(){void f(){ m.entrySet().removeAll(cheater);}}, new F(){void f(){ m.entrySet().retainAll(cheater);}}); equalCCE( new F(){void f(){ m.put(3, 1); }}, new F(){void f(){ m.putAll(singletonMap(3, 1)); }}); equal(m.size(), 1); equal(m.keySet(), singleton("a")); equal(m.entrySet(), singleton(new AbstractMap.SimpleImmutableEntry("a","b"))); } catch (Throwable t) { unexpected(t); } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new CheckedNull().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} } jsr166/src/test/jtreg/util/Collection/0000755000000000000000000000000011652013242014724 5ustar jsr166/src/test/jtreg/util/Collection/BiggernYours.java0000644000000000000000000002152611450166503020221 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6415641 6377302 * @summary Concurrent collections are permitted to lie about their size * @author Martin Buchholz */ import java.io.*; import java.util.*; import java.util.concurrent.*; @SuppressWarnings("unchecked") public class BiggernYours { static final Random rnd = new Random(); static void compareCollections(Collection c1, Collection c2) { arrayEqual(c1.toArray(), c2.toArray()); arrayEqual(c1.toArray(new Object[0]), c2.toArray(new Object[0])); arrayEqual(c1.toArray(new Object[5]), c2.toArray(new Object[5])); } static void compareMaps(Map m1, Map m2) { compareCollections(m1.keySet(), m2.keySet()); compareCollections(m1.values(), m2.values()); compareCollections(m1.entrySet(), m2.entrySet()); } static void compareNavigableMaps(NavigableMap m1, NavigableMap m2) { compareMaps(m1, m2); compareMaps(m1.descendingMap(), m2.descendingMap()); compareMaps(m1.tailMap(Integer.MIN_VALUE), m2.tailMap(Integer.MIN_VALUE)); compareMaps(m1.headMap(Integer.MAX_VALUE), m2.headMap(Integer.MAX_VALUE)); } static void compareNavigableSets(NavigableSet s1, NavigableSet s2) { compareCollections(s1, s2); compareCollections(s1.descendingSet(), s2.descendingSet()); compareCollections(s1.tailSet(Integer.MIN_VALUE), s2.tailSet(Integer.MIN_VALUE)); } abstract static class MapFrobber { abstract void frob(Map m); } abstract static class SetFrobber { abstract void frob(Set s); } abstract static class ColFrobber { abstract void frob(Collection c); } static ColFrobber adder(final int i) { return new ColFrobber() {void frob(Collection c) { c.add(i); }}; } static final ColFrobber[] adders = { adder(1), adder(3), adder(2) }; static MapFrobber putter(final int k, final int v) { return new MapFrobber() {void frob(Map m) { m.put(k,v); }}; } static final MapFrobber[] putters = { putter(1, -2), putter(3, -6), putter(2, -4) }; static void unexpected(Throwable t, Object suspect) { System.out.println(suspect.getClass()); unexpected(t); } static void testCollections(Collection c1, Collection c2) { try { compareCollections(c1, c2); for (ColFrobber adder : adders) { for (Collection c : new Collection[]{c1, c2}) adder.frob(c); compareCollections(c1, c2); } } catch (Throwable t) { unexpected(t, c1); } } static void testNavigableSets(NavigableSet s1, NavigableSet s2) { try { compareNavigableSets(s1, s2); for (ColFrobber adder : adders) { for (Set s : new Set[]{s1, s2}) adder.frob(s); compareNavigableSets(s1, s2); } } catch (Throwable t) { unexpected(t, s1); } } static void testMaps(Map m1, Map m2) { try { compareMaps(m1, m2); for (MapFrobber putter : putters) { for (Map m : new Map[]{m1, m2}) putter.frob(m); compareMaps(m1, m2); } } catch (Throwable t) { unexpected(t, m1); } } static void testNavigableMaps(NavigableMap m1, NavigableMap m2) { try { compareNavigableMaps(m1, m2); for (MapFrobber putter : putters) { for (Map m : new Map[]{m1, m2}) putter.frob(m); compareNavigableMaps(m1, m2); } } catch (Throwable t) { unexpected(t, m1); } } static int randomize(int size) { return rnd.nextInt(size + 2); } @SuppressWarnings("serial") private static void realMain(String[] args) throws Throwable { testNavigableMaps( new ConcurrentSkipListMap(), new ConcurrentSkipListMap() { public int size() {return randomize(super.size());}}); testNavigableSets( new ConcurrentSkipListSet(), new ConcurrentSkipListSet() { public int size() {return randomize(super.size());}}); testCollections( new CopyOnWriteArraySet(), new CopyOnWriteArraySet() { public int size() {return randomize(super.size());}}); testCollections( new CopyOnWriteArrayList(), new CopyOnWriteArrayList() { public int size() {return randomize(super.size());}}); testCollections( new TreeSet(), new TreeSet() { public int size() {return randomize(super.size());}}); testMaps( new ConcurrentHashMap(), new ConcurrentHashMap() { public int size() {return randomize(super.size());}}); testCollections( new ConcurrentLinkedDeque(), new ConcurrentLinkedDeque() { public int size() {return randomize(super.size());}}); testCollections( new ConcurrentLinkedQueue(), new ConcurrentLinkedQueue() { public int size() {return randomize(super.size());}}); testCollections( new LinkedTransferQueue(), new LinkedTransferQueue() { public int size() {return randomize(super.size());}}); testCollections( new LinkedBlockingQueue(), new LinkedBlockingQueue() { public int size() {return randomize(super.size());}}); testCollections( new LinkedBlockingDeque(), new LinkedBlockingDeque() { public int size() {return randomize(super.size());}}); testCollections( new ArrayBlockingQueue(5), new ArrayBlockingQueue(5) { public int size() {return randomize(super.size());}}); testCollections( new PriorityBlockingQueue(5), new PriorityBlockingQueue(5) { public int size() {return randomize(super.size());}}); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} static void arrayEqual(Object[] x, Object[] y) { if (x == null ? y == null : Arrays.equals(x, y)) pass(); else fail(Arrays.toString(x) + " not equal to " + Arrays.toString(y));} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class Fun {abstract void f() throws Throwable;} static void THROWS(Class k, Fun... fs) { for (Fun f : fs) try { f.f(); fail("Expected " + k.getName() + " not thrown"); } catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} private abstract static class CheckedThread extends Thread { abstract void realRun() throws Throwable; public void run() { try {realRun();} catch (Throwable t) {unexpected(t);}}} } jsr166/src/test/jtreg/util/Collection/MOAT.java0000644000000000000000000013457111450166503016347 0ustar /* * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6207984 6272521 6192552 6269713 6197726 6260652 5073546 4137464 * 4155650 4216399 4294891 6282555 6318622 6355327 6383475 6420753 * 6431845 4802633 6570566 6570575 6570631 6570924 6691185 6691215 * @summary Run many tests on many Collection and Map implementations * @author Martin Buchholz */ /* Mother Of All (Collection) Tests * * Testing of collection classes is often spotty, because many tests * need to be performed on many implementations, but the onus on * writing the tests falls on the engineer introducing the new * implementation. * * The idea of this mega-test is that: * * An engineer adding a new collection implementation could simply add * their new implementation to a list of implementations in this * test's main method. Any general purpose Collection or * Map class is appropriate. * * An engineer fixing a regression could add their regression test here and * simultaneously test all other implementations. */ import java.io.*; import java.util.*; import java.util.concurrent.*; import static java.util.Collections.*; public class MOAT { public static void realMain(String[] args) { testCollection(new LinkedHashSet()); testCollection(new HashSet()); testCollection(new Vector()); testCollection(new Vector().subList(0,0)); testCollection(new ArrayDeque()); testCollection(new ArrayList()); testCollection(new ArrayList().subList(0,0)); testCollection(new LinkedList()); testCollection(new LinkedList().subList(0,0)); testCollection(new TreeSet()); testCollection(new CopyOnWriteArrayList()); testCollection(new CopyOnWriteArrayList().subList(0,0)); testCollection(new CopyOnWriteArraySet()); testCollection(new PriorityQueue()); testCollection(new PriorityBlockingQueue()); testCollection(new ArrayBlockingQueue(20)); testCollection(new LinkedBlockingQueue(20)); testCollection(new LinkedBlockingDeque(20)); testCollection(new ConcurrentLinkedDeque()); testCollection(new ConcurrentLinkedQueue()); testCollection(new LinkedTransferQueue()); testCollection(new ConcurrentSkipListSet()); testCollection(Arrays.asList(new Integer(42))); testCollection(Arrays.asList(1,2,3)); testCollection(nCopies(25,1)); testImmutableList(nCopies(25,1)); testImmutableList(unmodifiableList(Arrays.asList(1,2,3))); testMap(new HashMap()); testMap(new LinkedHashMap()); testMap(new WeakHashMap()); testMap(new IdentityHashMap()); testMap(new TreeMap()); testMap(new Hashtable()); testMap(new ConcurrentHashMap(10, 0.5f)); testMap(new ConcurrentSkipListMap()); // Empty collections final List emptyArray = Arrays.asList(new Integer[]{}); testCollection(emptyArray); testEmptyList(emptyArray); THROWS(IndexOutOfBoundsException.class, new Fun(){void f(){ emptyArray.set(0,1); }}); THROWS(UnsupportedOperationException.class, new Fun(){void f(){ emptyArray.add(0,1); }}); List noOne = nCopies(0,1); testCollection(noOne); testEmptyList(noOne); testImmutableList(noOne); Set emptySet = emptySet(); testCollection(emptySet); testEmptySet(emptySet); testEmptySet(EMPTY_SET); testImmutableSet(emptySet); List emptyList = emptyList(); testCollection(emptyList); testEmptyList(emptyList); testEmptyList(EMPTY_LIST); testImmutableList(emptyList); Map emptyMap = emptyMap(); testMap(emptyMap); testEmptyMap(emptyMap); testEmptyMap(EMPTY_MAP); testImmutableMap(emptyMap); // Singleton collections Set singletonSet = singleton(1); equal(singletonSet.size(), 1); testCollection(singletonSet); testImmutableSet(singletonSet); List singletonList = singletonList(1); equal(singletonList.size(), 1); testCollection(singletonList); testImmutableList(singletonList); testImmutableList(singletonList.subList(0,1)); testImmutableList(singletonList.subList(0,1).subList(0,1)); testEmptyList(singletonList.subList(0,0)); testEmptyList(singletonList.subList(0,0).subList(0,0)); Map singletonMap = singletonMap(1,2); equal(singletonMap.size(), 1); testMap(singletonMap); testImmutableMap(singletonMap); } private static void checkContainsSelf(Collection c) { check(c.containsAll(c)); check(c.containsAll(Arrays.asList(c.toArray()))); check(c.containsAll(Arrays.asList(c.toArray(new Integer[0])))); } private static void checkContainsEmpty(Collection c) { check(c.containsAll(new ArrayList())); } private static void testEmptyCollection(Collection c) { check(c.isEmpty()); equal(c.size(), 0); equal(c.toString(),"[]"); equal(c.toArray().length, 0); equal(c.toArray(new Object[0]).length, 0); check(c.toArray(new Object[]{42})[0] == null); Object[] a = new Object[1]; a[0] = Boolean.TRUE; equal(c.toArray(a), a); equal(a[0], null); testEmptyIterator(c.iterator()); } static void testEmptyIterator(final Iterator it) { if (rnd.nextBoolean()) check(! it.hasNext()); THROWS(NoSuchElementException.class, new Fun(){void f(){ it.next(); }}); try { it.remove(); } catch (IllegalStateException _) { pass(); } catch (UnsupportedOperationException _) { pass(); } catch (Throwable t) { unexpected(t); } if (rnd.nextBoolean()) check(! it.hasNext()); } private static void testEmptyList(List c) { testEmptyCollection(c); equal(c.hashCode(), 1); equal2(c, Collections.emptyList()); } private static void testEmptySet(Set c) { testEmptyCollection(c); equal(c.hashCode(), 0); equal2(c, Collections.emptySet()); if (c instanceof NavigableSet) testEmptyIterator(((NavigableSet)c).descendingIterator()); } private static void testImmutableCollection(final Collection c) { THROWS(UnsupportedOperationException.class, new Fun(){void f(){ c.add(99); }}, new Fun(){void f(){ c.addAll(singleton(99)); }}); if (! c.isEmpty()) { final Integer first = c.iterator().next(); THROWS(UnsupportedOperationException.class, new Fun(){void f(){ c.clear(); }}, new Fun(){void f(){ c.remove(first); }}, new Fun(){void f(){ c.removeAll(singleton(first)); }}, new Fun(){void f(){ c.retainAll(emptyList()); }} ); } } private static void testImmutableSet(final Set c) { testImmutableCollection(c); } private static void testImmutableList(final List c) { testList(c); testImmutableCollection(c); THROWS(UnsupportedOperationException.class, new Fun(){void f(){ c.set(0,42); }}, new Fun(){void f(){ c.add(0,42); }}, new Fun(){void f(){ c.addAll(0,singleton(86)); }}); if (! c.isEmpty()) THROWS(UnsupportedOperationException.class, new Fun(){void f(){ Iterator it = c.iterator(); it.next(); it.remove();}}, new Fun(){void f(){ ListIterator it = c.listIterator(); it.next(); it.remove();}}); } private static void clear(Collection c) { try { c.clear(); } catch (Throwable t) { unexpected(t); } testEmptyCollection(c); } private static void testEmptyMap(final Map m) { check(m.isEmpty()); equal(m.size(), 0); equal(m.toString(),"{}"); testEmptySet(m.keySet()); testEmptySet(m.entrySet()); testEmptyCollection(m.values()); try { check(! m.containsValue(null)); } catch (NullPointerException _) { /* OK */ } try { check(! m.containsKey(null)); } catch (NullPointerException _) { /* OK */ } check(! m.containsValue(1)); check(! m.containsKey(1)); } private static void testImmutableMap(final Map m) { THROWS(UnsupportedOperationException.class, new Fun(){void f(){ m.put(1,1); }}, new Fun(){void f(){ m.putAll(singletonMap(1,1)); }}); if (! m.isEmpty()) { final Integer first = m.keySet().iterator().next(); THROWS(UnsupportedOperationException.class, new Fun(){void f(){ m.remove(first); }}, new Fun(){void f(){ m.clear(); }}); final Map.Entry me = m.entrySet().iterator().next(); Integer key = me.getKey(); Integer val = me.getValue(); THROWS(UnsupportedOperationException.class, new Fun(){void f(){ me.setValue(3); }}); equal(key, me.getKey()); equal(val, me.getValue()); } testImmutableSet(m.keySet()); testImmutableCollection(m.values()); //testImmutableSet(m.entrySet()); } private static void clear(Map m) { try { m.clear(); } catch (Throwable t) { unexpected(t); } testEmptyMap(m); } private static void oneElement(Collection c) { clear(c); try { check(c.add(-42)); equal(c.toString(), "[-42]"); if (c instanceof Set) check(! c.add(-42)); } catch (Throwable t) { unexpected(t); } check(! c.isEmpty()); check(c.size() == 1); } private static boolean supportsAdd(Collection c) { try { check(c.add(778347983)); } catch (UnsupportedOperationException t) { return false; } catch (Throwable t) { unexpected(t); } try { check(c.contains(778347983)); check(c.remove(778347983)); } catch (Throwable t) { unexpected(t); } return true; } private static boolean supportsRemove(Collection c) { try { check(! c.remove(19134032)); } catch (UnsupportedOperationException t) { return false; } catch (Throwable t) { unexpected(t); } return true; } private static void checkFunctionalInvariants(Collection c) { try { checkContainsSelf(c); checkContainsEmpty(c); check(c.size() != 0 ^ c.isEmpty()); { int size = 0; for (Integer i : c) size++; check(c.size() == size); } check(c.toArray().length == c.size()); check(c.toArray().getClass() == Object[].class || // !!!! // 6260652: (coll) Arrays.asList(x).toArray().getClass() // should be Object[].class (c.getClass().getName().equals("java.util.Arrays$ArrayList")) ); for (int size : new int[]{0,1,c.size(), c.size()+1}) { Integer[] a = c.toArray(new Integer[size]); check((size > c.size()) || a.length == c.size()); int i = 0; for (Integer j : c) check(a[i++] == j); check((size <= c.size()) || (a[c.size()] == null)); check(a.getClass() == Integer[].class); } check(c.equals(c)); if (c instanceof Serializable) { //System.out.printf("Serializing %s%n", c.getClass().getName()); try { Object clone = serialClone(c); equal(c instanceof Serializable, clone instanceof Serializable); equal(c instanceof RandomAccess, clone instanceof RandomAccess); if ((c instanceof List) || (c instanceof Set)) equal(c, clone); else equal(new HashSet(c), new HashSet(serialClone(c))); } catch (Error xxx) { if (! (xxx.getCause() instanceof NotSerializableException)) throw xxx; } } } catch (Throwable t) { unexpected(t); } } //---------------------------------------------------------------- // If add(null) succeeds, contains(null) & remove(null) should succeed //---------------------------------------------------------------- private static void testNullElement(Collection c) { // !!!! 5018849: (coll) TreeSet.contains(null) does not agree with Javadoc if (c instanceof TreeSet) return; try { check(c.add(null)); if (c.size() == 1) equal(c.toString(), "[null]"); try { checkFunctionalInvariants(c); check(c.contains(null)); check(c.remove(null)); } catch (Throwable t) { unexpected(t); } } catch (NullPointerException e) { /* OK */ } catch (Throwable t) { unexpected(t); } } //---------------------------------------------------------------- // If add("x") succeeds, contains("x") & remove("x") should succeed //---------------------------------------------------------------- @SuppressWarnings("unchecked") private static void testStringElement(Collection c) { Collection x = (Collection)c; // Make type-unsafe try { check(x.add("x")); try { check(x.contains("x")); check(x.remove("x")); } catch (Throwable t) { unexpected(t); } } catch (ClassCastException e) { /* OK */ } catch (Throwable t) { unexpected(t); } } private static void testConcurrentCollection(Collection c) { try { c.add(1); Iterator it = c.iterator(); check(it.hasNext()); clear(c); check(it.next() instanceof Integer); // No CME check(c.isEmpty()); } catch (Throwable t) { unexpected(t); } } private static void testQueue(Queue q) { q.clear(); for (int i = 0; i < 5; i++) { testQueueAddRemove(q, null); testQueueAddRemove(q, 537); q.add(i); } equal(q.size(), 5); checkFunctionalInvariants(q); q.poll(); equal(q.size(), 4); checkFunctionalInvariants(q); if ((q instanceof LinkedBlockingQueue) || (q instanceof LinkedBlockingDeque) || (q instanceof ConcurrentLinkedDeque) || (q instanceof ConcurrentLinkedQueue)) { testQueueIteratorRemove(q); } } private static void testQueueAddRemove(final Queue q, final Integer e) { final List originalContents = new ArrayList(q); final boolean isEmpty = q.isEmpty(); final boolean isList = (q instanceof List); final List asList = isList ? (List) q : null; check(!q.contains(e)); try { q.add(e); } catch (NullPointerException npe) { check(e == null); return; // Null elements not supported } check(q.contains(e)); check(q.remove(e)); check(!q.contains(e)); equal(new ArrayList(q), originalContents); if (q instanceof Deque) { final Deque deq = (Deque) q; final List singleton = Collections.singletonList(e); // insert, query, remove element at head if (isEmpty) { THROWS(NoSuchElementException.class, new Fun(){void f(){ deq.getFirst(); }}, new Fun(){void f(){ deq.element(); }}, new Fun(){void f(){ deq.iterator().next(); }}); check(deq.peekFirst() == null); check(deq.peek() == null); } else { check(deq.getFirst() != e); check(deq.element() != e); check(deq.iterator().next() != e); check(deq.peekFirst() != e); check(deq.peek() != e); } check(!deq.contains(e)); check(!deq.removeFirstOccurrence(e)); check(!deq.removeLastOccurrence(e)); if (isList) { check(asList.indexOf(e) == -1); check(asList.lastIndexOf(e) == -1); } switch (rnd.nextInt(isList ? 4 : 3)) { case 0: deq.addFirst(e); break; case 1: check(deq.offerFirst(e)); break; case 2: deq.push(e); break; case 3: asList.add(0, e); break; default: throw new AssertionError(); } check(deq.peekFirst() == e); check(deq.getFirst() == e); check(deq.element() == e); check(deq.peek() == e); check(deq.iterator().next() == e); check(deq.contains(e)); if (isList) { check(asList.get(0) == e); check(asList.indexOf(e) == 0); check(asList.lastIndexOf(e) == 0); check(asList.subList(0, 1).equals(singleton)); } switch (rnd.nextInt(isList ? 11 : 9)) { case 0: check(deq.pollFirst() == e); break; case 1: check(deq.removeFirst() == e); break; case 2: check(deq.remove() == e); break; case 3: check(deq.pop() == e); break; case 4: check(deq.removeFirstOccurrence(e)); break; case 5: check(deq.removeLastOccurrence(e)); break; case 6: check(deq.remove(e)); break; case 7: check(deq.removeAll(singleton)); break; case 8: Iterator it = deq.iterator(); it.next(); it.remove(); break; case 9: asList.remove(0); break; case 10: asList.subList(0, 1).clear(); break; default: throw new AssertionError(); } if (isEmpty) { THROWS(NoSuchElementException.class, new Fun(){void f(){ deq.getFirst(); }}, new Fun(){void f(){ deq.element(); }}, new Fun(){void f(){ deq.iterator().next(); }}); check(deq.peekFirst() == null); check(deq.peek() == null); } else { check(deq.getFirst() != e); check(deq.element() != e); check(deq.iterator().next() != e); check(deq.peekFirst() != e); check(deq.peek() != e); } check(!deq.contains(e)); check(!deq.removeFirstOccurrence(e)); check(!deq.removeLastOccurrence(e)); if (isList) { check(isEmpty || asList.get(0) != e); check(asList.indexOf(e) == -1); check(asList.lastIndexOf(e) == -1); } equal(new ArrayList(deq), originalContents); // insert, query, remove element at tail if (isEmpty) { check(deq.peekLast() == null); THROWS(NoSuchElementException.class, new Fun(){void f(){ deq.getLast(); }}); } else { check(deq.peekLast() != e); check(deq.getLast() != e); } switch (rnd.nextInt(isList ? 6 : 4)) { case 0: deq.addLast(e); break; case 1: check(deq.offerLast(e)); break; case 2: check(deq.add(e)); break; case 3: deq.addAll(singleton); break; case 4: asList.addAll(deq.size(), singleton); break; case 5: asList.add(deq.size(), e); break; default: throw new AssertionError(); } check(deq.peekLast() == e); check(deq.getLast() == e); check(deq.contains(e)); if (isList) { ListIterator it = asList.listIterator(asList.size()); check(it.previous() == e); check(asList.get(asList.size() - 1) == e); check(asList.indexOf(e) == asList.size() - 1); check(asList.lastIndexOf(e) == asList.size() - 1); int size = asList.size(); check(asList.subList(size - 1, size).equals(singleton)); } switch (rnd.nextInt(isList ? 8 : 6)) { case 0: check(deq.pollLast() == e); break; case 1: check(deq.removeLast() == e); break; case 2: check(deq.removeFirstOccurrence(e)); break; case 3: check(deq.removeLastOccurrence(e)); break; case 4: check(deq.remove(e)); break; case 5: check(deq.removeAll(singleton)); break; case 6: asList.remove(asList.size() - 1); break; case 7: ListIterator it = asList.listIterator(asList.size()); it.previous(); it.remove(); break; default: throw new AssertionError(); } if (isEmpty) { check(deq.peekLast() == null); THROWS(NoSuchElementException.class, new Fun(){void f(){ deq.getLast(); }}); } else { check(deq.peekLast() != e); check(deq.getLast() != e); } check(!deq.contains(e)); equal(new ArrayList(deq), originalContents); // Test operations on empty deque switch (rnd.nextInt(isList ? 4 : 2)) { case 0: deq.clear(); break; case 1: Iterator it = deq.iterator(); while (it.hasNext()) { it.next(); it.remove(); } break; case 2: asList.subList(0, asList.size()).clear(); break; case 3: ListIterator lit = asList.listIterator(asList.size()); while (lit.hasPrevious()) { lit.previous(); lit.remove(); } break; default: throw new AssertionError(); } testEmptyCollection(deq); check(!deq.iterator().hasNext()); if (isList) { check(!asList.listIterator().hasPrevious()); THROWS(NoSuchElementException.class, new Fun(){void f(){ asList.listIterator().previous(); }}); } THROWS(NoSuchElementException.class, new Fun(){void f(){ deq.iterator().next(); }}, new Fun(){void f(){ deq.element(); }}, new Fun(){void f(){ deq.getFirst(); }}, new Fun(){void f(){ deq.getLast(); }}, new Fun(){void f(){ deq.pop(); }}, new Fun(){void f(){ deq.remove(); }}, new Fun(){void f(){ deq.removeFirst(); }}, new Fun(){void f(){ deq.removeLast(); }}); check(deq.poll() == null); check(deq.pollFirst() == null); check(deq.pollLast() == null); check(deq.peek() == null); check(deq.peekFirst() == null); check(deq.peekLast() == null); check(!deq.removeFirstOccurrence(e)); check(!deq.removeLastOccurrence(e)); check(deq.addAll(originalContents) == !isEmpty); equal(new ArrayList(deq), originalContents); check(!deq.addAll(Collections.emptyList())); equal(new ArrayList(deq), originalContents); } } private static void testQueueIteratorRemove(Queue q) { System.err.printf("testQueueIteratorRemove %s%n", q.getClass().getSimpleName()); q.clear(); for (int i = 0; i < 5; i++) q.add(i); Iterator it = q.iterator(); check(it.hasNext()); for (int i = 3; i >= 0; i--) q.remove(i); equal(it.next(), 0); equal(it.next(), 4); q.clear(); for (int i = 0; i < 5; i++) q.add(i); it = q.iterator(); equal(it.next(), 0); check(it.hasNext()); for (int i = 1; i < 4; i++) q.remove(i); equal(it.next(), 1); equal(it.next(), 4); } private static void testList(final List l) { //---------------------------------------------------------------- // 4802633: (coll) AbstractList.addAll(-1,emptyCollection) // doesn't throw IndexOutOfBoundsException //---------------------------------------------------------------- try { l.addAll(-1, Collections.emptyList()); fail("Expected IndexOutOfBoundsException not thrown"); } catch (UnsupportedOperationException _) {/* OK */} catch (IndexOutOfBoundsException _) {/* OK */} catch (Throwable t) { unexpected(t); } // equal(l instanceof Serializable, // l.subList(0,0) instanceof Serializable); if (l.subList(0,0) instanceof Serializable) check(l instanceof Serializable); equal(l instanceof RandomAccess, l.subList(0,0) instanceof RandomAccess); } private static void testCollection(Collection c) { try { testCollection1(c); } catch (Throwable t) { unexpected(t); } } private static void testCollection1(Collection c) { System.out.println("\n==> " + c.getClass().getName()); checkFunctionalInvariants(c); if (! supportsAdd(c)) return; //System.out.println("add() supported"); if (c instanceof NavigableSet) { System.out.println("NavigableSet tests..."); NavigableSet ns = (NavigableSet)c; testNavigableSet(ns); testNavigableSet(ns.headSet(6, false)); testNavigableSet(ns.headSet(5, true)); testNavigableSet(ns.tailSet(0, false)); testNavigableSet(ns.tailSet(1, true)); testNavigableSet(ns.subSet(0, false, 5, true)); testNavigableSet(ns.subSet(1, true, 6, false)); } if (c instanceof Queue) testQueue((Queue)c); if (c instanceof List) testList((List)c); check(supportsRemove(c)); try { oneElement(c); checkFunctionalInvariants(c); } catch (Throwable t) { unexpected(t); } clear(c); testNullElement(c); oneElement(c); testNullElement(c); clear(c); testStringElement(c); oneElement(c); testStringElement(c); if (c.getClass().getName().matches(".*concurrent.*")) testConcurrentCollection(c); //---------------------------------------------------------------- // The "all" operations should throw NPE when passed null //---------------------------------------------------------------- { oneElement(c); try { c.removeAll(null); fail("Expected NullPointerException"); } catch (NullPointerException e) { pass(); } catch (Throwable t) { unexpected(t); } oneElement(c); try { c.retainAll(null); fail("Expected NullPointerException"); } catch (NullPointerException e) { pass(); } catch (Throwable t) { unexpected(t); } oneElement(c); try { c.addAll(null); fail("Expected NullPointerException"); } catch (NullPointerException e) { pass(); } catch (Throwable t) { unexpected(t); } oneElement(c); try { c.containsAll(null); fail("Expected NullPointerException"); } catch (NullPointerException e) { pass(); } catch (Throwable t) { unexpected(t); } } } //---------------------------------------------------------------- // Map //---------------------------------------------------------------- private static void checkFunctionalInvariants(Map m) { check(m.keySet().size() == m.entrySet().size()); check(m.keySet().size() == m.size()); checkFunctionalInvariants(m.keySet()); checkFunctionalInvariants(m.values()); check(m.size() != 0 ^ m.isEmpty()); } private static void testMap(Map m) { System.out.println("\n==> " + m.getClass().getName()); if (m instanceof ConcurrentMap) testConcurrentMap((ConcurrentMap) m); if (m instanceof NavigableMap) { System.out.println("NavigableMap tests..."); NavigableMap nm = (NavigableMap) m; testNavigableMapRemovers(nm); testNavigableMap(nm); testNavigableMap(nm.headMap(6, false)); testNavigableMap(nm.headMap(5, true)); testNavigableMap(nm.tailMap(0, false)); testNavigableMap(nm.tailMap(1, true)); testNavigableMap(nm.subMap(1, true, 6, false)); testNavigableMap(nm.subMap(0, false, 5, true)); } checkFunctionalInvariants(m); if (supportsClear(m)) { try { clear(m); } catch (Throwable t) { unexpected(t); } } if (supportsPut(m)) { try { check(m.put(3333, 77777) == null); check(m.put(9134, 74982) == null); check(m.get(9134) == 74982); check(m.put(9134, 1382) == 74982); check(m.get(9134) == 1382); check(m.size() == 2); checkFunctionalInvariants(m); checkNPEConsistency(m); } catch (Throwable t) { unexpected(t); } } } private static boolean supportsPut(Map m) { // We're asking for .equals(...) semantics if (m instanceof IdentityHashMap) return false; try { check(m.put(778347983,12735) == null); } catch (UnsupportedOperationException t) { return false; } catch (Throwable t) { unexpected(t); } try { check(m.containsKey(778347983)); check(m.remove(778347983) != null); } catch (Throwable t) { unexpected(t); } return true; } private static boolean supportsClear(Map m) { try { m.clear(); } catch (UnsupportedOperationException t) { return false; } catch (Throwable t) { unexpected(t); } return true; } //---------------------------------------------------------------- // ConcurrentMap //---------------------------------------------------------------- private static void testConcurrentMap(ConcurrentMap m) { System.out.println("ConcurrentMap tests..."); try { clear(m); check(m.putIfAbsent(18357,7346) == null); check(m.containsKey(18357)); check(m.putIfAbsent(18357,8263) == 7346); try { m.putIfAbsent(18357,null); fail("NPE"); } catch (NullPointerException t) { } check(m.containsKey(18357)); check(! m.replace(18357,8888,7777)); check(m.containsKey(18357)); try { m.replace(18357,null,7777); fail("NPE"); } catch (NullPointerException t) { } check(m.containsKey(18357)); check(m.get(18357) == 7346); check(m.replace(18357,7346,5555)); check(m.replace(18357,5555,7346)); check(m.get(18357) == 7346); check(m.replace(92347,7834) == null); try { m.replace(18357,null); fail("NPE"); } catch (NullPointerException t) { } check(m.replace(18357,7346) == 7346); check(m.replace(18357,5555) == 7346); check(m.get(18357) == 5555); check(m.replace(18357,7346) == 5555); check(m.get(18357) == 7346); check(! m.remove(18357,9999)); check(m.get(18357) == 7346); check(m.containsKey(18357)); check(! m.remove(18357,null)); // 6272521 check(m.get(18357) == 7346); check(m.remove(18357,7346)); check(m.get(18357) == null); check(! m.containsKey(18357)); check(m.isEmpty()); m.putIfAbsent(1,2); check(m.size() == 1); check(! m.remove(1,null)); check(! m.remove(1,null)); check(! m.remove(1,1)); check(m.remove(1,2)); check(m.isEmpty()); testEmptyMap(m); } catch (Throwable t) { unexpected(t); } } private static void throwsConsistently(Class k, Iterable fs) { List> threw = new ArrayList>(); for (Fun f : fs) try { f.f(); threw.add(null); } catch (Throwable t) { check(k.isAssignableFrom(t.getClass())); threw.add(t.getClass()); } if (new HashSet(threw).size() != 1) fail(threw.toString()); } private static void checkNPEConsistency(final Map m) { m.clear(); final ConcurrentMap cm = (m instanceof ConcurrentMap) ? (ConcurrentMap) m : null; List fs = new ArrayList(); fs.add(new Fun(){void f(){ check(! m.containsKey(null));}}); fs.add(new Fun(){void f(){ equal(m.remove(null), null);}}); fs.add(new Fun(){void f(){ equal(m.get(null), null);}}); if (cm != null) { fs.add(new Fun(){void f(){ check(! cm.remove(null,null));}});} throwsConsistently(NullPointerException.class, fs); fs.clear(); final Map sm = singletonMap(null,1); fs.add(new Fun(){void f(){ equal(m.put(null,1), null); m.clear();}}); fs.add(new Fun(){void f(){ m.putAll(sm); m.clear();}}); if (cm != null) { fs.add(new Fun(){void f(){ check(! cm.remove(null,null));}}); fs.add(new Fun(){void f(){ equal(cm.putIfAbsent(null,1), 1);}}); fs.add(new Fun(){void f(){ equal(cm.replace(null,1), null);}}); fs.add(new Fun(){void f(){ equal(cm.replace(null,1, 1), 1);}}); } throwsConsistently(NullPointerException.class, fs); } //---------------------------------------------------------------- // NavigableMap //---------------------------------------------------------------- private static void checkNavigableMapKeys(NavigableMap m, Integer i, Integer lower, Integer floor, Integer ceiling, Integer higher) { equal(m.lowerKey(i), lower); equal(m.floorKey(i), floor); equal(m.ceilingKey(i), ceiling); equal(m.higherKey(i), higher); } private static void checkNavigableSetKeys(NavigableSet m, Integer i, Integer lower, Integer floor, Integer ceiling, Integer higher) { equal(m.lower(i), lower); equal(m.floor(i), floor); equal(m.ceiling(i), ceiling); equal(m.higher(i), higher); } static final Random rnd = new Random(); static void equalNext(final Iterator it, Object expected) { if (rnd.nextBoolean()) check(it.hasNext()); equal(it.next(), expected); } static void equalMaps(Map m1, Map m2) { equal(m1, m2); equal(m2, m1); equal(m1.size(), m2.size()); equal(m1.isEmpty(), m2.isEmpty()); equal(m1.toString(), m2.toString()); check(Arrays.equals(m1.entrySet().toArray(), m2.entrySet().toArray())); } @SuppressWarnings({"unchecked", "rawtypes"}) static void testNavigableMapRemovers(NavigableMap m) { final Map emptyMap = new HashMap(); final Map singletonMap = new HashMap(); singletonMap.put(1, 2); abstract class NavigableMapView { abstract NavigableMap view(NavigableMap m); } NavigableMapView[] views = { new NavigableMapView() { NavigableMap view(NavigableMap m) { return m; }}, new NavigableMapView() { NavigableMap view(NavigableMap m) { return m.headMap(99, true); }}, new NavigableMapView() { NavigableMap view(NavigableMap m) { return m.tailMap(-99, false); }}, new NavigableMapView() { NavigableMap view(NavigableMap m) { return m.subMap(-99, true, 99, false); }}, }; abstract class Remover { abstract void remove(NavigableMap m, Object k, Object v); } Remover[] removers = { new Remover() { void remove(NavigableMap m, Object k, Object v) { equal(m.remove(k), v); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { equal(m.descendingMap().remove(k), v); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { equal(m.descendingMap().headMap(-86, false).remove(k), v); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { equal(m.descendingMap().tailMap(86, true).remove(k), v); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { equal(m.headMap(86, true).remove(k), v); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { equal(m.tailMap(-86, true).remove(k), v); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { equal(m.subMap(-86, false, 86, true).remove(k), v); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { check(m.keySet().remove(k)); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { check(m.navigableKeySet().remove(k)); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { check(m.navigableKeySet().headSet(86, true).remove(k)); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { check(m.navigableKeySet().tailSet(-86, false).remove(k)); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { check(m.navigableKeySet().subSet(-86, true, 86, false) .remove(k)); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { check(m.descendingKeySet().headSet(-86, false).remove(k)); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { check(m.descendingKeySet().tailSet(86, true).remove(k)); }}, new Remover() { void remove(NavigableMap m, Object k, Object v) { check(m.descendingKeySet().subSet(86, true, -86, false) .remove(k)); }}, }; for (NavigableMapView view : views) { for (Remover remover : removers) { try { m.clear(); equalMaps(m, emptyMap); equal(m.put(1, 2), null); equalMaps(m, singletonMap); NavigableMap v = view.view(m); remover.remove(v, 1, 2); equalMaps(m, emptyMap); } catch (Throwable t) { unexpected(t); } } } } private static void testNavigableMap(NavigableMap m) { clear(m); checkNavigableMapKeys(m, 1, null, null, null, null); equal(m.put(1, 2), null); equal(m.put(3, 4), null); equal(m.put(5, 9), null); equal(m.put(1, 2), 2); equal(m.put(3, 4), 4); equal(m.put(5, 6), 9); checkNavigableMapKeys(m, 0, null, null, 1, 1); checkNavigableMapKeys(m, 1, null, 1, 1, 3); checkNavigableMapKeys(m, 2, 1, 1, 3, 3); checkNavigableMapKeys(m, 3, 1, 3, 3, 5); checkNavigableMapKeys(m, 5, 3, 5, 5, null); checkNavigableMapKeys(m, 6, 5, 5, null, null); for (final Iterator it : (Iterator[]) new Iterator[] { m.descendingKeySet().iterator(), m.navigableKeySet().descendingIterator()}) { equalNext(it, 5); equalNext(it, 3); equalNext(it, 1); check(! it.hasNext()); THROWS(NoSuchElementException.class, new Fun(){void f(){it.next();}}); } { final Iterator> it = m.descendingMap().entrySet().iterator(); check(it.hasNext()); equal(it.next().getKey(), 5); check(it.hasNext()); equal(it.next().getKey(), 3); check(it.hasNext()); equal(it.next().getKey(), 1); check(! it.hasNext()); THROWS(NoSuchElementException.class, new Fun(){void f(){it.next();}}); } } private static void testNavigableSet(NavigableSet s) { clear(s); checkNavigableSetKeys(s, 1, null, null, null, null); check(s.add(1)); check(s.add(3)); check(s.add(5)); check(! s.add(1)); check(! s.add(3)); check(! s.add(5)); checkNavigableSetKeys(s, 0, null, null, 1, 1); checkNavigableSetKeys(s, 1, null, 1, 1, 3); checkNavigableSetKeys(s, 2, 1, 1, 3, 3); checkNavigableSetKeys(s, 3, 1, 3, 3, 5); checkNavigableSetKeys(s, 5, 3, 5, 5, null); checkNavigableSetKeys(s, 6, 5, 5, null, null); for (final Iterator it : (Iterator[]) new Iterator[] { s.descendingIterator(), s.descendingSet().iterator()}) { equalNext(it, 5); equalNext(it, 3); equalNext(it, 1); check(! it.hasNext()); THROWS(NoSuchElementException.class, new Fun(){void f(){it.next();}}); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() { passed++; } static void fail() { failed++; Thread.dumpStack(); } static void fail(String msg) { System.out.println(msg); fail(); } static void unexpected(Throwable t) { failed++; t.printStackTrace(); } static void check(boolean cond) { if (cond) pass(); else fail(); } static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else {System.out.println(x + " not equal to " + y); fail();}} static void equal2(Object x, Object y) {equal(x, y); equal(y, x);} public static void main(String[] args) throws Throwable { try { realMain(args); } catch (Throwable t) { unexpected(t); } System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Exception("Some tests failed"); } private abstract static class Fun {abstract void f() throws Throwable;} private static void THROWS(Class k, Fun... fs) { for (Fun f : fs) try { f.f(); fail("Expected " + k.getName() + " not thrown"); } catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} static byte[] serializedForm(Object obj) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); new ObjectOutputStream(baos).writeObject(obj); return baos.toByteArray(); } catch (IOException e) { throw new Error(e); }} static Object readObject(byte[] bytes) throws IOException, ClassNotFoundException { InputStream is = new ByteArrayInputStream(bytes); return new ObjectInputStream(is).readObject();} @SuppressWarnings("unchecked") static T serialClone(T obj) { try { return (T) readObject(serializedForm(obj)); } catch (Exception e) { throw new Error(e); }} } jsr166/src/test/jtreg/util/Collection/HotPotatoes.java0000644000000000000000000001061211450166503020045 0ustar /* * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6355660 6347106 6394004 * @summary methods taking concurrently mutating collection should work * @author Martin Buchholz */ import java.lang.reflect.*; import java.util.*; import java.util.concurrent.*; @SuppressWarnings("unchecked") public class HotPotatoes { private static void realMain(String[] args) throws Throwable { testImplementation(Vector.class); testImplementation(ArrayList.class); testImplementation(PriorityQueue.class); testImplementation(PriorityBlockingQueue.class); } private static void testImplementation(Class implClazz) throws Throwable { testPotato(implClazz, Vector.class); testPotato(implClazz, CopyOnWriteArrayList.class); final Constructor constr = implClazz.getConstructor(Collection.class); final Collection coll = constr.newInstance(Arrays.asList(new String[] {})); coll.add(1); equal(coll.toString(), "[1]"); } private static void testPotato(Class implClazz, Class argClazz) throws Throwable { try { System.out.printf("implClazz=%s, argClazz=%s\n", implClazz.getName(), argClazz.getName()); final int iterations = 100000; final List list = (List) argClazz.newInstance(); final Integer one = Integer.valueOf(1); final List oneElementList = Collections.singletonList(one); final Constructor constr = implClazz.getConstructor(Collection.class); final Thread t = new CheckedThread() { public void realRun() { for (int i = 0; i < iterations; i++) { list.add(one); list.remove(one); }}}; t.setDaemon(true); t.start(); for (int i = 0; i < iterations; i++) { Collection coll = constr.newInstance(list); Object[] elts = coll.toArray(); check(elts.length == 0 || (elts.length == 1 && elts[0] == one)); } } catch (Throwable t) { unexpected(t); } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class CheckedThread extends Thread { public abstract void realRun() throws Throwable; public void run() { try { realRun(); } catch (Throwable t) { unexpected(t); }}} } jsr166/src/test/jtreg/util/Collection/IteratorAtEnd.java0000644000000000000000000001271011450166503020302 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6529795 * @summary next() does not change iterator state if throws NoSuchElementException * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; @SuppressWarnings("unchecked") public class IteratorAtEnd { private static final int SIZE = 6; static void realMain(String[] args) throws Throwable { testCollection(new ArrayList()); testCollection(new Vector()); testCollection(new LinkedList()); testCollection(new ArrayDeque()); testCollection(new TreeSet()); testCollection(new CopyOnWriteArrayList()); testCollection(new CopyOnWriteArraySet()); testCollection(new ConcurrentSkipListSet()); testCollection(new PriorityQueue()); testCollection(new LinkedBlockingQueue()); testCollection(new ArrayBlockingQueue(100)); testCollection(new ConcurrentLinkedDeque()); testCollection(new ConcurrentLinkedQueue()); testCollection(new LinkedTransferQueue()); testMap(new HashMap()); testMap(new Hashtable()); testMap(new LinkedHashMap()); testMap(new WeakHashMap()); testMap(new IdentityHashMap()); testMap(new ConcurrentHashMap()); testMap(new ConcurrentSkipListMap()); testMap(new TreeMap()); } static void testCollection(Collection c) { try { for (int i = 0; i < SIZE; i++) c.add(i); test(c); } catch (Throwable t) { unexpected(t); } } static void testMap(Map m) { try { for (int i = 0; i < 3*SIZE; i++) m.put(i, i); test(m.values()); test(m.keySet()); test(m.entrySet()); } catch (Throwable t) { unexpected(t); } } static void test(Collection c) { try { final Iterator it = c.iterator(); THROWS(NoSuchElementException.class, new Fun() {void f() { while (true) it.next(); }}); try { it.remove(); } catch (UnsupportedOperationException _) { return; } pass(); } catch (Throwable t) { unexpected(t); } if (c instanceof List) { final List list = (List) c; try { final ListIterator it = list.listIterator(0); it.next(); final Object x = it.previous(); THROWS(NoSuchElementException.class, new Fun() {void f() { it.previous(); }}); try { it.remove(); } catch (UnsupportedOperationException _) { return; } pass(); check(! list.get(0).equals(x)); } catch (Throwable t) { unexpected(t); } try { final ListIterator it = list.listIterator(list.size()); it.previous(); final Object x = it.next(); THROWS(NoSuchElementException.class, new Fun() {void f() { it.next(); }}); try { it.remove(); } catch (UnsupportedOperationException _) { return; } pass(); check(! list.get(list.size()-1).equals(x)); } catch (Throwable t) { unexpected(t); } } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class Fun {abstract void f() throws Throwable;} static void THROWS(Class k, Fun... fs) { for (Fun f : fs) try { f.f(); fail("Expected " + k.getName() + " not thrown"); } catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/ArrayList/0000755000000000000000000000000011652013242014543 5ustar jsr166/src/test/jtreg/util/ArrayList/Bug6533203.java0000644000000000000000000000564311441006143016677 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6533203 * @summary AbstractList.ListItr.add might corrupt iterator state if enclosing add throws */ import java.util.*; @SuppressWarnings({"serial","unchecked"}) public class Bug6533203 { void test(String[] args) throws Throwable { final List superstitious = new ArrayList() { public void add(int index, Integer i) { if (i == 13) throw new Error("unlucky"); else super.add(index, i); }}; final ListIterator it = superstitious.listIterator(0); equal(it.nextIndex(), 0); THROWS(Error.class, new F(){void f(){it.add(13);}}); equal(it.nextIndex(), 0); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.out.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new Bug6533203().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} void THROWS(Class k, F... fs) { for (F f : fs) try {f.f(); fail("Expected " + k.getName() + " not thrown");} catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/ArrayList/AddAll.java0000644000000000000000000000570011441006143016527 0ustar /* * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4715206 * @summary Ensure that addAll method can cope with underestimate by size(). * @author Josh Bloch */ import java.util.*; public class AddAll { public static void main(String[] args) { for (int j = 0; j < 1; j++) { Map m = new WeakHashMap(100000); for (int i = 0; i < 100000; i++) m.put(new Object(), Boolean.TRUE); new ArrayList().addAll(m.keySet()); } for (int j = 0; j < 1; j++) { Map m = new WeakHashMap(100000); for (int i = 0; i < 100000; i++) m.put(new Object(), Boolean.TRUE); new LinkedList().addAll(m.keySet()); } for (int j = 0; j < 1; j++) { Map m = new WeakHashMap(100000); for (int i = 0; i < 100000; i++) m.put(new Object(), Boolean.TRUE); new Vector().addAll(m.keySet()); } for (int j = 0; j < 1; j++) { Map m = new WeakHashMap(100000); for (int i = 0; i < 100000; i++) m.put(new Object(), Boolean.TRUE); List list = new ArrayList(); list.add("inka"); list.add("dinka"); list.add("doo"); list.addAll(1, m.keySet()); } for (int j = 0; j < 1; j++) { Map m = new WeakHashMap(100000); for (int i = 0; i < 100000; i++) m.put(new Object(), Boolean.TRUE); List list = new LinkedList(); list.add("inka"); list.add("dinka"); list.add("doo"); list.addAll(1, m.keySet()); } for (int j = 0; j < 1; j++) { Map m = new WeakHashMap(100000); for (int i = 0; i < 100000; i++) m.put(new Object(), Boolean.TRUE); List list = new ArrayList(); list.add("inka"); list.add("dinka"); list.add("doo"); list.addAll(1, m.keySet()); } } } jsr166/src/test/jtreg/util/ArrayList/IteratorMicroBenchmark.java0000644000000000000000000004750011441006143022010 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * This is not a regression test, but a micro-benchmark. * Be patient; this runs for half an hour! * * I have run this as follows: * * for f in -client -server; do mergeBench dolphin . jr -dsa -da $f IteratorMicroBenchmark.java; done * * * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; import java.util.regex.Pattern; public class IteratorMicroBenchmark { abstract static class Job { private final String name; public Job(String name) { this.name = name; } public String name() { return name; } public abstract void work() throws Throwable; } private static void collectAllGarbage() { final java.util.concurrent.CountDownLatch drained = new java.util.concurrent.CountDownLatch(1); try { System.gc(); // enqueue finalizable objects new Object() { protected void finalize() { drained.countDown(); }}; System.gc(); // enqueue detector drained.await(); // wait for finalizer queue to drain System.gc(); // cleanup finalized objects } catch (InterruptedException e) { throw new Error(e); } } /** * Runs each job for long enough that all the runtime compilers * have had plenty of time to warm up, i.e. get around to * compiling everything worth compiling. * Returns array of average times per job per run. */ private static long[] time0(Job ... jobs) throws Throwable { final long warmupNanos = 10L * 1000L * 1000L * 1000L; long[] nanoss = new long[jobs.length]; for (int i = 0; i < jobs.length; i++) { collectAllGarbage(); long t0 = System.nanoTime(); long t; int j = 0; do { jobs[i].work(); j++; } while ((t = System.nanoTime() - t0) < warmupNanos); nanoss[i] = t/j; } return nanoss; } private static void time(Job ... jobs) throws Throwable { long[] warmup = time0(jobs); // Warm up run long[] nanoss = time0(jobs); // Real timing run long[] milliss = new long[jobs.length]; double[] ratios = new double[jobs.length]; final String nameHeader = "Method"; final String millisHeader = "Millis"; final String ratioHeader = "Ratio"; int nameWidth = nameHeader.length(); int millisWidth = millisHeader.length(); int ratioWidth = ratioHeader.length(); for (int i = 0; i < jobs.length; i++) { nameWidth = Math.max(nameWidth, jobs[i].name().length()); milliss[i] = nanoss[i]/(1000L * 1000L); millisWidth = Math.max(millisWidth, String.format("%d", milliss[i]).length()); ratios[i] = (double) nanoss[i] / (double) nanoss[0]; ratioWidth = Math.max(ratioWidth, String.format("%.3f", ratios[i]).length()); } String format = String.format("%%-%ds %%%dd %%%d.3f%%n", nameWidth, millisWidth, ratioWidth); String headerFormat = String.format("%%-%ds %%%ds %%%ds%%n", nameWidth, millisWidth, ratioWidth); System.out.printf(headerFormat, "Method", "Millis", "Ratio"); // Print out absolute and relative times, calibrated against first job for (int i = 0; i < jobs.length; i++) System.out.printf(format, jobs[i].name(), milliss[i], ratios[i]); } private static String keywordValue(String[] args, String keyword) { for (String arg : args) if (arg.startsWith(keyword)) return arg.substring(keyword.length() + 1); return null; } private static int intArg(String[] args, String keyword, int defaultValue) { String val = keywordValue(args, keyword); return val == null ? defaultValue : Integer.parseInt(val); } private static Pattern patternArg(String[] args, String keyword) { String val = keywordValue(args, keyword); return val == null ? null : Pattern.compile(val); } private static Job[] filter(Pattern filter, Job[] jobs) { if (filter == null) return jobs; Job[] newJobs = new Job[jobs.length]; int n = 0; for (Job job : jobs) if (filter.matcher(job.name()).find()) newJobs[n++] = job; // Arrays.copyOf not available in JDK 5 Job[] ret = new Job[n]; System.arraycopy(newJobs, 0, ret, 0, n); return ret; } private static void deoptimize(int sum) { if (sum == 42) System.out.println("the answer"); } private static List asSubList(List list) { return list.subList(0, list.size()); } private static Iterable backwards(final List list) { return new Iterable() { public Iterator iterator() { return new Iterator() { final ListIterator it = list.listIterator(list.size()); public boolean hasNext() { return it.hasPrevious(); } public T next() { return it.previous(); } public void remove() { it.remove(); }};}}; } /** * Usage: [iterations=N] [size=N] [filter=REGEXP] */ public static void main(String[] args) throws Throwable { final int iterations = intArg(args, "iterations", 100000); final int size = intArg(args, "size", 1000); final Pattern filter = patternArg(args, "filter"); final ConcurrentSkipListMap m = new ConcurrentSkipListMap(); final Vector v = new Vector(size); final ArrayList al = new ArrayList(size); // Populate collections with random data final Random rnd = new Random(); for (int i = 0; i < size; i++) { m.put(rnd.nextInt(size), rnd.nextInt(size)); v.add(rnd.nextInt(size)); } al.addAll(v); // Also test "short" collections final int shortSize = 5; final Vector sv = new Vector(v.subList(0, shortSize)); final ArrayList sal = new ArrayList(sv); // Checks for correctness *and* prevents loop optimizations class Check { private int sum; public void sum(int sum) { if (this.sum == 0) this.sum = sum; if (this.sum != sum) throw new AssertionError("Sum mismatch"); } } final Check check = new Check(); final Check shortCheck = new Check(); Job[] jobs = { // new Job("Vector iterate desugared") { // public void work() throws Throwable { // for (int i = 0; i < iterations; i++) { // int sum = 0; // for (Iterator it = v.iterator(); it.hasNext();) // sum += it.next(); // check.sum(sum);}}}, new Job("array loop") { public void work() throws Throwable { Integer[] a = al.toArray(new Integer[0]); for (int i = 0; i < iterations; i++) { int sum = 0; int size = a.length; for (int j = 0; j < size; ++j) sum += a[j]; check.sum(sum);}}}, new Job("Vector get loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; int size = v.size(); for (int j = 0; j < size; ++j) sum += v.get(j); check.sum(sum);}}}, new Job("Vector iterate for loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; for (Integer n : v) sum += n; check.sum(sum);}}}, new Job("Vector descending listIterator loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; ListIterator it = v.listIterator(al.size()); while (it.hasPrevious()) sum += it.previous(); check.sum(sum);}}}, new Job("Vector Enumeration loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; Enumeration it = v.elements(); while (it.hasMoreElements()) sum += it.nextElement(); check.sum(sum);}}}, new Job("Vector subList iterate for loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; for (Integer n : asSubList(v)) sum += n; check.sum(sum);}}}, new Job("Vector subList subList subList iterate for loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; for (Integer n : asSubList(asSubList(asSubList(v)))) sum += n; check.sum(sum);}}}, new Job("Vector backwards wrapper ListIterator for loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; for (Integer n : backwards(v)) sum += n; check.sum(sum);}}}, new Job("Vector backwards wrapper subList ListIterator for loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; for (Integer n : backwards(asSubList(v))) sum += n; check.sum(sum);}}}, // new Job("Vector iterate for loop invokeinterface") { // public void work() throws Throwable { // final List l = v; // for (int i = 0; i < iterations; i++) { // int sum = 0; // for (Integer n : l) // sum += n; // check.sum(sum);}}}, // new Job("Vector subList iterate for loop invokeinterface") { // public void work() throws Throwable { // final List l = v; // for (int i = 0; i < iterations; i++) { // int sum = 0; // for (Integer n : asSubList(l)) // sum += n; // check.sum(sum);}}}, new Job("Short Vector get loop") { public void work() throws Throwable { for (int i = 0; i < (iterations * size / shortSize); i++) { int sum = 0; int size = sv.size(); for (int j = 0; j < size; ++j) sum += sv.get(j); shortCheck.sum(sum);}}}, new Job("Short Vector iterate for loop") { public void work() throws Throwable { for (int i = 0; i < (iterations * size / shortSize); i++) { int sum = 0; for (Integer n : sv) sum += n; shortCheck.sum(sum);}}}, new Job("Short Vector sublist iterate for loop") { public void work() throws Throwable { for (int i = 0; i < (iterations * size / shortSize); i++) { int sum = 0; for (Integer n : asSubList(sv)) sum += n; shortCheck.sum(sum);}}}, new Job("ArrayList get loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; int size = al.size(); for (int j = 0; j < size; ++j) sum += al.get(j); check.sum(sum);}}}, new Job("ArrayList iterate for loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; for (Integer n : al) sum += n; check.sum(sum);}}}, new Job("ArrayList descending listIterator loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; ListIterator it = al.listIterator(al.size()); while (it.hasPrevious()) sum += it.previous(); check.sum(sum);}}}, new Job("ArrayList listIterator loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; ListIterator it = al.listIterator(); while (it.hasNext()) sum += it.next(); check.sum(sum);}}}, new Job("ArrayList subList get loop") { public void work() throws Throwable { List sl = asSubList(al); for (int i = 0; i < iterations; i++) { int sum = 0; int size = sl.size(); for (int j = 0; j < size; ++j) sum += sl.get(j); check.sum(sum);}}}, new Job("ArrayList subList iterate for loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; for (Integer n : asSubList(al)) sum += n; check.sum(sum);}}}, new Job("ArrayList subList subList subList iterate for loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; for (Integer n : asSubList(asSubList(asSubList(al)))) sum += n; check.sum(sum);}}}, new Job("ArrayList backwards wrapper ListIterator for loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; for (Integer n : backwards(al)) sum += n; check.sum(sum);}}}, new Job("ArrayList backwards wrapper subList ListIterator for loop") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; for (Integer n : backwards(asSubList(al))) sum += n; check.sum(sum);}}}, // new Job("ArrayList iterate desugared") { // public void work() throws Throwable { // for (int i = 0; i < iterations; i++) { // int sum = 0; // for (Iterator it = al.iterator(); it.hasNext();) // sum += it.next(); // check.sum(sum);}}}, new Job("Short ArrayList get loop") { public void work() throws Throwable { for (int i = 0; i < (iterations * size / shortSize); i++) { int sum = 0; int size = sal.size(); for (int j = 0; j < size; ++j) sum += sal.get(j); shortCheck.sum(sum);}}}, new Job("Short ArrayList iterate for loop") { public void work() throws Throwable { for (int i = 0; i < (iterations * size / shortSize); i++) { int sum = 0; for (Integer n : sal) sum += n; shortCheck.sum(sum);}}}, new Job("Short ArrayList sublist iterate for loop") { public void work() throws Throwable { for (int i = 0; i < (iterations * size / shortSize); i++) { int sum = 0; for (Integer n : asSubList(sal)) sum += n; shortCheck.sum(sum);}}}, new Job("Vector ArrayList alternating iteration") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; Iterator it1 = v.iterator(); Iterator it2 = al.iterator(); while (it1.hasNext()) sum += it1.next() + it2.next(); check.sum(sum/2);}}}, new Job("Vector ArrayList alternating invokeVirtual iteration") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; List> its = new ArrayList>(2); its.add(v.iterator()); its.add(al.iterator()); for (int k = 0; its.get(k).hasNext(); k = (k == 0) ? 1 : 0) sum += its.get(k).next(); check.sum(sum/2);}}}, new Job("ConcurrentSkipListMap entrySet iterate") { public void work() throws Throwable { for (int i = 0; i < iterations; i++) { int sum = 0; for (Map.Entry e : m.entrySet()) sum += e.getKey(); deoptimize(sum);}}} }; time(filter(filter, jobs)); } } jsr166/src/test/jtreg/util/ArrayList/RangeCheckMicroBenchmark.java0000644000000000000000000002177411441006143022216 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * This is not a regression test, but a micro-benchmark. * * I have run this as follows: * * repeat 5 for f in -client -server; do mergeBench dolphin . jr -dsa -da $f RangeCheckMicroBenchmark.java; done * * * @author Martin Buchholz */ import java.util.*; import java.util.regex.Pattern; import java.util.concurrent.CountDownLatch; public class RangeCheckMicroBenchmark { abstract static class Job { private final String name; Job(String name) { this.name = name; } String name() { return name; } abstract void work() throws Throwable; } private static void collectAllGarbage() { final CountDownLatch drained = new CountDownLatch(1); try { System.gc(); // enqueue finalizable objects new Object() { protected void finalize() { drained.countDown(); }}; System.gc(); // enqueue detector drained.await(); // wait for finalizer queue to drain System.gc(); // cleanup finalized objects } catch (InterruptedException e) { throw new Error(e); } } /** * Runs each job for long enough that all the runtime compilers * have had plenty of time to warm up, i.e. get around to * compiling everything worth compiling. * Returns array of average times per job per run. */ private static long[] time0(Job ... jobs) throws Throwable { final long warmupNanos = 10L * 1000L * 1000L * 1000L; long[] nanoss = new long[jobs.length]; for (int i = 0; i < jobs.length; i++) { collectAllGarbage(); long t0 = System.nanoTime(); long t; int j = 0; do { jobs[i].work(); j++; } while ((t = System.nanoTime() - t0) < warmupNanos); nanoss[i] = t/j; } return nanoss; } private static void time(Job ... jobs) throws Throwable { long[] warmup = time0(jobs); // Warm up run long[] nanoss = time0(jobs); // Real timing run long[] milliss = new long[jobs.length]; double[] ratios = new double[jobs.length]; final String nameHeader = "Method"; final String millisHeader = "Millis"; final String ratioHeader = "Ratio"; int nameWidth = nameHeader.length(); int millisWidth = millisHeader.length(); int ratioWidth = ratioHeader.length(); for (int i = 0; i < jobs.length; i++) { nameWidth = Math.max(nameWidth, jobs[i].name().length()); milliss[i] = nanoss[i]/(1000L * 1000L); millisWidth = Math.max(millisWidth, String.format("%d", milliss[i]).length()); ratios[i] = (double) nanoss[i] / (double) nanoss[0]; ratioWidth = Math.max(ratioWidth, String.format("%.3f", ratios[i]).length()); } String format = String.format("%%-%ds %%%dd %%%d.3f%%n", nameWidth, millisWidth, ratioWidth); String headerFormat = String.format("%%-%ds %%%ds %%%ds%%n", nameWidth, millisWidth, ratioWidth); System.out.printf(headerFormat, "Method", "Millis", "Ratio"); // Print out absolute and relative times, calibrated against first job for (int i = 0; i < jobs.length; i++) System.out.printf(format, jobs[i].name(), milliss[i], ratios[i]); } private static String keywordValue(String[] args, String keyword) { for (String arg : args) if (arg.startsWith(keyword)) return arg.substring(keyword.length() + 1); return null; } private static int intArg(String[] args, String keyword, int defaultValue) { String val = keywordValue(args, keyword); return val == null ? defaultValue : Integer.parseInt(val); } private static Pattern patternArg(String[] args, String keyword) { String val = keywordValue(args, keyword); return val == null ? null : Pattern.compile(val); } private static Job[] filter(Pattern filter, Job[] jobs) { if (filter == null) return jobs; Job[] newJobs = new Job[jobs.length]; int n = 0; for (Job job : jobs) if (filter.matcher(job.name()).find()) newJobs[n++] = job; // Arrays.copyOf not available in JDK 5 Job[] ret = new Job[n]; System.arraycopy(newJobs, 0, ret, 0, n); return ret; } private static void deoptimize(ArrayList list) { for (Integer x : list) if (x == null) throw new Error(); } /** * Usage: [iterations=N] [size=N] [filter=REGEXP] */ public static void main(String[] args) throws Throwable { final int iterations = intArg(args, "iterations", 30000); final int size = intArg(args, "size", 1000); final Pattern filter = patternArg(args, "filter"); final ArrayList list = new ArrayList(); final Random rnd = new Random(); for (int i = 0; i < size; i++) list.add(rnd.nextInt()); final Job[] jobs = { new Job("get") { void work() { for (int i = 0; i < iterations; i++) { for (int k = 0; k < size; k++) if (list.get(k) == 42) throw new Error(); } deoptimize(list);}}, new Job("set") { void work() { Integer[] xs = list.toArray(new Integer[size]); for (int i = 0; i < iterations; i++) { for (int k = 0; k < size; k++) list.set(k, xs[k]); } deoptimize(list);}}, new Job("get/set") { void work() { for (int i = 0; i < iterations; i++) { for (int k = 0; k < size; k++) list.set(k, list.get(size - k - 1)); } deoptimize(list);}}, new Job("add/remove at end") { void work() { Integer x = rnd.nextInt(); for (int i = 0; i < iterations; i++) { for (int k = 0; k < size - 1; k++) { list.add(size, x); list.remove(size); } } deoptimize(list);}}, new Job("subList get") { void work() { List sublist = list.subList(0, list.size()); for (int i = 0; i < iterations; i++) { for (int k = 0; k < size; k++) if (sublist.get(k) == 42) throw new Error(); } deoptimize(list);}}, new Job("subList set") { void work() { List sublist = list.subList(0, list.size()); Integer[] xs = sublist.toArray(new Integer[size]); for (int i = 0; i < iterations; i++) { for (int k = 0; k < size; k++) sublist.set(k, xs[k]); } deoptimize(list);}}, new Job("subList get/set") { void work() { List sublist = list.subList(0, list.size()); for (int i = 0; i < iterations; i++) { for (int k = 0; k < size; k++) sublist.set(k, sublist.get(size - k - 1)); } deoptimize(list);}}, new Job("subList add/remove at end") { void work() { List sublist = list.subList(0, list.size()); Integer x = rnd.nextInt(); for (int i = 0; i < iterations; i++) { for (int k = 0; k < size - 1; k++) { sublist.add(size, x); sublist.remove(size); } } deoptimize(list);}} }; time(filter(filter, jobs)); } } jsr166/src/test/jtreg/util/AbstractSequentialList/0000755000000000000000000000000011652013242017263 5ustar jsr166/src/test/jtreg/util/AbstractSequentialList/AddAll.java0000644000000000000000000000336511441006143021254 0ustar /* * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 4295163 * @summary AddAll(int, Collection) intersperses the Collection with this List. */ import java.util.*; public class AddAll { public static void main(String[] args) throws Exception { List t = new FooList(); t.add("b"); t.add("a"); t.add("r"); t.addAll(0, Arrays.asList(new String[] {"f","o","o"})); if (!t.equals(Arrays.asList(new String[] {"f","o","o","b","a","r"}))) throw new Exception("addAll is broken"); } } class FooList extends AbstractSequentialList { List a = new ArrayList(); public int size() { return a.size(); } public ListIterator listIterator(int index) { return a.listIterator(index); } } jsr166/src/test/jtreg/util/PriorityQueue/0000755000000000000000000000000011652013243015460 5ustar jsr166/src/test/jtreg/util/PriorityQueue/PriorityQueueSort.java0000644000000000000000000000435411537741070022037 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @summary Checks that a priority queue returns elements in sorted order across various operations */ import java.util.*; public class PriorityQueueSort { static class MyComparator implements Comparator { public int compare(Integer x, Integer y) { int i = x.intValue(); int j = y.intValue(); if (i < j) return -1; if (i > j) return 1; return 0; } } public static void main(String[] args) { int n = 10000; if (args.length > 0) n = Integer.parseInt(args[0]); List sorted = new ArrayList(n); for (int i = 0; i < n; i++) sorted.add(new Integer(i)); List shuffled = new ArrayList(sorted); Collections.shuffle(shuffled); Queue pq = new PriorityQueue(n, new MyComparator()); for (Iterator i = shuffled.iterator(); i.hasNext(); ) pq.add(i.next()); List recons = new ArrayList(); while (!pq.isEmpty()) recons.add(pq.remove()); if (!recons.equals(sorted)) throw new RuntimeException("Sort test failed"); recons.clear(); pq = new PriorityQueue(shuffled); while (!pq.isEmpty()) recons.add(pq.remove()); if (!recons.equals(sorted)) throw new RuntimeException("Sort test failed"); // Remove all odd elements from queue pq = new PriorityQueue(shuffled); for (Iterator i = pq.iterator(); i.hasNext(); ) if ((i.next().intValue() & 1) == 1) i.remove(); recons.clear(); while (!pq.isEmpty()) recons.add(pq.remove()); for (Iterator i = sorted.iterator(); i.hasNext(); ) if ((i.next().intValue() & 1) == 1) i.remove(); if (!recons.equals(sorted)) throw new RuntimeException("Iterator remove test failed."); } } jsr166/src/test/jtreg/util/PriorityQueue/NoNulls.java0000644000000000000000000001511211537741070017725 0ustar /* * Written by Martin Buchholz with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6950540 * @summary Attempt to add a null throws NullPointerException */ import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Collection; import java.util.Collections; import java.util.PriorityQueue; import java.util.SortedSet; import java.util.TreeSet; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.PriorityBlockingQueue; public class NoNulls { void test(String[] args) throws Throwable { final Comparator nullTolerantComparator = new Comparator<>() { public int compare(String x, String y) { return (x == null ? -1 : y == null ? 1 : x.compareTo(y)); }}; final SortedSet nullSortedSet = new TreeSet<>(nullTolerantComparator); nullSortedSet.add(null); final PriorityQueue nullPriorityQueue = new PriorityQueue<>() { public Object[] toArray() { return new Object[] { null };}}; final Collection nullCollection = new ArrayList<>(); nullCollection.add(null); THROWS(NullPointerException.class, new F() { void f() { new PriorityQueue(nullCollection); }}, new F() { void f() { new PriorityBlockingQueue(nullCollection); }}, new F() { void f() { new ArrayBlockingQueue(10, false, nullCollection); }}, new F() { void f() { new ArrayBlockingQueue(10, true, nullCollection); }}, new F() { void f() { new LinkedBlockingQueue(nullCollection); }}, new F() { void f() { new LinkedBlockingDeque(nullCollection); }}, new F() { void f() { new PriorityQueue((Collection) nullPriorityQueue); }}, new F() { void f() { new PriorityBlockingQueue((Collection) nullPriorityQueue); }}, new F() { void f() { new PriorityQueue(nullSortedSet); }}, new F() { void f() { new PriorityBlockingQueue(nullSortedSet); }}, new F() { void f() { new PriorityQueue((Collection) nullSortedSet); }}, new F() { void f() { new PriorityBlockingQueue((Collection) nullSortedSet); }}, new F() { void f() { new PriorityQueue(nullPriorityQueue); }}, new F() { void f() { new PriorityBlockingQueue(nullPriorityQueue); }}, new F() { void f() { new PriorityQueue().add(null); }}, new F() { void f() { new PriorityBlockingQueue().add(null); }}, new F() { void f() { new ArrayBlockingQueue(10, false).add(null); }}, new F() { void f() { new ArrayBlockingQueue(10, true).add(null); }}, new F() { void f() { new LinkedBlockingQueue().add(null); }}, new F() { void f() { new LinkedBlockingDeque().add(null); }}, new F() { void f() { new PriorityQueue().offer(null); }}, new F() { void f() { new PriorityBlockingQueue().offer(null); }}); nullSortedSet.add("foo"); nullCollection.add("foo"); THROWS(NullPointerException.class, new F() { void f() { new PriorityQueue(nullCollection); }}, new F() { void f() { new PriorityBlockingQueue(nullCollection); }}, new F() { void f() { new PriorityQueue((Collection) nullPriorityQueue); }}, new F() { void f() { new PriorityBlockingQueue((Collection) nullPriorityQueue); }}, new F() { void f() { new PriorityQueue(nullSortedSet); }}, new F() { void f() { new PriorityBlockingQueue(nullSortedSet); }}, new F() { void f() { new PriorityQueue((Collection) nullSortedSet); }}, new F() { void f() { new PriorityBlockingQueue((Collection) nullSortedSet); }}); } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new NoNulls().instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} void THROWS(Class k, F... fs) { for (F f : fs) try {f.f(); fail("Expected " + k.getName() + " not thrown");} catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/PriorityQueue/ForgetMeNot.java0000644000000000000000000001306511450166503020525 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6394004 * @summary Test ForgetMeNot implementation feature (and more) * @author Martin Buchholz */ import java.util.*; public class ForgetMeNot { private static void checkQ(PriorityQueue q, Integer...elts) { check(Arrays.equals(q.toArray(), elts)); } private static void noMoreElements(final Iterator it) { for (int j = 0; j < 2; j++) { THROWS(NoSuchElementException.class, new Fun() { void f() { it.next(); }}); check(! it.hasNext()); } } private static void removeIsCurrentlyIllegal(final Iterator it) { for (int j = 0; j < 2; j++) { THROWS(IllegalStateException.class, new Fun() { void f() { it.remove(); }}); } } private static void remove(Iterator it, Queue q) { int size = q.size(); it.remove(); removeIsCurrentlyIllegal(it); equal(size, q.size()+1); } private static void realMain(String[] args) throws Throwable { final PriorityQueue q = new PriorityQueue(); Iterator it; //---------------------------------------------------------------- // Empty //---------------------------------------------------------------- checkQ(q); check(q.isEmpty()); check(! q.contains(1)); it = q.iterator(); removeIsCurrentlyIllegal(it); noMoreElements(it); q.clear(); check(q.isEmpty()); //---------------------------------------------------------------- // Singleton //---------------------------------------------------------------- q.add(1); checkQ(q, 1); check(! q.isEmpty()); check(q.contains(1)); it = q.iterator(); removeIsCurrentlyIllegal(it); check(it.hasNext()); equal(it.next(), 1); noMoreElements(it); remove(it, q); check(q.isEmpty()); noMoreElements(it); checkQ(q); q.clear(); //---------------------------------------------------------------- // @see PriorityQueue.forgetMeNot //---------------------------------------------------------------- final Integer[] a = {0, 4, 1, 6, 7, 2, 3}; // Carefully chosen! q.addAll(Arrays.asList(a)); checkQ(q, a); it = q.iterator(); checkQ(q, a); removeIsCurrentlyIllegal(it); checkQ(q, a); check(it.hasNext()); removeIsCurrentlyIllegal(it); checkQ(q, a); check(it.hasNext()); equal(it.next(), 0); equal(it.next(), 4); equal(it.next(), 1); equal(it.next(), 6); check(it.hasNext()); checkQ(q, a); remove(it, q); checkQ(q, 0, 3, 1, 4, 7, 2); check(it.hasNext()); removeIsCurrentlyIllegal(it); equal(it.next(), 7); remove(it, q); checkQ(q, 0, 2, 1, 4, 3); check(it.hasNext()); removeIsCurrentlyIllegal(it); check(it.hasNext()); equal(it.next(), 3); equal(it.next(), 2); check(! it.hasNext()); remove(it, q); checkQ(q, 0, 3, 1, 4); check(! it.hasNext()); noMoreElements(it); removeIsCurrentlyIllegal(it); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} private abstract static class Fun {abstract void f() throws Throwable;} static void THROWS(Class k, Fun... fs) { for (Fun f : fs) try { f.f(); fail("Expected " + k.getName() + " not thrown"); } catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} } jsr166/src/test/jtreg/util/PriorityQueue/RemoveContains.java0000644000000000000000000000614311441006144021261 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6207984 6268068 * @summary Test contains/remove equator compatibility * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class RemoveContains { static volatile int passed = 0, failed = 0; static void fail(String msg) { failed++; new AssertionError(msg).printStackTrace(); } static void pass() { passed++; } static void unexpected(Throwable t) { failed++; t.printStackTrace(); } static void check(boolean condition, String msg) { if (condition) passed++; else fail(msg); } static void check(boolean condition) { check(condition, "Assertion failure"); } public static void main(String[] args) { final Comparator firstChar = new Comparator() { public int compare(String x, String y) { return x.charAt(0) - y.charAt(0); }}; test(new PriorityQueue(10, firstChar)); test(new PriorityBlockingQueue(10, firstChar)); test(new ArrayBlockingQueue(10)); test(new LinkedBlockingQueue(10)); test(new LinkedBlockingDeque(10)); test(new LinkedTransferQueue()); test(new ArrayDeque(10)); System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Error("Some tests failed"); } private static void test(Queue q) { try { List words = Arrays.asList("foo", "fee", "fi", "fo", "fum", "Englishman"); q.addAll(words); for (String word : words) check(q.contains(word)); check(! q.contains("flurble")); check(q.remove("fi")); for (String word : words) check(q.contains(word) ^ word.equals("fi")); check(! q.remove("fi")); check(! q.remove("flurble")); } catch (Throwable t) { unexpected(t); } } } jsr166/src/test/jtreg/util/Deque/0000755000000000000000000000000011652013243013675 5ustar jsr166/src/test/jtreg/util/Deque/ChorusLine.java0000644000000000000000000001531411450166503016623 0ustar /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6324846 * @summary Deque implementations must behave isomorphically * @author Martin Buchholz */ import java.util.*; import java.util.concurrent.*; public class ChorusLine { private interface Tweaker { void run(Deque deq); } private static final Tweaker[] tweakers = { new Tweaker() { public void run(Deque deq) { for (int i = 0; i < 7; i++) deq.addLast(i); deq.removeFirst(); deq.removeFirst(); deq.addLast(7); deq.addLast(8); Iterator it = deq.descendingIterator(); equal(it.next(), 8); it.remove(); try {it.remove();} catch (IllegalStateException e) {pass();} catch (Throwable t) {unexpected(t);} deq.addLast(9); it = deq.descendingIterator(); equal(it.next(), 9); equal(it.next(), 7); it.remove(); try {it.remove();} catch (IllegalStateException e) {pass();} catch (Throwable t) {unexpected(t);} equal(it.next(), 6); System.out.println(deq); }}, new Tweaker() { public void run(Deque deq) { deq.clear(); check(deq.isEmpty()); check(deq.size() == 0); check(! deq.iterator().hasNext()); check(! deq.descendingIterator().hasNext()); try {deq.iterator().next(); fail();} catch (NoSuchElementException e) {pass();} catch (Throwable t) {unexpected(t);} try {deq.descendingIterator().next(); fail();} catch (NoSuchElementException e) {pass();} catch (Throwable t) {unexpected(t);} }}, new Tweaker() { public void run(Deque deq) { for (int i = 0; i < 11; i++) deq.add(i); Iterator it = deq.iterator(); equal(it.next(), 0); equal(it.next(), 1); it.remove(); deq.addFirst(-1); deq.addFirst(-2); it = deq.iterator(); equal(it.next(), -2); equal(it.next(), -1); equal(it.next(), 0); it.remove(); it = deq.descendingIterator(); try {it.remove(); fail();} catch (IllegalStateException e) {pass();} catch (Throwable t) {unexpected(t);} equal(it.next(), 10); it.remove(); try {it.remove(); fail();} catch (IllegalStateException e) {pass();} catch (Throwable t) {unexpected(t);} equal(it.next(), 9); equal(it.next(), 8); it.remove(); System.out.println(deq); }}, new Tweaker() { public void run(Deque deq) { while (deq.size() > 1) { Iterator it = deq.iterator(); it.next(); it.remove(); it = deq.descendingIterator(); it.next(); it.remove(); } System.out.println(deq); }}}; private static void realMain(String[] args) throws Throwable { Collection> deqs = new ArrayDeque>(3); deqs.add(new ArrayDeque()); deqs.add(new LinkedList()); deqs.add(new LinkedBlockingDeque()); deqs.add(new ConcurrentLinkedDeque()); equal(deqs); for (Tweaker tweaker : tweakers) { for (Deque deq : deqs) tweaker.run(deq); equal(deqs); } } private static void equal(Iterable> deqs) { Deque prev = null; for (Deque deq : deqs) { if (prev != null) { equal(prev.isEmpty(), deq.isEmpty()); equal(prev.size(), deq.size()); equal(prev.toString(), deq.toString()); } prev = deq; } Deque> its = new ArrayDeque>(); for (Deque deq : deqs) its.addLast(deq.iterator()); equal(its); Deque> dits = new ArrayDeque>(); for (Deque deq : deqs) dits.addLast(deq.descendingIterator()); equal(dits); } private static void equal(Deque> its) { Iterator it0 = its.remove(); while (it0.hasNext()) { Integer i = it0.next(); for (Iterator it : its) equal(it.next(), i); } for (Iterator it : its) { check(! it.hasNext()); try {it.next(); fail();} catch (NoSuchElementException e) {pass();} catch (Throwable t) {unexpected(t);} } } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} static void fail(String msg) {System.out.println(msg); fail();} static void unexpected(Throwable t) {failed++; t.printStackTrace();} static void check(boolean cond) {if (cond) pass(); else fail();} static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/jtreg/util/List/0000755000000000000000000000000011652013243013545 5ustar jsr166/src/test/jtreg/util/List/LockStep.java0000644000000000000000000003227511441006144016143 0ustar /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6359979 * @summary Compare List implementations for identical behavior * @author Martin Buchholz */ import java.io.*; import java.util.*; import java.util.concurrent.*; import static java.util.Collections.*; @SuppressWarnings("unchecked") public class LockStep { final int DEFAULT_SIZE = 5; int size; // Running time is O(size**2) int intArg(String[] args, int i, int defaultValue) { return args.length > i ? Integer.parseInt(args[i]) : defaultValue; } boolean maybe(int n) { return rnd.nextInt(n) == 0; } void test(String[] args) { size = intArg(args, 0, DEFAULT_SIZE); lockSteps(new ArrayList(), new LinkedList(), new Vector()); } void equalLists(List... lists) { for (List list : lists) equalLists(list, lists[0]); } void equalLists(List x, List y) { equal(x, y); equal(y, x); equal(x.size(), y.size()); equal(x.isEmpty(), y.isEmpty()); equal(x.hashCode(), y.hashCode()); equal(x.toString(), y.toString()); equal(x.toArray(), y.toArray()); } void lockSteps(List... lists) { for (int i = 0; i < lists.length; i++) if (maybe(4)) lists[i] = serialClone(lists[i]); for (final List list : lists) testEmptyList(list); for (int i = 0; i < size; i++) { ListFrobber adder = randomAdder(); for (final List list : lists) { adder.frob(list); equal(list.size(), i+1); } equalLists(lists); } { final ListFrobber adder = randomAdder(); final ListFrobber remover = randomRemover(); for (final List list : lists) { THROWS(ConcurrentModificationException.class, new F(){void f(){ Iterator it = list.iterator(); adder.frob(list); it.next();}}, new F(){void f(){ Iterator it = asSubList(list).iterator(); remover.frob(list); it.next();}}, new F(){void f(){ Iterator it = asSubList(asSubList(list)).iterator(); adder.frob(list); it.next();}}, new F(){void f(){ List subList = asSubList(list); remover.frob(list); subList.get(0);}}, new F(){void f(){ List sl = asSubList(list); List ssl = asSubList(sl); adder.frob(sl); ssl.get(0);}}, new F(){void f(){ List sl = asSubList(list); List ssl = asSubList(sl); remover.frob(sl); ssl.get(0);}}); } } for (final List l : lists) { final List sl = asSubList(l); final List ssl = asSubList(sl); ssl.add(0, 42); equal(ssl.get(0), 42); equal(sl.get(0), 42); equal(l.get(0), 42); final int s = l.size(); final int rndIndex = rnd.nextInt(l.size()); THROWS(IndexOutOfBoundsException.class, new F(){void f(){l.subList(rndIndex, rndIndex).get(0);}}, new F(){void f(){l.subList(s/2, s).get(s/2 + 1);}}, new F(){void f(){l.subList(s/2, s).get(-1);}} ); THROWS(IllegalArgumentException.class, new F(){void f(){ l.subList(1, 0);}}, new F(){void f(){ sl.subList(1, 0);}}, new F(){void f(){ssl.subList(1, 0);}}); } equalLists(lists); for (final List list : lists) { equalLists(list, asSubList(list)); equalLists(list, asSubList(asSubList(list))); } for (final List list : lists) System.out.println(list); for (int i = lists[0].size(); i > 0; i--) { ListFrobber remover = randomRemover(); for (final List list : lists) remover.frob(list); equalLists(lists); } } List asSubList(List list) { return list.subList(0, list.size()); } void testEmptyCollection(Collection c) { check(c.isEmpty()); equal(c.size(), 0); equal(c.toString(),"[]"); equal(c.toArray().length, 0); equal(c.toArray(new Object[0]).length, 0); Object[] a = new Object[1]; a[0] = Boolean.TRUE; equal(c.toArray(a), a); equal(a[0], null); } void testEmptyList(List list) { testEmptyCollection(list); equal(list.hashCode(), 1); equal(list, Collections.emptyList()); } final Random rnd = new Random(); abstract class ListFrobber { abstract void frob(List l); } ListFrobber randomAdder() { final Integer e = rnd.nextInt(1024); final int subListCount = rnd.nextInt(3); final boolean atBeginning = rnd.nextBoolean(); final boolean useIterator = rnd.nextBoolean(); final boolean simpleIterator = rnd.nextBoolean(); return new ListFrobber() {void frob(List l) { final int s = l.size(); List ll = l; for (int i = 0; i < subListCount; i++) ll = asSubList(ll); if (! useIterator) { if (atBeginning) { switch (rnd.nextInt(3)) { case 0: ll.add(0, e); break; case 1: ll.subList(0, rnd.nextInt(s+1)).add(0, e); break; case 2: ll.subList(0, rnd.nextInt(s+1)).subList(0,0).add(0,e); break; default: throw new Error(); } } else { switch (rnd.nextInt(3)) { case 0: check(ll.add(e)); break; case 1: ll.subList(s/2, s).add(s - s/2, e); break; case 2: ll.subList(s, s).subList(0, 0).add(0, e); break; default: throw new Error(); } } } else { if (atBeginning) { ListIterator it = ll.listIterator(); equal(it.nextIndex(), 0); check(! it.hasPrevious()); it.add(e); equal(it.previousIndex(), 0); equal(it.nextIndex(), 1); check(it.hasPrevious()); } else { final int siz = ll.size(); ListIterator it = ll.listIterator(siz); equal(it.previousIndex(), siz-1); check(! it.hasNext()); it.add(e); equal(it.previousIndex(), siz); equal(it.nextIndex(), siz+1); check(! it.hasNext()); check(it.hasPrevious()); } }}}; } ListFrobber randomRemover() { final int position = rnd.nextInt(3); final int subListCount = rnd.nextInt(3); return new ListFrobber() {void frob(List l) { final int s = l.size(); List ll = l; for (int i = 0; i < subListCount; i++) ll = asSubList(ll); switch (position) { case 0: // beginning switch (rnd.nextInt(3)) { case 0: ll.remove(0); break; case 1: { final Iterator it = ll.iterator(); check(it.hasNext()); THROWS(IllegalStateException.class, new F(){void f(){it.remove();}}); it.next(); it.remove(); THROWS(IllegalStateException.class, new F(){void f(){it.remove();}}); break;} case 2: { final ListIterator it = ll.listIterator(); check(it.hasNext()); THROWS(IllegalStateException.class, new F(){void f(){it.remove();}}); it.next(); it.remove(); THROWS(IllegalStateException.class, new F(){void f(){it.remove();}}); break;} default: throw new Error(); } break; case 1: // midpoint switch (rnd.nextInt(3)) { case 0: ll.remove(s/2); break; case 1: { final ListIterator it = ll.listIterator(s/2); it.next(); it.remove(); break; } case 2: { final ListIterator it = ll.listIterator(s/2+1); it.previous(); it.remove(); break; } default: throw new Error(); } break; case 2: // end switch (rnd.nextInt(3)) { case 0: ll.remove(s-1); break; case 1: ll.subList(s-1, s).clear(); break; case 2: final ListIterator it = ll.listIterator(s); check(! it.hasNext()); check(it.hasPrevious()); THROWS(IllegalStateException.class, new F(){void f(){it.remove();}}); it.previous(); equal(it.nextIndex(), s-1); check(it.hasNext()); it.remove(); equal(it.nextIndex(), s-1); check(! it.hasNext()); THROWS(IllegalStateException.class, new F(){void f(){it.remove();}}); break; default: throw new Error(); } break; default: throw new Error(); }}}; } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} void equal(T[] x, T[] y) {check(Arrays.equals(x,y));} public static void main(String[] args) throws Throwable { new LockStep().instanceMain(args);} void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} abstract class F {abstract void f() throws Throwable;} void THROWS(Class k, F... fs) { for (F f : fs) try {f.f(); fail("Expected " + k.getName() + " not thrown");} catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} static byte[] serializedForm(Object obj) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); new ObjectOutputStream(baos).writeObject(obj); return baos.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); }} static Object readObject(byte[] bytes) throws IOException, ClassNotFoundException { InputStream is = new ByteArrayInputStream(bytes); return new ObjectInputStream(is).readObject();} @SuppressWarnings("unchecked") static T serialClone(T obj) { try { return (T) readObject(serializedForm(obj)); } catch (Exception e) { throw new RuntimeException(e); }} } jsr166/src/test/jtreg/util/TimSort/0000755000000000000000000000000011652013243014233 5ustar jsr166/src/test/jtreg/util/TimSort/README0000644000000000000000000000033011247074536015123 0ustar This directory contains benchmark programs used to compare the performance of the TimSort algorithm against the historic 1997 implementation of Arrays.sort. Any future benchmarking will require minor modifications. jsr166/src/test/jtreg/util/TimSort/Sorter.java0000644000000000000000000000345411441006144016360 0ustar /* * Copyright 2009 Google Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import java.util.*; public enum Sorter { TIMSORT { public void sort(Object[] array) { ComparableTimSort.sort(array); } }, MERGESORT { public void sort(Object[] array) { Arrays.sort(array); } }; public abstract void sort(Object[] array); public static void warmup() { System.out.println("start warm up"); Integer[] gold = new Integer[10000]; Random random = new java.util.Random(); for (int i=0; i < gold.length; i++) gold[i] = random.nextInt(); for (int i=0; i < 10000; i++) { for (Sorter s : values()) { Integer[] test= gold.clone(); s.sort(test); } } System.out.println(" end warm up"); } } jsr166/src/test/jtreg/util/TimSort/SortPerf.java0000644000000000000000000000510011441006144016634 0ustar /* * Copyright 2009 Google Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import java.util.Arrays; public class SortPerf { private static final int NUM_SETS = 5; private static final int[] lengths = { 10, 100, 1000, 10000, 1000000 }; // Returns the number of repetitions as a function of the list length private static int reps(int n) { return (int) (12000000 / (n * Math.log10(n))); } public static void main(String[] args) { Sorter.warmup(); System.out.print("Strategy,Length"); for (Sorter sorter : Sorter.values()) System.out.print("," + sorter); System.out.println(); for (ArrayBuilder ab : ArrayBuilder.values()) { for (int n : lengths) { System.out.printf("%s,%d", ab, n); int reps = reps(n); Object[] proto = ab.build(n); for (Sorter sorter : Sorter.values()) { double minTime = Double.POSITIVE_INFINITY; for (int set = 0; set < NUM_SETS; set++) { long startTime = System.nanoTime(); for (int k = 0; k < reps; k++) { Object[] a = proto.clone(); sorter.sort(a); } long endTime = System.nanoTime(); double time = (endTime - startTime) / (1000000. * reps); minTime = Math.min(minTime, time); } System.out.printf(",%5f", minTime); } System.out.println(); } } } } jsr166/src/test/jtreg/util/TimSort/ArrayBuilder.java0000644000000000000000000001026511441006144017465 0ustar /* * Copyright 2009 Google Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import java.util.Random; import java.math.BigInteger; public enum ArrayBuilder { // These seven are from Tim's paper (listsort.txt) RANDOM_INT { public Object[] build(int len) { Integer[] result = new Integer[len]; for (int i = 0; i < len; i++) result[i] = rnd.nextInt(); return result; } }, DESCENDING_INT { public Object[] build(int len) { Integer[] result = new Integer[len]; for (int i = 0; i < len; i++) result[i] = len - i; return result; } }, ASCENDING_INT { public Object[] build(int len) { Integer[] result = new Integer[len]; for (int i = 0; i < len; i++) result[i] = i; return result; } }, ASCENDING_3_RND_EXCH_INT { public Object[] build(int len) { Integer[] result = new Integer[len]; for (int i = 0; i < len; i++) result[i] = i; for (int i = 0; i < 3; i++) swap(result, rnd.nextInt(result.length), rnd.nextInt(result.length)); return result; } }, ASCENDING_10_RND_AT_END_INT { public Object[] build(int len) { Integer[] result = new Integer[len]; int endStart = len - 10; for (int i = 0; i < endStart; i++) result[i] = i; for (int i = endStart; i < len; i++) result[i] = rnd.nextInt(endStart + 10); return result; } }, ALL_EQUAL_INT { public Object[] build(int len) { Integer[] result = new Integer[len]; for (int i = 0; i < len; i++) result[i] = 666; return result; } }, DUPS_GALORE_INT { public Object[] build(int len) { Integer[] result = new Integer[len]; for (int i = 0; i < len; i++) result[i] = rnd.nextInt(4); return result; } }, RANDOM_WITH_DUPS_INT { public Object[] build(int len) { Integer[] result = new Integer[len]; for (int i = 0; i < len; i++) result[i] = rnd.nextInt(len); return result; } }, PSEUDO_ASCENDING_STRING { public String[] build(int len) { String[] result = new String[len]; for (int i = 0; i < len; i++) result[i] = Integer.toString(i); return result; } }, RANDOM_BIGINT { public BigInteger[] build(int len) { BigInteger[] result = new BigInteger[len]; for (int i = 0; i < len; i++) result[i] = HUGE.add(BigInteger.valueOf(rnd.nextInt(len))); return result; } }; public abstract Object[] build(int len); public void resetRandom() { rnd = new Random(666); } private static Random rnd = new Random(666); private static void swap(Object[] a, int i, int j) { Object t = a[i]; a[i] = a[j]; a[j] = t; } private static BigInteger HUGE = BigInteger.ONE.shiftLeft(100); } jsr166/src/test/jtreg/TEST.ROOT0000644000000000000000000000000011443315222013127 0ustar jsr166/src/test/loops/0000755000000000000000000000000011652013243011676 5ustar jsr166/src/test/loops/NoopLockLoops.java0000644000000000000000000000572311537741071015322 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class NoopLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 20000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); new ReentrantLockLoop(1).test(); new ReentrantLockLoop(1).test(); print = true; int k = 1; for (int i = 1; i <= maxThreads;) { System.out.print("Threads: " + i); new ReentrantLockLoop(i).test(); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v + 1; int x = sum + 1; int n = iters; while (n-- > 0) { synchronized (this) { x = LoopHelpers.compute4(x); } sum += x; if ((x += readBarrier) == 0) ++readBarrier; } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/RLIBar.java0000644000000000000000000002170311537741071013630 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ // Adapted from code that was in turn // Derived from SocketPerformanceTest.java - BugID: 4763450 // // import java.io.*; import java.net.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; public class RLIBar { static int batchLimit; static int mseq; static int nReady; static int ExThreads; static int ASum; static final ReentrantLock Gate = new ReentrantLock(); static final Condition GateCond = Gate.newCondition(); static final ReentrantLock HoldQ = new ReentrantLock(); static final Condition HoldQCond = HoldQ.newCondition(); static boolean Hold = false; static int HoldPop; static int HoldLimit; private static boolean HoldCheck() { try { HoldQ.lock(); try { if (!Hold) return false; else { ++HoldPop; if (HoldPop >= HoldLimit) { System.out.print("Holding "); Thread.sleep(1000); System.out.println(); Hold = false; HoldQCond.signalAll(); } else while (Hold) HoldQCond.await(); if (--HoldPop == 0) HoldQCond.signalAll(); return true; } } finally { HoldQ.unlock(); } } catch (Exception Ex) { System.out.println("Unexpected exception in Hold: " + Ex); return false; } } private static class Server { private int nClients; final ReentrantLock thisLock = new ReentrantLock(); final Condition thisCond = thisLock.newCondition(); Server(int nClients) { this.nClients = nClients; try { for (int i = 0; i < nClients; ++i) { final int fix = i; new Thread() { public void run() { runServer(fix); }}.start(); } } catch (Exception e) { System.err.println(e); } } // the total number of messages received by all server threads // on this server int msgsReceived = 0; // incremented each time we get a complete batch of requests private int currentBatch = 0; // the number of requests received since the last time currentBatch // was incremented private int currentBatchSize = 0; private void runServer(int id) { int msg; boolean held = false; final ReentrantLock thisLock = this.thisLock; final Condition thisCond = this.thisCond; try { // Startup barrier - rendezvous - wait for all threads. // Forces all threads to park on their LWPs, ensuring // proper provisioning on T1. // Alternately, use THR_BOUND threads Gate.lock(); try { ++nReady; if (nReady == ExThreads) { GateCond.signalAll(); } while (nReady != ExThreads) GateCond.await(); } finally { Gate.unlock(); } for (;;) { // if (!held && currentBatchSize == 0) held = HoldCheck (); msg = (++ mseq) ^ id; thisLock.lock(); try { ASum += msg; ++msgsReceived; int myBatch = currentBatch; if (++currentBatchSize >= batchLimit) { // this batch is full, start a new one ... ++currentBatch; currentBatchSize = 0; // and wake up everyone in this one thisCond.signalAll(); } // Wait until our batch is complete while (myBatch == currentBatch) thisCond.await(); } finally { thisLock.unlock(); } } } catch (Exception e) { System.err.println("Server thread: exception " + e); e.printStackTrace(); } } } public static void main(String[] args) throws Exception { int nServers = 10; int nClients = 10; int samplePeriod = 10000; int nSamples = 5; int nextArg = 0; while (nextArg < args.length) { String arg = args[nextArg++]; if (arg.equals("-nc")) nClients = Integer.parseInt(args[nextArg++]); else if (arg.equals("-ns")) nServers = Integer.parseInt(args[nextArg++]); else if (arg.equals("-batch")) batchLimit = Integer.parseInt(args[nextArg++]); else if (arg.equals("-sample")) samplePeriod = Integer.parseInt(args[nextArg++]); else if (arg.equals("-np")) nSamples = Integer.parseInt(args[nextArg++]); else { System.err.println("Argument error:" + arg); System.exit(1); } } if (nClients <= 0 || nServers <= 0 || samplePeriod <= 0 || batchLimit > nClients) { System.err.println("Argument error"); System.exit(1); } // default batch size is 2/3 the number of clients // (for no particular reason) if (false && batchLimit <= 0) batchLimit = (2 * nClients + 1) / 3; ExThreads = nServers * nClients; // expected # of threads HoldLimit = ExThreads; // start up all threads Server[] servers = new Server[nServers]; for (int i = 0; i < nServers; ++i) { servers[i] = new Server(nClients); } // Wait for consensus try { Gate.lock(); try { while (nReady != ExThreads ) GateCond.await(); } finally { Gate.unlock(); } } catch (Exception ex) { System.out.println(ex); } System.out.println( nReady + " Ready: nc=" + nClients + " ns=" + nServers + " batch=" + batchLimit); // Start sampling ... // Methodological problem: all the mutator threads // can starve the compiler threads, resulting in skewed scores. // In theory, over time, the scores will improve as the compiler // threads are granted CPU cycles, but in practice a "warm up" phase // might be good idea to help C2. For this reason I've implemented // the "Hold" facility. long lastNumMsgs = 0; long sampleStart = System.currentTimeMillis(); for (int j = 0; j < nSamples; ++j) { // when this sample period is supposed to end long sampleEnd = sampleStart + samplePeriod; for (;;) { long now = System.currentTimeMillis(); if (now >= sampleEnd) { // when it really did end sampleEnd = now; break; } Thread.sleep(sampleEnd - now); } if (false && j == 2) { System.out.print("Hold activated ..."); HoldQ.lock(); try { Hold = true; while (Hold) HoldQCond.await(); } finally { HoldQ.unlock(); } } // there's no synchronization here, so the total i get is // approximate, but that's OK since any i miss for this // sample will get credited to the next sample, and on average // we'll be right long numMsgs = 0; for (int i = 0; i < nServers; ++i) numMsgs += servers[i].msgsReceived; long deltaMsgs = numMsgs - lastNumMsgs; long deltaT = sampleEnd - sampleStart; if (true || j != 2) { // Don't report results if we issued a hold ... System.out.print( "Sample period = " + deltaT + " ms; " + "New msgs rcvd = " + deltaMsgs + "; " + "Throughput = " + (deltaMsgs*1000 / deltaT) + " msg/sec\n"); // for (int i = 0; i < nServers; ++i) // servers[i].thisLock.dump(); } sampleStart = sampleEnd; lastNumMsgs = numMsgs; } System.exit(0); } } jsr166/src/test/loops/TieredPhaserLoops.java0000644000000000000000000000550511537741072016154 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; //import jsr166y.*; /* * Based loosely on Java Grande Forum barrierBench */ public class TieredPhaserLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final ExecutorService pool = Executors.newCachedThreadPool(); static final int FIRST_SIZE = 10000; static final int LAST_SIZE = 1000000; /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static int tasksPerPhaser = Math.max(NCPUS / 8, 4); static void build(Runnable[] actions, int sz, int lo, int hi, Phaser b) { if (hi - lo > tasksPerPhaser) { for (int i = lo; i < hi; i += tasksPerPhaser) { int j = Math.min(i + tasksPerPhaser, hi); build(actions, sz, i, j, new Phaser(b)); } } else { for (int i = lo; i < hi; ++i) actions[i] = new PhaserAction(i, b, sz); } } static final class PhaserAction implements Runnable { final int id; final int size; final Phaser phaser; public PhaserAction(int id, Phaser b, int size) { this.id = id; this.phaser = b; this.size = size; phaser.register(); } public void run() { int n = size; Phaser b = phaser; for (int i = 0; i < n; ++i) b.arriveAndAwaitAdvance(); } } public static void main(String[] args) throws Exception { int nthreads = NCPUS; if (args.length > 0) nthreads = Integer.parseInt(args[0]); if (args.length > 1) tasksPerPhaser = Integer.parseInt(args[1]); System.out.printf("Max %d Threads, %d tasks per phaser\n", nthreads, tasksPerPhaser); for (int k = 2; k <= nthreads; k *= 2) { for (int size = FIRST_SIZE; size <= LAST_SIZE; size *= 10) { long startTime = System.nanoTime(); Runnable[] actions = new Runnable [k]; build(actions, size, 0, k, new Phaser()); Future[] futures = new Future[k]; for (int i = 0; i < k; ++i) { futures[i] = pool.submit(actions[i]); } for (int i = 0; i < k; ++i) { futures[i].get(); } long elapsed = System.nanoTime() - startTime; long bs = (NPS * size) / elapsed; System.out.printf("%4d Threads %8d iters: %11d barriers/sec\n", k, size, bs); } } pool.shutdown(); } } jsr166/src/test/loops/FJPhaserJacobi.java0000644000000000000000000001273311445743475015342 0ustar // Barrier version of Jacobi iteration import java.util.concurrent.*; public class FJPhaserJacobi { static int dimGran; static final double EPSILON = 0.0001; // convergence criterion public static void main(String[] args) { int n = 2048; int steps = 1000; try { if (args.length > 0) n = Integer.parseInt(args[0]); if (args.length > 1) steps = Integer.parseInt(args[1]); } catch (Exception e) { System.out.println("Usage: java ThreadPhaserJacobi "); return; } ForkJoinPool fjp = new ForkJoinPool(); // int granularity = (n * n / fjp.getParallelism()) / 2; int granularity = n * n / fjp.getParallelism(); dimGran = (int)(Math.sqrt(granularity)); // allocate enough space for edges int dim = n+2; int ncells = dim * dim; double[][] a = new double[dim][dim]; double[][] b = new double[dim][dim]; // Initialize interiors to small value double smallVal = 1.0/dim; for (int i = 1; i < dim-1; ++i) { for (int j = 1; j < dim-1; ++j) a[i][j] = smallVal; } int nreps = 3; for (int rep = 0; rep < nreps; ++rep) { // Fill all edges with 1's. for (int k = 0; k < dim; ++k) { a[k][0] += 1.0; a[k][n+1] += 1.0; a[0][k] += 1.0; a[n+1][k] += 1.0; } Driver driver = new Driver(a, b, 1, n, 1, n, steps); long startTime = System.currentTimeMillis(); fjp.invoke(driver); long time = System.currentTimeMillis() - startTime; double secs = ((double)time) / 1000.0; System.out.println("Compute Time: " + secs); System.out.println(fjp); } } static class Segment extends CyclicAction { double[][] A; // matrix to get old values from double[][] B; // matrix to put new values into // indices of current submatrix final int loRow; final int hiRow; final int loCol; final int hiCol; volatile double maxDiff; // maximum difference between old and new values Segment(double[][] A, double[][] B, int loRow, int hiRow, int loCol, int hiCol, Phaser br) { super(br); this.A = A; this.B = B; this.loRow = loRow; this.hiRow = hiRow; this.loCol = loCol; this.hiCol = hiCol; } public void step() { maxDiff = update(A, B); double[][] tmp = A; A = B; B = tmp; } double update(double[][] a, double[][] b) { double md = 0.0; // local for computing max diff for (int i = loRow; i <= hiRow; ++i) { for (int j = loCol; j <= hiCol; ++j) { double v = 0.25 * (a[i-1][j] + a[i][j-1] + a[i+1][j] + a[i][j+1]); b[i][j] = v; double diff = v - a[i][j]; if (diff < 0) diff = -diff; if (diff > md) md = diff; } } return md; } } static class MyPhaser extends Phaser { final int max; MyPhaser(int steps) { this.max = steps - 1; } public boolean onAdvance(int phase, int registeredParties) { return phase >= max || registeredParties <= 0; } } static class Driver extends RecursiveAction { double[][] A; // matrix to get old values from double[][] B; // matrix to put new values into final int loRow; // indices of current submatrix final int hiRow; final int loCol; final int hiCol; final int steps; Driver(double[][] mat1, double[][] mat2, int firstRow, int lastRow, int firstCol, int lastCol, int steps) { this.A = mat1; this.B = mat2; this.loRow = firstRow; this.hiRow = lastRow; this.loCol = firstCol; this.hiCol = lastCol; this.steps = steps; } public void compute() { int rows = hiRow - loRow + 1; int cols = hiCol - loCol + 1; int rblocks = (int)(Math.round((float)rows / dimGran)); int cblocks = (int)(Math.round((float)cols / dimGran)); int n = rblocks * cblocks; System.out.println("Using " + n + " segments"); Segment[] segs = new Segment[n]; Phaser barrier = new MyPhaser(steps); int k = 0; for (int i = 0; i < rblocks; ++i) { int lr = loRow + i * dimGran; int hr = lr + dimGran; if (i == rblocks-1) hr = hiRow; for (int j = 0; j < cblocks; ++j) { int lc = loCol + j * dimGran; int hc = lc + dimGran; if (j == cblocks-1) hc = hiCol; segs[k] = new Segment(A, B, lr, hr, lc, hc, barrier); ++k; } } invokeAll(segs); double maxd = 0; for (k = 0; k < n; ++k) { double md = segs[k].maxDiff; if (md > maxd) maxd = md; } System.out.println("Max diff after " + steps + " steps = " + maxd); } } } jsr166/src/test/loops/PhaserLoops.java0000644000000000000000000000453511537741071015020 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; //import jsr166y.*; /* * Based loosely on Java Grande Forum barrierBench */ public class PhaserLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final ExecutorService pool = Executors.newCachedThreadPool(); static final int FIRST_SIZE = 10000; static final int LAST_SIZE = 1000000; /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static final class PhaserAction implements Runnable { final int id; final int size; final Phaser phaser; public PhaserAction(int id, Phaser b, int size) { this.id = id; this.phaser = b; this.size = size; phaser.register(); } public void run() { int n = size; Phaser b = phaser; for (int i = 0; i < n; ++i) b.arriveAndAwaitAdvance(); } } public static void main(String[] args) throws Exception { int nthreads = NCPUS; if (args.length > 0) nthreads = Integer.parseInt(args[0]); System.out.printf("max %d Threads\n", nthreads); for (int k = 2; k <= nthreads; k *= 2) { for (int size = FIRST_SIZE; size <= LAST_SIZE; size *= 10) { long startTime = System.nanoTime(); Phaser phaser = new Phaser(); PhaserAction[] actions = new PhaserAction[nthreads]; for (int i = 0; i < k; ++i) { actions[i] = new PhaserAction(i, phaser, size); } Future[] futures = new Future[k]; for (int i = 0; i < k; ++i) { futures[i] = pool.submit(actions[i]); } for (int i = 0; i < k; ++i) { futures[i].get(); } long elapsed = System.nanoTime() - startTime; long bs = (NPS * size) / elapsed; System.out.printf("%4d Threads %8d iters: %11d barriers/sec\n", k, size, bs); } } pool.shutdown(); } } jsr166/src/test/loops/LongMutex.java0000644000000000000000000000275211537741071014502 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.*; import java.io.*; /** * A sample user extension of AbstractQueuedLongSynchronizer. */ public final class LongMutex extends AbstractQueuedLongSynchronizer implements Lock, java.io.Serializable { static final long LOCKED = -1L; public boolean isHeldExclusively() { return getState() == LOCKED; } public boolean tryAcquire(long acquires) { return compareAndSetState(0, LOCKED); } public boolean tryRelease(long releases) { setState(0); return true; } public Condition newCondition() { return new ConditionObject(); } private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); setState(0); // reset to unlocked state } public void lock() { acquire(LOCKED); } public boolean tryLock() { return tryAcquire(LOCKED); } public void lockInterruptibly() throws InterruptedException { acquireInterruptibly(LOCKED); } public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException { return tryAcquireNanos(LOCKED, unit.toNanos(timeout)); } public void unlock() { release(LOCKED); } } jsr166/src/test/loops/RWCollection.java0000644000000000000000000001006311537741071015116 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; /** * This is an incomplete implementation of a wrapper class * that places read-write locks around unsynchronized Collections. * Exists as a sample input for CollectionLoops test. */ public final class RWCollection implements Collection { private final Collection c; private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); public RWCollection(Collection c) { if (c == null) throw new NullPointerException(); this.c = c; } public RWCollection() { this(new ArrayList()); } public final int size() { final ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return c.size(); } finally { l.unlock(); } } public final boolean isEmpty() { final ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return c.isEmpty(); } finally { l.unlock(); } } public final boolean contains(Object o) { final ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return c.contains(o); } finally { l.unlock(); } } public final boolean equals(Object o) { final ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return c.equals(o); } finally { l.unlock(); } } public final int hashCode() { final ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return c.hashCode(); } finally { l.unlock(); } } public final String toString() { final ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return c.toString(); } finally { l.unlock(); } } public final Iterator iterator() { final ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return c.iterator(); } finally { l.unlock(); } } public final Object[] toArray() { final ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return c.toArray(); } finally { l.unlock(); } } public final T[] toArray(T[] a) { final ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return (T[])c.toArray(a); } finally { l.unlock(); } } public final boolean add(E e) { final ReentrantReadWriteLock.WriteLock l = rwl.writeLock(); l.lock(); try { return c.add(e); } finally { l.unlock(); } } public final boolean remove(Object o) { final ReentrantReadWriteLock.WriteLock l = rwl.writeLock(); l.lock(); try { return c.remove(o); } finally { l.unlock(); } } public final boolean containsAll(Collection coll) { final ReentrantReadWriteLock.WriteLock l = rwl.writeLock(); l.lock(); try { return c.containsAll(coll); } finally { l.unlock(); } } public final boolean addAll(Collection coll) { final ReentrantReadWriteLock.WriteLock l = rwl.writeLock(); l.lock(); try { return c.addAll(coll); } finally { l.unlock(); } } public final boolean removeAll(Collection coll) { final ReentrantReadWriteLock.WriteLock l = rwl.writeLock(); l.lock(); try { return c.removeAll(coll); } finally { l.unlock(); } } public final boolean retainAll(Collection coll) { final ReentrantReadWriteLock.WriteLock l = rwl.writeLock(); l.lock(); try { return c.retainAll(coll); } finally { l.unlock(); } } public final void clear() { final ReentrantReadWriteLock.WriteLock l = rwl.writeLock(); l.lock(); try { c.clear(); } finally { l.unlock(); } } } jsr166/src/test/loops/SimpleSemaphoreLoops.java0000644000000000000000000000646011537741072016673 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class SimpleSemaphoreLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 10000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; int reps = 2; for (int i = 1; i <= maxThreads; i += (i+1) >>> 1) { int n = reps; if (reps > 1) --reps; while (n-- > 0) { System.out.print("Threads: " + i); new SemaphoreLoop(i).test(); Thread.sleep(100); } } pool.shutdown(); } static final class SemaphoreLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final Semaphore lock = new Semaphore(1, false); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; SemaphoreLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { final Semaphore lock = this.lock; try { barrier.await(); int sum = v + 1; int x = 0; int n = iters; while (n-- > 0) { lock.acquireUninterruptibly(); int k = (sum & 3); if (k > 0) { x = v; while (k-- > 0) x = LoopHelpers.compute6(x); v = x; } else x = sum + 1; lock.release(); if ((x += readBarrier) == 0) ++readBarrier; for (int l = x & 7; l > 0; --l) sum += LoopHelpers.compute6(sum); } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/CancelledProducerConsumerLoops.java0000644000000000000000000001205211551700072020651 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; public class CancelledProducerConsumerLoops { static final int CAPACITY = 100; static final long TIMEOUT = 100; static final ExecutorService pool = Executors.newCachedThreadPool(); static boolean print = false; public static void main(String[] args) throws Exception { int maxPairs = 8; int iters = 1000000; if (args.length > 0) maxPairs = Integer.parseInt(args[0]); print = true; for (int i = 1; i <= maxPairs; i += (i+1) >>> 1) { System.out.println("Pairs:" + i); try { oneTest(i, iters); } catch (BrokenBarrierException bb) { // OK, ignore } Thread.sleep(100); } pool.shutdown(); } static void oneRun(BlockingQueue q, int npairs, int iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(npairs * 2 + 1, timer); Future[] prods = new Future[npairs]; Future[] cons = new Future[npairs]; for (int i = 0; i < npairs; ++i) { prods[i] = pool.submit(new Producer(q, barrier, iters)); cons[i] = pool.submit(new Consumer(q, barrier, iters)); } barrier.await(); Thread.sleep(TIMEOUT); boolean tooLate = false; for (int i = 1; i < npairs; ++i) { if (!prods[i].cancel(true)) tooLate = true; if (!cons[i].cancel(true)) tooLate = true; } Object p0 = prods[0].get(); Object c0 = cons[0].get(); if (!tooLate) { for (int i = 1; i < npairs; ++i) { if (!prods[i].isDone() || !prods[i].isCancelled()) throw new Error("Only one producer thread should complete"); if (!cons[i].isDone() || !cons[i].isCancelled()) throw new Error("Only one consumer thread should complete"); } } else System.out.print("(cancelled too late) "); long endTime = System.nanoTime(); long time = endTime - timer.startTime; if (print) { double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } } static void oneTest(int pairs, int iters) throws Exception { if (print) System.out.print("ArrayBlockingQueue "); oneRun(new ArrayBlockingQueue(CAPACITY), pairs, iters); if (print) System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(CAPACITY), pairs, iters); if (print) System.out.print("LinkedTransferQueue "); oneRun(new LinkedTransferQueue(), pairs, iters); if (print) System.out.print("SynchronousQueue "); oneRun(new SynchronousQueue(), pairs, iters / 8); if (print) System.out.print("SynchronousQueue(fair) "); oneRun(new SynchronousQueue(true), pairs, iters / 8); /* Can legitimately run out of memory before cancellation if (print) System.out.print("PriorityBlockingQueue "); oneRun(new PriorityBlockingQueue(ITERS / 2 * pairs), pairs, iters / 4); */ } abstract static class Stage implements Callable { final BlockingQueue queue; final CyclicBarrier barrier; final int iters; Stage(BlockingQueue q, CyclicBarrier b, int iters) { queue = q; barrier = b; this.iters = iters; } } static class Producer extends Stage { Producer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public Object call() throws Exception { barrier.await(); int s = 0; int l = 4321; for (int i = 0; i < iters; ++i) { l = LoopHelpers.compute1(l); s += LoopHelpers.compute2(l); if (!queue.offer(new Integer(l), 1, TimeUnit.SECONDS)) break; } return new Integer(s); } } static class Consumer extends Stage { Consumer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public Object call() throws Exception { barrier.await(); int l = 0; int s = 0; for (int i = 0; i < iters; ++i) { Integer x = queue.poll(1, TimeUnit.SECONDS); if (x == null) break; l = LoopHelpers.compute1(x.intValue()); s += l; } return new Integer(s); } } } jsr166/src/test/loops/CollectionWordLoops.java0000644000000000000000000001332411537741071016521 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.io.*; public class CollectionWordLoops { static final String[] WORDS_FILES = { "kw.txt", "class.txt", // "dir.txt", // "ids.txt", // "/usr/dict/words", }; static final int MAX_WORDS = 500000; static final int pinsert = 80; static final int premove = 2; static final int NOPS = 100000; static final int numTests = 2; public static void main(String[] args) { Class collectionClass = null; try { collectionClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } System.out.println("Testing " + collectionClass.getName()); for (int s = 0; s < WORDS_FILES.length; ++s) tests(collectionClass, numTests, s); for (int s = WORDS_FILES.length-1; s >= 0; --s) tests(collectionClass, numTests, s); } static void tests(Class collectionClass, int numTests, int sizeIndex) { try { String[] key = readWords(sizeIndex); int size = key.length; System.out.print("n = " +LoopHelpers.rightJustify(size) +" : "); long least = Long.MAX_VALUE; for (int i = 0; i < numTests; ++i) { Collection m = newCollection(collectionClass); long t = doTest(collectionClass.getName(), m, key); if (t < least) least = t; m.clear(); m = null; } long nano = Math.round(1000000.0 * (least) / NOPS); System.out.println(LoopHelpers.rightJustify(nano) + " ns per op"); } catch (IOException ignore) { return; // skip test if can't read file } } static Collection newCollection(Class cl) { try { Collection m = (Collection) cl.newInstance(); return m; } catch (Exception e) { throw new RuntimeException("Can't instantiate " + cl + ": " + e); } } static void pause() { try { Thread.sleep(100); } catch (InterruptedException ie) { return; } } static String[] readWords(int sizeIndex) throws IOException { String[] l = new String[MAX_WORDS]; String[] array = null; try { FileReader fr = new FileReader(WORDS_FILES[sizeIndex]); BufferedReader reader = new BufferedReader(fr); int k = 0; for (;;) { String s = reader.readLine(); if (s == null) break; l[k++] = s; } array = new String[k]; for (int i = 0; i < k; ++i) { array[i] = l[i]; l[i] = null; } l = null; reader.close(); } catch (IOException ex) { System.out.println("Can't read words file:" + ex); throw ex; } return array; } static long doTest(String name, final Collection m, final String[] key) { // System.out.print(name + "\t"); Runner runner = new Runner(m, key); long startTime = System.currentTimeMillis(); runner.run(); long afterRun = System.currentTimeMillis(); long runTime = (afterRun - startTime); int np = runner.total; if (runner.total == runner.hashCode()) System.out.println("Useless Number" + runner.total); int sz = runner.maxsz; if (sz == runner.hashCode()) System.out.println("Useless Number" + sz); // System.out.print(" m = " + sz); return runTime; } static class Runner implements Runnable { final Collection collection; final String[] key; LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); final int pctrem; final int pctins; int nputs = 0; int npgets = 0; int nagets = 0; int nremoves = 0; volatile int total; int maxsz; Runner(Collection m, String[] k) { collection = m; key = k; pctrem = (int)(((long)premove * (long)(Integer.MAX_VALUE/2)) / 50); pctins = (int)(((long)pinsert * (long)(Integer.MAX_VALUE/2)) / 50); } int oneStep(int j) { int n = key.length; int r = rng.next() & 0x7FFFFFFF; int jinc = (r & 7); j += jinc - 3; if (j >= n) j -= n; if (j < 0) j += n; int l = n / 4 + j; if (l >= n) l -= n; String k = key[j]; if (!collection.contains(k)) { ++nagets; if (r < pctins) { collection.add(k); ++nputs; int csz = nputs - nremoves; if (csz > maxsz) maxsz = csz; } } else { ++npgets; if (r < pctrem) { collection.remove(k); ++nremoves; j += ((r >>> 8) & 7) + n / 2; if (j >= n) j -= n; } } return j; } public void run() { int j = key.length / 2; for (int i = 0; i < NOPS; ++i) { j = oneStep(j); } total = nputs + npgets + nagets + nremoves; } } } jsr166/src/test/loops/FinalLongTest.java0000644000000000000000000000626311537741071015272 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ public class FinalLongTest { static int npairs = 2; static int iters = 10000000; static int LEN = 2; static final Long[] nums = new Long[LEN]; static volatile boolean done; static volatile long total; static Long n0 = new Long(21); static Long n1 = new Long(22); static Long n2 = new Long(23); static Long n3 = new Long(23); public static void main(String[] args) { for (int i = 0; i < LEN; ++i) nums[i] = new Long(i+1); Thread[] ps = new Thread[npairs]; Thread[] as = new Reader[npairs]; for (int i = 0; i < npairs; ++i) { ps[i] = new Writer(); as[i] = new Reader(); } for (int i = 0; i < as.length; ++i) { ps[i].start(); as[i].start(); } } static long nextRandom(long seed) { return (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1); } static long initialSeed(Object x) { return (System.currentTimeMillis() + x.hashCode()) | 1; } static class Writer extends Thread { public void run() { long s = initialSeed(this); int n = iters / 2; Long[] ns = nums; while (n-- > 0) { // int k = (int) (s & (LEN-1)); // if (k < 0 || k >= LEN) k = 1; // int l = (k+1) & (LEN-1); // if (l < 0 || l >= LEN) l = 0; // int k = (s & 1) == 0 ? 0 : 1; // int l = (k == 0) ? 1 : 0; if ((s & (LEN-1)) == 0) { n3 = n1; n0 = new Long(s); n2 = n1; n1 = new Long(s); } else { n3 = n0; n1 = new Long(s); n2 = n0; n0 = new Long(s); } s = nextRandom(s); if (s == 0) s = initialSeed(this); } done = true; total += s; } } static class Reader extends Thread { public void run() { int n = iters; long s = initialSeed(this); while (s != 0 && n > 0) { long nexts; // = nums[(int) (s & (LEN-1))].longValue(); if ((s & (LEN-1)) == 0) nexts = n0.longValue(); else nexts = n1.longValue(); if (nexts != 0) { if ((s & 4) == 0) nexts = n2.longValue(); else nexts = n3.longValue(); } if (nexts != s) --n; else if (done) break; s = nexts; } done = true; total += s; if (s == 0) throw new Error("Saw uninitialized value"); } } } jsr166/src/test/loops/RWMap.java0000644000000000000000000000650411537741071013545 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; /** * This is an incomplete implementation of a wrapper class * that places read-write locks around unsynchronized Maps. * Exists as a sample input for MapLoops test. */ public class RWMap implements Map { private final Map m; private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); public RWMap(Map m) { if (m == null) throw new NullPointerException(); this.m = m; } public RWMap() { this(new TreeMap()); // use TreeMap by default // this(new IdentityHashMap()); } public int size() { ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return m.size(); } finally { l.unlock(); } } public boolean isEmpty() { ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return m.isEmpty(); } finally { l.unlock(); } } public Object get(Object key) { ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return m.get(key); } finally { l.unlock(); } } public boolean containsKey(Object key) { ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return m.containsKey(key); } finally { l.unlock(); } } public boolean containsValue(Object value) { ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return m.containsValue(value); } finally { l.unlock(); } } public Set keySet() { // Not implemented return m.keySet(); } public Set entrySet() { // Not implemented return m.entrySet(); } public Collection values() { // Not implemented return m.values(); } public boolean equals(Object o) { ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return m.equals(o); } finally { l.unlock(); } } public int hashCode() { ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return m.hashCode(); } finally { l.unlock(); } } public String toString() { ReentrantReadWriteLock.ReadLock l = rwl.readLock(); l.lock(); try { return m.toString(); } finally { l.unlock(); } } public Object put(Object key, Object value) { ReentrantReadWriteLock.WriteLock l = rwl.writeLock(); l.lock(); try { return m.put(key, value); } finally { l.unlock(); } } public Object remove(Object key) { ReentrantReadWriteLock.WriteLock l = rwl.writeLock(); l.lock(); try { return m.remove(key); } finally { l.unlock(); } } public void putAll(Map map) { ReentrantReadWriteLock.WriteLock l = rwl.writeLock(); l.lock(); try { m.putAll(map); } finally { l.unlock(); } } public void clear() { ReentrantReadWriteLock.WriteLock l = rwl.writeLock(); l.lock(); try { m.clear(); } finally { l.unlock(); } } } jsr166/src/test/loops/NQueensCS.java0000644000000000000000000001002611537741071014355 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ //import jsr166y.*; import java.util.*; import java.util.concurrent.*; public final class NQueensCS extends RecursiveAction { static long lastStealCount; static int boardSize; static final int[] expectedSolutions = new int[] { 0, 1, 0, 0, 2, 10, 4, 40, 92, 352, 724, 2680, 14200, 73712, 365596, 2279184, 14772512, 95815104, 666090624 }; // see http://www.durangobill.com/N_Queens.html static final int FIRST_SIZE = 8; // smaller ones too short to measure well static final int LAST_SIZE = 15; // bigger ones too long to wait for /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); public static void main(String[] args) throws Exception { int procs = 0; try { if (args.length > 0) procs = Integer.parseInt(args[0]); } catch (Exception e) { System.out.println("Usage: java NQueensCS "); return; } for (int reps = 0; reps < 2; ++reps) { ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); lastStealCount = g.getStealCount(); for (int i = FIRST_SIZE; i <= LAST_SIZE; i++) test(g, i); System.out.println(g); g.shutdown(); } } static void test(ForkJoinPool g, int i) throws Exception { boardSize = i; int ps = g.getParallelism(); long start = System.nanoTime(); NQueensCS task = new NQueensCS(new int[0]); g.invoke(task); int solutions = task.solutions; long time = System.nanoTime() - start; double secs = ((double)time) / NPS; if (solutions != expectedSolutions[i]) throw new Error(); System.out.printf("NQueensCS %3d", i); System.out.printf(" Time: %7.3f", secs); long sc = g.getStealCount(); long ns = sc - lastStealCount; lastStealCount = sc; System.out.printf(" Steals/t: %5d", ns/ps); System.out.println(); } // Boards are represented as arrays where each cell // holds the column number of the queen in that row final int[] sofar; NQueensCS nextSubtask; // to link subtasks int solutions; NQueensCS(int[] a) { this.sofar = a; } public final void compute() { NQueensCS subtasks; int bs = boardSize; if (sofar.length >= bs) solutions = 1; else if ((subtasks = explore(sofar, bs)) != null) solutions = processSubtasks(subtasks); } private static NQueensCS explore(int[] array, int bs) { int row = array.length; NQueensCS s = null; // subtask list outer: for (int q = 0; q < bs; ++q) { for (int i = 0; i < row; i++) { int p = array[i]; if (q == p || q == p - (row - i) || q == p + (row - i)) continue outer; // attacked } NQueensCS first = s; // lag forks to ensure 1 kept if (first != null) first.fork(); int[] next = Arrays.copyOf(array, row+1); next[row] = q; NQueensCS subtask = new NQueensCS(next); subtask.nextSubtask = first; s = subtask; } return s; } private static int processSubtasks(NQueensCS s) { // Always run first the task held instead of forked s.compute(); int ns = s.solutions; s = s.nextSubtask; // Then the unstolen ones while (s != null && s.tryUnfork()) { s.compute(); ns += s.solutions; s = s.nextSubtask; } // Then wait for the stolen ones while (s != null) { s.join(); ns += s.solutions; s = s.nextSubtask; } return ns; } } jsr166/src/test/loops/CyclicBarrierLoops.java0000644000000000000000000000477611537741071016322 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; //import jsr166y.*; /* * Based loosely on Java Grande Forum barrierBench */ public class CyclicBarrierLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final ExecutorService pool = Executors.newCachedThreadPool(); static final int FIRST_SIZE = 10000; static final int LAST_SIZE = 1000000; /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static final class CyclicBarrierAction implements Runnable { final int id; final int size; final CyclicBarrier barrier; public CyclicBarrierAction(int id, CyclicBarrier b, int size) { this.id = id; this.barrier = b; this.size = size; } public void run() { try { int n = size; CyclicBarrier b = barrier; for (int i = 0; i < n; ++i) b.await(); } catch (Exception ex) { throw new Error(ex); } } } public static void main(String[] args) throws Exception { int nthreads = NCPUS; if (args.length > 0) nthreads = Integer.parseInt(args[0]); System.out.printf("max %d Threads\n", nthreads); for (int k = 2; k <= nthreads; k *= 2) { for (int size = FIRST_SIZE; size <= LAST_SIZE; size *= 10) { long startTime = System.nanoTime(); CyclicBarrier barrier = new CyclicBarrier(k); CyclicBarrierAction[] actions = new CyclicBarrierAction[k]; for (int i = 0; i < k; ++i) { actions[i] = new CyclicBarrierAction(i, barrier, size); } Future[] futures = new Future[k]; for (int i = 0; i < k; ++i) { futures[i] = pool.submit(actions[i]); } for (int i = 0; i < k; ++i) { futures[i].get(); } long elapsed = System.nanoTime() - startTime; long bs = (NPS * size) / elapsed; System.out.printf("%4d Threads %8d iters: %11d barriers/sec\n", k, size, bs); } } pool.shutdown(); } } jsr166/src/test/loops/AsyncNQueensCS.java0000644000000000000000000000713511537741071015362 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.*; import java.util.concurrent.atomic.*; public final class AsyncNQueensCS extends LinkedAsyncAction { static long lastStealCount; static int boardSize; static final int[] expectedSolutions = new int[] { 0, 1, 0, 0, 2, 10, 4, 40, 92, 352, 724, 2680, 14200, 73712, 365596, 2279184, 14772512, 95815104, 666090624 }; // see http://www.durangobill.com/N_Queens.html static final int FIRST_SIZE = 8; // smaller ones too short to measure well static final int LAST_SIZE = 15; // bigger ones too long to wait for /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); public static void main(String[] args) throws Exception { int procs = 0; try { if (args.length > 0) procs = Integer.parseInt(args[0]); } catch (Exception e) { System.out.println("Usage: java AsyncNQueensCS "); return; } for (int reps = 0; reps < 2; ++reps) { ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); System.out.println("Number of procs=" + g.getParallelism()); lastStealCount = g.getStealCount(); for (int i = FIRST_SIZE; i <= LAST_SIZE; i++) test(g, i); g.shutdown(); } } static void test(ForkJoinPool g, int i) throws Exception { boardSize = i; int ps = g.getParallelism(); long start = System.nanoTime(); AsyncNQueensCS task = new AsyncNQueensCS(null, new int[0]); g.invoke(task); int solutions = task.solutions; long time = System.nanoTime() - start; double secs = ((double)time) / NPS; if (solutions != expectedSolutions[i]) throw new Error(); System.out.printf("AsyncNQueensCS %3d", i); System.out.printf(" Time: %7.3f", secs); long sc = g.getStealCount(); long ns = sc - lastStealCount; lastStealCount = sc; System.out.printf(" Steals/t: %5d", ns/ps); System.out.println(); } // Boards are represented as arrays where each cell // holds the column number of the queen in that row final int[] sofar; volatile int solutions; AsyncNQueensCS(AsyncNQueensCS parent, int[] a) { super(parent); this.sofar = a; } public final boolean exec() { int bs = boardSize; int row = sofar.length; if (row >= bs) solutions = 1; else { outer: for (int q = 0; q < bs; ++q) { for (int i = 0; i < row; i++) { int p = sofar[i]; if (q == p || q == p - (row - i) || q == p + (row - i)) continue outer; // attacked } int[] next = Arrays.copyOf(sofar, row+1); next[row] = q; new AsyncNQueensCS(this, next).fork(); } } complete(); return false; } protected void onCompletion() { LinkedAsyncAction p; int n = solutions; if (n != 0 && (p = getParent()) != null) solutionUpdater.addAndGet((AsyncNQueensCS)p, n); } static final AtomicIntegerFieldUpdater solutionUpdater = AtomicIntegerFieldUpdater.newUpdater(AsyncNQueensCS.class, "solutions"); } jsr166/src/test/loops/CollectionLoops.java0000644000000000000000000001437411537741071015673 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; public class CollectionLoops { static int pinsert = 100; static int premove = 1; static int maxThreads = 48; static int removesPerMaxRandom; static int insertsPerMaxRandom; static volatile int checkSum = 0; static boolean print = false; static final ExecutorService pool = Executors.newCachedThreadPool(); public static void main(String[] args) throws Exception { int nkeys = 10000; int nops = 100000; Class collectionClass = null; if (args.length > 0) { try { collectionClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } if (args.length > 1) maxThreads = Integer.parseInt(args[1]); if (args.length > 2) nkeys = Integer.parseInt(args[2]); if (args.length > 3) pinsert = Integer.parseInt(args[3]); if (args.length > 4) premove = Integer.parseInt(args[4]); if (args.length > 5) nops = Integer.parseInt(args[5]); // normalize probabilities wrt random number generator removesPerMaxRandom = (int)(((double)premove/100.0 * 0x7FFFFFFFL)); insertsPerMaxRandom = (int)(((double)pinsert/100.0 * 0x7FFFFFFFL)); System.out.print("Class: " + collectionClass.getName()); System.out.print(" threads: " + maxThreads); System.out.print(" size: " + nkeys); System.out.print(" ins: " + pinsert); System.out.print(" rem: " + premove); System.out.print(" ops: " + nops); System.out.println(); // warmup test(1, 100, 100, collectionClass); test(2, 100, 100, collectionClass); test(4, 100, 100, collectionClass); print = true; int k = 1; int warmups = 2; for (int i = 1; i <= maxThreads;) { Thread.sleep(100); test(i, nkeys, nops, collectionClass); if (warmups > 0) --warmups; else if (i == k) { k = i << 1; i = i + (i >>> 1); } else if (i == 1 && k == 2) { i = k; warmups = 1; } else i = k; } pool.shutdown(); } static Integer[] makeKeys(int n) { LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); Integer[] key = new Integer[n]; for (int i = 0; i < key.length; ++i) key[i] = new Integer(rng.next()); return key; } static void shuffleKeys(Integer[] key) { Random rng = new Random(); for (int i = key.length; i > 1; --i) { int j = rng.nextInt(i); Integer tmp = key[j]; key[j] = key[i-1]; key[i-1] = tmp; } } static void test(int i, int nk, int nops, Class collectionClass) throws Exception { if (print) System.out.print("Threads: " + i + "\t:"); Collection collection = (Collection)collectionClass.newInstance(); Integer[] key = makeKeys(nk); // Uncomment to start with a non-empty table for (int j = 0; j < nk; j += 2) collection.add(key[j]); shuffleKeys(key); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(i+1, timer); for (int t = 0; t < i; ++t) pool.execute(new Runner(t, collection, key, barrier, nops)); barrier.await(); barrier.await(); long time = timer.getTime(); long tpo = time / (i * (long) nops); if (print) System.out.print(LoopHelpers.rightJustify(tpo) + " ns per op"); double secs = (double) time / 1000000000.0; if (print) System.out.print("\t " + secs + "s run time"); if (checkSum == 0) System.out.print(" "); if (print) System.out.println(); collection.clear(); } static class Runner implements Runnable { final Collection collection; final Integer[] key; final LoopHelpers.SimpleRandom rng; final CyclicBarrier barrier; int position; int total; int nops; Runner(int id, Collection collection, Integer[] key, CyclicBarrier barrier, int nops) { this.collection = collection; this.key = key; this.barrier = barrier; this.nops = nops; position = key.length / (id + 1); rng = new LoopHelpers.SimpleRandom((id + 1) * 8862213513L); rng.next(); } public void run() { try { barrier.await(); int p = position; int ops = nops; Collection c = collection; while (ops > 0) { int r = rng.next(); p += (r & 7) - 3; while (p >= key.length) p -= key.length; while (p < 0) p += key.length; Integer k = key[p]; if (c.contains(k)) { if (r < removesPerMaxRandom) { if (c.remove(k)) { p = Math.abs(total % key.length); ops -= 2; continue; } } } else if (r < insertsPerMaxRandom) { ++p; ops -= 2; c.add(k); continue; } total += LoopHelpers.compute6(k.intValue()); --ops; } checkSum += total; barrier.await(); } catch (Exception ex) { throw new RuntimeException(ex); } } } } jsr166/src/test/loops/IteratorLoops.java0000644000000000000000000000756411537741071015374 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; /** * Estimates time per iteration of collection iterators. Preloads * most elements, but adds about 1/8 of them dynamically to preclude * overly clever optimizations. The array of collections has * approximately exponentially different lengths, so check both short * and long iterators. Reports include times for adds and other * checks, so overestimate times per iteration. */ public final class IteratorLoops { static final int DEFAULT_SIZE = 16384; static final int DEFAULT_TRIALS = 4; static final int NC = 16; // number of collections must be power of 2 static volatile long mismatches = 0; static int randomSeed = 3122688; public static void main(String[] args) throws Exception { Class klass = Class.forName(args[0]); int n = (args.length <= 1) ? DEFAULT_SIZE : Integer.parseInt(args[1]); int t = (args.length <= 2) ? DEFAULT_TRIALS : Integer.parseInt(args[2]); System.out.print("Class: " + klass.getName()); System.out.print(" ~iters: " + (long) n * (long) n); System.out.print(" trials: " + t); System.out.println(); Collection[] colls = (Collection[])new Collection[NC]; for (int k = 0; k < colls.length; ++k) { Object x = klass.newInstance(); if (x instanceof Collection) colls[k] = (Collection) x; else if (x instanceof Map) colls[k] = (Collection) Collections.newSetFromMap((Map) x); else throw new Error("bad class"); } for (int i = 0; i < t; ++i) new IteratorLoops(colls).oneRun(n); if (mismatches != 0) throw new Error("Bad checksum :" + mismatches); } private int elementCount; private final Collection[] cs; IteratorLoops(Collection[] colls) { cs = colls; elementCount = 0; } void oneRun(int n) { preload(n); long startTime = System.nanoTime(); long count = traversals(n); double elapsed = (double) (System.nanoTime() - startTime); double npi = elapsed / count; double secs = elapsed / 1000000000; System.out.printf("%7.1f ns/iter %8.3fs run time\n", npi, secs); } long traversals(int n) { long count = 0; long check = 0; for (int i = 0; i < n; i++) { check += elementCount; count += counts(); maybeAdd(); } if (count != check) mismatches = count; return count; } int counts() { int count = 0; for (int k = 0; k < cs.length; ++k) { for (Iterator it = cs[k].iterator(); it.hasNext();) { if (it.next() != null) ++count; } } return count; } void maybeAdd() { int r = randomSeed; r ^= r << 6; r ^= r >>> 21; r ^= r << 7; randomSeed = r; if ((r >>> 29) == 0) cs[r & (cs.length-1)].add(new Integer(elementCount++)); } void preload(int n) { for (int i = 0; i < cs.length; ++i) cs[i].clear(); int k = (n - n / 8) / 2; ArrayList al = new ArrayList(k+1); for (int i = 0; i < cs.length; ++i) { if (k > 0) { for (int j = 0; j < k; ++j) al.add(new Integer(elementCount++)); cs[i].addAll(al); al.clear(); } k >>>= 1; } // let GC settle down try { Thread.sleep(500); } catch (Exception ex) { return; } } } jsr166/src/test/loops/LastKeyOfSubMap.java0000644000000000000000000000275411537741071015533 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ // Adapted from bug report 5018354 import java.util.*; public class LastKeyOfSubMap { private static final Comparator NULL_AT_END = new Comparator() { /** * Allows for nulls. Null is greater than anything non-null. */ public int compare(Object pObj1, Object pObj2) { if (pObj1 == null && pObj2 == null) return 0; if (pObj1 == null && pObj2 != null) return 1; if (pObj1 != null && pObj2 == null) return -1; return ((Comparable) pObj1).compareTo(pObj2); } }; public static void main(String[] pArgs) { SortedMap m1 = new TreeMap(NULL_AT_END); m1.put("a", "a"); m1.put("b", "b"); m1.put("c", "c"); m1.put(null, "d"); SortedMap m2 = new TreeMap(m1); System.out.println(m1.lastKey()); System.out.println(m1.get(m1.lastKey())); Object m1lk = m1.remove(m1.lastKey()); if (m1lk == null) throw new Error("bad remove of last key"); m2 = m2.tailMap("b"); System.out.println(m2.lastKey()); System.out.println(m2.get(m2.lastKey())); Object m2lk = m2.remove(m2.lastKey()); if (m2lk == null) throw new Error("bad remove of last key"); } } jsr166/src/test/loops/ContextSwitchTest.java0000644000000000000000000000342511537741071016224 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.*; import java.util.*; public final class ContextSwitchTest { static final int iters = 1000000; static AtomicReference turn = new AtomicReference(); public static void main(String[] args) throws Exception { test(); test(); test(); } static void test() throws Exception { MyThread a = new MyThread(); MyThread b = new MyThread(); a.other = b; b.other = a; turn.set(a); long startTime = System.nanoTime(); a.start(); b.start(); a.join(); b.join(); long endTime = System.nanoTime(); int np = a.nparks + b.nparks; System.out.println("Average time: " + ((endTime - startTime) / np) + "ns"); } static final class MyThread extends Thread { volatile Thread other; volatile int nparks; public void run() { final AtomicReference t = turn; final Thread other = this.other; if (turn == null || other == null) throw new NullPointerException(); int p = 0; for (int i = 0; i < iters; ++i) { while (!t.compareAndSet(other, this)) { LockSupport.park(); ++p; } LockSupport.unpark(other); } LockSupport.unpark(other); nparks = p; System.out.println("parks: " + p); } } } jsr166/src/test/loops/SimpleLoops.java0000644000000000000000000000611611537741072015025 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class SimpleLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 10000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; int k = 1; for (int i = 1; i <= maxThreads;) { System.out.print("Threads: " + 1); new Loop(1).test(); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static final class Loop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; Loop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v + 1; int x = 0; int n = iters; while (n-- > 0) { int k = (sum & 3); if (k > 0) { x = v; while (k-- > 0) x = LoopHelpers.compute1(x); v = x; } else x = sum + 1; if ((x += readBarrier) == 0) ++readBarrier; for (int l = x & 7; l > 0; --l) sum += LoopHelpers.compute1(sum); } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/class.txt0000644000000000000000000004472510235476645013577 0ustar ASCII AWTError AWTEvent AWTEventListener AWTEventListenerProxy AWTEventMulticaster AWTException AWTKeyStroke AWTPermission AbstractChannel AbstractCollection AbstractList AbstractMap AbstractMethodError AbstractPreferences AbstractSelectableChannel AbstractSelectionKey AbstractSelector AbstractSequentialList AbstractSet AccessControlContext AccessControlException AccessController AccessException AccessibleObject Acl AclEntry AclNotFoundException ActionEvent ActionListener Activatable ActivateFailedException ActivationDesc ActivationException ActivationGroup ActivationGroupDesc ActivationGroupID ActivationID ActivationInstantiator ActivationMonitor ActivationSystem Activator ActiveEvent Adjustable AdjustmentEvent AdjustmentListener Adler32 AffineTransform AffineTransformOp AlgorithmParameterGenerator AlgorithmParameterGeneratorSpi AlgorithmParameterSpec AlgorithmParameters AlgorithmParametersSpi AllPermission AlphaComposite AlreadyBoundException AlreadyConnectedException Annotation Applet AppletContext AppletInitializer AppletStub Arc2D ArcIterator Area AreaAveragingScaleFilter ArithmeticException Array ArrayIndexOutOfBoundsException ArrayList ArrayStoreException Arrays AssertionError AssertionStatusDirectives AsynchronousCloseException AttributeValue AttributedCharacterIterator AttributedString Attributes AudioClip Authenticator Autoscroll BackingStoreException BandCombineOp BandedSampleModel Base64 BasicPermission BasicStroke BatchUpdateException BeanContext BeanContextChild BeanContextChildComponentProxy BeanContextChildSupport BeanContextContainerProxy BeanContextEvent BeanContextMembershipEvent BeanContextMembershipListener BeanContextProxy BeanContextServiceAvailableEvent BeanContextServiceProvider BeanContextServiceProviderBeanInfo BeanContextServiceRevokedEvent BeanContextServiceRevokedListener BeanContextServices BeanContextServicesListener BeanContextServicesSupport BeanContextSupport BeanDescriptor BeanInfo Beans Bidi BigDecimal BigInteger BindException BitSet BitSieve Bits Blob Book Boolean BorderLayout BreakDictionary BreakIterator Buffer BufferCapabilities BufferOverflowException BufferStrategy BufferUnderflowException BufferedImage BufferedImageFilter BufferedImageOp BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter Button ButtonPeer Byte ByteArrayInputStream ByteArrayOutputStream ByteBuffer ByteBufferAs-X-Buffer ByteBufferAsCharBufferB ByteBufferAsCharBufferL ByteBufferAsCharBufferRB ByteBufferAsCharBufferRL ByteBufferAsDoubleBufferB ByteBufferAsDoubleBufferL ByteBufferAsDoubleBufferRB ByteBufferAsDoubleBufferRL ByteBufferAsFloatBufferB ByteBufferAsFloatBufferL ByteBufferAsFloatBufferRB ByteBufferAsFloatBufferRL ByteBufferAsIntBufferB ByteBufferAsIntBufferL ByteBufferAsIntBufferRB ByteBufferAsIntBufferRL ByteBufferAsLongBufferB ByteBufferAsLongBufferL ByteBufferAsLongBufferRB ByteBufferAsLongBufferRL ByteBufferAsShortBufferB ByteBufferAsShortBufferL ByteBufferAsShortBufferRB ByteBufferAsShortBufferRL ByteChannel ByteLookupTable ByteOrder CMMException CRC32 CRL CRLException CRLSelector Calendar CallableStatement CancelledKeyException Canvas CanvasPeer CardLayout CertPath CertPathBuilder CertPathBuilderException CertPathBuilderResult CertPathBuilderSpi CertPathParameters CertPathValidator CertPathValidatorException CertPathValidatorResult CertPathValidatorSpi CertSelector CertStore CertStoreException CertStoreParameters CertStoreSpi Certificate CertificateEncodingException CertificateException CertificateExpiredException CertificateFactory CertificateFactorySpi CertificateNotYetValidException CertificateParsingException Channel Channels CharArrayIterator CharArrayReader CharArrayWriter CharBuffer CharConversionException CharSequence CharSet Character CharacterBreakData CharacterCodingException CharacterIterator CharacterIteratorFieldDelegate Charset Charset-X-Coder CharsetDecoder CharsetEncoder CharsetProvider Checkbox CheckboxGroup CheckboxMenuItem CheckboxMenuItemPeer CheckboxPeer CheckedInputStream CheckedOutputStream Checksum Choice ChoiceFormat ChoicePeer Class ClassCastException ClassCircularityError ClassFormatError ClassLoader ClassNotFoundException Clipboard ClipboardOwner Clob CloneNotSupportedException Cloneable ClosedByInterruptException ClosedChannelException ClosedSelectorException CodeSource CollationElementIterator CollationKey CollationRules Collator Collection CollectionCertStoreParameters Collections Color ColorConvertOp ColorModel ColorPaintContext ColorSpace Comparable Comparator Compiler Component ComponentAdapter ComponentColorModel ComponentEvent ComponentListener ComponentOrientation ComponentPeer ComponentSampleModel Composite CompositeContext ConcurrentModificationException Conditional ConnectException ConnectIOException Connection ConnectionPendingException ConsoleHandler Constructor Container ContainerAdapter ContainerEvent ContainerListener ContainerOrderFocusTraversalPolicy ContainerPeer ContentHandler ContentHandlerFactory ContextualRenderedImageFactory ConvolveOp CropImageFilter CubicCurve2D CubicIterator Currency CurrencyData Cursor Customizer DGC DSAKey DSAKeyPairGenerator DSAParameterSpec DSAParams DSAPrivateKey DSAPrivateKeySpec DSAPublicKey DSAPublicKeySpec DataBuffer DataBufferByte DataBufferDouble DataBufferFloat DataBufferInt DataBufferShort DataBufferUShort DataFlavor DataFormatException DataInput DataInputStream DataOutput DataOutputStream DataTruncation DatabaseMetaData DatagramChannel DatagramPacket DatagramSocket DatagramSocketImpl DatagramSocketImplFactory Date DateFormat DateFormatSymbols DecimalFormat DecimalFormatSymbols DefaultFocusTraversalPolicy DefaultKeyboardFocusManager DefaultPersistenceDelegate Deflater DeflaterOutputStream DesignMode Dialog DialogPeer Dictionary DictionaryBasedBreakIterator DigestException DigestInputStream DigestOutputStream DigitList Dimension Dimension2D Direct-X-Buffer Direct-X-Buffer-bin DirectByteBuffer DirectByteBufferR DirectCharBufferRS DirectCharBufferRU DirectCharBufferS DirectCharBufferU DirectColorModel DirectDoubleBufferRS DirectDoubleBufferRU DirectDoubleBufferS DirectDoubleBufferU DirectFloatBufferRS DirectFloatBufferRU DirectFloatBufferS DirectFloatBufferU DirectIntBufferRS DirectIntBufferRU DirectIntBufferS DirectIntBufferU DirectLongBufferRS DirectLongBufferRU DirectLongBufferS DirectLongBufferU DirectShortBufferRS DirectShortBufferRU DirectShortBufferS DirectShortBufferU DisplayMode DnDConstants DomainCombiner Double DoubleBuffer DragGestureEvent DragGestureListener DragGestureRecognizer DragSource DragSourceAdapter DragSourceContext DragSourceContextPeer DragSourceDragEvent DragSourceDropEvent DragSourceEvent DragSourceListener Driver DriverManager DriverPropertyInfo DropTarget DropTargetAdapter DropTargetContext DropTargetContextPeer DropTargetDragEvent DropTargetDropEvent DropTargetEvent DropTargetListener DropTargetPeer EOFException Ellipse2D EllipseIterator EmptyStackException EncodedKeySpec Encoder EntryPair Enumeration Error Event EventDispatchThread EventHandler EventListener EventListenerProxy EventObject EventQueue EventSetDescriptor Exception ExceptionInInitializerError ExceptionListener ExportException Expression Externalizable FeatureDescriptor Field FieldPosition File FileChannel FileDescriptor FileDialog FileDialogPeer FileFilter FileHandler FileInputStream FileLock FileLockInterruptionException FileNameMap FileNotFoundException FileOutputStream FilePermission FileReader FileSystem FileSystemPreferences FileSystemPreferencesFactory FileWriter FilenameFilter Filter FilterInputStream FilterOutputStream FilterReader FilterWriter FilteredImageSource FinalReference Finalizer FlatteningPathIterator FlavorMap FlavorTable Float FloatBuffer FloatingDecimal FlowLayout FocusAdapter FocusEvent FocusListener FocusTraversalPolicy Font FontFormatException FontMetrics FontPeer FontRenderContext Format Formatter Frame FramePeer GZIPInputStream GZIPOutputStream GatheringByteChannel GeneralPath GeneralPathIterator GeneralSecurityException GlyphJustificationInfo GlyphMetrics GlyphVector GradientPaint GradientPaintContext GraphicAttribute Graphics Graphics2D GraphicsCallback GraphicsConfigTemplate GraphicsConfiguration GraphicsDevice GraphicsEnvironment GregorianCalendar GridBagConstraints GridBagLayout GridLayout Group Guard GuardedObject Handler HashMap HashSet Hashtable HeadlessException Heap-X-Buffer HeapByteBuffer HeapByteBufferR HeapCharBuffer HeapCharBufferR HeapDoubleBuffer HeapDoubleBufferR HeapFloatBuffer HeapFloatBufferR HeapIntBuffer HeapIntBufferR HeapLongBuffer HeapLongBufferR HeapShortBuffer HeapShortBufferR HierarchyBoundsAdapter HierarchyBoundsListener HierarchyEvent HierarchyListener HttpURLConnection ICC_ColorSpace ICC_Profile ICC_ProfileGray ICC_ProfileRGB IOException Identity IdentityHashMap IdentityHashtable IdentityScope IllegalAccessError IllegalAccessException IllegalArgumentException IllegalBlockingModeException IllegalCharsetNameException IllegalComponentStateException IllegalMonitorStateException IllegalPathStateException IllegalSelectorException IllegalStateException IllegalThreadStateException Image ImageCapabilities ImageConsumer ImageFilter ImageGraphicAttribute ImageObserver ImageProducer ImagingOpException InaccessibleBufferIndexException IncompatibleClassChangeError IndexColorModel IndexOutOfBoundsException IndexedPropertyDescriptor Inet4Address Inet6Address InetAddress InetSocketAddress Inflater InflaterInputStream InheritableThreadLocal InputContext InputEvent InputMethod InputMethodContext InputMethodDescriptor InputMethodEvent InputMethodHighlight InputMethodListener InputMethodRequests InputStream InputStreamReader InputSubset Insets InstantiationError InstantiationException IntBuffer Integer InternalError InterruptedException InterruptedIOException IntrospectionException Introspector InvalidAlgorithmParameterException InvalidClassException InvalidDnDOperationException InvalidKeyException InvalidKeySpecException InvalidMarkException InvalidObjectException InvalidParameterException InvalidParameterSpecException InvalidPreferencesFormatException InvocationEvent InvocationHandler InvocationTargetException ItemEvent ItemListener ItemSelectable Iterator JarEntry JarException JarFile JarInputStream JarOutputStream JarURLConnection JarVerifier JobAttributes Kernel Key KeyAdapter KeyEvent KeyEventDispatcher KeyEventPostProcessor KeyException KeyFactory KeyFactorySpi KeyListener KeyManagementException KeyPair KeyPairGenerator KeyPairGeneratorSpi KeySpec KeyStore KeyStoreException KeyStoreSpi KeyboardFocusManager LDAPCertStoreParameters Label LabelPeer LastOwnerException LayoutManager LayoutManager2 Lease Level LightweightPeer Line2D LineBreakData LineBreakMeasurer LineIterator LineMetrics LineNumberInputStream LineNumberReader LinkageError LinkedHashMap LinkedHashSet LinkedList List ListIterator ListPeer ListResourceBundle LoaderHandler Locale LocateRegistry LogManager LogRecord LogStream Logger LoggingPermission Long LongBuffer LookupOp LookupTable MalformedInputException MalformedURLException Manifest Map MappedByteBuffer MarshalException MarshalledObject Matcher Math MediaTracker Member MemoryHandler MemoryImageSource Menu MenuBar MenuBarPeer MenuComponent MenuComponentPeer MenuContainer MenuItem MenuItemPeer MenuPeer MenuShortcut MergeCollation MessageDigest MessageDigestSpi MessageFormat MetaData Method MethodDescriptor MimeType MimeTypeParameterList MimeTypeParseException MissingResourceException Modifier MouseAdapter MouseDragGestureRecognizer MouseEvent MouseListener MouseMotionAdapter MouseMotionListener MouseWheelEvent MouseWheelListener MultiPixelPackedSampleModel MulticastSocket MultipleMaster MutableBigInteger NameGenerator Naming NativeLibLoader NegativeArraySizeException NetPermission NetworkInterface NoClassDefFoundError NoConnectionPendingException NoRouteToHostException NoSuchAlgorithmException NoSuchElementException NoSuchFieldError NoSuchFieldException NoSuchMethodError NoSuchMethodException NoSuchObjectException NoSuchProviderException NodeChangeEvent NodeChangeListener NonReadableChannelException NonWritableChannelException NoninvertibleTransformException Normalizer NotActiveException NotBoundException NotOwnerException NotSerializableException NotYetConnectedException NullPointerException Number NumberFormat NumberFormatException NumericShaper ObjID Object ObjectInput ObjectInputStream ObjectInputValidation ObjectOutput ObjectOutputStream ObjectStreamClass ObjectStreamConstants ObjectStreamException ObjectStreamField Observable Observer OpenType Operation OptionalDataException OutOfMemoryError OutputStream OutputStreamWriter OverlappingFileLockException Owner PKCS8EncodedKeySpec PKIXBuilderParameters PKIXCertPathBuilderResult PKIXCertPathChecker PKIXCertPathValidatorResult PKIXParameters Package PackedColorModel PageAttributes PageFormat Pageable Paint PaintContext PaintEvent Panel PanelPeer Paper ParameterBlock ParameterDescriptor ParameterMetaData ParseException ParsePosition PasswordAuthentication PathIterator Pattern PatternEntry PatternSyntaxException Permission PermissionCollection Permissions PersistenceDelegate PhantomReference Pipe PipedInputStream PipedOutputStream PipedReader PipedWriter PixelGrabber PixelInterleavedSampleModel PlainDatagramSocketImpl PlainSocketImpl Point Point2D Policy PolicyNode PolicyQualifierInfo Polygon PopupMenu PopupMenuPeer PortUnreachableException PreferenceChangeEvent PreferenceChangeListener Preferences PreferencesFactory PreparedStatement Principal PrintGraphics PrintJob PrintStream PrintWriter Printable PrinterAbortException PrinterException PrinterGraphics PrinterIOException PrinterJob PrivateKey PrivilegedAction PrivilegedActionException PrivilegedExceptionAction Process ProfileDataException Properties PropertyChangeEvent PropertyChangeListener PropertyChangeListenerProxy PropertyChangeSupport PropertyDescriptor PropertyEditor PropertyEditorManager PropertyEditorSupport PropertyPermission PropertyResourceBundle PropertyVetoException ProtectionDomain ProtocolException Provider ProviderException Proxy PublicKey PushbackInputStream PushbackReader QuadCurve2D QuadIterator RBCollationTables RBTableBuilder RGBImageFilter RMIClassLoader RMIClassLoaderSpi RMIClientSocketFactory RMIFailureHandler RMISecurityException RMISecurityManager RMIServerSocketFactory RMISocketFactory RSAKey RSAKeyGenParameterSpec RSAPrivateCrtKey RSAPrivateCrtKeySpec RSAPrivateKey RSAPrivateKeySpec RSAPublicKey RSAPublicKeySpec Random RandomAccess RandomAccessFile Raster RasterFormatException RasterOp ReadOnlyBufferException ReadableByteChannel Reader RectIterator Rectangle Rectangle2D RectangularShape Ref Reference ReferenceQueue ReflectAccess ReflectPermission Registry RegistryHandler Remote RemoteCall RemoteException RemoteObject RemoteRef RemoteServer RemoteStub RenderContext RenderableImage RenderableImageOp RenderableImageProducer RenderedImage RenderedImageFactory RenderingHints ReplicateScaleFilter RescaleOp ResourceBundle ResultSet ResultSetMetaData Robot RobotPeer RoundRectIterator RoundRectangle2D RuleBasedBreakIterator RuleBasedCollator Runnable Runtime RuntimeException RuntimePermission SQLData SQLException SQLInput SQLOutput SQLPermission SQLWarning SampleModel Savepoint ScatteringByteChannel ScrollPane ScrollPaneAdjustable ScrollPanePeer Scrollbar ScrollbarPeer SecureClassLoader SecureRandom SecureRandomSpi Security SecurityException SecurityManager SecurityPermission SelectableChannel SelectionKey Selector SelectorProvider SentEvent SentenceBreakData SequenceInputStream SequencedEvent Serializable SerializablePermission SerializationTester ServerCloneException ServerError ServerException ServerNotActiveException ServerRef ServerRuntimeException ServerSocket ServerSocketChannel Set Shape ShapeGraphicAttribute Short ShortBuffer ShortLookupTable Shutdown Signature SignatureException SignatureSpi SignedMutableBigInteger SignedObject Signer SimpleBeanInfo SimpleDateFormat SimpleFormatter SimpleTextBoundary SimpleTimeZone SinglePixelPackedSampleModel Skeleton SkeletonMismatchException SkeletonNotFoundException Socket SocketAddress SocketChannel SocketException SocketHandler SocketImpl SocketImplFactory SocketInputStream SocketOptions SocketOutputStream SocketPermission SocketSecurityException SocketTimeoutException SocksConsts SocksSocketImpl SocksSocketImplFactory SoftReference SortedMap SortedSet SpecialMapping Stack StackOverflowError StackTraceElement Statement StreamCorruptedException StreamHandler StreamTokenizer StrictMath String StringBuffer StringBufferInputStream StringCharBuffer StringCharacterIterator StringCoding StringIndexOutOfBoundsException StringReader StringSelection StringTokenizer StringWriter Stroke Struct StubNotFoundException StyledParagraph SyncFailedException System SystemColor SystemFlavorMap Terminator TextArea TextAreaPeer TextAttribute TextBoundaryData TextComponent TextComponentPeer TextEvent TextField TextFieldPeer TextHitInfo TextJustifier TextLayout TextLine TextListener TextMeasurer TexturePaint TexturePaintContext Thread ThreadDeath ThreadGroup ThreadLocal Throwable TileObserver Time TimeZone TimeoutException Timer TimerTask Timestamp TooManyListenersException Toolkit Transferable TransformAttribute Transparency TreeMap TreeSet TrustAnchor Types UID UNIXProcess URI URISyntaxException URL URLClassLoader URLConnection URLDecoder URLEncoder URLStreamHandler URLStreamHandlerFactory UTFDataFormatException UnconnectedChannelException UndeclaredThrowableException UnexpectedException UnicastRemoteObject UnicodeClassMapping UnixFileSystem UnknownError UnknownGroupException UnknownHostException UnknownObjectException UnknownServiceException UnmappableCharacterException UnmarshalException UnrecoverableKeyException Unreferenced UnresolvedPermission UnresolvedPermissionCollection UnsatisfiedLinkError UnsupportedCharsetException UnsupportedClassVersionError UnsupportedEncodingException UnsupportedFlavorException UnsupportedOperationException VMID Vector VerifyError VetoableChangeListener VetoableChangeListenerProxy VetoableChangeSupport VirtualMachineError Visibility Void VolatileImage WeakHashMap WeakReference Window WindowAdapter WindowEvent WindowFocusListener WindowListener WindowPeer WindowStateListener WordBreakData WordBreakTable WritableByteChannel WritableRaster WritableRenderedImage WriteAbortedException Writer X-Buffer X-Buffer-bin X509CRL X509CRLEntry X509CRLSelector X509CertSelector X509Certificate X509EncodedKeySpec X509Extension XMLDecoder XMLEncoder XMLFormatter XmlSupport ZipConstants ZipEntry ZipException ZipFile ZipInputStream ZipOutputStream acl activation applet awt beancontext beans cert channels charset color datatransfer dgc dnd event font geom im image interfaces io jar lang logging math net nio peer prefs print ref reflect regex registry renderable rmi security server spec spi sql text util zip jsr166/src/test/loops/RLJBar.java0000644000000000000000000001255211551700072013623 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ // Yet another contended object monitor throughput test // adapted from bug reports import java.util.*; import java.lang.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; class Producer extends Thread { // private static Hashtable buddiesOnline = new Hashtable(); private static Map buddiesOnline = new ConcurrentHashMap(); public Producer(String name) { super(name); } public void run() { Object key = null; final ReentrantLock dr = RLJBar.DeathRow; final ReentrantLock bar = RLJBar.bar; final ReentrantLock end = RLJBar.End; final Condition endCondition = RLJBar.EndCondition; if (RLJBar.OneKey) key = new Integer(0); // per-thread v. per iteration // The barrier has a number of interesting effects: // 1. It enforces full LWP provisioning on T1. // (nearly all workers park concurrently). // 2. It gives the C2 compiler thread(s) a chance to run. // By transiently quiescing the workings the C2 threads // might avoid starvation. // try { bar.lock(); try { ++RLJBar.nUp; if (RLJBar.nUp == RLJBar.nThreads) { if (RLJBar.quiesce != 0) { RLJBar.barCondition.awaitNanos(RLJBar.quiesce * 1000000); } RLJBar.epoch = System.currentTimeMillis(); RLJBar.barCondition.signalAll(); // System.out.print ("Consensus "); } if (RLJBar.UseBar) { while (RLJBar.nUp != RLJBar.nThreads) { RLJBar.barCondition.await(); } } } finally { bar.unlock(); } } catch (Exception ex) { System.out.println("Exception in barrier: " + ex); } // Main execution time ... the code being timed ... // HashTable.get() is highly contended (serial). for (int loop = 1; loop < 100000 ;loop++) { if (!RLJBar.OneKey) key = new Integer(0); buddiesOnline.get(key); } // Mutator epilog: // The following code determines if the test will/wont include (measure) // thread death time. end.lock(); try { ++RLJBar.nDead; if (RLJBar.nDead == RLJBar.nUp) { // System.out.print((System.currentTimeMillis()-RLJBar.epoch) + " ms"); endCondition.signalAll(); } } finally { end.unlock(); } dr.lock(); dr.unlock(); } } public class RLJBar // ProdConsTest { public static final int ITERS = 10; public static boolean OneKey = false; // alloc once or once per iteration public static boolean UseBar = false; public static int nThreads = 100; public static int nUp = 0; public static int nDead = 0; public static ReentrantLock bar = new ReentrantLock(); public static Condition barCondition = bar.newCondition(); public static long epoch; public static ReentrantLock DeathRow = new ReentrantLock(); public static ReentrantLock End = new ReentrantLock(); public static int quiesce = 0; public static Condition EndCondition = End.newCondition(); public static void main(String[] args) { int argix = 0; if (argix < args.length && args[argix].equals("-o")) { ++argix; OneKey = true; System.out.println("OneKey"); } if (argix < args.length && args[argix].equals ("-b")) { ++argix; UseBar = true; System.out.println("UseBar"); } if (argix < args.length && args[argix].equals ("-q")) { ++argix; if (argix < args.length) { quiesce = Integer.parseInt(args[argix++]); System.out.println("Quiesce " + quiesce + " msecs"); } } for (int k = 0; k < ITERS; ++k) oneRun(); } public static void oneRun() { DeathRow = new ReentrantLock(); End = new ReentrantLock(); EndCondition = End.newCondition(); nDead = nUp = 0; long cyBase = System.currentTimeMillis(); DeathRow.lock(); try { for (int i = 1; i <= nThreads; i++) { new Producer("Producer" + i).start(); } try { End.lock(); try { while (nDead != nThreads) EndCondition.await(); } finally { End.unlock(); } } catch (Exception ex) { System.out.println("Exception in End: " + ex); } } finally { DeathRow.unlock(); } System.out.println("Outer time: " + (System.currentTimeMillis()-cyBase)); // Let workers quiesce/exit. try { Thread.sleep (1000); } catch (Exception ex) {}; } } jsr166/src/test/loops/TimeoutMutexLoops.java0000644000000000000000000000635011537741072016245 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * Checks for responsiveness of locks to timeouts. Runs under the * assumption that ITERS computations require more than TIMEOUT msecs * to complete, which seems to be a safe assumption for another * decade. */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class TimeoutMutexLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static final int ITERS = Integer.MAX_VALUE; static final long TIMEOUT = 100; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; for (int i = 1; i <= maxThreads; i += (i+1) >>> 1) { System.out.print("Threads: " + i); new MutexLoop(i).test(); Thread.sleep(TIMEOUT); } pool.shutdown(); } static final class MutexLoop implements Runnable { private int v = rng.next(); private volatile boolean completed; private volatile int result = 17; private final Mutex lock = new Mutex(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; MutexLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); Thread.sleep(TIMEOUT); lock.lock(); barrier.await(); if (print) { long time = timer.getTime(); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } if (completed) throw new Error("Some thread completed instead of timing out"); int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v; int x = 0; int n = ITERS; do { if (!lock.tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) break; try { v = x = LoopHelpers.compute1(v); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } while (n-- > 0); if (n <= 0) completed = true; barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/SimpleNoLockLoops.java0000644000000000000000000000635711537741072016142 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class SimpleNoLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 2000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); new ReentrantLockLoop(1).test(); new ReentrantLockLoop(1).test(); print = true; int k = 1; for (int i = 1; i <= maxThreads;) { System.out.print("Threads: " + i); new ReentrantLockLoop(i).test(); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v + 1; int x = 0; int n = iters; while (n-- > 0) { int k = (sum & 3); if (k > 0) { x = v; while (k-- > 0) x = LoopHelpers.compute6(x); v = x; } else x = sum + 1; if ((x += readBarrier) == 0) ++readBarrier; for (int l = x & 1; l > 0; --l) sum += LoopHelpers.compute6(sum); } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/ReadHoldingWriteLock.java0000644000000000000000000001102111537741071016551 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.locks.*; class ReadHoldingWriteLock { public static void main(String[] args) throws Exception { ReadHoldingWriteLock t = new ReadHoldingWriteLock(); t.testReadAfterWriteLock(); t.testReadHoldingWriteLock(); t.testReadHoldingWriteLock2(); t.testReadHoldingWriteLockFair(); t.testReadHoldingWriteLockFair2(); } static final long SHORT_DELAY_MS = 50; static final long MEDIUM_DELAY_MS = 200; void assertTrue(boolean b) { if (!b) throw new Error(); } /** * Readlocks succeed after a writing thread unlocks */ public void testReadAfterWriteLock() throws Exception { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.writeLock().lock(); Thread t1 = new Thread(new Runnable() { public void run() { lock.readLock().lock(); lock.readLock().unlock(); } }); Thread t2 = new Thread(new Runnable() { public void run() { lock.readLock().lock(); lock.readLock().unlock(); } }); t1.start(); t2.start(); Thread.sleep(SHORT_DELAY_MS); lock.writeLock().unlock(); t1.join(MEDIUM_DELAY_MS); t2.join(MEDIUM_DELAY_MS); assertTrue(!t1.isAlive()); assertTrue(!t2.isAlive()); } /** * Read trylock succeeds if write locked by current thread */ public void testReadHoldingWriteLock()throws Exception { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.writeLock().lock(); assertTrue(lock.readLock().tryLock()); lock.readLock().unlock(); lock.writeLock().unlock(); } /** * Read lock succeeds if write locked by current thread even if * other threads are waiting */ public void testReadHoldingWriteLock2() throws Exception{ final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.writeLock().lock(); Thread t1 = new Thread(new Runnable() { public void run() { lock.readLock().lock(); lock.readLock().unlock(); } }); Thread t2 = new Thread(new Runnable() { public void run() { lock.readLock().lock(); lock.readLock().unlock(); } }); t1.start(); t2.start(); lock.readLock().lock(); lock.readLock().unlock(); Thread.sleep(SHORT_DELAY_MS); lock.readLock().lock(); lock.readLock().unlock(); lock.writeLock().unlock(); t1.join(MEDIUM_DELAY_MS); t2.join(MEDIUM_DELAY_MS); assertTrue(!t1.isAlive()); assertTrue(!t2.isAlive()); } /** * Fair Read trylock succeeds if write locked by current thread */ public void testReadHoldingWriteLockFair() throws Exception{ final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); lock.writeLock().lock(); assertTrue(lock.readLock().tryLock()); lock.readLock().unlock(); lock.writeLock().unlock(); } /** * Fair Read lock succeeds if write locked by current thread even if * other threads are waiting */ public void testReadHoldingWriteLockFair2() throws Exception { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); lock.writeLock().lock(); Thread t1 = new Thread(new Runnable() { public void run() { lock.readLock().lock(); lock.readLock().unlock(); } }); Thread t2 = new Thread(new Runnable() { public void run() { lock.readLock().lock(); lock.readLock().unlock(); } }); t1.start(); t2.start(); lock.readLock().lock(); lock.readLock().unlock(); Thread.sleep(SHORT_DELAY_MS); lock.readLock().lock(); lock.readLock().unlock(); lock.writeLock().unlock(); t1.join(MEDIUM_DELAY_MS); t2.join(MEDIUM_DELAY_MS); assertTrue(!t1.isAlive()); assertTrue(!t2.isAlive()); } } jsr166/src/test/loops/OfferPollLoops.java0000644000000000000000000001653111537741071015465 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; //import jsr166y.*; public class OfferPollLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final Random rng = new Random(); static final ExecutorService pool = Executors.newCachedThreadPool(); static boolean print = false; static int producerSum; static int consumerSum; static synchronized void addProducerSum(int x) { producerSum += x; } static synchronized void addConsumerSum(int x) { consumerSum += x; } static synchronized void checkSum() { if (producerSum != consumerSum) throw new Error("CheckSum mismatch"); } // Number of elements passed around -- must be power of two // Elements are reused from pool to minimize alloc impact static final int POOL_SIZE = 1 << 8; static final int POOL_MASK = POOL_SIZE-1; static final Integer[] intPool = new Integer[POOL_SIZE]; static { for (int i = 0; i < POOL_SIZE; ++i) intPool[i] = Integer.valueOf(i); } // Number of puts by producers or takes by consumers static final int ITERS = 1 << 20; // max lag between a producer and consumer to avoid // this becoming a GC test rather than queue test. // Used only per-pair to lessen impact on queue sync static final int LAG_MASK = (1 << 12) - 1; public static void main(String[] args) throws Exception { int maxN = NCPUS * 3 / 2; if (args.length > 0) maxN = Integer.parseInt(args[0]); warmup(); print = true; int k = 1; for (int i = 1; i <= maxN;) { System.out.println("Pairs:" + i); oneTest(i, ITERS); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static void warmup() throws Exception { print = false; System.out.print("Warmup "); int it = 2000; for (int j = 5; j > 0; --j) { oneTest(j, it); System.out.print("."); it += 1000; } System.gc(); it = 20000; for (int j = 5; j > 0; --j) { oneTest(j, it); System.out.print("."); it += 10000; } System.gc(); System.out.println(); } static void oneTest(int n, int iters) throws Exception { int fairIters = iters/16; Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue "); oneRun(new LinkedTransferQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("ConcurrentLinkedQueue "); oneRun(new ConcurrentLinkedQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("ConcurrentLinkedDeque "); oneRun(new ConcurrentLinkedDeque(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingQueue(cap)"); oneRun(new LinkedBlockingQueue(POOL_SIZE), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingDeque "); oneRun(new LinkedBlockingDeque(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("ArrayBlockingQueue "); oneRun(new ArrayBlockingQueue(POOL_SIZE), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("PriorityBlockingQueue "); oneRun(new PriorityBlockingQueue(), n, fairIters); Thread.sleep(100); // System.gc(); if (print) System.out.print("ArrayBlockingQueue(fair)"); oneRun(new ArrayBlockingQueue(POOL_SIZE, true), n, fairIters); } abstract static class Stage implements Runnable { final int iters; final Queue queue; final CyclicBarrier barrier; final Phaser lagPhaser; Stage(Queue q, CyclicBarrier b, Phaser s, int iters) { queue = q; barrier = b; lagPhaser = s; this.iters = iters; } } static class Producer extends Stage { Producer(Queue q, CyclicBarrier b, Phaser s, int iters) { super(q, b, s, iters); } public void run() { try { barrier.await(); int ps = 0; int r = hashCode(); int i = 0; for (;;) { r = LoopHelpers.compute7(r); Integer v = intPool[r & POOL_MASK]; int k = v.intValue(); if (queue.offer(v)) { ps += k; ++i; if (i >= iters) break; if ((i & LAG_MASK) == LAG_MASK) lagPhaser.arriveAndAwaitAdvance(); } } addProducerSum(ps); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static class Consumer extends Stage { Consumer(Queue q, CyclicBarrier b, Phaser s, int iters) { super(q, b, s, iters); } public void run() { try { barrier.await(); int cs = 0; int i = 0; for (;;) { Integer v = queue.poll(); if (v != null) { int k = v.intValue(); cs += k; ++i; if (i >= iters) break; if ((i & LAG_MASK) == LAG_MASK) lagPhaser.arriveAndAwaitAdvance(); } } addConsumerSum(cs); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static void oneRun(Queue q, int n, int iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(n * 2 + 1, timer); for (int i = 0; i < n; ++i) { Phaser s = new Phaser(2); pool.execute(new Producer(q, barrier, s, iters)); pool.execute(new Consumer(q, barrier, s, iters)); } barrier.await(); barrier.await(); long time = timer.getTime(); checkSum(); if (print) System.out.println("\t: " + LoopHelpers.rightJustify(time / (iters * n)) + " ns per transfer"); } } jsr166/src/test/loops/CASLoops.java0000644000000000000000000004645111537741071014207 0ustar /* * Written by Doug Lea and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * Estimates the difference in time for compareAndSet and CAS-like * operations versus unsynchronized, non-volatile pseudo-CAS when * updating random numbers. These estimates thus give the cost * of atomicity/barriers/exclusion over and above the time to * just compare and conditionally store (int) values, so are * not intended to measure the "raw" cost of a CAS. * * Outputs, in nanoseconds: * "Atomic CAS" AtomicInteger.compareAndSet * "Updater CAS" CAS first comparing args * "Volatile" pseudo-CAS using volatile store if comparison succeeds * "Mutex" emulated compare and set done under AQS-based mutex lock * "Synchronized" emulated compare and set done under a synchronized block. * * By default, these are printed for 1..#cpus threads, but you can * change the upper bound number of threads by providing the * first argument to this program. * * The last two kinds of runs (mutex and synchronized) are done only * if this program is called with (any) second argument */ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; import java.util.concurrent.*; import java.util.concurrent.locks.*; public class CASLoops { static final int TRIALS = 2; static final long BASE_SECS_PER_RUN = 4; static final int NCPUS = Runtime.getRuntime().availableProcessors(); static int maxThreads = NCPUS; static boolean includeLocks = false; public static void main(String[] args) throws Exception { if (args.length > 0) maxThreads = Integer.parseInt(args[0]); loopIters = new long[maxThreads+1]; if (args.length > 1) includeLocks = true; System.out.println("Warmup..."); for (int i = maxThreads; i > 0; --i) { runCalibration(i, 10); oneRun(i, loopIters[i] / 4, false); System.out.print("."); } for (int i = 1; i <= maxThreads; ++i) loopIters[i] = 0; for (int j = 0; j < 2; ++j) { for (int i = 1; i <= maxThreads; ++i) { runCalibration(i, 1000); oneRun(i, loopIters[i] / 8, false); System.out.print("."); } } for (int i = 1; i <= maxThreads; ++i) loopIters[i] = 0; for (int j = 0; j < TRIALS; ++j) { System.out.println("Trial " + j); for (int i = 1; i <= maxThreads; ++i) { runCalibration(i, BASE_SECS_PER_RUN * 1000L); oneRun(i, loopIters[i], true); } } } static final AtomicLong totalIters = new AtomicLong(0); static final AtomicLong successes = new AtomicLong(0); static final AtomicInteger sum = new AtomicInteger(0); static final LoopHelpers.MarsagliaRandom rng = new LoopHelpers.MarsagliaRandom(); static long[] loopIters; static final class NonAtomicInteger { volatile int readBarrier; int value; NonAtomicInteger() {} int get() { int junk = readBarrier; return value; } boolean compareAndSet(int cmp, int val) { if (value == cmp) { value = val; return true; } return false; } void set(int val) { value = val; } } static final class UpdaterAtomicInteger { volatile int value; static final AtomicIntegerFieldUpdater valueUpdater = AtomicIntegerFieldUpdater.newUpdater (UpdaterAtomicInteger.class, "value"); UpdaterAtomicInteger() {} int get() { return value; } boolean compareAndSet(int cmp, int val) { return valueUpdater.compareAndSet(this, cmp, val); } void set(int val) { value = val; } } static final class VolatileInteger { volatile int value; VolatileInteger() {} int get() { return value; } boolean compareAndSet(int cmp, int val) { if (value == cmp) { value = val; return true; } return false; } void set(int val) { value = val; } } static final class SynchedInteger { int value; SynchedInteger() {} int get() { return value; } synchronized boolean compareAndSet(int cmp, int val) { if (value == cmp) { value = val; return true; } return false; } synchronized void set(int val) { value = val; } } static final class LockedInteger extends AbstractQueuedSynchronizer { int value; LockedInteger() {} public boolean tryAcquire(int acquires) { return compareAndSetState(0, 1); } public boolean tryRelease(int releases) { setState(0); return true; } void lock() { acquire(1); } void unlock() { release(1); } int get() { return value; } boolean compareAndSet(int cmp, int val) { lock(); try { if (value == cmp) { value = val; return true; } return false; } finally { unlock(); } } void set(int val) { lock(); try { value = val; } finally { unlock(); } } } // All these versions are copy-paste-hacked to avoid // contamination with virtual call resolution etc. // Use fixed-length unrollable inner loops to reduce safepoint checks static final int innerPerOuter = 16; static final class NonAtomicLoop implements Runnable { final long iters; final NonAtomicInteger obj; final CyclicBarrier barrier; NonAtomicLoop(long iters, NonAtomicInteger obj, CyclicBarrier b) { this.iters = iters; this.obj = obj; this.barrier = b; obj.set(rng.next()); } public void run() { try { barrier.await(); long i = iters; int y = 0; int succ = 0; while (i > 0) { for (int k = 0; k < innerPerOuter; ++k) { int x = obj.get(); int z = y + LoopHelpers.compute6(x); if (obj.compareAndSet(x, z)) ++succ; y = LoopHelpers.compute7(z); } i -= innerPerOuter; } sum.getAndAdd(obj.get()); successes.getAndAdd(succ); barrier.await(); } catch (Exception ie) { return; } } } static final class AtomicLoop implements Runnable { final long iters; final AtomicInteger obj; final CyclicBarrier barrier; AtomicLoop(long iters, AtomicInteger obj, CyclicBarrier b) { this.iters = iters; this.obj = obj; this.barrier = b; obj.set(rng.next()); } public void run() { try { barrier.await(); long i = iters; int y = 0; int succ = 0; while (i > 0) { for (int k = 0; k < innerPerOuter; ++k) { int x = obj.get(); int z = y + LoopHelpers.compute6(x); if (obj.compareAndSet(x, z)) ++succ; y = LoopHelpers.compute7(z); } i -= innerPerOuter; } sum.getAndAdd(obj.get()); successes.getAndAdd(succ); barrier.await(); } catch (Exception ie) { return; } } } static final class UpdaterAtomicLoop implements Runnable { final long iters; final UpdaterAtomicInteger obj; final CyclicBarrier barrier; UpdaterAtomicLoop(long iters, UpdaterAtomicInteger obj, CyclicBarrier b) { this.iters = iters; this.obj = obj; this.barrier = b; obj.set(rng.next()); } public void run() { try { barrier.await(); long i = iters; int y = 0; int succ = 0; while (i > 0) { for (int k = 0; k < innerPerOuter; ++k) { int x = obj.get(); int z = y + LoopHelpers.compute6(x); if (obj.compareAndSet(x, z)) ++succ; y = LoopHelpers.compute7(z); } i -= innerPerOuter; } sum.getAndAdd(obj.get()); successes.getAndAdd(succ); barrier.await(); } catch (Exception ie) { return; } } } static final class VolatileLoop implements Runnable { final long iters; final VolatileInteger obj; final CyclicBarrier barrier; VolatileLoop(long iters, VolatileInteger obj, CyclicBarrier b) { this.iters = iters; this.obj = obj; this.barrier = b; obj.set(rng.next()); } public void run() { try { barrier.await(); long i = iters; int y = 0; int succ = 0; while (i > 0) { for (int k = 0; k < innerPerOuter; ++k) { int x = obj.get(); int z = y + LoopHelpers.compute6(x); if (obj.compareAndSet(x, z)) ++succ; y = LoopHelpers.compute7(z); } i -= innerPerOuter; } sum.getAndAdd(obj.get()); successes.getAndAdd(succ); barrier.await(); } catch (Exception ie) { return; } } } static final class SynchedLoop implements Runnable { final long iters; final SynchedInteger obj; final CyclicBarrier barrier; SynchedLoop(long iters, SynchedInteger obj, CyclicBarrier b) { this.iters = iters; this.obj = obj; this.barrier = b; obj.set(rng.next()); } public void run() { try { barrier.await(); long i = iters; int y = 0; int succ = 0; while (i > 0) { for (int k = 0; k < innerPerOuter; ++k) { int x = obj.get(); int z = y + LoopHelpers.compute6(x); if (obj.compareAndSet(x, z)) ++succ; y = LoopHelpers.compute7(z); } i -= innerPerOuter; } sum.getAndAdd(obj.get()); successes.getAndAdd(succ); barrier.await(); } catch (Exception ie) { return; } } } static final class LockedLoop implements Runnable { final long iters; final LockedInteger obj; final CyclicBarrier barrier; LockedLoop(long iters, LockedInteger obj, CyclicBarrier b) { this.iters = iters; this.obj = obj; this.barrier = b; obj.set(rng.next()); } public void run() { try { barrier.await(); long i = iters; int y = 0; int succ = 0; while (i > 0) { for (int k = 0; k < innerPerOuter; ++k) { int x = obj.get(); int z = y + LoopHelpers.compute6(x); if (obj.compareAndSet(x, z)) ++succ; y = LoopHelpers.compute7(z); } i -= innerPerOuter; } sum.getAndAdd(obj.get()); successes.getAndAdd(succ); barrier.await(); } catch (Exception ie) { return; } } } static final int loopsPerTimeCheck = 2048; static final class NACalibrationLoop implements Runnable { final long endTime; final NonAtomicInteger obj; final CyclicBarrier barrier; NACalibrationLoop(long endTime, NonAtomicInteger obj, CyclicBarrier b) { this.endTime = endTime; this.obj = obj; this.barrier = b; obj.set(rng.next()); } public void run() { try { barrier.await(); long iters = 0; int y = 0; int succ = 0; do { int i = loopsPerTimeCheck; while (i > 0) { for (int k = 0; k < innerPerOuter; ++k) { int x = obj.get(); int z = y + LoopHelpers.compute6(x); if (obj.compareAndSet(x, z)) ++succ; y = LoopHelpers.compute7(z); } i -= innerPerOuter; } iters += loopsPerTimeCheck; } while (System.currentTimeMillis() < endTime); totalIters.getAndAdd(iters); sum.getAndAdd(obj.get()); successes.getAndAdd(succ); barrier.await(); } catch (Exception ie) { return; } } } static void runCalibration(int n, long nms) throws Exception { long now = System.currentTimeMillis(); long endTime = now + nms; CyclicBarrier b = new CyclicBarrier(n+1); totalIters.set(0); NonAtomicInteger a = new NonAtomicInteger(); for (int j = 0; j < n; ++j) new Thread(new NACalibrationLoop(endTime, a, b)).start(); b.await(); b.await(); long ipt = totalIters.get() / n; if (ipt > loopIters[n]) loopIters[n] = ipt; if (sum.get() == 0) System.out.print(" "); } static long runNonAtomic(int n, long iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier b = new CyclicBarrier(n+1, timer); NonAtomicInteger a = new NonAtomicInteger(); for (int j = 0; j < n; ++j) new Thread(new NonAtomicLoop(iters, a, b)).start(); b.await(); b.await(); if (sum.get() == 0) System.out.print(" "); return timer.getTime(); } static long runUpdaterAtomic(int n, long iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier b = new CyclicBarrier(n+1, timer); UpdaterAtomicInteger a = new UpdaterAtomicInteger(); for (int j = 0; j < n; ++j) new Thread(new UpdaterAtomicLoop(iters, a, b)).start(); b.await(); b.await(); if (sum.get() == 0) System.out.print(" "); return timer.getTime(); } static long runAtomic(int n, long iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier b = new CyclicBarrier(n+1, timer); AtomicInteger a = new AtomicInteger(); for (int j = 0; j < n; ++j) new Thread(new AtomicLoop(iters, a, b)).start(); b.await(); b.await(); if (sum.get() == 0) System.out.print(" "); return timer.getTime(); } static long runVolatile(int n, long iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier b = new CyclicBarrier(n+1, timer); VolatileInteger a = new VolatileInteger(); for (int j = 0; j < n; ++j) new Thread(new VolatileLoop(iters, a, b)).start(); b.await(); b.await(); if (sum.get() == 0) System.out.print(" "); return timer.getTime(); } static long runSynched(int n, long iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier b = new CyclicBarrier(n+1, timer); SynchedInteger a = new SynchedInteger(); for (int j = 0; j < n; ++j) new Thread(new SynchedLoop(iters, a, b)).start(); b.await(); b.await(); if (sum.get() == 0) System.out.print(" "); return timer.getTime(); } static long runLocked(int n, long iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier b = new CyclicBarrier(n+1, timer); LockedInteger a = new LockedInteger(); for (int j = 0; j < n; ++j) new Thread(new LockedLoop(iters, a, b)).start(); b.await(); b.await(); if (sum.get() == 0) System.out.print(" "); return timer.getTime(); } static void report(String tag, long runtime, long basetime, int nthreads, long iters) { System.out.print(tag); long t = (runtime - basetime) / iters; if (nthreads > NCPUS) t = t * NCPUS / nthreads; System.out.print(LoopHelpers.rightJustify(t)); double secs = (double) runtime / 1000000000.0; System.out.println("\t " + secs + "s run time"); } static void oneRun(int i, long iters, boolean print) throws Exception { if (print) System.out.println("threads : " + i + " base iters per thread per run : " + LoopHelpers.rightJustify(loopIters[i])); long ntime = runNonAtomic(i, iters); if (print) report("Base : ", ntime, ntime, i, iters); Thread.sleep(100L); long atime = runAtomic(i, iters); if (print) report("Atomic CAS : ", atime, ntime, i, iters); Thread.sleep(100L); long gtime = runUpdaterAtomic(i, iters); if (print) report("Updater CAS : ", gtime, ntime, i, iters); Thread.sleep(100L); long vtime = runVolatile(i, iters); if (print) report("Volatile : ", vtime, ntime, i, iters); Thread.sleep(100L); if (!includeLocks) return; long mtime = runLocked(i, iters); if (print) report("Mutex : ", mtime, ntime, i, iters); Thread.sleep(100L); long stime = runSynched(i, iters); if (print) report("Synchronized: ", stime, ntime, i, iters); Thread.sleep(100L); } } jsr166/src/test/loops/Sync100M.java0000644000000000000000000000217211537741072014027 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ class Sync100M { public static void main(String[] args) throws Exception { int x = loop((int) System.nanoTime(), 100000); x = loop(x, 100000); x = loop(x, 100000); long start = System.nanoTime(); x = loop(x, 100000000); if (x == 0) System.out.print(" "); long time = System.nanoTime() - start; double secs = (double) time / 1000000000.0; System.out.println("time: " + secs); start = System.nanoTime(); x = loop(x, 100000000); if (x == 0) System.out.print(" "); time = System.nanoTime() - start; secs = (double) time / 1000000000.0; System.out.println("time: " + secs); } static final Object obj = new Object(); static int loop(int x, int iters) { for (int i = iters; i > 0; --i) { synchronized (obj) { x = x * 134775813 + 1; } } return x; } } jsr166/src/test/loops/SimpleLockLoops.java0000644000000000000000000000653311537741072015641 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class SimpleLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 2000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); new LockLoop(1).test(); new LockLoop(1).test(); print = true; int k = 1; for (int i = 1; i <= maxThreads;) { System.out.print("Threads: " + i); new LockLoop(i).test(); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static final class LockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final Object lock = new Object(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; LockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { final Object lock = this.lock; try { barrier.await(); int sum = v + 1; int x = 0; int n = iters; while (n-- > 0) { synchronized (lock) { int k = (sum & 3); if (k > 0) { x = v; while (k-- > 0) x = LoopHelpers.compute6(x); v = x; } else x = sum + 1; } if ((x += readBarrier) == 0) ++readBarrier; for (int l = x & 7; l > 0; --l) sum += LoopHelpers.compute6(sum); } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/DynamicLeftSpineFib.java0000644000000000000000000000701011475011736016366 0ustar import java.util.concurrent.*; import java.util.*; import java.util.concurrent.TimeUnit; //import java.util.concurrent.*; public final class DynamicLeftSpineFib extends RecursiveAction { static long lastStealCount; public static void main(String[] args) throws Exception { int procs = 0; int num = 45; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) num = Integer.parseInt(args[1]); } catch (Exception e) { System.out.println("Usage: java DynamicLeftSpineFib []"); return; } for (int reps = 0; reps < 2; ++reps) { ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); lastStealCount = g.getStealCount(); for (int i = 0; i < 20; ++i) { test(g, num); } System.out.println(g); g.shutdown(); if (!g.awaitTermination(10, TimeUnit.SECONDS)) throw new Error(); Thread.sleep(1000); } } static void test(ForkJoinPool g, int num) throws Exception { int ps = g.getParallelism(); long start = System.currentTimeMillis(); DynamicLeftSpineFib f = new DynamicLeftSpineFib(num, null); g.invoke(f); long time = System.currentTimeMillis() - start; double secs = ((double)time) / 1000.0; long result = f.getAnswer(); System.out.print("DLSFib " + num + " = " + result); System.out.printf("\tTime: %7.3f", secs); long sc = g.getStealCount(); long ns = sc - lastStealCount; lastStealCount = sc; System.out.printf(" Steals/t: %5d", ns/ps); System.out.printf(" Workers: %8d", g.getPoolSize()); System.out.println(); } // Initialized with argument; replaced with result int number; DynamicLeftSpineFib next; DynamicLeftSpineFib(int n, DynamicLeftSpineFib nxt) { number = n; next = nxt; } int getAnswer() { return number; } public void compute() { number = fib(number); } static final int fib(int n) { if (n <= 1) return n; int r = 0; DynamicLeftSpineFib rt = null; while (getSurplusQueuedTaskCount() <= 3) { int m = n - 2; n -= 1; if (m <= 1) { r += m; if (n > 1) { r += n - 2; n -= 1; } break; } (rt = new DynamicLeftSpineFib(m, rt)).fork(); } if (n <= 1) r += n; else r += seqFib(n - 2) + fib(n - 1); if (rt != null) r += collectRights(rt); return r; } static final int collectRights(DynamicLeftSpineFib rt) { int r = 0; while (rt != null) { DynamicLeftSpineFib rn = rt.next; rt.next = null; if (rt.tryUnfork()) r += fib(rt.number); else { rt.join(); r += rt.number; } rt = rn; } return r; } // Sequential version for arguments less than threshold static final int seqFib(int n) { // unroll left only int r = 1; do { int m = n - 2; r += m <= 1 ? m : seqFib(m); } while (--n > 1); return r; } } jsr166/src/test/loops/ConcurrentDequeLoops.java0000644000000000000000000001156011551700072016670 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.concurrent.locks.*; public class ConcurrentDequeLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static AtomicInteger totalItems; static boolean print = false; public static void main(String[] args) throws Exception { int maxStages = 8; int items = 1000000; Class klass = null; if (args.length > 0) { try { klass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } else throw new Error(); if (args.length > 1) maxStages = Integer.parseInt(args[1]); System.out.print("Class: " + klass.getName()); System.out.println(" stages: " + maxStages); print = false; System.out.println("Warmup..."); oneRun(klass, 1, items); Thread.sleep(100); oneRun(klass, 1, items); Thread.sleep(100); print = true; int k = 1; for (int i = 1; i <= maxStages;) { oneRun(klass, i, items); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static class Stage implements Callable { final Deque queue; final CyclicBarrier barrier; final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); int items; Stage(Deque q, CyclicBarrier b, int items) { queue = q; barrier = b; this.items = items; } public Integer call() { // Repeatedly take something from queue if possible, // transform it, and put back in. try { barrier.await(); int l = (int) System.nanoTime(); int takes = 0; for (;;) { Integer item; int rnd = rng.next(); if ((rnd & 1) == 0) item = queue.pollFirst(); else item = queue.pollLast(); if (item != null) { ++takes; l += LoopHelpers.compute2(item.intValue()); } else if (takes != 0) { totalItems.getAndAdd(-takes); takes = 0; } else if (totalItems.get() <= 0) break; l = LoopHelpers.compute1(l); if (items > 0) { --items; Integer res = new Integer(l); if ((rnd & 16) == 0) queue.addFirst(res); else queue.addLast(res); } else { // spinwait for (int k = 1 + (l & 15); k != 0; --k) l = LoopHelpers.compute1(LoopHelpers.compute2(l)); if ((l & 3) == 3) { Thread.sleep(1); } } } return new Integer(l); } catch (Exception ie) { ie.printStackTrace(); throw new Error("Call loop failed"); } } } static void oneRun(Class klass, int n, int items) throws Exception { Deque q = (Deque) klass.newInstance(); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(n + 1, timer); totalItems = new AtomicInteger(n * items); ArrayList> results = new ArrayList>(n); for (int i = 0; i < n; ++i) results.add(pool.submit(new Stage(q, barrier, items))); if (print) System.out.print("Threads: " + n + "\t:"); barrier.await(); int total = 0; for (int i = 0; i < n; ++i) { Future f = results.get(i); Integer r = f.get(); total += r.intValue(); } long endTime = System.nanoTime(); long time = endTime - timer.startTime; if (print) System.out.println(LoopHelpers.rightJustify(time / (items * n)) + " ns per item"); if (total == 0) // avoid overoptimization System.out.println("useless result: " + total); } } jsr166/src/test/loops/LU.java0000644000000000000000000003154111537741071013076 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ //import jsr166y.*; import java.util.concurrent.*; import java.util.concurrent.TimeUnit; /** * LU matrix decomposition demo * Based on those in Cilk and Hood */ public final class LU { /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); // granularity is hard-wired as compile-time constant here static final int BLOCK_SIZE = 16; static final boolean CHECK = false; // set true to check answer public static void main(String[] args) throws Exception { final String usage = "Usage: java LU [runs] \n For example, try java LU 2 512"; int procs = 0; int n = 2048; int runs = 5; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) n = Integer.parseInt(args[1]); if (args.length > 2) runs = Integer.parseInt(args[2]); } catch (Exception e) { System.out.println(usage); return; } if ( ((n & (n - 1)) != 0)) { System.out.println(usage); return; } ForkJoinPool pool = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); System.out.println("procs: " + pool.getParallelism() + " n: " + n + " runs: " + runs); for (int run = 0; run < runs; ++run) { double[][] m = new double[n][n]; randomInit(m, n); double[][] copy = null; if (CHECK) { copy = new double[n][n]; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { copy[i][j] = m[i][j]; } } } Block M = new Block(m, 0, 0); long start = System.nanoTime(); pool.invoke(new LowerUpper(n, M)); long time = System.nanoTime() - start; double secs = ((double)time) / NPS; System.out.printf("\tTime: %7.3f\n", secs); if (CHECK) check(m, copy, n); } System.out.println(pool.toString()); pool.shutdown(); } static void randomInit(double[][] M, int n) { java.util.Random rng = new java.util.Random(); for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) M[i][j] = rng.nextDouble(); // for compatibility with hood demo, force larger diagonals for (int k = 0; k < n; ++k) M[k][k] *= 10.0; } static void check(double[][] LU, double[][] M, int n) { double maxDiff = 0.0; // track max difference for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { double v = 0.0; int k; for (k = 0; k < i && k <= j; k++ ) v += LU[i][k] * LU[k][j]; if (k == i && k <= j ) v += LU[k][j]; double diff = M[i][j] - v; if (diff < 0) diff = -diff; if (diff > 0.001) { System.out.println("large diff at[" + i + "," + j + "]: " + M[i][j] + " vs " + v); } if (diff > maxDiff) maxDiff = diff; } } System.out.println("Max difference = " + maxDiff); } // Blocks record underlying matrix, and offsets into current block static final class Block { final double[][] m; final int loRow; final int loCol; Block(double[][] mat, int lr, int lc) { m = mat; loRow = lr; loCol = lc; } } static final class Schur extends RecursiveAction { final int size; final Block V; final Block W; final Block M; Schur(int size, Block V, Block W, Block M) { this.size = size; this.V = V; this.W = W; this.M = M; } void schur() { // base case for (int j = 0; j < BLOCK_SIZE; ++j) { for (int i = 0; i < BLOCK_SIZE; ++i) { double s = M.m[i+M.loRow][j+M.loCol]; for (int k = 0; k < BLOCK_SIZE; ++k) { s -= V.m[i+V.loRow][k+V.loCol] * W.m[k+W.loRow][j+W.loCol]; } M.m[i+M.loRow][j+M.loCol] = s; } } } public void compute() { if (size == BLOCK_SIZE) { schur(); } else { int h = size / 2; Block M00 = new Block(M.m, M.loRow, M.loCol); Block M01 = new Block(M.m, M.loRow, M.loCol+h); Block M10 = new Block(M.m, M.loRow+h, M.loCol); Block M11 = new Block(M.m, M.loRow+h, M.loCol+h); Block V00 = new Block(V.m, V.loRow, V.loCol); Block V01 = new Block(V.m, V.loRow, V.loCol+h); Block V10 = new Block(V.m, V.loRow+h, V.loCol); Block V11 = new Block(V.m, V.loRow+h, V.loCol+h); Block W00 = new Block(W.m, W.loRow, W.loCol); Block W01 = new Block(W.m, W.loRow, W.loCol+h); Block W10 = new Block(W.m, W.loRow+h, W.loCol); Block W11 = new Block(W.m, W.loRow+h, W.loCol+h); Seq2 s3 = seq(new Schur(h, V10, W01, M11), new Schur(h, V11, W11, M11)); s3.fork(); Seq2 s2 = seq(new Schur(h, V10, W00, M10), new Schur(h, V11, W10, M10)); s2.fork(); Seq2 s1 = seq(new Schur(h, V00, W01, M01), new Schur(h, V01, W11, M01)); s1.fork(); new Schur(h, V00, W00, M00).compute(); new Schur(h, V01, W10, M00).compute(); if (s1.tryUnfork()) s1.compute(); else s1.join(); if (s2.tryUnfork()) s2.compute(); else s2.join(); if (s3.tryUnfork()) s3.compute(); else s3.join(); } } } static final class Lower extends RecursiveAction { final int size; final Block L; final Block M; Lower(int size, Block L, Block M) { this.size = size; this.L = L; this.M = M; } void lower() { // base case for (int i = 1; i < BLOCK_SIZE; ++i) { for (int k = 0; k < i; ++k) { double a = L.m[i+L.loRow][k+L.loCol]; double[] x = M.m[k+M.loRow]; double[] y = M.m[i+M.loRow]; int n = BLOCK_SIZE; for (int p = n-1; p >= 0; --p) { y[p+M.loCol] -= a * x[p+M.loCol]; } } } } public void compute() { if (size == BLOCK_SIZE) { lower(); } else { int h = size / 2; Block M00 = new Block(M.m, M.loRow, M.loCol); Block M01 = new Block(M.m, M.loRow, M.loCol+h); Block M10 = new Block(M.m, M.loRow+h, M.loCol); Block M11 = new Block(M.m, M.loRow+h, M.loCol+h); Block L00 = new Block(L.m, L.loRow, L.loCol); Block L01 = new Block(L.m, L.loRow, L.loCol+h); Block L10 = new Block(L.m, L.loRow+h, L.loCol); Block L11 = new Block(L.m, L.loRow+h, L.loCol+h); Seq3 s1 = seq(new Lower(h, L00, M00), new Schur(h, L10, M00, M10), new Lower(h, L11, M10)); Seq3 s2 = seq(new Lower(h, L00, M01), new Schur(h, L10, M01, M11), new Lower(h, L11, M11)); s2.fork(); s1.compute(); if (s2.tryUnfork()) s2.compute(); else s2.join(); } } } static final class Upper extends RecursiveAction { final int size; final Block U; final Block M; Upper(int size, Block U, Block M) { this.size = size; this.U = U; this.M = M; } void upper() { // base case for (int i = 0; i < BLOCK_SIZE; ++i) { for (int k = 0; k < BLOCK_SIZE; ++k) { double a = M.m[i+M.loRow][k+M.loCol] / U.m[k+U.loRow][k+U.loCol]; M.m[i+M.loRow][k+M.loCol] = a; double[] x = U.m[k+U.loRow]; double[] y = M.m[i+M.loRow]; int n = BLOCK_SIZE - k - 1; for (int p = n - 1; p >= 0; --p) { y[p+k+1+M.loCol] -= a * x[p+k+1+U.loCol]; } } } } public void compute() { if (size == BLOCK_SIZE) { upper(); } else { int h = size / 2; Block M00 = new Block(M.m, M.loRow, M.loCol); Block M01 = new Block(M.m, M.loRow, M.loCol+h); Block M10 = new Block(M.m, M.loRow+h, M.loCol); Block M11 = new Block(M.m, M.loRow+h, M.loCol+h); Block U00 = new Block(U.m, U.loRow, U.loCol); Block U01 = new Block(U.m, U.loRow, U.loCol+h); Block U10 = new Block(U.m, U.loRow+h, U.loCol); Block U11 = new Block(U.m, U.loRow+h, U.loCol+h); Seq3 s1 = seq(new Upper(h, U00, M00), new Schur(h, M00, U01, M01), new Upper(h, U11, M01)); Seq3 s2 = seq(new Upper(h, U00, M10), new Schur(h, M10, U01, M11), new Upper(h, U11, M11)); s2.fork(); s1.compute(); if (s2.tryUnfork()) s2.compute(); else s2.join(); } } } static final class LowerUpper extends RecursiveAction { final int size; final Block M; LowerUpper(int size, Block M) { this.size = size; this.M = M; } void lu() { // base case for (int k = 0; k < BLOCK_SIZE; ++k) { for (int i = k+1; i < BLOCK_SIZE; ++i) { double b = M.m[k+M.loRow][k+M.loCol]; double a = M.m[i+M.loRow][k+M.loCol] / b; M.m[i+M.loRow][k+M.loCol] = a; double[] x = M.m[k+M.loRow]; double[] y = M.m[i+M.loRow]; int n = BLOCK_SIZE-k-1; for (int p = n-1; p >= 0; --p) { y[k+1+p+M.loCol] -= a * x[k+1+p+M.loCol]; } } } } public void compute() { if (size == BLOCK_SIZE) { lu(); } else { int h = size / 2; Block M00 = new Block(M.m, M.loRow, M.loCol); Block M01 = new Block(M.m, M.loRow, M.loCol+h); Block M10 = new Block(M.m, M.loRow+h, M.loCol); Block M11 = new Block(M.m, M.loRow+h, M.loCol+h); new LowerUpper(h, M00).compute(); Lower sl = new Lower(h, M00, M01); Upper su = new Upper(h, M00, M10); su.fork(); sl.compute(); if (su.tryUnfork()) su.compute(); else su.join(); new Schur(h, M10, M01, M11).compute(); new LowerUpper(h, M11).compute(); } } } static Seq2 seq(RecursiveAction task1, RecursiveAction task2) { return new Seq2(task1, task2); } static final class Seq2 extends RecursiveAction { final RecursiveAction fst; final RecursiveAction snd; public Seq2(RecursiveAction task1, RecursiveAction task2) { fst = task1; snd = task2; } public void compute() { fst.invoke(); snd.invoke(); } } static Seq3 seq(RecursiveAction task1, RecursiveAction task2, RecursiveAction task3) { return new Seq3(task1, task2, task3); } static final class Seq3 extends RecursiveAction { final RecursiveAction fst; final RecursiveAction snd; final RecursiveAction thr; public Seq3(RecursiveAction task1, RecursiveAction task2, RecursiveAction task3) { fst = task1; snd = task2; thr = task3; } public void compute() { fst.invoke(); snd.invoke(); thr.invoke(); } } } jsr166/src/test/loops/ListBash.java0000644000000000000000000002343111537741071014266 0ustar /* * Written by Josh Bloch and Doug Lea with assistance from members of * JCP JSR-166 Expert Group and released to the public domain, as * explained at http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; public class ListBash { static boolean canRemove = true; static final Random rnd = new Random(); static int numItr; static int listSize; static boolean synch; static Class cl; public static void main(String[] args) { numItr = Integer.parseInt(args[1]); listSize = Integer.parseInt(args[2]); cl = null; try { cl = Class.forName(args[0]); } catch (ClassNotFoundException e) { fail("Class " + args[0] + " not found."); } synch = (args.length>3); oneRun(); oneRun(); oneRun(); } static void oneRun() { long startTime = System.nanoTime(); for (int i=0; i s = newList(cl, synch); for (int i=0; i s1 = newList(cl, synch); AddRandoms(s1, listSize); List s2 = newList(cl, synch); AddRandoms(s2, listSize); sets(s1, s2); s1.clear(); if (s1.size() != 0) fail("Clear didn't reduce size to zero."); s1.addAll(0, s2); if (!(s1.equals(s2) && s2.equals(s1))) fail("addAll(int, Collection) doesn't work."); // Reverse List for (int j=0, n=s1.size(); j s1, List s2) { int sum = 0; for (int k = 0; k < listSize; ++k) { sum += (s1.get(k)).intValue(); sum -= (s2.get(k)).intValue(); } for (int k = 0; k < listSize; ++k) { sum += (s1.get(k)).intValue(); s1.set(k, sum); sum -= (s2.get(k)).intValue(); s1.set(k, -sum); } for (int k = 0; k < listSize; ++k) { sum += (s1.get(k)).intValue(); sum -= (s2.get(k)).intValue(); } if (sum == 0) System.out.print(" "); } static void sets(List s1, List s2) { List intersection = clone(s1, cl,synch);intersection.retainAll(s2); List diff1 = clone(s1, cl, synch); diff1.removeAll(s2); List diff2 = clone(s2, cl, synch); diff2.removeAll(s1); List union = clone(s1, cl, synch); union.addAll(s2); if (diff1.removeAll(diff2)) fail("List algebra identity 2 failed"); if (diff1.removeAll(intersection)) fail("List algebra identity 3 failed"); if (diff2.removeAll(diff1)) fail("List algebra identity 4 failed"); if (diff2.removeAll(intersection)) fail("List algebra identity 5 failed"); if (intersection.removeAll(diff1)) fail("List algebra identity 6 failed"); if (intersection.removeAll(diff1)) fail("List algebra identity 7 failed"); intersection.addAll(diff1); intersection.addAll(diff2); if (!(intersection.containsAll(union) && union.containsAll(intersection))) fail("List algebra identity 1 failed"); Iterator e = union.iterator(); while (e.hasNext()) intersection.remove(e.next()); if (!intersection.isEmpty()) fail("Copy nonempty after deleting all elements."); e = union.iterator(); while (e.hasNext()) { Object o = e.next(); if (!union.contains(o)) fail("List doesn't contain one of its elements."); if (canRemove) { try { e.remove(); } catch (UnsupportedOperationException uoe) { canRemove = false; } } } if (canRemove && !union.isEmpty()) fail("List nonempty after deleting all elements."); } static void evenOdd(List s) { List even = clone(s, cl, synch); List odd = clone(s, cl, synch); List all; Iterator it; if (!canRemove) all = clone(s, cl, synch); else { it = even.iterator(); while (it.hasNext()) if ((it.next()).intValue() % 2 == 1) it.remove(); it = even.iterator(); while (it.hasNext()) if ((it.next()).intValue() % 2 == 1) fail("Failed to remove all odd nubmers."); for (int i=0; i<(listSize/2); i++) odd.remove(i); for (int i=0; i<(listSize/2); i++) { int ii = (odd.get(i)).intValue(); if (ii % 2 != 1) fail("Failed to remove all even nubmers. " + ii); } all = clone(odd, cl, synch); for (int i=0; i<(listSize/2); i++) all.add(2*i, even.get(i)); if (!all.equals(s)) fail("Failed to reconstruct ints from odds and evens."); all = clone(odd, cl, synch); ListIterator itAll = all.listIterator(all.size()); ListIterator itEven = even.listIterator(even.size()); while (itEven.hasPrevious()) { itAll.previous(); itAll.add(itEven.previous()); itAll.previous(); // ??? } itAll = all.listIterator(); while (itAll.hasNext()) { Integer i = itAll.next(); itAll.set(new Integer(i.intValue())); } itAll = all.listIterator(); it = s.iterator(); while (it.hasNext()) if (it.next()==itAll.next()) fail("Iterator.set failed to change value."); } if (!all.equals(s)) fail("Failed to reconstruct ints with ListIterator."); } static void sublists(List s) { List all = clone(s, cl, synch); Iterator it = all.listIterator(); int i=0; while (it.hasNext()) { Object o = it.next(); if (all.indexOf(o) != all.lastIndexOf(o)) fail("Apparent duplicate detected."); if (all.subList(i, all.size()).indexOf(o) != 0) { System.out.println("s0: " + all.subList(i, all.size()).indexOf(o)); fail("subList/indexOf is screwy."); } if (all.subList(i+1, all.size()).indexOf(o) != -1) { System.out.println("s-1: " + all.subList(i+1, all.size()).indexOf(o)); fail("subList/indexOf is screwy."); } if (all.subList(0,i+1).lastIndexOf(o) != i) { System.out.println("si" + all.subList(0,i+1).lastIndexOf(o)); fail("subList/lastIndexOf is screwy."); } i++; } } static void arrays() { List l = newList(cl, synch); AddRandoms(l, listSize); Integer[] ia = l.toArray(new Integer[0]); if (!l.equals(Arrays.asList(ia))) fail("toArray(Object[]) is hosed (1)"); ia = new Integer[listSize]; Integer[] ib = l.toArray(ia); if (ia != ib || !l.equals(Arrays.asList(ia))) fail("toArray(Object[]) is hosed (2)"); ia = new Integer[listSize+1]; ia[listSize] = new Integer(69); ib = l.toArray(ia); if (ia != ib || ia[listSize] != null || !l.equals(Arrays.asList(ia).subList(0, listSize))) fail("toArray(Object[]) is hosed (3)"); } // Done inefficiently so as to exercise toArray static List clone(List s, Class cl, boolean synch) { List a = Arrays.asList(s.toArray()); if (s.hashCode() != a.hashCode()) fail("Incorrect hashCode computation."); List clone = newList(cl, synch); clone.addAll(a); if (!s.equals(clone)) fail("List not equal to copy."); if (!s.containsAll(clone)) fail("List does not contain copy."); if (!clone.containsAll(s)) fail("Copy does not contain list."); return (List) clone; } static List newList(Class cl, boolean synch) { try { List s = (List) cl.newInstance(); if (synch) s = Collections.synchronizedList(s); if (!s.isEmpty()) fail("New instance non empty."); return s; } catch (Throwable t) { fail("Can't instantiate " + cl + ": " + t); } return null; //Shut up compiler. } static void AddRandoms(List s, int n) { for (int i=0; i 0) procs = Integer.parseInt(args[0]); if (args.length > 1) n = Integer.parseInt(args[1]); if (args.length > 2) reps = Integer.parseInt(args[1]); } catch (Exception e) { System.out.println("Usage: java BoxedLongSort threads n reps"); return; } ForkJoinPool pool = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); Long[] a = new Long[n]; seqRandomFill(a, 0, n); if (warmup) { System.out.printf("Sorting %d longs, %d replications\n", n, 1); Collections.shuffle(Arrays.asList(a)); long last = System.nanoTime(); java.util.Arrays.sort(a); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("Arrays.sort time: %7.3f\n", elapsed); checkSorted(a); } // for now hardwire 8 * #CPUs leaf tasks THRESHOLD = 1 + ((n + 7) >>> 3) / pool.getParallelism(); // THRESHOLD = 1 + ((n + 15) >>> 4) / pool.getParallelism(); // THRESHOLD = 1 + ((n + 31) >>> 5) / pool.getParallelism(); System.out.printf("Sorting %d longs, %d replications\n", n, reps); for (int i = 0; i < reps; ++i) { Collections.shuffle(Arrays.asList(a)); // pool.invoke(new RandomFiller(a, 0, n)); long last = System.nanoTime(); pool.invoke(new Sorter(a, new Long[n], 0, n)); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("Parallel sort time: %7.3f\n", elapsed); if (i == 0) checkSorted(a); } System.out.println(pool); System.out.printf("Sorting %d longs, %d replications\n", n, sreps); for (int i = 0; i < sreps; ++i) { Collections.shuffle(Arrays.asList(a)); // pool.invoke(new RandomFiller(a, 0, n)); long last = System.nanoTime(); java.util.Arrays.sort(a); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("Arrays.sort time: %7.3f\n", elapsed); if (i == 0) checkSorted(a); } System.out.println(pool); pool.shutdown(); } static final class Sorter extends RecursiveAction { final Long[] a; final Long[] w; final int origin; final int n; Sorter(Long[] a, Long[] w, int origin, int n) { this.a = a; this.w = w; this.origin = origin; this.n = n; } public void compute() { int l = origin; if (n <= THRESHOLD) Arrays.sort(a, l, l+n); else { // divide in quarters to ensure sorted array in a not w int h = n >>> 1; int q = n >>> 2; int u = h + q; SubSorter rs = new SubSorter (new Sorter(a, w, l+h, q), new Sorter(a, w, l+u, n-u), new Merger(a, w, l+h, q, l+u, n-u, l+h, null)); rs.fork(); Sorter rl = new Sorter(a, w, l+q, h-q); rl.fork(); (new Sorter(a, w, l, q)).compute(); rl.join(); (new Merger(a, w, l, q, l+q, h-q, l, null)).compute(); rs.join(); new Merger(w, a, l, h, l+h, n-h, l, null).compute(); } } } static final class SubSorter extends RecursiveAction { final Sorter left; final Sorter right; final Merger merger; SubSorter(Sorter left, Sorter right, Merger merger) { this.left = left; this.right = right; this.merger = merger; } public void compute() { right.fork(); left.compute(); right.join(); merger.compute(); } } static final class Merger extends RecursiveAction { final Long[] a; final Long[] w; final int lo; final int ln; final int ro; final int rn; final int wo; Merger next; Merger(Long[] a, Long[] w, int lo, int ln, int ro, int rn, int wo, Merger next) { this.a = a; this.w = w; this.lo = lo; this.ln = ln; this.ro = ro; this.rn = rn; this.wo = wo; this.next = next; } /** * Merge left and right by splitting left in half, * and finding index of right closest to split point. * Uses left-spine decomposition to generate all * merge tasks before bottomming out at base case. * */ public final void compute() { Merger rights = null; int nleft = ln; int nright = rn; while (nleft > THRESHOLD) { // && nright > (THRESHOLD >>> 3)) { int lh = nleft >>> 1; int splitIndex = lo + lh; Long split = a[splitIndex]; int rl = 0; int rh = nright; while (rl < rh) { int mid = (rl + rh) >>> 1; if (split <= a[ro + mid]) rh = mid; else rl = mid + 1; } (rights = new Merger(a, w, splitIndex, nleft-lh, ro+rh, nright-rh, wo+lh+rh, rights)).fork(); nleft = lh; nright = rh; } merge(nleft, nright); if (rights != null) collectRights(rights); } final void merge(int nleft, int nright) { int l = lo; int lFence = lo + nleft; int r = ro; int rFence = ro + nright; int k = wo; while (l < lFence && r < rFence) { Long al = a[l]; Long ar = a[r]; Long t; if (al <= ar) { ++l; t = al; } else { ++r; t = ar; } w[k++] = t; } while (l < lFence) w[k++] = a[l++]; while (r < rFence) w[k++] = a[r++]; } static void collectRights(Merger rt) { while (rt != null) { Merger next = rt.next; rt.next = null; if (rt.tryUnfork()) rt.compute(); else rt.join(); rt = next; } } } static void checkSorted (Long[] a) { int n = a.length; for (int i = 0; i < n - 1; i++) { if (a[i] > a[i+1]) { throw new Error("Unsorted at " + i + ": " + a[i] + " / " + a[i+1]); } } } static void seqRandomFill(Long[] array, int lo, int hi) { ThreadLocalRandom rng = ThreadLocalRandom.current(); for (int i = lo; i < hi; ++i) array[i] = rng.nextLong(); } static final class RandomFiller extends RecursiveAction { final Long[] array; final int lo, hi; RandomFiller(Long[] array, int lo, int hi) { this.array = array; this.lo = lo; this.hi = hi; } public void compute() { if (hi - lo <= THRESHOLD) { Long[] a = array; ThreadLocalRandom rng = ThreadLocalRandom.current(); for (int i = lo; i < hi; ++i) a[i] = rng.nextLong(); } else { int mid = (lo + hi) >>> 1; RandomFiller r = new RandomFiller(array, mid, hi); r.fork(); (new RandomFiller(array, lo, mid)).compute(); r.join(); } } } } jsr166/src/test/loops/IntegrateGamma.java0000644000000000000000000001333211537741071015441 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; /** * Adapted from FJTask version. * Sample program using Guassian Quadrature for numerical integration. * Inspired by a * Filaments * demo program. * */ public class IntegrateGamma { /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); public static void main(String[] args) { int procs = 0; double start = 1.0; double end = 96.0; int exp = 5; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) start = new Double(args[1]).doubleValue(); if (args.length > 2) end = new Double(args[2]).doubleValue(); if (args.length > 3) exp = Integer.parseInt(args[3]); } catch (Exception e) { System.out.println("Usage: java IntegrateGamma \n (for example 2 1 48 5)."); return; } ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); System.out.println("Integrating from " + start + " to " + end + " exponent: " + exp + " parallelism " + g.getParallelism()); Function f = new SampleFunction(exp); for (int i = 0; i < 10; ++i) { Integrator integrator = new Integrator(f, 0.001, g); long last = System.nanoTime(); double result = integrator.integral(start, end); double elapsed = elapsedTime(last); System.out.printf("time: %7.3f", elapsed); System.out.println(" Answer = " + result); } System.out.println(g); g.shutdown(); } static double elapsedTime(long startTime) { return (double)(System.nanoTime() - startTime) / NPS; } /* This is all set up as if it were part of a more serious framework, but is for now just a demo, with all classes declared as static within Integrate */ /** A function to be integrated */ static interface Function { double compute(double x); } /** * Sample from filaments demo. * Computes (2*n-1)*(x^(2*n-1)) for all odd values. */ static class SampleFunction implements Function { final int n; SampleFunction(int n) { this.n = n; } public double compute(double x) { double power = x; double xsq = x * x; double val = power; double di = 1.0; for (int i = n - 1; i > 0; --i) { di += 2.0; power *= xsq; val += di * power; } return val; } } static class Integrator { final Function f; // The function to integrate final double errorTolerance; final ForkJoinPool g; Integrator(Function f, double errorTolerance, ForkJoinPool g) { this.f = f; this.errorTolerance = errorTolerance; this.g = g; } double integral(double lowerBound, double upperBound) { double f_lower = f.compute(lowerBound); double f_upper = f.compute(upperBound); double initialArea = 0.5 * (upperBound-lowerBound) * (f_upper + f_lower); Quad q = new Quad(lowerBound, upperBound, f_lower, f_upper, initialArea); g.invoke(q); return q.area; } /** * FJTask to recursively perform the quadrature. * Algorithm: * Compute the area from lower bound to the center point of interval, * and from the center point to the upper bound. If this * differs from the value from lower to upper by more than * the error tolerance, recurse on each half. */ final class Quad extends RecursiveAction { final double left; // lower bound final double right; // upper bound final double f_left; // value of the function evaluated at left final double f_right; // value of the function evaluated at right // Area initialized with original estimate from left to right. // It is replaced with refined value. volatile double area; Quad(double left, double right, double f_left, double f_right, double area) { this.left = left; this.right = right; this.f_left = f_left; this.f_right = f_right; this.area = area; } public void compute() { double center = 0.5 * (left + right); double f_center = f.compute(center); double leftArea = 0.5 * (center - left) * (f_left + f_center); double rightArea = 0.5 * (right - center) * (f_center + f_right); double sum = leftArea + rightArea; double diff = sum - area; if (diff < 0) diff = -diff; if (diff >= errorTolerance) { Quad q1 = new Quad(left, center, f_left, f_center, leftArea); q1.fork(); Quad q2 = new Quad(center, right, f_center, f_right, rightArea); q2.compute(); q1.join(); sum = q1.area + q2.area; } area = sum; } } } } jsr166/src/test/loops/BinaryAsyncAction.java0000644000000000000000000002174211445743762016147 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; /** * AsyncActions that are always linked in binary parent-child * relationships. Compared to Recursive tasks, BinaryAsyncActions may * have smaller stack space footprints and faster completion mechanics * but higher per-task footprints. Compared to LinkedAsyncActions, * BinaryAsyncActions are simpler to use and have less overhead in * typical uasges but are restricted to binary computation trees. * *

Upon construction, an BinaryAsyncAction does not bear any * linkages. For non-root tasks, links must be established using * method linkSubtasks before use. * *

Sample Usage. A version of Fibonacci: *

 * class Fib extends BinaryAsyncAction {
 *   final int n;
 *   int result;
 *   Fib(int n) { this.n = n; }
 *   protected void compute() {
 *     if (n > 1) {
 *        linkAndForkSubtasks(new Fib(n-1), new Fib(n-2));
 *     else {
 *        result = n; // fib(0)==0; fib(1)==1
 *        complete();
 *     }
 *   }
 *   protected void onComplete(BinaryAsyncAction x, BinaryAsyncAction y) {
 *      result = ((Fib)x).result + ((Fib)y).result;
 *   }
 * }
 * 
* An alternative, and usually faster strategy is to instead use a * loop to fork subtasks: *
 *   protected void compute() {
 *     Fib f = this;
 *     while (f.n > 1) {
 *        Fib left = new Fib(f.n - 1);
 *        Fib right = new Fib(f.n - 2);
 *        f.linkSubtasks(left, right);
 *        right.fork(); // fork right
 *        f = left;     // loop on left
 *     }
 *     f.result = f.n;
 *     f.complete();
 *   }
 * }
 * 
*/ public abstract class BinaryAsyncAction extends ForkJoinTask { private volatile int controlState; static final AtomicIntegerFieldUpdater controlStateUpdater = AtomicIntegerFieldUpdater.newUpdater(BinaryAsyncAction.class, "controlState"); /** * Parent to propagate completion; nulled after completion to * avoid retaining entire tree as garbage */ private BinaryAsyncAction parent; /** * Sibling to access on subtask joins, also nulled after completion. */ private BinaryAsyncAction sibling; /** * Creates a new action. Unless this is a root task, you will need * to link it using method linkSubtasks before forking as * a subtask. */ protected BinaryAsyncAction() { } public final Void getRawResult() { return null; } protected final void setRawResult(Void mustBeNull) { } /** * Establishes links for the given tasks to have the current task * as parent, and each other as siblings. * @param x one subtask * @param y the other subtask * @throws NullPointerException if either argument is null. */ public final void linkSubtasks(BinaryAsyncAction x, BinaryAsyncAction y) { x.parent = y.parent = this; x.sibling = y; y.sibling = x; } /** * Overridable callback action triggered upon complete of * subtasks. Upon invocation, both subtasks have completed. * After return, this task isDone and is joinable by * other tasks. The default version of this method does * nothing. But it may may be overridden in subclasses to perform * some action (for example a reduction) when this task is * completes. * @param x one subtask * @param y the other subtask */ protected void onComplete(BinaryAsyncAction x, BinaryAsyncAction y) { } /** * Overridable callback action triggered by * completeExceptionally. Upon invocation, this task has * aborted due to an exception (accessible via * getException). If this method returns true, * the exception propagates to the current task's * parent. Otherwise, normal completion is propagated. The * default version of this method does nothing and returns * true. * @return true if this task's exception should be propagated to * this tasks parent. */ protected boolean onException() { return true; } /** * Equivalent in effect to invoking linkSubtasks and then * forking both tasks. * @param x one subtask * @param y the other subtask */ public void linkAndForkSubtasks(BinaryAsyncAction x, BinaryAsyncAction y) { linkSubtasks(x, y); y.fork(); x.fork(); } /** Basic per-task complete */ private void completeThis() { super.complete(null); } /** Basic per-task completeExceptionally */ private void completeThisExceptionally(Throwable ex) { super.completeExceptionally(ex); } /* * We use one bit join count on taskState. The first arriving * thread CAS's from 0 to 1. The second ultimately sets status * to signify completion. */ /** * Completes this task, and if this task has a sibling that is * also complete, invokes onComplete of parent task, and so * on. If an exception is encountered, tasks instead * completeExceptionally. */ public final void complete() { // todo: Use tryUnfork without possibly blowing stack BinaryAsyncAction a = this; for (;;) { BinaryAsyncAction s = a.sibling; BinaryAsyncAction p = a.parent; a.sibling = null; a.parent = null; a.completeThis(); if (p == null || p.compareAndSetControlState(0, 1)) break; try { p.onComplete(a, s); } catch (Throwable rex) { p.completeExceptionally(rex); return; } a = p; } } /** * Completes this task abnormally. Unless this task already * cancelled or aborted, upon invocation, this method invokes * onException, and then, depending on its return value, * completees parent (if one exists) exceptionally or normally. To * avoid unbounded exception loops, this method aborts if an * exception is encountered in any onException * invocation. * @param ex the exception to throw when joining this task * @throws NullPointerException if ex is null * @throws Throwable if any invocation of * onException does so. */ public final void completeExceptionally(Throwable ex) { BinaryAsyncAction a = this; while (!a.isCompletedAbnormally()) { a.completeThisExceptionally(ex); BinaryAsyncAction s = a.sibling; if (s != null) s.cancel(false); if (!a.onException() || (a = a.parent) == null) break; } } /** * Returns this task's parent, or null if none or this task * is already complete. * @return this task's parent, or null if none. */ public final BinaryAsyncAction getParent() { return parent; } /** * Returns this task's sibling, or null if none or this task is * already complete. * @return this task's sibling, or null if none. */ public BinaryAsyncAction getSibling() { return sibling; } /** * Resets the internal bookkeeping state of this task, erasing * parent and child linkages. */ public void reinitialize() { parent = sibling = null; super.reinitialize(); } /** * Gets the control state, which is initially zero, or negative if * this task has completed or cancelled. Once negative, the value * cannot be changed. * @return control state */ protected final int getControlState() { return controlState; } /** * Atomically sets the control state to the given updated value if * the current value is and equal to the expected value. * @param expect the expected value * @param update the new value * @return true if successful */ protected final boolean compareAndSetControlState(int expect, int update) { return controlStateUpdater.compareAndSet(this, expect, update); } /** * Attempts to set the control state to the given value, failing if * this task is already completed or the control state value would be * negative. * @param value the new value * @return true if successful */ protected final void setControlState(int value) { controlState = value; } /** * Sets the control state to the given value, * @param value the new value */ protected final void incrementControlState() { controlStateUpdater.incrementAndGet(this); } /** * Decrement the control state * @return true if successful */ protected final void decrementControlState() { controlStateUpdater.decrementAndGet(this); } } jsr166/src/test/loops/ExecutorCompletionServiceLoops.java0000644000000000000000000000445011551700072020733 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; public class ExecutorCompletionServiceLoops { static final int POOLSIZE = 100; static final ExecutorService pool = Executors.newFixedThreadPool(POOLSIZE); static final ExecutorCompletionService ecs = new ExecutorCompletionService(pool); static boolean print = false; public static void main(String[] args) throws Exception { int max = 8; int base = 10000; if (args.length > 0) max = Integer.parseInt(args[0]); System.out.println("Warmup..."); oneTest( base ); Thread.sleep(100); print = true; for (int i = 1; i <= max; i += (i+1) >>> 1) { System.out.print("n: " + i * base); oneTest(i * base ); Thread.sleep(100); } pool.shutdown(); } static class Task implements Callable { public Integer call() { int l = System.identityHashCode(this); l = LoopHelpers.compute2(l); int s = LoopHelpers.compute1(l); l = LoopHelpers.compute2(l); s += LoopHelpers.compute1(l); return new Integer(s); } } static class Producer implements Runnable { final ExecutorCompletionService cs; final int iters; Producer(ExecutorCompletionService ecs, int i) { cs = ecs; iters = i; } public void run() { for (int i = 0; i < iters; ++i) ecs.submit(new Task()); } } static void oneTest(int iters) throws Exception { long startTime = System.nanoTime(); new Thread(new Producer(ecs, iters)).start(); int r = 0; for (int i = 0; i < iters; ++i) r += ecs.take().get().intValue(); long elapsed = System.nanoTime() - startTime; long tpi = elapsed/ iters; if (print) System.out.println("\t: " + LoopHelpers.rightJustify(tpi) + " ns per task"); if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } } jsr166/src/test/loops/kw.txt0000644000000000000000000000051710235476645013102 0ustar assert abstract default if private this boolean do implements protected throw break double import public throws byte else instanceof return transient case extends int short try catch final interface static void char finally long strictfp volatile class float native super while const for new switch continue goto package synchronized jsr166/src/test/loops/LinkedAsyncAction.java0000644000000000000000000002731411445743475016133 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; /** * AsyncActions that may be linked in parent-child relationships. * *

Upon construction, an LinkedAsyncAction may register as a * subtask of a given parent task. In this case, completion of this * task will propagate to its parent. If the parent's pending subtask * completion count becomes zero, it too will complete. * LinkedAsyncActions rarely use methods join or * invoke but instead propagate completion to parents * implicitly via complete. While typical, it is not necessary * for each task to complete itself. For example, it is * possible to treat one subtask as a continuation of the current task * by not registering it on construction. In this case, a * complete of the subtask will trigger complete of the * parent without the parent explicitly doing so. * *

In addition to supporting these different computation styles * compared to Recursive tasks, LinkedAsyncActions may have smaller * stack space footprints while executing, but may have greater * per-task overhead. * *

Sample Usage. Here is a sketch of an LinkedAsyncAction * that visits all of the nodes of a graph. The details of the graph's * Node and Edge classes are omitted, but we assume each node contains * an AtomicBoolean mark that starts out false. To execute * this, you would create a GraphVisitor for the root node with null * parent, and invoke in a ForkJoinPool. Upon return, all * reachable nodes will have been visited. * *

 * class GraphVisitor extends LinkedAsyncAction {
 *    final Node node;
 *    GraphVisitor(GraphVistor parent, Node node) {
 *      super(parent); this.node = node;
 *    }
 *    protected void compute() {
 *      if (node.mark.compareAndSet(false, true)) {
 *         for (Edge e : node.edges()) {
 *            Node dest = e.getDestination();
 *            if (!dest.mark.get())
 *               new GraphVisitor(this, dest).fork();
 *         }
 *         visit(node);
 *      }
 *      complete();
 *   }
 * }
 * 
* */ public abstract class LinkedAsyncAction extends ForkJoinTask { /** * The maximum number of pending children */ private static int maxPending = 0xffff; private volatile int controlState; static final AtomicIntegerFieldUpdater controlStateUpdater = AtomicIntegerFieldUpdater.newUpdater(LinkedAsyncAction.class, "controlState"); /** * Parent to notify on completion */ private LinkedAsyncAction parent; /** * Creates a new action with no parent. (You can add a parent * later (but before forking) via reinitialize). */ protected LinkedAsyncAction() { } /** * Creates a new action with the given parent. If the parent is * non-null, this tasks registers with the parent, in which case, * the parent task cannot complete until this task completes. * @param parent the parent task, or null if none */ protected LinkedAsyncAction(LinkedAsyncAction parent) { this.parent = parent; if (parent != null) parent.incrementControlState(); } /** * Creates a new action with the given parent, optionally * registering with the parent. If the parent is non-null and * register is true, this tasks registers with the * parent, in which case, the parent task cannot complete until * this task completes. * @param parent the parent task, or null if none * @param register true if parent must wait for this task * to complete before it completes */ protected LinkedAsyncAction(LinkedAsyncAction parent, boolean register) { this.parent = parent; if (parent != null && register) parent.incrementControlState(); } /** * Creates a new action with the given parent, optionally * registering with the parent, and setting the pending join count * to the given value. If the parent is non-null and * register is true, this tasks registers with the * parent, in which case, the parent task cannot complete until * this task completes. Setting the pending join count requires * care -- it is correct only if child tasks do not themselves * register. * @param parent the parent task, or null if none * @param register true if parent must wait for this task * to complete before it completes * @param pending the pending join count */ protected LinkedAsyncAction(LinkedAsyncAction parent, boolean register, int pending) { this.parent = parent; setControlState(pending); if (parent != null && register) parent.incrementControlState(); } public final Void getRawResult() { return null; } protected final void setRawResult(Void mustBeNull) { } /** * Overridable callback action triggered by complete. Upon * invocation, all subtasks have completed. After return, this * task isDone and is joinable by other tasks. The * default version of this method does nothing. But it may may be * overridden in subclasses to perform some action when this task * is about to complete. */ protected void onCompletion() { } /** * Overridable callback action triggered by * completeExceptionally. Upon invocation, this task has * aborted due to an exception (accessible via * getException). If this method returns true, * the exception propagates to the current task's * parent. Otherwise, normal completion is propagated. The * default version of this method does nothing and returns * true. * @return true if this task's exception should be propagated to * this tasks parent. */ protected boolean onException() { return true; } /** Basic per-task complete */ private void completeThis() { complete(null); } /** Basic per-task completeExceptionally */ private void completeThisExceptionally(Throwable ex) { super.completeExceptionally(ex); } /** * Completes this task. If the pending subtask completion count is * zero, invokes onCompletion, then causes this task to * be joinable (isDone becomes true), and then * recursively applies to this tasks's parent, if it exists. If an * exception is encountered in any onCompletion * invocation, that task and its ancestors * completeExceptionally. */ public final void complete() { LinkedAsyncAction a = this; while (a != null && !a.isDone()) { int c = a.getControlState(); if (c <= 0) { try { a.onCompletion(); a.completeThis(); } catch (Throwable rex) { a.completeExceptionally(rex); return; } a = a.parent; } else if (a.compareAndSetControlState(c, c-1)) return; } } /** * Completes this task abnormally. Unless this task already * cancelled or aborted, upon invocation, this method invokes * onException, and then, depending on its return value, * completees parent (if one exists) exceptionally or normally. To * avoid unbounded exception loops, this method aborts if an * exception is encountered in any onException * invocation. * @param ex the exception to throw when joining this task * @throws NullPointerException if ex is null * @throws Throwable if any invocation of * onException does so. */ public final void completeExceptionally(Throwable ex) { LinkedAsyncAction a = this; while (!a.isCompletedAbnormally()) { a.completeThisExceptionally(ex); boolean up = a.onException(); // abort if this throws a = a.parent; if (a == null) break; if (!up) { a.complete(); break; } } } /** * Returns this task's parent, or null if none. * @return this task's parent, or null if none. */ public final LinkedAsyncAction getParent() { return parent; } /** * Returns the number of subtasks that have not yet completed. * @return the number of subtasks that have not yet completed. */ public final int getPendingSubtaskCount() { return getControlState(); } /** * Resets the internal bookkeeping state of this task, maintaining * the current parent but clearing pending joins. */ public void reinitialize() { super.reinitialize(); } /** * Resets the internal bookkeeping state of this task, maintaining * the current parent and setting pending joins to the given value. * @param pending the number of pending joins */ public void reinitialize(int pending) { super.reinitialize(); setControlState(pending); } /** * Reinitialize with the given parent, optionally registering. * @param parent the parent task, or null if none * @param register true if parent must wait for this task * to complete before it completes */ public void reinitialize(LinkedAsyncAction parent, boolean register) { this.parent = parent; super.reinitialize(); if (parent != null && register) parent.incrementControlState(); } /** * Reinitialize with the given parent, optionally registering * and setting pending join count. * @param parent the parent task, or null if none * @param register true if parent must wait for this task * to complete before it completes * @param pending the pending join count */ public void reinitialize(LinkedAsyncAction parent, boolean register, int pending) { this.parent = parent; super.reinitialize(); setControlState(pending); if (parent != null && register) parent.incrementControlState(); } /** * Gets the control state, which is initially zero, or negative if * this task has completed or cancelled. Once negative, the value * cannot be changed. * @return control state */ protected final int getControlState() { return controlState; } /** * Atomically sets the control state to the given updated value if * the current value is and equal to the expected value. * @param expect the expected value * @param update the new value * @return true if successful */ protected final boolean compareAndSetControlState(int expect, int update) { return controlStateUpdater.compareAndSet(this, expect, update); } /** * Sets the control state to the given value, * @param value the new value */ protected final void setControlState(int value) { controlState = value; } /** * Increment the control state * @return true if successful */ protected final void incrementControlState() { controlStateUpdater.incrementAndGet(this); } /** * Decrement the control state * @return true if successful */ protected final void decrementControlState() { controlStateUpdater.decrementAndGet(this); } } jsr166/src/test/loops/FibTask.java0000644000000000000000000000575111475011736014104 0ustar import java.util.concurrent.*; /** * Recursive task-based version of Fibonacci. Computes: *
 * Computes fibonacci(n) = fibonacci(n-1) + fibonacci(n-2);  for n> 1
 *          fibonacci(0) = 0;
 *          fibonacci(1) = 1.
 * 
*/ public final class FibTask extends RecursiveTask { // Performance-tuning constant: static int sequentialThreshold; static long lastStealCount; public static void main(String[] args) throws Exception { int procs = 0; int num = 45; sequentialThreshold = 2; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) num = Integer.parseInt(args[1]); if (args.length > 2) sequentialThreshold = Integer.parseInt(args[2]); } catch (Exception e) { System.out.println("Usage: java Fib []"); return; } for (int reps = 0; reps < 2; ++reps) { ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); lastStealCount = g.getStealCount(); for (int i = 0; i < 20; ++i) { test(g, num); // Thread.sleep(1000); } System.out.println(g); g.shutdown(); } } /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static void test(ForkJoinPool g, int num) throws Exception { int ps = g.getParallelism(); long start = System.nanoTime(); int result = g.invoke(new FibTask(num)); long time = System.nanoTime() - start; double secs = ((double)time) / NPS; System.out.print("FibTask " + num + " = " + result); System.out.printf("\tTime: %7.3f", secs); long sc = g.getStealCount(); long ns = sc - lastStealCount; lastStealCount = sc; System.out.printf(" Steals/t: %5d", ns/ps); System.out.printf(" Workers: %5d", g.getPoolSize()); System.out.println(); } // Initialized with argument; replaced with result int number; FibTask(int n) { number = n; } public Integer compute() { int n = number; // Handle base cases: if (n <= 1) { return n; } // Use sequential code for small problems: else if (n <= sequentialThreshold) { return seqFib(n); } // Otherwise use recursive parallel decomposition: else { FibTask f1 = new FibTask(n - 1); f1.fork(); FibTask f2 = new FibTask(n - 2); return f2.compute() + f1.join(); } } // Sequential version for arguments less than threshold static final int seqFib(int n) { // unroll left only int r = 1; do { int m = n - 2; r += m <= 1 ? m : seqFib(m); } while (--n > 1); return r; } } jsr166/src/test/loops/ThreadPhaserJacobi.java0000644000000000000000000001455111537741072016243 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ // Barrier version of Jacobi iteration import java.util.*; import java.util.concurrent.*; //import jsr166y.*; public class ThreadPhaserJacobi { static final int nprocs = Runtime.getRuntime().availableProcessors(); /** * The maximum submatrix length (both row-wise and column-wise) * for any Segment */ static final double EPSILON = 0.0001; // convergence criterion static int dimGran; public static void main(String[] args) throws Exception { int n = 2048; int steps = 1000; try { if (args.length > 0) n = Integer.parseInt(args[0]); if (args.length > 1) steps = Integer.parseInt(args[1]); } catch (Exception e) { System.out.println("Usage: java ThreadPhaserJacobi "); return; } int granularity = n * n / nprocs; dimGran = (int) Math.sqrt(granularity); // allocate enough space for edges int dim = n+2; int ncells = dim * dim; double[][] a = new double[dim][dim]; double[][] b = new double[dim][dim]; // Initialize interiors to small value double smallVal = 1.0/dim; for (int i = 1; i < dim-1; ++i) { for (int j = 1; j < dim-1; ++j) a[i][j] = smallVal; } int nreps = 3; for (int rep = 0; rep < nreps; ++rep) { // Fill all edges with 1's. for (int k = 0; k < dim; ++k) { a[k][0] += 1.0; a[k][n+1] += 1.0; a[0][k] += 1.0; a[n+1][k] += 1.0; } Driver driver = new Driver(a, b, 1, n, 1, n, steps); long startTime = System.currentTimeMillis(); driver.compute(); long time = System.currentTimeMillis() - startTime; double secs = (double) time / 1000.0; System.out.println("Compute Time: " + secs); } } static class Segment implements Runnable { double[][] A; // matrix to get old values from double[][] B; // matrix to put new values into // indices of current submatrix final int loRow; final int hiRow; final int loCol; final int hiCol; final int steps; final Phaser barrier; double maxDiff; // maximum difference between old and new values Segment(double[][] A, double[][] B, int loRow, int hiRow, int loCol, int hiCol, int steps, Phaser barrier) { this.A = A; this.B = B; this.loRow = loRow; this.hiRow = hiRow; this.loCol = loCol; this.hiCol = hiCol; this.steps = steps; this.barrier = barrier; barrier.register(); } public void run() { try { double[][] a = A; double[][] b = B; for (int i = 0; i < steps; ++i) { maxDiff = update(a, b); if (barrier.awaitAdvance(barrier.arrive()) < 0) break; double[][] tmp = a; a = b; b = tmp; } } catch (Exception ex) { ex.printStackTrace(); return; } } double update(double[][] a, double[][] b) { double md = 0.0; // local for computing max diff for (int i = loRow; i <= hiRow; ++i) { for (int j = loCol; j <= hiCol; ++j) { double v = 0.25 * (a[i-1][j] + a[i][j-1] + a[i+1][j] + a[i][j+1]); b[i][j] = v; double diff = v - a[i][j]; if (diff < 0) diff = -diff; if (diff > md) md = diff; } } return md; } } static class Driver { double[][] A; // matrix to get old values from double[][] B; // matrix to put new values into final int loRow; // indices of current submatrix final int hiRow; final int loCol; final int hiCol; final int steps; Segment[] allSegments; Driver(double[][] mat1, double[][] mat2, int firstRow, int lastRow, int firstCol, int lastCol, int steps) { this.A = mat1; this.B = mat2; this.loRow = firstRow; this.hiRow = lastRow; this.loCol = firstCol; this.hiCol = lastCol; this.steps = steps; int rows = hiRow - loRow + 1; int cols = hiCol - loCol + 1; int rblocks = Math.round((float) rows / dimGran); int cblocks = Math.round((float) cols / dimGran); int n = rblocks * cblocks; Segment[] segs = new Segment[n]; Phaser barrier = new Phaser(); int k = 0; for (int i = 0; i < rblocks; ++i) { int lr = loRow + i * dimGran; int hr = lr + dimGran; if (i == rblocks-1) hr = hiRow; for (int j = 0; j < cblocks; ++j) { int lc = loCol + j * dimGran; int hc = lc + dimGran; if (j == cblocks-1) hc = hiCol; segs[k] = new Segment(A, B, lr, hr, lc, hc, steps, barrier); ++k; } } System.out.println("Using " + n + " segments (threads)"); allSegments = segs; } public void compute() throws InterruptedException { Segment[] segs = allSegments; int n = segs.length; Thread[] threads = new Thread[n]; for (int k = 0; k < n; ++k) threads[k] = new Thread(segs[k]); for (int k = 0; k < n; ++k) threads[k].start(); for (int k = 0; k < n; ++k) threads[k].join(); double maxd = 0; for (int k = 0; k < n; ++k) { double md = segs[k].maxDiff; if (md > maxd) maxd = md; } System.out.println("Max diff after " + steps + " steps = " + maxd); } } } jsr166/src/test/loops/DequeBash.java0000644000000000000000000003320611551700072014407 0ustar /* * Written by Josh Bloch of Google Inc. and released to the public domain, * as explained at http://creativecommons.org/publicdomain/zero/1.0/. */ import java.util.*; import java.io.*; /** * Interface-based Deque tester. This test currently makes three * assumptions about the implementation under test: * * 1) It has no size limitation. * 2) It implements Serializable. * 3) It has a conventional (Collection) constructor. * * All of these assumptions could be relaxed. */ public class DequeBash { static int seed = 7; static int nextTail = 0; static int nextHead = -1; static int size() { return nextTail - nextHead - 1; } static int random(int bound) { int x = seed; int t = (x % 127773) * 16807 - (x / 127773) * 2836; seed = (t > 0) ? t : t + 0x7fffffff; return (t & 0x7fffffff) % bound; } static int random() { int x = seed; int t = (x % 127773) * 16807 - (x / 127773) * 2836; seed = (t > 0) ? t : t + 0x7fffffff; return (t & 0x7fffffff); } public static void main(String args[]) throws Exception { Class cls = Class.forName(args[0]); int n = 1000000; for (int j = 0; j < 3; ++j) { @SuppressWarnings("unchecked") Deque deque = (Deque) cls.newInstance(); nextTail = 0; nextHead = -1; long start = System.nanoTime(); mainTest(deque, n); long end = System.nanoTime(); long elapsedTimeMillis = (end - start) / (1000L * 1000L); System.out.printf("Time: %d ms%n", elapsedTimeMillis); if (deque.isEmpty()) System.out.print(" "); } } static void mainTest(Deque deque, int n) throws Exception { /* * Perform a random sequence of operations, keeping contiguous * sequence of integers on the deque. */ for (int i = 0; i < n; i++) { sizeTests(deque); randomOp(deque); // Test iterator occasionally if ((i & 1023) == 0) { testIter(deque); testDescendingIter(deque); } // Test serialization and copying if ((i & 4095) == 0) { testEqual(deque, serialClone(deque)); testEqual(deque, copyConstructorClone(deque)); } // Test fancy removal stuff once in a blue moon if ((i & 8191) == 0) testRemove(deque); } // Stupid tests for clear, toString deque.clear(); testEmpty(deque); Collection c = Arrays.asList(1, 2, 3); deque.addAll(c); if (!deque.toString().equals("[1, 2, 3]")) throw new Exception("Deque.toString(): " + deque.toString()); } static void testIter(Deque deque) throws Exception { int next = nextHead + 1; int count = 0; for (int j : deque) { if (j != next++) throw new Exception("Element "+ j + " != " + (next-1)); count++; } if (count != size()) throw new Exception("Count " + count + " != " + size()); } static void testDescendingIter(Deque deque) throws Exception { int next = deque.size() + nextHead; int count = 0; for (Iterator it = deque.descendingIterator(); it.hasNext();) { int j = it.next(); if (j != next--) throw new Exception("Element "+ j + " != " + (next-1)); count++; } if (count != size()) throw new Exception("Count " + count + " != " + size()); } static void sizeTests(Deque deque) throws Exception { if (deque.size() != size()) throw new Exception("Size: " + deque.size() + ", expecting " + size()); if (deque.isEmpty() != (size() == 0)) throw new Exception( "IsEmpty " + deque.isEmpty() + ", size " + size()); // Check head and tail if (size() == 0) testEmpty(deque); else nonEmptyTest(deque); } static void nonEmptyTest(Deque deque) throws Exception { if (deque.getFirst() != nextHead + 1) throw new Exception("getFirst got: " + deque.getFirst() + " expecting " + (nextHead + 1)); if (deque.element() != nextHead + 1) throw new Exception("element got: " + deque.element() + " expecting " + (nextHead + 1)); if (deque.peekFirst() != nextHead + 1) throw new Exception("peekFirst got: "+deque.peekFirst() + " expecting " + (nextHead + 1)); if (deque.peek() != nextHead + 1) throw new Exception("peek got: " + deque.peek() + " expecting " + (nextHead + 1)); if (deque.peekLast() != nextTail - 1) throw new Exception("peekLast got: " + deque.peekLast() + " expecting " + (nextTail - 1)); if (deque.getLast() != nextTail - 1) throw new Exception("getLast got: " + deque.getLast() + " expecting " + (nextTail - 1)); } static void randomOp(Deque deque) throws Exception { // Perform a random operation switch (random() & 3) { case 0: switch (random() & 3) { case 0: deque.addLast(nextTail++); break; case 1: deque.offerLast(nextTail++); break; case 2: deque.offer(nextTail++); break; case 3: deque.add(nextTail++); break; default: throw new Exception("How'd we get here"); } break; case 1: if (size() == 0) { int result = 666; boolean threw = false; try { switch (random(3)) { case 0: result = deque.removeFirst(); break; case 1: result = deque.remove(); break; case 2: result = deque.pop(); break; default: throw new Exception("How'd we get here"); } } catch (NoSuchElementException e) { threw = true; } if (!threw) throw new Exception("Remove-no exception: " + result); } else { // deque nonempty int result = -1; switch (random(5)) { case 0: result = deque.removeFirst(); break; case 1: result = deque.remove(); break; case 2: result = deque.pop(); break; case 3: result = deque.pollFirst(); break; case 4: result = deque.poll(); break; default: throw new Exception("How'd we get here"); } if (result != ++nextHead) throw new Exception( "Removed "+ result + " expecting "+(nextHead - 1)); } break; case 2: switch (random(3)) { case 0: deque.addFirst(nextHead--); break; case 1: deque.offerFirst(nextHead--); break; case 2: deque.push(nextHead--); break; default: throw new Exception("How'd we get here"); } break; case 3: if (size() == 0) { int result = -1; boolean threw = false; try { result = deque.removeLast(); } catch (NoSuchElementException e) { threw = true; } if (!threw) throw new Exception("Remove-no exception: " + result); } else { // deque nonempty int result = ((random() & 1) == 0 ? deque.removeLast() : deque.pollLast()); if (result != --nextTail) throw new Exception( "Removed "+ result + " expecting "+(nextTail + 1)); } break; default: throw new Exception("How'd we get here"); } } private static void testEqual(Deque d1, Deque d2) throws Exception { if (d1.size() != d2.size()) throw new Exception("Size " + d1.size() + " != " + d2.size()); Iterator it = d2.iterator(); for (int i : d1) { int j = it.next(); if (j != i) throw new Exception("Element " + j + " != " + i); } for (int i : d1) if (!d2.contains(i)) throw new Exception("d2 doesn't contain " + i); for (int i : d2) if (!d1.contains(i)) throw new Exception("d2 doesn't contain " + i); if (d1.contains(Integer.MIN_VALUE)) throw new Exception("d2 contains Integer.MIN_VALUE"); if (d2.contains(Integer.MIN_VALUE)) throw new Exception("d2 contains Integer.MIN_VALUE"); if (d1.contains(null)) throw new Exception("d1 contains null"); if (d2.contains(null)) throw new Exception("d2 contains null"); if (!d1.containsAll(d2)) throw new Exception("d1 doesn't contain all of d2"); if (!d2.containsAll(d1)) throw new Exception("d2 doesn't contain all of d1"); Collection c = Collections.singleton(Integer.MIN_VALUE); if (d1.containsAll(c)) throw new Exception("d1 contains all of {Integer.MIN_VALUE }"); if (d2.containsAll(c)) throw new Exception("d2 contains all of {Integer.MIN_VALUE }"); } @SuppressWarnings("unchecked") private static T copyConstructorClone(T o) throws Exception { return (T) o.getClass().getConstructor(Collection.class).newInstance(o); } @SuppressWarnings("unchecked") private static T serialClone(T o) throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(o); oos.flush(); oos.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bin); return (T) ois.readObject(); } private static void testRemove(Deque deque) throws Exception { Deque copy = ((random() & 1) == 0) ? copyConstructorClone(deque) : serialClone(deque); int numRemoved = 0; for (Iterator it = copy.iterator(); it.hasNext(); ) { if ((it.next() & 1) == 0) { it.remove(); numRemoved++; } } if (copy.size() + numRemoved != size()) throw new Exception((copy.size() + numRemoved) + " != " + size()); for (int i : copy) if ((i & 1) == 0) throw new Exception("Even number still present: " + i); List elements = Arrays.asList(copy.toArray(new Integer[0])); Collections.shuffle(elements); for (int e : elements) { if (!copy.contains(e)) throw new Exception(e + " missing."); boolean removed = false; switch (random(3)) { case 0: removed = copy.remove(e); break; case 1: removed = copy.removeFirstOccurrence(e); break; case 2: removed = copy.removeLastOccurrence(e); break; default: throw new Exception("How'd we get here"); } if (!removed) throw new Exception(e + " not removed."); if (copy.contains(e)) throw new Exception(e + " present after removal."); } testEmpty(copy); copy = copyConstructorClone(deque); copy.retainAll(deque); testEqual(deque, copy); copy.removeAll(deque); testEmpty(copy); } static boolean checkedThrows; private static void testEmpty(Deque deque) throws Exception { if (!deque.isEmpty()) throw new Exception("Deque isn't empty"); if (deque.size() != 0) throw new Exception("Deque size isn't zero"); if (!(deque.pollFirst() == null)) throw new Exception("pollFirst lies"); if (!(deque.poll() == null)) throw new Exception("poll lies"); if (!(deque.peekFirst() == null)) throw new Exception("peekFirst lies"); if (!(deque.peek() == null)) throw new Exception("peek lies"); if (!(deque.pollLast() == null)) throw new Exception("pollLast lies"); if (!(deque.peekLast() == null)) throw new Exception("peekLast lies"); if (!checkedThrows) { checkedThrows = true; boolean threw = false; int result = 666; try { result = ((random() & 1) == 0 ? deque.getFirst() : deque.element()); } catch (NoSuchElementException e) { threw = true; } if (!threw) throw new Exception("getFirst-no exception: "+result); threw = false; try { result = deque.getLast(); } catch (NoSuchElementException e) { threw = true; } if (!threw) throw new Exception("getLast-no exception: "+result); } } } jsr166/src/test/loops/SynchronizedLinkedListQueue.java0000644000000000000000000000372311537741072020227 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; public class SynchronizedLinkedListQueue extends AbstractCollection implements Queue { private final Queue q = new LinkedList(); public synchronized Iterator iterator() { return q.iterator(); } public synchronized boolean isEmpty() { return q.isEmpty(); } public synchronized int size() { return q.size(); } public synchronized boolean offer(E o) { return q.offer(o); } public synchronized boolean add(E o) { return q.add(o); } public synchronized E poll() { return q.poll(); } public synchronized E remove() { return q.remove(); } public synchronized E peek() { return q.peek(); } public synchronized E element() { return q.element(); } public synchronized boolean contains(Object o) { return q.contains(o); } public synchronized Object[] toArray() { return q.toArray(); } public synchronized T[] toArray(T[] a) { return q.toArray(a); } public synchronized boolean remove(Object o) { return q.remove(o); } public synchronized boolean containsAll(Collection coll) { return q.containsAll(coll); } public synchronized boolean addAll(Collection coll) { return q.addAll(coll); } public synchronized boolean removeAll(Collection coll) { return q.removeAll(coll); } public synchronized boolean retainAll(Collection coll) { return q.retainAll(coll); } public synchronized void clear() { q.clear(); } public synchronized String toString() { return q.toString(); } } jsr166/src/test/loops/NavigableSetCheck.java0000644000000000000000000003173011537741071016060 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * @test * @synopsis Times and checks basic set operations */ import java.util.*; import java.io.*; public class NavigableSetCheck { static int absentSize; static int absentMask; static Integer[] absent; static final Integer MISSING = new Integer(Integer.MIN_VALUE); static TestTimer timer = new TestTimer(); static void reallyAssert(boolean b) { if (!b) throw new Error("Failed Assertion"); } public static void main(String[] args) throws Exception { Class setClass = null; int numTests = 50; int size = 50000; if (args.length > 0) { try { setClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } if (args.length > 1) numTests = Integer.parseInt(args[1]); if (args.length > 2) size = Integer.parseInt(args[2]); System.out.println("Testing " + setClass.getName() + " trials: " + numTests + " size: " + size); absentSize = 8; while (absentSize < size) absentSize <<= 1; absentMask = absentSize - 1; absent = new Integer[absentSize]; for (int i = 0; i < absentSize; ++i) absent[i] = new Integer(i * 2); Integer[] key = new Integer[size]; for (int i = 0; i < size; ++i) key[i] = new Integer(i * 2 + 1); for (int rep = 0; rep < numTests; ++rep) { runTest(newSet(setClass), key); } TestTimer.printStats(); } static NavigableSet newSet(Class cl) { try { NavigableSet m = (NavigableSet) cl.newInstance(); return m; } catch (Exception e) { throw new RuntimeException("Can't instantiate " + cl + ": " + e); } } static void runTest(NavigableSet s, Integer[] key) { shuffle(key); int size = key.length; long startTime = System.currentTimeMillis(); test(s, key); long time = System.currentTimeMillis() - startTime; } static void t1(String nm, int n, NavigableSet s, Integer[] key, int expect) { int sum = 0; int iters = 4; timer.start(nm, n * iters); for (int j = 0; j < iters; ++j) { for (int i = 0; i < n; i++) { if (s.contains(key[i])) ++sum; } } timer.finish(); reallyAssert(sum == expect * iters); } static void t2(String nm, int n, NavigableSet s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.remove(key[i])) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t3(String nm, int n, NavigableSet s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.add(key[i])) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t4(String nm, int n, NavigableSet s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.contains(key[i])) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t5(String nm, int n, NavigableSet s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n/2); for (int i = n-2; i >= 0; i-=2) { if (s.remove(key[i])) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t6(String nm, int n, NavigableSet s, Integer[] k1, Integer[] k2) { int sum = 0; timer.start(nm, n * 2); for (int i = 0; i < n; i++) { if (s.contains(k1[i])) ++sum; if (s.contains(k2[i & absentMask])) ++sum; } timer.finish(); reallyAssert(sum == n); } static void t7(String nm, int n, NavigableSet s, Integer[] k1, Integer[] k2) { int sum = 0; timer.start(nm, n * 2); for (int i = 0; i < n; i++) { if (s.contains(k1[i])) ++sum; if (s.contains(k2[i & absentMask])) ++sum; } timer.finish(); reallyAssert(sum == n); } static void t8(String nm, int n, NavigableSet s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.contains(key[i])) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void higherTest(NavigableSet s) { int sum = 0; int iters = s.size(); timer.start("Higher ", iters); Object e = s.first(); while (e != null) { ++sum; e = s.higher(e); } timer.finish(); reallyAssert(sum == iters); } static void lowerTest(NavigableSet s) { int sum = 0; int iters = s.size(); timer.start("Lower ", iters); Object e = s.first(); while (e != null) { ++sum; e = s.higher(e); } timer.finish(); reallyAssert(sum == iters); } static void ceilingTest(NavigableSet s) { int sum = 0; int iters = s.size(); if (iters > absentSize) iters = absentSize; timer.start("Ceiling ", iters); for (int i = 0; i < iters; ++i) { Object e = s.ceiling(absent[i]); if (e != null) ++sum; } timer.finish(); reallyAssert(sum == iters); } static void floorTest(NavigableSet s) { int sum = 0; int iters = s.size(); if (iters > absentSize) iters = absentSize; timer.start("Floor ", iters); for (int i = 1; i < iters; ++i) { Object e = s.floor(absent[i]); if (e != null) ++sum; } timer.finish(); reallyAssert(sum == iters-1); } static void ktest(NavigableSet s, int size, Integer[] key) { timer.start("Contains ", size); int sum = 0; for (int i = 0; i < size; i++) { if (s.contains(key[i])) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest1(NavigableSet s, int size) { int sum = 0; timer.start("Iter Key ", size); for (Iterator it = s.iterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest(NavigableSet s, int size) { ittest1(s, size); } static void rittest1(NavigableSet s, int size) { int sum = 0; timer.start("Desc Iter Key ", size); for (Iterator it = s.descendingIterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void rittest(NavigableSet s, int size) { rittest1(s, size); } static void rtest(NavigableSet s, int size) { timer.start("Remove (iterator) ", size); for (Iterator it = s.iterator(); it.hasNext(); ) { it.next(); it.remove(); } timer.finish(); } static void dtest(NavigableSet s, int size, Integer[] key) { timer.start("Add (addAll) ", size * 2); NavigableSet s2 = null; try { s2 = (NavigableSet) (s.getClass().newInstance()); s2.addAll(s); } catch (Exception e) { e.printStackTrace(); return; } timer.finish(); timer.start("Iter Equals ", size * 2); boolean eqt = s2.equals(s) && s.equals(s2); reallyAssert(eqt); timer.finish(); timer.start("Iter HashCode ", size * 2); int shc = s.hashCode(); int s2hc = s2.hashCode(); reallyAssert(shc == s2hc); timer.finish(); timer.start("Add (present) ", size); s2.addAll(s); timer.finish(); t6("Contains ", size, s2, key, absent); boolean as2 = s2.add(absent[absentSize-1]); reallyAssert(as2); timer.start("Iter Equals ", size * 2); eqt = s2.equals(s) && s.equals(s2); if (as2) reallyAssert(!eqt); timer.finish(); timer.start("Iter HashCode ", size * 2); int s1h = s.hashCode(); int s2h = s2.hashCode(); if (as2) reallyAssert(s1h != s2h); timer.finish(); timer.start("Clear ", size); s.clear(); s2.clear(); timer.finish(); reallyAssert(s2.isEmpty() && s.isEmpty()); } static void test(NavigableSet s, Integer[] key) { int size = key.length; t3("Add (absent) ", size, s, key, size); t3("Add (present) ", size, s, key, 0); t7("ContainsKey ", size, s, key, absent); t4("ContainsKey ", size, s, key, size); ktest(s, size, key); t4("Contains ", absentSize, s, absent, 0); t6("Contains ", size, s, key, absent); t1("Contains (present) ", size, s, key, size); t1("Contains (absent) ", absentSize, s, absent, 0); t2("Remove (absent) ", absentSize, s, absent, 0); t5("Remove (present) ", size, s, key, size / 2); t3("Add (half present) ", size, s, key, size / 2); ittest(s, size); rittest(s, size); higherTest(s); ceilingTest(s); floorTest(s); lowerTest(s); rtest(s, size); t4("Contains ", size, s, key, 0); t2("Remove (absent) ", size, s, key, 0); t3("Add (presized) ", size, s, key, size); dtest(s, size, key); } static class TestTimer { private String name; private long numOps; private long startTime; private String cname; static final java.util.TreeMap accum = new java.util.TreeMap(); static void printStats() { for (Iterator it = accum.entrySet().iterator(); it.hasNext(); ) { Map.Entry e = (Map.Entry) it.next(); Stats stats = (Stats) e.getValue(); int n = stats.number; double t; if (n > 0) t = stats.sum / n; else t = stats.least; long nano = Math.round(1000000.0 * t); System.out.println(e.getKey() + ": " + nano); } } void start(String name, long numOps) { this.name = name; this.cname = classify(); this.numOps = numOps; startTime = System.currentTimeMillis(); } String classify() { if (name.startsWith("Contains")) return "Contains "; else if (name.startsWith("Add")) return "Add "; else if (name.startsWith("Remove")) return "Remove "; else if (name.startsWith("Iter")) return "Iter "; else return null; } void finish() { long endTime = System.currentTimeMillis(); long time = endTime - startTime; double timePerOp = (double) time / numOps; Object st = accum.get(name); if (st == null) accum.put(name, new Stats(timePerOp)); else { Stats stats = (Stats) st; stats.sum += timePerOp; stats.number++; if (timePerOp < stats.least) stats.least = timePerOp; } if (cname != null) { st = accum.get(cname); if (st == null) accum.put(cname, new Stats(timePerOp)); else { Stats stats = (Stats) st; stats.sum += timePerOp; stats.number++; if (timePerOp < stats.least) stats.least = timePerOp; } } } } static class Stats { double sum = 0; double least; int number = 0; Stats(double t) { least = t; } } static Random rng = new Random(); static void shuffle(Integer[] keys) { int size = keys.length; for (int i=size; i>1; i--) { int r = rng.nextInt(i); Integer t = keys[i-1]; keys[i-1] = keys[r]; keys[r] = t; } } } jsr166/src/test/loops/MatrixMultiply.java0000644000000000000000000002115311537741071015560 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ //import jsr166y.*; import java.util.concurrent.*; import java.util.concurrent.TimeUnit; /** * Divide and Conquer matrix multiply demo */ public class MatrixMultiply { /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static final int DEFAULT_GRANULARITY = 32; /** * The quadrant size at which to stop recursing down * and instead directly multiply the matrices. * Must be a power of two. Minimum value is 2. */ static int granularity = DEFAULT_GRANULARITY; public static void main(String[] args) throws Exception { final String usage = "Usage: java MatrixMultiply [] \n Size and granularity must be powers of two.\n For example, try java MatrixMultiply 2 512 16"; int procs = 0; int n = 2048; int runs = 5; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) n = Integer.parseInt(args[1]); if (args.length > 2) granularity = Integer.parseInt(args[2]); if (args.length > 3) runs = Integer.parseInt(args[2]); } catch (Exception e) { System.out.println(usage); return; } if ( ((n & (n - 1)) != 0) || ((granularity & (granularity - 1)) != 0) || granularity < 2) { System.out.println(usage); return; } ForkJoinPool pool = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); System.out.println("procs: " + pool.getParallelism() + " n: " + n + " granularity: " + granularity + " runs: " + runs); float[][] a = new float[n][n]; float[][] b = new float[n][n]; float[][] c = new float[n][n]; for (int i = 0; i < runs; ++i) { init(a, b, n); long start = System.nanoTime(); pool.invoke(new Multiplier(a, 0, 0, b, 0, 0, c, 0, 0, n)); long time = System.nanoTime() - start; double secs = ((double)time) / NPS; Thread.sleep(100); System.out.printf("\tTime: %7.3f\n", secs); // check(c, n); } System.out.println(pool.toString()); pool.shutdown(); } // To simplify checking, fill with all 1's. Answer should be all n's. static void init(float[][] a, float[][] b, int n) { for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { a[i][j] = 1.0F; b[i][j] = 1.0F; } } } static void check(float[][] c, int n) { for (int i = 0; i < n; i++ ) { for (int j = 0; j < n; j++ ) { if (c[i][j] != n) { throw new Error("Check Failed at [" + i +"]["+j+"]: " + c[i][j]); } } } } /** * Multiply matrices AxB by dividing into quadrants, using algorithm: *
     *      A      x      B
     *
     *  A11 | A12     B11 | B12     A11*B11 | A11*B12     A12*B21 | A12*B22
     * |----+----| x |----+----| = |--------+--------| + |---------+-------|
     *  A21 | A22     B21 | B21     A21*B11 | A21*B21     A22*B21 | A22*B22
     * 
*/ static class Multiplier extends RecursiveAction { final float[][] A; // Matrix A final int aRow; // first row of current quadrant of A final int aCol; // first column of current quadrant of A final float[][] B; // Similarly for B final int bRow; final int bCol; final float[][] C; // Similarly for result matrix C final int cRow; final int cCol; final int size; // number of elements in current quadrant Multiplier(float[][] A, int aRow, int aCol, float[][] B, int bRow, int bCol, float[][] C, int cRow, int cCol, int size) { this.A = A; this.aRow = aRow; this.aCol = aCol; this.B = B; this.bRow = bRow; this.bCol = bCol; this.C = C; this.cRow = cRow; this.cCol = cCol; this.size = size; } public void compute() { if (size <= granularity) { multiplyStride2(); } else { int h = size / 2; invokeAll(new Seq2[] { seq(new Multiplier(A, aRow, aCol, // A11 B, bRow, bCol, // B11 C, cRow, cCol, // C11 h), new Multiplier(A, aRow, aCol+h, // A12 B, bRow+h, bCol, // B21 C, cRow, cCol, // C11 h)), seq(new Multiplier(A, aRow, aCol, // A11 B, bRow, bCol+h, // B12 C, cRow, cCol+h, // C12 h), new Multiplier(A, aRow, aCol+h, // A12 B, bRow+h, bCol+h, // B22 C, cRow, cCol+h, // C12 h)), seq(new Multiplier(A, aRow+h, aCol, // A21 B, bRow, bCol, // B11 C, cRow+h, cCol, // C21 h), new Multiplier(A, aRow+h, aCol+h, // A22 B, bRow+h, bCol, // B21 C, cRow+h, cCol, // C21 h)), seq(new Multiplier(A, aRow+h, aCol, // A21 B, bRow, bCol+h, // B12 C, cRow+h, cCol+h, // C22 h), new Multiplier(A, aRow+h, aCol+h, // A22 B, bRow+h, bCol+h, // B22 C, cRow+h, cCol+h, // C22 h)) }); } } /** * Version of matrix multiplication that steps 2 rows and columns * at a time. Adapted from Cilk demos. * Note that the results are added into C, not just set into C. * This works well here because Java array elements * are created with all zero values. */ void multiplyStride2() { for (int j = 0; j < size; j+=2) { for (int i = 0; i < size; i +=2) { float[] a0 = A[aRow+i]; float[] a1 = A[aRow+i+1]; float s00 = 0.0F; float s01 = 0.0F; float s10 = 0.0F; float s11 = 0.0F; for (int k = 0; k < size; k+=2) { float[] b0 = B[bRow+k]; s00 += a0[aCol+k] * b0[bCol+j]; s10 += a1[aCol+k] * b0[bCol+j]; s01 += a0[aCol+k] * b0[bCol+j+1]; s11 += a1[aCol+k] * b0[bCol+j+1]; float[] b1 = B[bRow+k+1]; s00 += a0[aCol+k+1] * b1[bCol+j]; s10 += a1[aCol+k+1] * b1[bCol+j]; s01 += a0[aCol+k+1] * b1[bCol+j+1]; s11 += a1[aCol+k+1] * b1[bCol+j+1]; } C[cRow+i] [cCol+j] += s00; C[cRow+i] [cCol+j+1] += s01; C[cRow+i+1][cCol+j] += s10; C[cRow+i+1][cCol+j+1] += s11; } } } } static Seq2 seq(RecursiveAction task1, RecursiveAction task2) { return new Seq2(task1, task2); } static final class Seq2 extends RecursiveAction { final RecursiveAction fst; final RecursiveAction snd; public Seq2(RecursiveAction task1, RecursiveAction task2) { fst = task1; snd = task2; } public void compute() { fst.invoke(); snd.invoke(); } } } jsr166/src/test/loops/MapWordLoops.java0000644000000000000000000001331711537741071015145 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.io.*; public class MapWordLoops { static final String[] WORDS_FILES = { "kw.txt", "class.txt", "dir.txt", "ids.txt", "testwords.txt", // "/usr/dict/words", }; static final int MAX_WORDS = 500000; static final int pinsert = 60; static final int premove = 2; static final int NOPS = 8000000; static final int numTests = 3; public static void main(String[] args) { Class mapClass = null; try { mapClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } System.out.println("Testing " + mapClass.getName()); for (int s = 0; s < WORDS_FILES.length; ++s) tests(mapClass, numTests, s); for (int s = WORDS_FILES.length-1; s >= 0; --s) tests(mapClass, numTests, s); } static void tests(Class mapClass, int numTests, int sizeIndex) { try { String[] key = readWords(sizeIndex); int size = key.length; System.out.print("n = " +LoopHelpers.rightJustify(size) +" : "); long least = Long.MAX_VALUE; for (int i = 0; i < numTests; ++i) { Map m = newMap(mapClass); long t = doTest(i, mapClass.getName(), m, key); if (t < least) least = t; m.clear(); m = null; } long nano = Math.round(1000000.0 * (least) / NOPS); System.out.println(LoopHelpers.rightJustify(nano) + " ns per op"); } catch (IOException ignore) { return; // skip test if can't read file } } static Map newMap(Class cl) { try { Map m = (Map)cl.newInstance(); return m; } catch (Exception e) { throw new RuntimeException("Can't instantiate " + cl + ": " + e); } } static void pause() { try { Thread.sleep(100); } catch (InterruptedException ie) { return; } } static String[] readWords(int sizeIndex) throws IOException { String[] l = new String[MAX_WORDS]; String[] array = null; try { FileReader fr = new FileReader(WORDS_FILES[sizeIndex]); BufferedReader reader = new BufferedReader(fr); int k = 0; for (;;) { String s = reader.readLine(); if (s == null) break; l[k++] = s; } array = new String[k]; for (int i = 0; i < k; ++i) { array[i] = l[i]; l[i] = null; } l = null; reader.close(); } catch (IOException ex) { System.out.println("Can't read words file:" + ex); throw ex; } return array; } static long doTest(int id, String name, final Map m, final String[] key) { // System.out.print(name + "\t"); Runner runner = new Runner(id, m, key); long startTime = System.currentTimeMillis(); runner.run(); long afterRun = System.currentTimeMillis(); long runTime = (afterRun - startTime); int np = runner.total; if (runner.total == runner.hashCode()) System.out.println("Useless Number" + runner.total); int sz = runner.maxsz; if (sz == runner.hashCode()) System.out.println("Useless Number" + sz); // System.out.print(" m = " + sz); return runTime; } static class Runner implements Runnable { final Map map; final String[] key; LoopHelpers.SimpleRandom rng; final int pctrem; final int pctins; int nputs = 0; int npgets = 0; int nagets = 0; int nremoves = 0; volatile int total; int maxsz; Runner(int id, Map m, String[] k) { map = m; key = k; pctrem = (int)(((long)premove * (long)(Integer.MAX_VALUE/2)) / 50); pctins = (int)(((long)pinsert * (long)(Integer.MAX_VALUE/2)) / 50); rng = new LoopHelpers.SimpleRandom((id + 1) * 8862213513L); } int oneStep(int j) { int n = key.length; int r = rng.next() & 0x7FFFFFFF; int jinc = (r & 7); j += jinc - 3; if (j >= n) j -= n; if (j < 0) j += n; int l = n / 4 + j; if (l >= n) l -= n; String k = key[j]; String x = map.get(k); if (x == null) { ++nagets; if (r < pctins) { map.put(k, key[l]); ++nputs; int csz = nputs - nremoves; if (csz > maxsz) maxsz = csz; } } else { if (k== x) ++npgets; if (r < pctrem) { map.remove(k); ++nremoves; j += ((r >>> 8) & 7) + n / 2; if (j >= n) j -= n; } } return j; } public void run() { int j = key.length / 2; for (int i = 0; i < NOPS; ++i) { j = oneStep(j); } total = nputs + npgets + nagets + nremoves; } } } jsr166/src/test/loops/MapMicroBenchmark.java0000644000000000000000000003747611537741071016115 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.io.*; import java.math.*; /** * A micro-benchmark with key types and operation mixes roughly * corresponding to some real programs. * * The main results are a table of approximate nanoseconds per * element-operation (averaged across get, put etc) for each type, * across a range of map sizes. It also includes category "Mixed" * that includes elements of multiple types including those with * identical hash codes. * * The program includes a bunch of microbenchmarking safeguards that * might underestimate typical performance. For example, by using many * different key types and exercising them in warmups it disables most * dynamic type specialization. Some test classes, like Float and * BigDecimal are included not because they are commonly used as keys, * but because they can be problematic for some map implementations. * * By default, it creates and inserts in order dense numerical keys * and searches for keys in scrambled order. Use "s" as second arg to * instead insert and search in unscrambled order. * * For String keys, the program tries to use file "testwords.txt", which * is best used with real words. We can't check in this file, but you * can create one from a real dictionary (1 line per word) and then run * linux "shuf" to randomize entries. If no file exists, it uses * String.valueOf(i) for element i. */ public class MapMicroBenchmark { static final String wordFile = "testwords.txt"; static Class mapClass; static boolean randomSearches = true; // Nanoseconds per run static final long NANOS_PER_JOB = 6L * 1000L*1000L*1000L; static final long NANOS_PER_WARMUP = 100L*1000L*1000L; // map operations per item per iteration -- change if job.work changed static final int OPS_PER_ITER = 11; static final int MIN_ITERS_PER_TEST = 3; // must be > 1 static final int MAX_ITERS_PER_TEST = 1000000; // avoid runaway // sizes are at halfway points for HashMap default resizes static final int firstSize = 9; static final int sizeStep = 4; // each size 4X last static final int nsizes = 9; static final int[] sizes = new int[nsizes]; public static void main(String[] args) throws Throwable { if (args.length == 0) { System.out.println("Usage: java MapMicroBenchmark className [r|s]keys [r|s]searches"); return; } mapClass = Class.forName(args[0]); if (args.length > 1) { if (args[1].startsWith("s")) randomSearches = false; else if (args[1].startsWith("r")) randomSearches = true; } System.out.print("Class " + mapClass.getName()); if (randomSearches) System.out.print(" randomized searches"); else System.out.print(" sequential searches"); System.out.println(); int n = firstSize; for (int i = 0; i < nsizes - 1; ++i) { sizes[i] = n; n *= sizeStep; } sizes[nsizes - 1] = n; int njobs = 10; Job[] jobs = new Job[njobs]; Object[] os = new Object[n]; for (int i = 0; i < n; i++) os[i] = new Object(); jobs[0] = new Job("Object ", os, Object.class); Object[] ss = new Object[n]; initStringKeys(ss, n); jobs[1] = new Job("String ", ss, String.class); Object[] is = new Object[n]; for (int i = 0; i < n; i++) is[i] = Integer.valueOf(i); jobs[2] = new Job("Integer ", is, Integer.class); Object[] ls = new Object[n]; for (int i = 0; i < n; i++) ls[i] = Long.valueOf((long) i); jobs[3] = new Job("Long ", ls, Long.class); Object[] fs = new Object[n]; for (int i = 0; i < n; i++) fs[i] = Float.valueOf((float) i); jobs[4] = new Job("Float ", fs, Float.class); Object[] ds = new Object[n]; for (int i = 0; i < n; i++) ds[i] = Double.valueOf((double) i); jobs[5] = new Job("Double ", ds, Double.class); Object[] bs = new Object[n]; long b = -n; // include some negatives for (int i = 0; i < n; i++) bs[i] = BigInteger.valueOf(b += 3); jobs[6] = new Job("BigInteger", bs, BigInteger.class); Object[] es = new Object[n]; long d = Integer.MAX_VALUE; // include crummy codes for (int i = 0; i < n; i++) es[i] = BigDecimal.valueOf(d += 65536); jobs[7] = new Job("BigDecimal", es, BigDecimal.class); Object[] rs = new Object[n]; for (int i = 0; i < n; i++) rs[i] = new RandomInt(); jobs[8] = new Job("RandomInt ", rs, RandomInt.class); Object[] ms = new Object[n]; for (int i = 0; i < n; i += 2) { int r = rng.nextInt(njobs - 1); ms[i] = jobs[r].items[i]; // include some that will have same hash but not .equal if (++r >= njobs - 1) r = 0; ms[i+1] = jobs[r].items[i]; } jobs[9] = new Job("Mixed ", ms, Object.class); Job mixed = jobs[9]; warmup1(mixed); warmup2(jobs); warmup1(mixed); warmup3(jobs); Thread.sleep(500); time(jobs); } static void runWork(Job[] jobs, int minIters, int maxIters, long timeLimit) throws Throwable { for (int k = 0; k < nsizes; ++k) { int len = sizes[k]; for (int i = 0; i < jobs.length; i++) { Thread.sleep(50); jobs[i].nanos[k] = jobs[i].work(len, minIters, maxIters, timeLimit); System.out.print("."); } } System.out.println(); } // First warmup -- run only mixed job to discourage type specialization static void warmup1(Job job) throws Throwable { for (int k = 0; k < nsizes; ++k) job.work(sizes[k], 1, 1, 0); } // Second, run each once static void warmup2(Job[] jobs) throws Throwable { System.out.print("warm up"); runWork(jobs, 1, 1, 0); long ck = jobs[0].checkSum; for (int i = 1; i < jobs.length - 1; i++) { if (jobs[i].checkSum != ck) throw new Error("CheckSum"); } } // Third: short timed runs static void warmup3(Job[] jobs) throws Throwable { System.out.print("warm up"); runWork(jobs, 1, MAX_ITERS_PER_TEST, NANOS_PER_WARMUP); } static void time(Job[] jobs) throws Throwable { System.out.print("running"); runWork(jobs, MIN_ITERS_PER_TEST, MAX_ITERS_PER_TEST, NANOS_PER_JOB); System.out.print("Type/Size:"); for (int k = 0; k < nsizes; ++k) System.out.printf("%7d", sizes[k]); System.out.println(); long[] aves = new long[nsizes]; int njobs = jobs.length; for (int i = 0; i < njobs; i++) { System.out.print(jobs[i].name); for (int k = 0; k < nsizes; ++k) { long nanos = jobs[i].nanos[k]; System.out.printf("%7d", nanos); aves[k] += nanos; } System.out.println(); } System.out.println(); System.out.print("average "); for (int k = 0; k < nsizes; ++k) System.out.printf("%7d", (aves[k] / njobs)); System.out.println("\n"); } static final class Job { final String name; final Class elementClass; long[] nanos = new long[nsizes]; final Object[] items; Object[] searches; volatile long checkSum; volatile int lastSum; Job(String name, Object[] items, Class elementClass) { this.name = name; this.items = items; this.elementClass = elementClass; if (randomSearches) { scramble(items); this.searches = new Object[items.length]; System.arraycopy(items, 0, searches, 0, items.length); scramble(searches); } else this.searches = items; } public long work(int len, int minIters, int maxIters, long timeLimit) { Map m; try { m = (Map) mapClass.newInstance(); } catch (Exception e) { throw new RuntimeException("Can't instantiate " + mapClass + ": " + e); } Object[] ins = items; Object[] keys = searches; if (ins.length < len || keys.length < len) throw new Error(name); int half = len / 2; int quarter = half / 2; int sum = lastSum; long startTime = System.nanoTime(); long elapsed; int j = 0; for (;;) { for (int i = 0; i < half; ++i) { Object x = ins[i]; if (m.put(x, x) == null) ++sum; } checkSum += sum ^ (sum << 1); // help avoid loop merging sum += len - half; for (int i = 0; i < len; ++i) { Object x = keys[i]; Object v = m.get(x); if (elementClass.isInstance(v)) // touch v ++sum; } checkSum += sum ^ (sum << 2); for (int i = half; i < len; ++i) { Object x = ins[i]; if (m.put(x, x) == null) ++sum; } checkSum += sum ^ (sum << 3); for (Object e : m.keySet()) { if (elementClass.isInstance(e)) ++sum; } checkSum += sum ^ (sum << 4); for (Object e : m.values()) { if (elementClass.isInstance(e)) ++sum; } checkSum += sum ^ (sum << 5); for (int i = len - 1; i >= 0; --i) { Object x = keys[i]; Object v = m.get(x); if (elementClass.isInstance(v)) ++sum; } checkSum += sum ^ (sum << 6); for (int i = 0; i < len; ++i) { Object x = ins[i]; Object v = m.get(x); if (elementClass.isInstance(v)) ++sum; } checkSum += sum ^ (sum << 7); for (int i = 0; i < len; ++i) { Object x = keys[i]; Object v = ins[i]; if (m.put(x, v) == x) ++sum; } checkSum += sum ^ (sum << 8); for (int i = 0; i < len; ++i) { Object x = keys[i]; Object v = ins[i]; if (v == m.get(x)) ++sum; } checkSum += sum ^ (sum << 9); for (int i = len - 1; i >= 0; --i) { Object x = ins[i]; Object v = m.get(x); if (elementClass.isInstance(v)) ++sum; } checkSum += sum ^ (sum << 10); for (int i = len - 1; i >= 0; --i) { Object x = keys[i]; Object v = ins[i]; if (v == m.get(x)) ++sum; } checkSum += sum ^ (sum << 11); for (int i = 0; i < quarter; ++i) { Object x = keys[i]; if (m.remove(x) != null) ++sum; } for (int i = 0; i < quarter; ++i) { Object x = keys[i]; if (m.put(x, x) == null) ++sum; } m.clear(); sum += len - (quarter * 2); checkSum += sum ^ (sum << 12); if (j == 0 && sum != lastSum + len * OPS_PER_ITER) throw new Error(name); elapsed = System.nanoTime() - startTime; ++j; if (j >= minIters && (j >= maxIters || elapsed >= timeLimit)) break; // non-warmup - swap some keys for next insert if (minIters != 1 && randomSearches) shuffleSome(ins, len, len >>> 3); } long ops = ((long) j) * len * OPS_PER_ITER; lastSum = sum; return elapsed / ops; } } static final Random rng = new Random(3122688); // Shuffle the subarrays for each size. This doesn't fully // randomize, but the remaining partial locality is arguably a bit // more realistic static void scramble(Object[] a) { for (int k = 0; k < sizes.length; ++k) { int origin = (k == 0) ? 0 : sizes[k-1]; for (int i = sizes[k]; i > origin + 1; i--) { Object t = a[i-1]; int r = rng.nextInt(i - origin) + origin; a[i-1] = a[r]; a[r] = t; } } } // plain array shuffle static void shuffle(Object[] a, int size) { for (int i= size; i>1; i--) { Object t = a[i-1]; int r = rng.nextInt(i); a[i-1] = a[r]; a[r] = t; } } // swap nswaps elements static void shuffleSome(Object[] a, int size, int nswaps) { for (int s = 0; s < nswaps; ++s) { int i = rng.nextInt(size); int r = rng.nextInt(size); Object t = a[i]; a[i] = a[r]; a[r] = t; } } // Integer-like class with random hash codes static final class RandomInt { static int seed = 3122688; static int next() { // a non-xorshift, 2^32-period RNG int x = seed; int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } seed = lo; return x; } final int value; RandomInt() { value = next(); } public int hashCode() { return value; } public boolean equals(Object x) { return (x instanceof RandomInt) && ((RandomInt)x).value == value; } } // Read in String keys from file if possible static void initStringKeys(Object[] keys, int n) throws Exception { FileInputStream fr = null; try { fr = new FileInputStream(wordFile); } catch (IOException ex) { System.out.println("No word file. Using String.valueOf(i)"); for (int i = 0; i < n; i++) keys[i] = String.valueOf(i); return; } BufferedInputStream in = new BufferedInputStream(fr); int k = 0; outer:while (k < n) { StringBuffer sb = new StringBuffer(); for (;;) { int c = in.read(); if (c < 0) break outer; char ch = (char) c; if (ch == '\n') { keys[k++] = sb.toString(); break; } if (!Character.isWhitespace(ch)) sb.append(ch); } } in.close(); // fill up remaining keys with path-like compounds of previous pairs int j = 0; while (k < n) keys[k++] = (String) keys[j++] + "/" + (String) keys[j]; } } jsr166/src/test/loops/TimeUnitLoops.java0000644000000000000000000000362211537741072015331 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.Random; public class TimeUnitLoops { static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); /** * False value allows aggressive inlining of cvt() calls from * test(). True value prevents any inlining, requiring virtual * method dispatch. */ static final boolean PREVENT_INLINING = true; // The following all are used by inlining prevention clause: static int index = 0; static final int NUNITS = 100; static final TimeUnit[] units = new TimeUnit[NUNITS]; static { TimeUnit[] v = TimeUnit.values(); for (int i = 0; i < NUNITS; ++i) units[i] = v[rng.next() % v.length]; } public static void main(String[] args) throws Exception { long start = System.currentTimeMillis(); long s = 0; for (int i = 0; i < 100; ++i) { s += test(); if (s == start) System.out.println(" "); } long end = System.currentTimeMillis(); System.out.println("Time: " + (end - start) + " ms"); } static long test() { long sum = 0; int x = rng.next(); for (int i = 0; i < 1000000; ++i) { long l = (long) x + (long) x; sum += cvt(l, TimeUnit.SECONDS); sum += TimeUnit.MILLISECONDS.toMicros(l+2); sum += cvt(l+17, TimeUnit.NANOSECONDS); sum += cvt(l+42, TimeUnit.MILLISECONDS); x = LoopHelpers.compute4(x); } return sum + x; } static long cvt(long d, TimeUnit u) { if (PREVENT_INLINING) { u = units[index]; index = (index+1) % NUNITS; } return u.toNanos(d); } } jsr166/src/test/loops/MultipleProducersSingleConsumerLoops.java0000644000000000000000000002045711537741071022137 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; //import jsr166y.*; public class MultipleProducersSingleConsumerLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final Random rng = new Random(); static final ExecutorService pool = Executors.newCachedThreadPool(); static boolean print = false; static int producerSum; static int consumerSum; static synchronized void addProducerSum(int x) { producerSum += x; } static synchronized void addConsumerSum(int x) { consumerSum += x; } static synchronized void checkSum() { if (producerSum != consumerSum) throw new Error("CheckSum mismatch"); } // Number of elements passed around -- must be power of two // Elements are reused from pool to minimize alloc impact static final int POOL_SIZE = 1 << 8; static final int POOL_MASK = POOL_SIZE-1; static final Integer[] intPool = new Integer[POOL_SIZE]; static { for (int i = 0; i < POOL_SIZE; ++i) intPool[i] = Integer.valueOf(i); } // Number of puts by producers or takes by consumers static final int ITERS = 1 << 20; // max lag between a producer and consumer to avoid // this becoming a GC test rather than queue test. static final int LAG = (1 << 12); static final int LAG_MASK = LAG - 1; public static void main(String[] args) throws Exception { int maxn = 12; // NCPUS * 3 / 2; if (args.length > 0) maxn = Integer.parseInt(args[0]); warmup(); print = true; int k = 1; for (int i = 1; i <= maxn;) { System.out.println("Producers:" + i); oneTest(i, ITERS); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static void warmup() throws Exception { print = false; System.out.print("Warmup "); int it = 2000; for (int j = 5; j > 0; --j) { oneTest(j, it); System.out.print("."); it += 1000; } System.gc(); it = 20000; for (int j = 5; j > 0; --j) { oneTest(j, it); System.out.print("."); it += 10000; } System.gc(); System.out.println(); } static void oneTest(int n, int iters) throws Exception { int fairIters = iters/16; Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue "); oneRun(new LinkedTransferQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingQueue(cap)"); oneRun(new LinkedBlockingQueue(POOL_SIZE), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingDeque "); oneRun(new LinkedBlockingDeque(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("ArrayBlockingQueue "); oneRun(new ArrayBlockingQueue(POOL_SIZE), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("SynchronousQueue "); oneRun(new SynchronousQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("SynchronousQueue(fair) "); oneRun(new SynchronousQueue(true), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue(xfer)"); oneRun(new LTQasSQ(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue(half)"); oneRun(new HalfSyncLTQ(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("PriorityBlockingQueue "); oneRun(new PriorityBlockingQueue(), n, fairIters); Thread.sleep(100); // System.gc(); if (print) System.out.print("ArrayBlockingQueue(fair)"); oneRun(new ArrayBlockingQueue(POOL_SIZE, true), n, fairIters); } abstract static class Stage implements Runnable { final int iters; final BlockingQueue queue; final CyclicBarrier barrier; final Phaser lagPhaser; final int lag; Stage(BlockingQueue q, CyclicBarrier b, Phaser s, int iters, int lag) { queue = q; barrier = b; lagPhaser = s; this.iters = iters; this.lag = lag; } } static class Producer extends Stage { Producer(BlockingQueue q, CyclicBarrier b, Phaser s, int iters, int lag) { super(q, b, s, iters, lag); } public void run() { try { barrier.await(); int ps = 0; int r = hashCode(); int j = 0; for (int i = 0; i < iters; ++i) { r = LoopHelpers.compute7(r); Integer v = intPool[r & POOL_MASK]; int k = v.intValue(); queue.put(v); ps += k; if (++j == lag) { j = 0; lagPhaser.arriveAndAwaitAdvance(); } } addProducerSum(ps); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static class Consumer extends Stage { Consumer(BlockingQueue q, CyclicBarrier b, Phaser s, int iters, int lag) { super(q, b, s, iters, lag); } public void run() { try { barrier.await(); int cs = 0; int j = 0; for (int i = 0; i < iters; ++i) { Integer v = queue.take(); int k = v.intValue(); cs += k; if (++j == lag) { j = 0; lagPhaser.arriveAndAwaitAdvance(); } } addConsumerSum(cs); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static void oneRun(BlockingQueue q, int n, int iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(n + 2, timer); Phaser s = new Phaser(n + 1); for (int i = 0; i < n; ++i) { pool.execute(new Producer(q, barrier, s, iters, LAG)); } pool.execute(new Consumer(q, barrier, s, iters * n, LAG * n)); barrier.await(); barrier.await(); long time = timer.getTime(); checkSum(); if (print) System.out.println("\t: " + LoopHelpers.rightJustify(time / (iters * (n + 1))) + " ns per transfer"); } static final class LTQasSQ extends LinkedTransferQueue { LTQasSQ() { super(); } public void put(T x) { try { super.transfer(x); } catch (InterruptedException ex) { throw new Error(); } } } static final class HalfSyncLTQ extends LinkedTransferQueue { int calls; HalfSyncLTQ() { super(); } public void put(T x) { if ((++calls & 1) == 0) super.put(x); else { try { super.transfer(x); } catch (InterruptedException ex) { throw new Error(); } } } } } jsr166/src/test/loops/ScalarLongSort.java0000644000000000000000000002022611537741071015451 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.*; class ScalarLongSort { static final long NPS = (1000L * 1000 * 1000); static int THRESHOLD; static final boolean warmup = true; public static void main (String[] args) throws Exception { int procs = 0; int n = 1 << 22; int reps = 20; int sreps = 2; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) n = Integer.parseInt(args[1]); if (args.length > 2) reps = Integer.parseInt(args[1]); } catch (Exception e) { System.out.println("Usage: java ScalarLongSort threads n reps"); return; } ForkJoinPool pool = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); long[] a = new long[n]; seqRandomFill(a, 0, n); if (warmup) { System.out.printf("Sorting %d longs, %d replications\n", n, 1); seqRandomFill(a, 0, n); long last = System.nanoTime(); java.util.Arrays.sort(a); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("Arrays.sort time: %7.3f\n", elapsed); checkSorted(a); } // for now hardwire 8 * #CPUs leaf tasks THRESHOLD = 1 + ((n + 7) >>> 3) / pool.getParallelism(); // THRESHOLD = 1 + ((n + 15) >>> 4) / pool.getParallelism(); // THRESHOLD = 1 + ((n + 31) >>> 5) / pool.getParallelism(); System.out.printf("Sorting %d longs, %d replications\n", n, reps); for (int i = 0; i < reps; ++i) { pool.invoke(new RandomFiller(a, 0, n)); long last = System.nanoTime(); pool.invoke(new Sorter(a, new long[n], 0, n)); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("Parallel sort time: %7.3f\n", elapsed); if (i == 0) checkSorted(a); } System.out.println(pool); System.out.printf("Sorting %d longs, %d replications\n", n, sreps); for (int i = 0; i < sreps; ++i) { pool.invoke(new RandomFiller(a, 0, n)); long last = System.nanoTime(); java.util.Arrays.sort(a); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("Arrays.sort time: %7.3f\n", elapsed); if (i == 0) checkSorted(a); } System.out.println(pool); pool.shutdown(); } static final class Sorter extends RecursiveAction { final long[] a; final long[] w; final int origin; final int n; Sorter(long[] a, long[] w, int origin, int n) { this.a = a; this.w = w; this.origin = origin; this.n = n; } public void compute() { int l = origin; if (n <= THRESHOLD) Arrays.sort(a, l, l+n); else { // divide in quarters to ensure sorted array in a not w int h = n >>> 1; int q = n >>> 2; int u = h + q; SubSorter rs = new SubSorter (new Sorter(a, w, l+h, q), new Sorter(a, w, l+u, n-u), new Merger(a, w, l+h, q, l+u, n-u, l+h, null)); rs.fork(); Sorter rl = new Sorter(a, w, l+q, h-q); rl.fork(); (new Sorter(a, w, l, q)).compute(); rl.join(); (new Merger(a, w, l, q, l+q, h-q, l, null)).compute(); rs.join(); new Merger(w, a, l, h, l+h, n-h, l, null).compute(); } } } static final class SubSorter extends RecursiveAction { final Sorter left; final Sorter right; final Merger merger; SubSorter(Sorter left, Sorter right, Merger merger) { this.left = left; this.right = right; this.merger = merger; } public void compute() { right.fork(); left.compute(); right.join(); merger.compute(); } } static final class Merger extends RecursiveAction { final long[] a; final long[] w; final int lo; final int ln; final int ro; final int rn; final int wo; Merger next; Merger(long[] a, long[] w, int lo, int ln, int ro, int rn, int wo, Merger next) { this.a = a; this.w = w; this.lo = lo; this.ln = ln; this.ro = ro; this.rn = rn; this.wo = wo; this.next = next; } /** * Merge left and right by splitting left in half, * and finding index of right closest to split point. * Uses left-spine decomposition to generate all * merge tasks before bottomming out at base case. * */ public final void compute() { Merger rights = null; int nleft = ln; int nright = rn; while (nleft > THRESHOLD) { // && nright > (THRESHOLD >>> 3)) { int lh = nleft >>> 1; int splitIndex = lo + lh; long split = a[splitIndex]; int rl = 0; int rh = nright; while (rl < rh) { int mid = (rl + rh) >>> 1; if (split <= a[ro + mid]) rh = mid; else rl = mid + 1; } (rights = new Merger(a, w, splitIndex, nleft-lh, ro+rh, nright-rh, wo+lh+rh, rights)).fork(); nleft = lh; nright = rh; } merge(nleft, nright); if (rights != null) collectRights(rights); } final void merge(int nleft, int nright) { int l = lo; int lFence = lo + nleft; int r = ro; int rFence = ro + nright; int k = wo; while (l < lFence && r < rFence) { long al = a[l]; long ar = a[r]; long t; if (al <= ar) { ++l; t = al; } else { ++r; t = ar; } w[k++] = t; } while (l < lFence) w[k++] = a[l++]; while (r < rFence) w[k++] = a[r++]; } static void collectRights(Merger rt) { while (rt != null) { Merger next = rt.next; rt.next = null; if (rt.tryUnfork()) rt.compute(); else rt.join(); rt = next; } } } static void checkSorted (long[] a) { int n = a.length; for (int i = 0; i < n - 1; i++) { if (a[i] > a[i+1]) { throw new Error("Unsorted at " + i + ": " + a[i] + " / " + a[i+1]); } } } static void seqRandomFill(long[] array, int lo, int hi) { ThreadLocalRandom rng = ThreadLocalRandom.current(); for (int i = lo; i < hi; ++i) array[i] = rng.nextLong(); } static final class RandomFiller extends RecursiveAction { final long[] array; final int lo, hi; RandomFiller(long[] array, int lo, int hi) { this.array = array; this.lo = lo; this.hi = hi; } public void compute() { if (hi - lo <= THRESHOLD) { long[] a = array; ThreadLocalRandom rng = ThreadLocalRandom.current(); for (int i = lo; i < hi; ++i) a[i] = rng.nextLong(); } else { int mid = (lo + hi) >>> 1; RandomFiller r = new RandomFiller(array, mid, hi); r.fork(); (new RandomFiller(array, lo, mid)).compute(); r.join(); } } } } jsr166/src/test/loops/NavigableMapCheck.java0000644000000000000000000003606611537741071016051 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * @test * @synopsis Times and checks basic map operations */ import java.util.*; import java.io.*; public class NavigableMapCheck { static int absentSize; static int absentMask; static Integer[] absent; static final Integer MISSING = new Integer(Integer.MIN_VALUE); static TestTimer timer = new TestTimer(); static void reallyAssert(boolean b) { if (!b) throw new Error("Failed Assertion"); } public static void main(String[] args) throws Exception { Class mapClass = null; int numTests = 50; int size = 50000; if (args.length > 0) { try { mapClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } if (args.length > 1) numTests = Integer.parseInt(args[1]); if (args.length > 2) size = Integer.parseInt(args[2]); System.out.println("Testing " + mapClass.getName() + " trials: " + numTests + " size: " + size); absentSize = 8; while (absentSize < size) absentSize <<= 1; absentMask = absentSize - 1; absent = new Integer[absentSize]; for (int i = 0; i < absentSize; ++i) absent[i] = new Integer(i * 2); Integer[] key = new Integer[size]; for (int i = 0; i < size; ++i) key[i] = new Integer(i * 2 + 1); for (int rep = 0; rep < numTests; ++rep) { runTest(newMap(mapClass), key); } TestTimer.printStats(); } static NavigableMap newMap(Class cl) { try { NavigableMap m = (NavigableMap) cl.newInstance(); return m; } catch (Exception e) { throw new RuntimeException("Can't instantiate " + cl + ": " + e); } } static void runTest(NavigableMap s, Integer[] key) { shuffle(key); int size = key.length; long startTime = System.currentTimeMillis(); test(s, key); long time = System.currentTimeMillis() - startTime; } static void t1(String nm, int n, NavigableMap s, Integer[] key, int expect) { int sum = 0; int iters = 4; timer.start(nm, n * iters); for (int j = 0; j < iters; ++j) { for (int i = 0; i < n; i++) { if (s.get(key[i]) != null) ++sum; } } timer.finish(); reallyAssert(sum == expect * iters); } static void t2(String nm, int n, NavigableMap s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.remove(key[i]) != null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t3(String nm, int n, NavigableMap s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.put(key[i], absent[i & absentMask]) == null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t4(String nm, int n, NavigableMap s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.containsKey(key[i])) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t5(String nm, int n, NavigableMap s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n/2); for (int i = n-2; i >= 0; i-=2) { if (s.remove(key[i]) != null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t6(String nm, int n, NavigableMap s, Integer[] k1, Integer[] k2) { int sum = 0; timer.start(nm, n * 2); for (int i = 0; i < n; i++) { if (s.get(k1[i]) != null) ++sum; if (s.get(k2[i & absentMask]) != null) ++sum; } timer.finish(); reallyAssert(sum == n); } static void t7(String nm, int n, NavigableMap s, Integer[] k1, Integer[] k2) { int sum = 0; timer.start(nm, n * 2); for (int i = 0; i < n; i++) { if (s.containsKey(k1[i])) ++sum; if (s.containsKey(k2[i & absentMask])) ++sum; } timer.finish(); reallyAssert(sum == n); } static void t8(String nm, int n, NavigableMap s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.get(key[i]) != null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t9(NavigableMap s) { int sum = 0; int iters = 20; timer.start("ContainsValue (/n) ", iters * s.size()); int step = absentSize / iters; for (int i = 0; i < absentSize; i += step) if (s.containsValue(absent[i])) ++sum; timer.finish(); reallyAssert(sum != 0); } static void higherTest(NavigableMap s) { int sum = 0; int iters = s.size(); timer.start("Higher ", iters); Map.Entry e = s.firstEntry(); while (e != null) { ++sum; e = s.higherEntry(e.getKey()); } timer.finish(); reallyAssert(sum == iters); } static void lowerTest(NavigableMap s) { int sum = 0; int iters = s.size(); timer.start("Lower ", iters); Map.Entry e = s.firstEntry(); while (e != null) { ++sum; e = s.higherEntry(e.getKey()); } timer.finish(); reallyAssert(sum == iters); } static void ceilingTest(NavigableMap s) { int sum = 0; int iters = s.size(); if (iters > absentSize) iters = absentSize; timer.start("Ceiling ", iters); for (int i = 0; i < iters; ++i) { Map.Entry e = s.ceilingEntry(absent[i]); if (e != null) ++sum; } timer.finish(); reallyAssert(sum == iters); } static void floorTest(NavigableMap s) { int sum = 0; int iters = s.size(); if (iters > absentSize) iters = absentSize; timer.start("Floor ", iters); for (int i = 1; i < iters; ++i) { Map.Entry e = s.floorEntry(absent[i]); if (e != null) ++sum; } timer.finish(); reallyAssert(sum == iters-1); } static void ktest(NavigableMap s, int size, Integer[] key) { timer.start("ContainsKey ", size); Set ks = s.keySet(); int sum = 0; for (int i = 0; i < size; i++) { if (ks.contains(key[i])) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest1(NavigableMap s, int size) { int sum = 0; timer.start("Iter Key ", size); for (Iterator it = s.keySet().iterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest2(NavigableMap s, int size) { int sum = 0; timer.start("Iter Value ", size); for (Iterator it = s.values().iterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest3(NavigableMap s, int size) { int sum = 0; timer.start("Iter Entry ", size); for (Iterator it = s.entrySet().iterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest(NavigableMap s, int size) { ittest1(s, size); ittest2(s, size); ittest3(s, size); } static void rittest1(NavigableMap s, int size) { int sum = 0; timer.start("Desc Iter Key ", size); for (Iterator it = s.descendingKeySet().iterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void rittest(NavigableMap s, int size) { rittest1(s, size); // rittest2(s, size); } static void rtest(NavigableMap s, int size) { timer.start("Remove (iterator) ", size); for (Iterator it = s.keySet().iterator(); it.hasNext(); ) { it.next(); it.remove(); } timer.finish(); } static void rvtest(NavigableMap s, int size) { timer.start("Remove (iterator) ", size); for (Iterator it = s.values().iterator(); it.hasNext(); ) { it.next(); it.remove(); } timer.finish(); } static void dtest(NavigableMap s, int size, Integer[] key) { timer.start("Put (putAll) ", size * 2); NavigableMap s2 = null; try { s2 = (NavigableMap) (s.getClass().newInstance()); s2.putAll(s); } catch (Exception e) { e.printStackTrace(); return; } timer.finish(); timer.start("Iter Equals ", size * 2); boolean eqt = s2.equals(s) && s.equals(s2); reallyAssert(eqt); timer.finish(); timer.start("Iter HashCode ", size * 2); int shc = s.hashCode(); int s2hc = s2.hashCode(); reallyAssert(shc == s2hc); timer.finish(); timer.start("Put (present) ", size); s2.putAll(s); timer.finish(); timer.start("Iter EntrySet contains ", size * 2); Set es2 = s2.entrySet(); int sum = 0; for (Iterator i1 = s.entrySet().iterator(); i1.hasNext(); ) { Object entry = i1.next(); if (es2.contains(entry)) ++sum; } timer.finish(); reallyAssert(sum == size); t6("Get ", size, s2, key, absent); Object hold = s2.get(key[size-1]); s2.put(key[size-1], absent[0]); timer.start("Iter Equals ", size * 2); eqt = s2.equals(s) && s.equals(s2); reallyAssert(!eqt); timer.finish(); timer.start("Iter HashCode ", size * 2); int s1h = s.hashCode(); int s2h = s2.hashCode(); reallyAssert(s1h != s2h); timer.finish(); s2.put(key[size-1], hold); timer.start("Remove (iterator) ", size * 2); Iterator s2i = s2.entrySet().iterator(); Set es = s.entrySet(); while (s2i.hasNext()) es.remove(s2i.next()); timer.finish(); reallyAssert(s.isEmpty()); timer.start("Clear ", size); s2.clear(); timer.finish(); reallyAssert(s2.isEmpty() && s.isEmpty()); } static void test(NavigableMap s, Integer[] key) { int size = key.length; t3("Put (absent) ", size, s, key, size); t3("Put (present) ", size, s, key, 0); t7("ContainsKey ", size, s, key, absent); t4("ContainsKey ", size, s, key, size); ktest(s, size, key); t4("ContainsKey ", absentSize, s, absent, 0); t6("Get ", size, s, key, absent); t1("Get (present) ", size, s, key, size); t1("Get (absent) ", absentSize, s, absent, 0); t2("Remove (absent) ", absentSize, s, absent, 0); t5("Remove (present) ", size, s, key, size / 2); t3("Put (half present) ", size, s, key, size / 2); ittest(s, size); rittest(s, size); higherTest(s); ceilingTest(s); floorTest(s); lowerTest(s); t9(s); rtest(s, size); t4("ContainsKey ", size, s, key, 0); t2("Remove (absent) ", size, s, key, 0); t3("Put (presized) ", size, s, key, size); dtest(s, size, key); } static class TestTimer { private String name; private long numOps; private long startTime; private String cname; static final java.util.TreeMap accum = new java.util.TreeMap(); static void printStats() { for (Iterator it = accum.entrySet().iterator(); it.hasNext(); ) { Map.Entry e = (Map.Entry) it.next(); Stats stats = (Stats) e.getValue(); int n = stats.number; double t; if (n > 0) t = stats.sum / n; else t = stats.least; long nano = Math.round(1000000.0 * t); System.out.println(e.getKey() + ": " + nano); } } void start(String name, long numOps) { this.name = name; this.cname = classify(); this.numOps = numOps; startTime = System.currentTimeMillis(); } String classify() { if (name.startsWith("Get")) return "Get "; else if (name.startsWith("Put")) return "Put "; else if (name.startsWith("Remove")) return "Remove "; else if (name.startsWith("Iter")) return "Iter "; else return null; } void finish() { long endTime = System.currentTimeMillis(); long time = endTime - startTime; double timePerOp = (double) time /numOps; Object st = accum.get(name); if (st == null) accum.put(name, new Stats(timePerOp)); else { Stats stats = (Stats) st; stats.sum += timePerOp; stats.number++; if (timePerOp < stats.least) stats.least = timePerOp; } if (cname != null) { st = accum.get(cname); if (st == null) accum.put(cname, new Stats(timePerOp)); else { Stats stats = (Stats) st; stats.sum += timePerOp; stats.number++; if (timePerOp < stats.least) stats.least = timePerOp; } } } } static class Stats { double sum = 0; double least; int number = 0; Stats(double t) { least = t; } } static Random rng = new Random(111); static void shuffle(Integer[] keys) { int size = keys.length; for (int i=size; i>1; i--) { int r = rng.nextInt(i); Integer t = keys[i-1]; keys[i-1] = keys[r]; keys[r] = t; } } } jsr166/src/test/loops/SimpleReentrantLockLoops.java0000644000000000000000000000661211537741072017522 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class SimpleReentrantLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 2000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); new ReentrantLockLoop(1).test(); new ReentrantLockLoop(1).test(); print = true; int k = 1; for (int i = 1; i <= maxThreads;) { System.out.print("Threads: " + i); new ReentrantLockLoop(i).test(); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { final ReentrantLock lock = this.lock; try { barrier.await(); int sum = v + 1; int x = 0; int n = iters; while (n-- > 0) { lock.lock(); int k = (sum & 3); if (k > 0) { x = v; while (k-- > 0) x = LoopHelpers.compute6(x); v = x; } else x = sum + 1; lock.unlock(); if ((x += readBarrier) == 0) ++readBarrier; for (int l = x & 7; l > 0; --l) sum += LoopHelpers.compute6(sum); } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/TimeoutProducerConsumerLoops.java0000644000000000000000000001635511551700072020437 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; public class TimeoutProducerConsumerLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final ExecutorService pool = Executors.newCachedThreadPool(); // Number of elements passed around -- must be power of two // Elements are reused from pool to minimize alloc impact static final int POOL_SIZE = 1 << 8; static final int POOL_MASK = POOL_SIZE-1; static final Integer[] intPool = new Integer[POOL_SIZE]; static { for (int i = 0; i < POOL_SIZE; ++i) intPool[i] = Integer.valueOf(i); } // max lag between a producer and consumer to avoid // this becoming a GC test rather than queue test. // Used only per-pair to lessen impact on queue sync static final int LAG_MASK = (1 << 12) - 1; static boolean print = false; static int producerSum; static int consumerSum; static synchronized void addProducerSum(int x) { producerSum += x; } static synchronized void addConsumerSum(int x) { consumerSum += x; } static synchronized void checkSum() { if (producerSum != consumerSum) { throw new Error("CheckSum mismatch"); } } public static void main(String[] args) throws Exception { int maxPairs = NCPUS * 3 / 2; int iters = 1000000; if (args.length > 0) maxPairs = Integer.parseInt(args[0]); print = true; int k = 1; for (int i = 1; i <= maxPairs;) { System.out.println("Pairs:" + i); oneTest(i, iters); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static void oneTest(int n, int iters) throws Exception { if (print) System.out.print("LinkedTransferQueue "); oneRun(new LinkedTransferQueue(), n, iters); if (print) System.out.print("LinkedTransferQueue(xfer)"); oneRun(new LTQasSQ(), n, iters); if (print) System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(), n, iters); if (print) System.out.print("LinkedBlockingQueue(cap) "); oneRun(new LinkedBlockingQueue(POOL_SIZE), n, iters); if (print) System.out.print("ArrayBlockingQueue(cap) "); oneRun(new ArrayBlockingQueue(POOL_SIZE), n, iters); if (print) System.out.print("LinkedBlockingDeque "); oneRun(new LinkedBlockingDeque(), n, iters); if (print) System.out.print("SynchronousQueue "); oneRun(new SynchronousQueue(), n, iters); if (print) System.out.print("SynchronousQueue(fair) "); oneRun(new SynchronousQueue(true), n, iters); if (print) System.out.print("PriorityBlockingQueue "); oneRun(new PriorityBlockingQueue(), n, iters / 16); if (print) System.out.print("ArrayBlockingQueue(fair) "); oneRun(new ArrayBlockingQueue(POOL_SIZE, true), n, iters/16); } abstract static class Stage implements Runnable { final int iters; final BlockingQueue queue; final CyclicBarrier barrier; final Phaser lagPhaser; Stage(BlockingQueue q, CyclicBarrier b, Phaser s, int iters) { queue = q; barrier = b; lagPhaser = s; this.iters = iters; } } static class Producer extends Stage { Producer(BlockingQueue q, CyclicBarrier b, Phaser s, int iters) { super(q, b, s, iters); } public void run() { try { barrier.await(); int s = 0; int l = hashCode(); int i = 0; long timeout = 1000; while (i < iters) { l = LoopHelpers.compute4(l); Integer v = intPool[l & POOL_MASK]; if (queue.offer(v, timeout, TimeUnit.NANOSECONDS)) { s += LoopHelpers.compute4(v.intValue()); ++i; if (timeout > 1) timeout--; if ((i & LAG_MASK) == LAG_MASK) lagPhaser.arriveAndAwaitAdvance(); } else timeout++; } addProducerSum(s); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static class Consumer extends Stage { Consumer(BlockingQueue q, CyclicBarrier b, Phaser s, int iters) { super(q, b, s, iters); } public void run() { try { barrier.await(); int l = 0; int s = 0; int i = 0; long timeout = 1000; while (i < iters) { Integer e = queue.poll(timeout, TimeUnit.NANOSECONDS); if (e != null) { l = LoopHelpers.compute4(e.intValue()); s += l; ++i; if (timeout > 1) --timeout; if ((i & LAG_MASK) == LAG_MASK) lagPhaser.arriveAndAwaitAdvance(); } else ++timeout; } addConsumerSum(s); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static void oneRun(BlockingQueue q, int npairs, int iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(npairs * 2 + 1, timer); for (int i = 0; i < npairs; ++i) { Phaser s = new Phaser(2); pool.execute(new Producer(q, barrier, s, iters)); pool.execute(new Consumer(q, barrier, s, iters)); } barrier.await(); barrier.await(); long time = timer.getTime(); checkSum(); q.clear(); if (print) System.out.println("\t: " + LoopHelpers.rightJustify(time / (iters * npairs)) + " ns per transfer"); } static final class LTQasSQ extends LinkedTransferQueue { LTQasSQ() { super(); } public void put(T x) { try { super.transfer(x); } catch (InterruptedException ex) { throw new Error(); } } public boolean offer(T x, long timeout, TimeUnit unit) { return super.offer(x, timeout, unit); } } } jsr166/src/test/loops/SimpleMutexLoops.java0000644000000000000000000000650211537741072016047 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class SimpleMutexLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 2000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); new MutexLoop(1).test(); new MutexLoop(1).test(); print = true; int k = 1; for (int i = 1; i <= maxThreads;) { System.out.print("Threads: " + i); new MutexLoop(i).test(); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static final class MutexLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final Mutex lock = new Mutex(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; MutexLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { final Mutex lock = this.lock; try { barrier.await(); int sum = v + 1; int x = 0; int n = iters; while (n-- > 0) { lock.lock(); int k = (sum & 3); if (k > 0) { x = v; while (k-- > 0) x = LoopHelpers.compute6(x); v = x; } else x = sum + 1; lock.unlock(); if ((x += readBarrier) == 0) ++readBarrier; for (int l = x & 7; l > 0; --l) sum += LoopHelpers.compute6(sum); } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/TimeoutLockLoops.java0000644000000000000000000000733411537741072016036 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 4486658 * @compile -source 1.5 TimeoutLockLoops.java * @run main TimeoutLockLoops * @summary Checks for responsiveness of locks to timeouts. * Runs under the assumption that ITERS computations require more than * TIMEOUT msecs to complete, which seems to be a safe assumption for * another decade. */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class TimeoutLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static final int ITERS = Integer.MAX_VALUE; static final long TIMEOUT = 100; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; for (int i = 1; i <= maxThreads; i += (i+1) >>> 1) { System.out.print("Threads: " + i); new ReentrantLockLoop(i).test(); // Thread.sleep(10); } pool.shutdown(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile boolean completed; private volatile int result = 17; private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) { lock.lock(); pool.execute(this); lock.unlock(); } barrier.await(); Thread.sleep(TIMEOUT); while (!lock.tryLock()); // Jam lock // lock.lock(); barrier.await(); if (print) { long time = timer.getTime(); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } if (completed) throw new Error("Some thread completed instead of timing out"); int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v; int x = 17; int n = ITERS; final ReentrantLock lock = this.lock; for (;;) { if (x != 0) { if (n-- <= 0) break; } if (!lock.tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) break; try { v = x = LoopHelpers.compute1(v); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } if (n <= 0) completed = true; barrier.await(); result += sum; } catch (Exception ex) { ex.printStackTrace(); return; } } } } jsr166/src/test/loops/TorusSpanningTree.java0000644000000000000000000001777011537741072016221 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ //import jsr166y.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; /** * This is reworked version of one of the tests reported on in the * paper: Guojing Cong, Sreedhar Kodali, Sriram Krishnamoorty, Doug * Lea, Vijay Saraswat and Tong Wen, "Solving irregular graph problems * using adaptive work-stealing", ICPP, 2008. * * It runs the main batching algorithm discussed there for spanning * trees, for a simple regular torus graph, where each node is * connected to its left. right, up, and down neighbors. */ public class TorusSpanningTree { static final int NCPUS = Runtime.getRuntime().availableProcessors(); // Dimensions for test runs. // graphs have side*side nodes, each with 4 neighbors static final int MIN_SIDE = 1000; static final int MAX_SIDE = 3000; static final int SIDE_STEP = 500; public static void main(String[] args) throws Exception { Random rng = new Random(); int procs = NCPUS; try { if (args.length > 0) procs = Integer.parseInt(args[0]); } catch (Exception e) { System.out.println("Usage: java TorusSpanningTree "); return; } System.out.println("Number of threads: " + procs); System.out.println("Printing nanosec per edge across replications"); System.out.print("for Toruses with side lengths"); System.out.printf(" from %5d to %5d step %5d\n", MIN_SIDE, MAX_SIDE, SIDE_STEP); ForkJoinPool pool = new ForkJoinPool(procs); boolean checked = false; for (int side = MIN_SIDE; side <= MAX_SIDE; side += SIDE_STEP) { int n = side * side; Node[] graph = makeGraph(side); System.out.printf( "N:%9d", n); for (int j = 0; j < 8; ++j) { Node root = graph[rng.nextInt(n)]; long start = System.nanoTime(); pool.invoke(new Driver(root)); long elapsed = System.nanoTime() - start; double nanosPerEdge = (double) elapsed / (4 * n); System.out.printf(" %7.2f", nanosPerEdge); if (!checked) { checked = true; checkSpanningTree(graph, root); } pool.invoke(new Resetter(graph, 0, graph.length)); } System.out.println(); } System.out.println(pool); pool.shutdown(); } static final class Node extends ForkJoinTask { final Node[] neighbors; Node parent; Node next; volatile int mark; Node(Node[] nbrs) { neighbors = nbrs; parent = this; } static final AtomicIntegerFieldUpdater markUpdater = AtomicIntegerFieldUpdater.newUpdater(Node.class, "mark"); boolean tryMark() { return mark == 0 && markUpdater.compareAndSet(this, 0, 1); } void setMark() { mark = 1; } /* * Traverse the list ("oldList") embedded across .next fields, * starting at this node, placing newly discovered neighboring * nodes in newList. If the oldList becomes exhausted, swap in * newList and continue. Otherwise, whenever the length of * newList exceeds current number of tasks in work-stealing * queue, push list onto queue. */ static final int LOG_MAX_BATCH_SIZE = 7; /** * Since tasks are never joined, we bypass Recursive{Action,Task} * and just directly implement exec */ public boolean exec() { int batchSize = 0; // computed lazily Node newList = null; int newLength = 0; Node oldList = this; Node par = parent; do { Node v = oldList; Node[] edges = v.neighbors; oldList = v.next; int nedges = edges.length; for (int k = 0; k < nedges; ++k) { Node e = edges[k]; if (e != null && e.tryMark()) { e.parent = par; e.next = newList; newList = e; if (batchSize == 0) { int s = getQueuedTaskCount(); batchSize = ((s >= LOG_MAX_BATCH_SIZE) ? (1 << LOG_MAX_BATCH_SIZE) : (1 << s)); } if (++newLength >= batchSize) { newLength = 0; batchSize = 0; if (oldList == null) oldList = newList; else newList.fork(); newList = null; } } } if (oldList == null) { oldList = newList; newList = null; newLength = 0; } } while (oldList != null); return false; } // required abstract implementations for ForkJoinTask public final Void getRawResult() { return null; } protected final void setRawResult(Void mustBeNull) { } public void reset() { reinitialize(); parent = this; next = null; mark = 0; } } static final class Driver extends RecursiveAction { final Node root; Driver(Node root) { this.root = root; } public void compute() { root.setMark(); root.fork(); helpQuiesce(); } } static Node[] makeGraph(int sideLength) { int n = sideLength * sideLength; Node[] vs = new Node[n]; for (int i = 0; i < n; ++i) vs[i] = new Node(new Node[4]); // connect each node to left, right, up, down neighbors int maxcol = n - sideLength; int col = 0; for (int i = 0; i < sideLength; ++i) { for (int j = 0; j < sideLength; ++j) { Node[] a = vs[col + j].neighbors; a[0] = vs[col + ((j < sideLength-1) ? (j+1) : 0)]; a[1] = vs[col + ((j != 0) ? (j-1) : (sideLength-1))]; a[2] = vs[j + ((i < sideLength-1) ? (col + sideLength) : 0)]; a[3] = vs[j + ((i != 0) ? (col - sideLength) : maxcol)]; } col += sideLength; } return vs; } static void resetAll(Node[] g) { for (int i = 0; i < g.length; ++i) g[i].reset(); } // check that all nodes have parents, and no cycles static void checkSpanningTree(Node[] g, Node root) { int n = g.length; for (int i = 0; i < n; ++i) { Node v = g[i]; Node p = v; int k = n; while (p != root) { if (p == null) throw new RuntimeException("null parent"); if (--k <= 0) throw new RuntimeException("cycle"); p = p.parent; } v.parent = root; } } static final class Resetter extends RecursiveAction { final Node[] g; final int lo, hi; Resetter(Node[] g, int lo, int hi) { this.g = g; this.lo = lo; this.hi = hi; } public void compute() { int mid = (lo + hi) >>> 1; if (mid == lo || getSurplusQueuedTaskCount() > 3) { for (int i = lo; i < hi; ++i) g[i].reset(); } else invokeAll(new Resetter(g, lo, mid), new Resetter(g, mid, hi)); } } } jsr166/src/test/loops/runscript0000755000000000000000000002076211537741072013676 0ustar #!/bin/sh # This runs most of the test programs with default settings except for # the supplied TRIALS, which controls the max number of threads # and/or test iterations in most programs. # Written by Doug Lea with assistance from members of JCP JSR-166 # Expert Group and released to the public domain, as explained at # http://creativecommons.org/publicdomain/zero/1.0/ # Set env variable RUNJAVA to java executable. Otherwise uses "java" RUN="java" if [ -n "$RUNJAVA" ]; then RUN=$RUNJAVA fi TRIALS=8 if [ $# != "0" ]; then TRIALS=$1 fi echo "Java is " $RUN echo "Trials per test: " $TRIALS echo CASLoops 4 #$TRIALS $RUN CASLoops 4 #$TRIALS echo SimpleReentrantLockLoops $RUN SimpleReentrantLockLoops $TRIALS echo SimpleMutexLoops $RUN SimpleMutexLoops $TRIALS echo SimpleSemaphoreLoops $RUN SimpleSemaphoreLoops $TRIALS echo SimpleLockLoops $RUN SimpleLockLoops $TRIALS echo SimpleWriteLockLoops $RUN SimpleWriteLockLoops $TRIALS echo SimpleTimedLockLoops $RUN SimpleTimedLockLoops $TRIALS echo SimpleSpinLockLoops $RUN SimpleSpinLockLoops 8 # $TRIALS echo TimeoutLockLoops $RUN TimeoutLockLoops $TRIALS echo CheckedLockLoops $RUN CheckedLockLoops $TRIALS echo UncheckedLockLoops $RUN UncheckedLockLoops $TRIALS echo CancelledLockLoops $RUN CancelledLockLoops $TRIALS echo LockOncePerThreadLoops $RUN LockOncePerThreadLoops 5 #$TRIALS echo ProducerConsumerLoops $RUN ProducerConsumerLoops $TRIALS echo OfferPollLoops $RUN OfferPollLoops $TRIALS echo MultipleProducersSingleConsumerLoops $RUN MultipleProducersSingleConsumerLoops $TRIALS echo SingleProducerMultipleConsumerLoops $RUN SingleProducerMultipleConsumerLoops $TRIALS echo CancelledProducerConsumerLoops $RUN CancelledProducerConsumerLoops $TRIALS echo TimeoutProducerConsumerLoops $RUN TimeoutProducerConsumerLoops $TRIALS echo ExecutorCompletionServiceLoops $RUN ExecutorCompletionServiceLoops $TRIALS echo CachedThreadPoolLoops $RUN CachedThreadPoolLoops $TRIALS echo ConcurrentQueueLoops ConcurrentLinkedQueue $RUN ConcurrentQueueLoops java.util.concurrent.ConcurrentLinkedQueue $TRIALS echo ConcurrentQueueLoops SynchronizedLinkedListQueue $RUN ConcurrentQueueLoops SynchronizedLinkedListQueue $TRIALS echo ConcurrentQueueLoops java.util.concurrent.LinkedTransferQueue $RUN ConcurrentQueueLoops java.util.concurrent.LinkedTransferQueue $TRIALS echo ConcurrentQueueLoops ConcurrentLinkedDeque $RUN ConcurrentQueueLoops java.util.concurrent.ConcurrentLinkedDeque $TRIALS echo ConcurrentDequeLoops LinkedBlockingDeque $RUN ConcurrentDequeLoops java.util.concurrent.LinkedBlockingDeque $TRIALS echo ConcurrentDequeLoops ConcurrentLinkedDeque $RUN ConcurrentDequeLoops java.util.concurrent.ConcurrentLinkedDeque $TRIALS $RUN OfferDrainToLoops echo DequeBash ArrayDeque $RUN DequeBash java.util.ArrayDeque $TRIALS echo DequeBash LinkedList $RUN DequeBash java.util.LinkedList $TRIALS echo DequeBash LinkedBlockingDeque $RUN DequeBash java.util.concurrent.LinkedBlockingDeque $TRIALS echo DequeBash ConcurrentLinkedDeque $RUN DequeBash java.util.concurrent.ConcurrentLinkedDeque $TRIALS echo ExchangeLoops $RUN ExchangeLoops $TRIALS echo TimeoutExchangerLoops $RUN TimeoutExchangerLoops $TRIALS echo TSPExchangerTest $RUN TSPExchangerTest $TRIALS echo CancelledFutureLoops $RUN CancelledFutureLoops $TRIALS echo MapCheck ConcurrentHashMap $RUN MapCheck java.util.concurrent.ConcurrentHashMap $TRIALS echo IntMapCheck ConcurrenHhashMap $RUN IntMapCheck java.util.concurrent.ConcurrentHashMap $TRIALS echo IntMapCheck ConcurrentSkipListMap $RUN IntMapCheck java.util.concurrent.ConcurrentSkipListMap $TRIALS echo NavigableMapCheck TreeMap $RUN NavigableMapCheck java.util.TreeMap $TRIALS echo NavigableMapCheck ConcurrentSkipListMap $RUN NavigableMapCheck java.util.concurrent.ConcurrentSkipListMap $TRIALS echo NavigableSetCheck TreeSet $RUN NavigableSetCheck java.util.TreeSet $TRIALS echo MapMicroBenchmark ConcurrentHashMap $RUN MapMicroBenchmark java.util.concurrent.ConcurrentHashMap echo SetBash ConcurrentSkipListSet $RUN SetBash java.util.concurrent.ConcurrentSkipListSet $TRIALS 100 echo SetBash ConcurrentHashSet $RUN SetBash ConcurrentHashSet $TRIALS 100 echo NavigableSetCheck ConcurrentSkipListSet $RUN NavigableSetCheck java.util.concurrent.ConcurrentSkipListSet $TRIALS echo MapLoops ConcurrentHashMap $RUN MapLoops java.util.concurrent.ConcurrentHashMap $TRIALS echo MapLoops ConcurrentSkipListMap $RUN MapLoops java.util.concurrent.ConcurrentSkipListMap $TRIALS echo MapLoops RWTreeMap $RUN MapLoops RWMap $TRIALS echo StringMapLoops ConcurrentHashMap $RUN StringMapLoops java.util.concurrent.ConcurrentHashMap $TRIALS echo StringMapLoops ConcurrentSkipListMap $RUN StringMapLoops java.util.concurrent.ConcurrentSkipListMap $TRIALS echo StringMapLoops RWTreeMap $RUN StringMapLoops RWMap $TRIALS echo MapWordLoops ConcurrentHashMap $RUN MapWordLoops java.util.concurrent.ConcurrentHashMap $TRIALS echo MapWordLoops java.util.TreeMap $RUN MapWordLoops java.util.TreeMap $TRIALS echo MapWordLoops RWTreeMap $RUN MapWordLoops RWMap $TRIALS echo MapWordLoops ConcurrentSkipListMap $RUN MapWordLoops java.util.concurrent.ConcurrentSkipListMap $TRIALS echo CollectionLoops RWCollection $RUN CollectionLoops RWCollection $TRIALS echo CollectionLoops SCollection $RUN CollectionLoops SCollection $TRIALS echo CollectionLoops SynchronizedCollection $RUN CollectionLoops SynchronizedCollection $TRIALS echo CollectionWordLoops ConcurrentSkipListSet $RUN CollectionWordLoops java.util.concurrent.ConcurrentSkipListSet echo CollectionWordLoops ConcurrentLinkedQueue $RUN CollectionWordLoops java.util.concurrent.ConcurrentLinkedQueue echo CollectionWordLoops CopyOnWriteArrayList $RUN CollectionWordLoops java.util.concurrent.CopyOnWriteArrayList echo CollectionWordLoops ArrayDeque $RUN CollectionWordLoops java.util.ArrayDeque echo ListBash CopyOnWriteArrayList $RUN ListBash java.util.concurrent.CopyOnWriteArrayList 100 100 echo ListBash LinkedList $RUN ListBash java.util.LinkedList 100 100 echo TimeUnitLoops $RUN TimeUnitLoops echo ReadHoldingWriteLock $RUN ReadHoldingWriteLock echo Finals $RUN Finals echo FinalLongTest $RUN FinalLongTest echo RLJBar $RUN RLJBar echo RLJBar -b $RUN RLJBar -b echo RLIBar $RUN RLIBar -np $TRIALS echo RLIBar -batch 10 $RUN RLIBar -batch 10 -np $TRIALS echo UnboundedQueueFillEmptyLoops $RUN UnboundedQueueFillEmptyLoops java.util.ArrayDeque $RUN UnboundedQueueFillEmptyLoops java.util.PriorityQueue $RUN UnboundedQueueFillEmptyLoops java.util.concurrent.PriorityBlockingQueue $RUN UnboundedQueueFillEmptyLoops java.util.LinkedList $RUN UnboundedQueueFillEmptyLoops java.util.concurrent.ConcurrentLinkedQueue $RUN UnboundedQueueFillEmptyLoops java.util.concurrent.ConcurrentLinkedDeque $RUN UnboundedQueueFillEmptyLoops java.util.concurrent.LinkedBlockingQueue $RUN UnboundedQueueFillEmptyLoops java.util.concurrent.LinkedBlockingDeque $RUN UnboundedQueueFillEmptyLoops java.util.concurrent.LinkedTransferQueue echo IteratorLoops $RUN IteratorLoops java.util.ArrayList $RUN IteratorLoops java.util.Vector $RUN IteratorLoops java.util.concurrent.CopyOnWriteArrayList $RUN IteratorLoops java.util.LinkedList $RUN IteratorLoops java.util.concurrent.ConcurrentLinkedQueue $RUN IteratorLoops java.util.concurrent.LinkedBlockingQueue $RUN IteratorLoops java.util.ArrayDeque $RUN IteratorLoops java.util.concurrent.LinkedBlockingDeque $RUN IteratorLoops java.util.PriorityQueue $RUN IteratorLoops java.util.concurrent.PriorityBlockingQueue $RUN IteratorLoops java.util.TreeSet $RUN IteratorLoops java.util.concurrent.ConcurrentSkipListSet $RUN IteratorLoops java.util.HashSet $RUN IteratorLoops ConcurrentHashSet $RUN IteratorLoops java.util.concurrent.LinkedTransferQueue $RUN IteratorLoops java.util.concurrent.ConcurrentLinkedDeque echo Integrate $RUN Integrate echo IntegrateGamma $RUN IntegrateGamma echo Fib $RUN Fib echo FibTask $RUN FibTask echo LeftSpineFib $RUN LeftSpineFib echo DynamicFib $RUN DynamicFib echo DynamicLeftSpineFib $RUN DynamicLeftSpineFib echo DynamicAsyncFib $RUN DynamicAsyncFib echo ScalarLongSort $RUN ScalarLongSort echo BoxedLongSort $RUN BoxedLongSort echo NQueensCS $RUN NQueensCS echo AsyncNQueensCS $RUN AsyncNQueensCS echo FJSums $RUN FJSums echo MatrixMultiply $RUN MatrixMultiply echo LU $RUN LU echo Microscope $RUN Microscope echo TorusSpanningTree $RUN TorusSpanningTree echo FJJacobi $RUN FJJacobi echo FJPhaserJacobi $RUN FJPhaserJacobi echo ThreadPhaserJacobi $RUN ThreadPhaserJacobi echo Heat $RUN Heat echo TieredPhaserLoops $RUN TieredPhaserLoops echo PhaserLoops $RUN PhaserLoops echo CyclicBarrierLoops $RUN CyclicBarrierLoops echo FJPhaserLoops $RUN FJPhaserLoops echo SpinningTieredPhaserLoops $RUN SpinningTieredPhaserLoops jsr166/src/test/loops/SimpleTimedLockLoops.java0000644000000000000000000000663611537741072016630 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class SimpleTimedLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 10000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; int reps = 3; for (int i = 1; i <= maxThreads; i += (i+1) >>> 1) { int n = reps; if (reps > 1) --reps; while (n-- > 0) { System.out.print("Threads: " + i); new ReentrantLockLoop(i).test(); Thread.sleep(100); } } pool.shutdown(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { final ReentrantLock lock = this.lock; try { barrier.await(); int sum = v + 1; int x = 0; int n = iters; while (n > 0) { if (lock.tryLock(1, TimeUnit.SECONDS)) { --n; int k = (sum & 3); if (k > 0) { x = v; while (k-- > 0) x = LoopHelpers.compute6(x); v = x; } else x = sum + 1; lock.unlock(); } if ((x += readBarrier) == 0) ++readBarrier; for (int l = x & 7; l > 0; --l) sum += LoopHelpers.compute6(sum); } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/CheckedLockLoops.java0000644000000000000000000003204411537741071015731 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @summary basic safety and liveness of ReentrantLocks, and other locks based on them */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class CheckedLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static boolean doBuiltin = true; public static void main(String[] args) throws Exception { int maxThreads = 100; int iters = 2000000; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); rng.setSeed(3122688L); warmup(iters); runTest(maxThreads, iters); pool.shutdown(); } static void runTest(int maxThreads, int iters) throws Exception { print = true; int k = 1; for (int i = 1; i <= maxThreads;) { System.out.println("Threads:" + i); oneTest(i, iters / i); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } } static void warmup(int iters) throws Exception { print = false; System.out.println("Warmup..."); oneTest(1, iters); oneTest(2, iters / 2); } static void oneTest(int nthreads, int iters) throws Exception { int fairIters = (nthreads <= 1) ? iters : iters/20; int v = rng.next(); if (print) System.out.print("NoLock (1 thread) "); new NoLockLoop().test(v, 1, iters * nthreads); Thread.sleep(10); if (print) System.out.print("ReentrantLock "); new ReentrantLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairReentrantLock "); new FairReentrantLockLoop().test(v, nthreads, fairIters); Thread.sleep(10); if (doBuiltin) { if (print) System.out.print("builtin lock "); new BuiltinLockLoop().test(v, nthreads, fairIters); Thread.sleep(10); } if (print) System.out.print("Mutex "); new MutexLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("LongMutex "); new LongMutexLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("Semaphore "); new SemaphoreLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairSemaphore "); new FairSemaphoreLoop().test(v, nthreads, fairIters); Thread.sleep(10); if (print) System.out.print("ReentrantWriteLock "); new ReentrantWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairRWriteLock "); new FairReentrantWriteLockLoop().test(v, nthreads, fairIters); Thread.sleep(10); if (print) System.out.print("ReentrantReadWriteLock"); new ReentrantReadWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairRReadWriteLock "); new FairReentrantReadWriteLockLoop().test(v, nthreads, fairIters); Thread.sleep(10); } abstract static class LockLoop implements Runnable { int value; int checkValue; int iters; volatile int result; volatile int failures; final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier; final int setValue(int v) { checkValue = v ^ 0x55555555; value = v; return v; } final int getValue() { int v = value; if (checkValue != ~(v ^ 0xAAAAAAAA)) ++failures; return v; } final void test(int initialValue, int nthreads, int iters) throws Exception { setValue(initialValue); this.iters = iters; barrier = new CyclicBarrier(nthreads+1, timer); for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); long time = timer.getTime(); if (print) { long tpi = time / (iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per update"); System.out.println(); } if (result == 0) // avoid overoptimization System.out.println("useless result: " + result); if (failures != 0) throw new Error("lock protection failure"); } abstract int loop(int n); public final void run() { try { barrier.await(); result += loop(iters); barrier.await(); } catch (Exception ie) { return; } } } private static class NoLockLoop extends LockLoop { private volatile int readBarrier; final int loop(int n) { int sum = 0; int x = 0; while (n-- > 0) { int r1 = readBarrier; x = setValue(LoopHelpers.compute1(getValue())); int r2 = readBarrier; if (r1 == r2 && x == r1) ++readBarrier; sum += LoopHelpers.compute2(x); } return sum; } } private static class BuiltinLockLoop extends LockLoop { final int loop(int n) { int sum = 0; int x = 0; while (n-- > 0) { synchronized (this) { x = setValue(LoopHelpers.compute1(getValue())); } sum += LoopHelpers.compute2(x); } return sum; } } private static class ReentrantLockLoop extends LockLoop { private final ReentrantLock lock = new ReentrantLock(); final int loop(int n) { final ReentrantLock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class MutexLoop extends LockLoop { private final Mutex lock = new Mutex(); final int loop(int n) { final Mutex lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class LongMutexLoop extends LockLoop { private final LongMutex lock = new LongMutex(); final int loop(int n) { final LongMutex lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class FairReentrantLockLoop extends LockLoop { private final ReentrantLock lock = new ReentrantLock(true); final int loop(int n) { final ReentrantLock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class ReentrantWriteLockLoop extends LockLoop { private final Lock lock = new ReentrantReadWriteLock().writeLock(); final int loop(int n) { final Lock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class FairReentrantWriteLockLoop extends LockLoop { final Lock lock = new ReentrantReadWriteLock(true).writeLock(); final int loop(int n) { final Lock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class SemaphoreLoop extends LockLoop { private final Semaphore sem = new Semaphore(1, false); final int loop(int n) { final Semaphore sem = this.sem; int sum = 0; int x = 0; while (n-- > 0) { sem.acquireUninterruptibly(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { sem.release(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class FairSemaphoreLoop extends LockLoop { private final Semaphore sem = new Semaphore(1, true); final int loop(int n) { final Semaphore sem = this.sem; int sum = 0; int x = 0; while (n-- > 0) { sem.acquireUninterruptibly(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { sem.release(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class ReentrantReadWriteLockLoop extends LockLoop { private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final int loop(int n) { final Lock rlock = lock.readLock(); final Lock wlock = lock.writeLock(); int sum = 0; int x = 0; while (n-- > 0) { if ((n & 16) != 0) { rlock.lock(); try { x = LoopHelpers.compute1(getValue()); x = LoopHelpers.compute2(x); } finally { rlock.unlock(); } } else { wlock.lock(); try { setValue(x); } finally { wlock.unlock(); } sum += LoopHelpers.compute2(x); } } return sum; } } private static class FairReentrantReadWriteLockLoop extends LockLoop { private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); final int loop(int n) { final Lock rlock = lock.readLock(); final Lock wlock = lock.writeLock(); int sum = 0; int x = 0; while (n-- > 0) { if ((n & 16) != 0) { rlock.lock(); try { x = LoopHelpers.compute1(getValue()); x = LoopHelpers.compute2(x); } finally { rlock.unlock(); } } else { wlock.lock(); try { setValue(x); } finally { wlock.unlock(); } sum += LoopHelpers.compute2(x); } } return sum; } } } jsr166/src/test/loops/SpinningTieredPhaserLoops.java0000644000000000000000000000600711537741072017660 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; //import jsr166y.*; /* * Based loosely on Java Grande Forum barrierBench */ public class SpinningTieredPhaserLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final ExecutorService pool = Executors.newCachedThreadPool(); static final int FIRST_SIZE = 10000; static final int LAST_SIZE = 1000000; /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static int tasksPerPhaser = Math.max(NCPUS / 4, 4); static void build(Runnable[] actions, int sz, int lo, int hi, Phaser b) { if (hi - lo > tasksPerPhaser) { for (int i = lo; i < hi; i += tasksPerPhaser) { int j = Math.min(i + tasksPerPhaser, hi); build(actions, sz, i, j, new Phaser(b)); } } else { for (int i = lo; i < hi; ++i) actions[i] = new PhaserAction(i, b, sz); } } static final class PhaserAction implements Runnable { final int id; final int size; final Phaser phaser; public PhaserAction(int id, Phaser b, int size) { this.id = id; this.phaser = b; this.size = size; phaser.register(); } public void run() { int n = size; Phaser b = phaser; for (int i = 0; i < n; ++i) { int p = b.arrive(); while (b.getPhase() == p) { if ((ThreadLocalRandom.current().nextInt() & 127) == 0) Thread.yield(); } } } } public static void main(String[] args) throws Exception { int nthreads = NCPUS; if (args.length > 0) nthreads = Integer.parseInt(args[0]); if (args.length > 1) tasksPerPhaser = Integer.parseInt(args[1]); System.out.printf("Max %d Threads, %d tasks per phaser\n", nthreads, tasksPerPhaser); for (int k = 2; k <= nthreads; k *= 2) { for (int size = FIRST_SIZE; size <= LAST_SIZE; size *= 10) { long startTime = System.nanoTime(); Runnable[] actions = new Runnable [k]; build(actions, size, 0, k, new Phaser()); Future[] futures = new Future[k]; for (int i = 0; i < k; ++i) { futures[i] = pool.submit(actions[i]); } for (int i = 0; i < k; ++i) { futures[i].get(); } long elapsed = System.nanoTime() - startTime; long bs = (NPS * size) / elapsed; System.out.printf("%4d Threads %8d iters: %11d barriers/sec\n", k, size, bs); } } pool.shutdown(); } } jsr166/src/test/loops/DynamicFib.java0000644000000000000000000000512611475011736014562 0ustar import java.util.concurrent.*; public final class DynamicFib extends RecursiveAction { static int procs; static long lastStealCount; // to display steal counts /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); public static void main(String[] args) throws Exception { procs = 0; int num = 45; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) num = Integer.parseInt(args[1]); } catch (Exception e) { System.out.println("Usage: java DynamicFib "); return; } for (int reps = 0; reps < 2; ++reps) { ForkJoinPool pool = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); for (int i = 0; i < 20; ++i) test(pool, num); System.out.println(pool); pool.shutdown(); } } static void test(ForkJoinPool pool, int num) throws Exception { int ps = pool.getParallelism(); long start = System.nanoTime(); DynamicFib f = new DynamicFib(num); pool.invoke(f); long time = System.nanoTime() - start; double secs = ((double)time) / NPS; long result = f.number; System.out.print("DynamicFib " + num + " = " + result); System.out.printf("\tTime: %9.3f", secs); long sc = pool.getStealCount(); long ns = sc - lastStealCount; lastStealCount = sc; System.out.printf(" Steals: %4d", ns/ps); System.out.printf(" Workers: %4d", pool.getPoolSize()); System.out.println(); } int number; // Initialized with argument; replaced with result DynamicFib(int n) { number = n; } public void compute() { number = fib(number); } static int fib(int n) { int res; if (n <= 1) res = n; else if (getSurplusQueuedTaskCount() >= 4) res = seqFib(n); else { DynamicFib f2 = new DynamicFib(n - 2); f2.fork(); res = fib(n - 1); if (f2.tryUnfork()) res += fib(n - 2); else { f2.quietlyJoin(); res += f2.number; } } return res; } // Sequential version for arguments less than threshold static final int seqFib(int n) { // unroll left only int r = 1; do { int m = n - 2; r += m <= 1 ? m : seqFib(m); } while (--n > 1); return r; } } jsr166/src/test/loops/PriorityQueueSort.java0000644000000000000000000000432611537741071016255 0ustar /* * Written by Josh Bloch and Doug Lea with assistance from members of * JCP JSR-166 Expert Group and released to the public domain, as * explained at http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @synopsis Checks that a priority queue returns elements in sorted order across various operations */ import java.util.*; public class PriorityQueueSort { static class MyComparator implements Comparator { public int compare(Integer x, Integer y) { int i = x; int j = y; if (i < j) return -1; if (i > j) return 1; return 0; } } public static void main(String[] args) { int n = 100000; if (args.length > 0) n = Integer.parseInt(args[0]); List sorted = new ArrayList(n); for (int i = 0; i < n; i++) sorted.add(new Integer(i)); List shuffled = new ArrayList(sorted); Collections.shuffle(shuffled); Queue pq = new PriorityQueue(n, new MyComparator()); for (Iterator i = shuffled.iterator(); i.hasNext(); ) pq.add(i.next()); List recons = new ArrayList(); while (!pq.isEmpty()) recons.add(pq.remove()); if (!recons.equals(sorted)) throw new RuntimeException("Sort test failed"); recons.clear(); pq = new PriorityQueue(shuffled); while (!pq.isEmpty()) recons.add(pq.remove()); if (!recons.equals(sorted)) throw new RuntimeException("Sort test failed"); // Remove all odd elements from queue pq = new PriorityQueue(shuffled); for (Iterator i = pq.iterator(); i.hasNext(); ) if ((i.next().intValue() & 1) == 1) i.remove(); recons.clear(); while (!pq.isEmpty()) recons.add(pq.remove()); for (Iterator i = sorted.iterator(); i.hasNext(); ) if ((i.next().intValue() & 1) == 1) i.remove(); if (!recons.equals(sorted)) throw new RuntimeException("Iterator remove test failed."); } } jsr166/src/test/loops/NoopSpinLockLoops.java0000644000000000000000000000621411537741071016150 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.*; import java.util.*; public final class NoopSpinLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 20000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); new ReentrantLockLoop(1).test(); new ReentrantLockLoop(1).test(); print = true; int k = 1; for (int i = 1; i <= maxThreads;) { System.out.print("Threads: " + i); new ReentrantLockLoop(i).test(); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; private final AtomicInteger spinlock = new AtomicInteger(); ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { final AtomicInteger lock = this.spinlock; try { barrier.await(); int sum = v + 1; int x = sum + 1; int n = iters; while (n-- > 0) { while (!lock.compareAndSet(0, 1)) ; x = LoopHelpers.compute4(x); lock.set(0); if ((x += readBarrier) == 0) ++readBarrier; sum += x; } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/ids.txt0000644000000000000000000105500710235476645013245 0ustar 0 00 000 0000 000000000 000000000000000000000000000000000000000000000000000000000000000 0001 0009 000D 000a 000ms 0010 00123 002 0020 0021 002F 003 003A 004 0040 005 005B 006 0060 007 007B 007E 00am 01 010 01004 011 012 01234 01234567 0123456789 0123456789abcdef 0123456789abcdefghijklmnopqrstuvwxyz 013 014 015 016 017 02 020 0200 0201 0208 021 0212 022 023 024 025 026 027 03 030 031 032 033 034 035 036 0369 037 04 040 042 0430 044 046 05 050 052 054 056 06 060 062 064 066 07 070 072 074 076 08 08001 09 092 096139210x 0D 0F 0L 0X 0d 0e0 0e0f 0e1 0e10 0e10f 0e11 0e12 0e13 0e14 0e15 0e16 0e17 0e18 0e19 0e1f 0e2 0e20 0e21 0e22 0e2f 0e3 0e300 0e3f 0e4 0e4f 0e5 0e5f 0e6 0e6f 0e7 0e7f 0e8 0e8f 0e9 0e9f 0f 0s 0t 0th 0x 0x0 0x00 0x0000 0x00000000 0x00000001 0x000000FF 0x000000ff 0x00000100 0x00000400 0x00000800 0x00000C00 0x00001000 0x00003000 0x00004000 0x00005000 0x00007000 0x00008000 0x0000FF00 0x0000ff00 0x0000ffff 0x0001 0x00010000 0x00020000 0x0008 0x0009 0x000A 0x000C 0x000D 0x000F 0x000FFFFFFFFFFFFFL 0x000fffff 0x000fffffffffffffL 0x0010 0x001F 0x0020 0x0027 0x0060 0x007F 0x007e 0x007fffff 0x0080 0x009F 0x00F6 0x00FF0000 0x00ff 0x00ff0000 0x00s 0x01 0x0102030405060708L 0x02 0x03 0x04 0x0409 0x05 0x07FC0000 0x07FF 0x07ffffff 0x08 0x08000000 0x0F 0x0f 0x0f0f0f0f 0x0f0f0f0f0f0f0f0fL 0x0ff 0x1 0x10 0x100 0x1000 0x10000 0x10000000 0x1000000000000000L 0x10000000000000L 0x1001 0x1002 0x1003 0x1006 0x11 0x1100 0x1161 0x11a7 0x12 0x1269ae40 0x12bf307ae81ffd59L 0x14adf4b7320334b9L 0x159fd800 0x16bcc41e90000000L 0x17179149 0x172588ad4f5f0981L 0x18754571 0x19a10000 0x1A 0x1C 0x1E 0x1F 0x1L 0x1cb91000 0x1e39a5057d810000L 0x1eca170c00000000L 0x1f 0x2 0x20 0x200 0x2000 0x20000 0x211e44f7d02c1000L 0x226ed36478bfa000L 0x23744899 0x247dbc80 0x2700 0x27b95e997e21d9f1L 0x2E 0x2b73a840 0x2d04b7fdd9c0ef49L 0x2ee56725f06e5c71L 0x3 0x30 0x309f1021 0x33333333 0x3333333333333333L 0x34e63b41 0x3547667b 0x3642798750226111L 0x383d9170b85ff80bL 0x39aa400 0x3E0 0x3F 0x3b9aca00 0x3f 0x4 0x40 0x400 0x4000 0x40000 0x40000000 0x4000000000000000L 0x41c21cb8e1000000L 0x45 0x4546b3db 0x48c27395 0x4c4b4000 0x4c650 0x4cfa3cc1 0x4d28cb56c33fa539L 0x4e900abb53e6b71L 0x50 0x53 0x54 0x56 0x5658597bcaa24000L 0x57f6c100 0x5B 0x5DEECE66DL 0x5a3c23e39c000000L 0x5b27ac993df97701L 0x5c13d840 0x5da0e1e53c5c8000L 0x61 0x64 0x6765c793fa10079dL 0x6E 0x6b5a6e1d 0x6c20a40 0x6d91b519 0x6feb266931a75b7L 0x7 0x70 0x70000000 0x71 0x72 0x73 0x74 0x75 0x75db9c97 0x76 0x7600ec618141000L 0x77 0x78 0x78000000 0x780c7372621bd74dL 0x79 0x7A 0x7B 0x7C 0x7D 0x7E000000 0x7F 0x7F000000 0x7FF0000000000000L 0x7FFF0000 0x7FFFFFFF 0x7e0000 0x7f 0x7f7fffff 0x7f800000 0x7f800001 0x7fc00000 0x7fefffffffffffffL 0x7ff0000000000000L 0x7ff0000000000001L 0x7ff8000000000000L 0x7ffL 0x7fffff 0x7fffffff 0x7fffffffffffffffL 0x8 0x80 0x800 0x8000 0x80000 0x800000 0x80000000 0x8000000000000000L 0x85 0x8d2d931 0xA1 0xAA 0xAC 0xB 0xB1 0xBA 0xBE 0xBL 0xC 0xC0 0xC00 0xC1 0xCA 0xCAFEBABE 0xCE 0xCF 0xD0 0xD8 0xD800 0xDBFF 0xDC00 0xDFFF 0xE0 0xE1 0xED 0xEE 0xF 0xF9 0xFE 0xFF 0xFF00 0xFF0000 0xFF000000 0xFF000080 0xFF005C5C 0xFF808080 0xFFC0C0C0 0xFFE0E000 0xFFE0E0E0 0xFFFF 0xFFFFFFFF 0xFFFFFFFFL 0xFFFFL 0xFFL 0xa2f1b6f 0xaaaaaaaa 0xaaaaaaaaaaaaaaaaL 0xac00 0xaced 0xaee5720ee830681L 0xb16a458ef403f19L 0xb640000 0xc0 0xc29e98000000000L 0xcc6db61 0xd7a4 0xde0b6b3a7640000L 0xe0 0xe0000000 0xe8d4a51 0xf0000000 0xfe 0xff 0xff00 0xff0000 0xff000000 0xff00000000000000L 0xff800000 0xff800001 0xfff0000000000000L 0xfff0000000000001L 0xffff 0xffff0000 0xffffff00 0xfffffffL 0xfffffffe 0xffffffff 0xffffffffL 0xfffffffffffffL 0xffffffffffffffffL 0xxxxxxx 1 10 100 1000 10000 100000 1000000 100000000 1000000000 1000000000000000055511151231257827021181583404541015625 1000070633030801713L 1001 1002 1003 1004 1005 1006 1007 1008 100850 1009 1009836000000L 1009839600000L 1009843200000L 100ms 100x100 101 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 102 1020 1021 1022 1023 1024 1025 102L 1030 1034234728574286014L 104 105 106 10646 106749550580L 106751991168 1075 108 1080 1098 1099 10L 10x13 10x14 10x15 10xx 10xxxxxx 11 110 1100110 110592 110L 110x 110xxxxx 111 1110 1110xxxx 1111 1111xxxx 112 1125 114 116 117 118 118526816881161077L 1189 11PM 12 120 121 122 12219292800000L 1224463164541339165L 123 1231 1234 1234321 12345 123456 1234567 1237 12373 124 12472 1249 125 126 1265 127 128 1297 13 130 132 134 1349 1356099454469L 136 1360826667806852920L 137 14 140 1414 1415 14159265358979323846 142 1421746759512286392L 143 143448358473180225L 144 1456 146 146097 1461 1464 148 15 150 1500 151 152 1521711792217232256L 153833 154 156 1582 1582296315990362920L 16 160 162 1624 163 164 166 167 168 1681126225205050147L 1682 169 16BE 16LE 16x16 17 170 172 1721426 174 175 176 176091259 179 1793 18 180 1800000 1800467484195073863L 1807547505821590642L 181 1819846354050686206L 182 1820017752578914078L 1825314779160409405L 1857741824849069317L 186 1889339587208144238L 189 19 1900 1900414231151323879L 1903 1904 1905 1918 1919 192 1928 1947 1949 195 1952 1964 1969 1970 1978198479659022715L 1986 1993 1994 1995 1996 1997 1998 1999 19991101 19991106 1L 1e 1e128 1e16 1e256 1e32 1e64 1f 1st 1xx 2 20 200 2000 2001 2002 2003 2004 2005 2006 201 2010 2012 2018 202 2022 203 204 2048 205 2053 206 21 210 212 213 2130706433 214 2147483647 2147483648 215 216 21757335363267194L 21st 22 220 2214773872412987419L 222 224 225 2250 226 2272572637695466749L 2278 2279 228 2284879212465893870L 229 2299161 23 230 230798 2308460125733713944L 231 232 234 234E3 236 2373 2378 238 239 2396 23E4 23E45 24 240 241 242 243 244 2440588 246 2491878825643557906L 25 250 252 253 254 255 255L 255f 256 257 259 25th 26 260 262 264 2648 266 2671257302660747028L 2673458971256075116L 27 270 270799 2712 272 2728009084054400034L 273 2732 2739099268398711800L 274 2745179027874758501L 275 276 2764017481108945198L 2767605614048989439L 2781 28 283967356065247728L 2875 28800000 289529654D 29 292269054 292269055 292272993 292275056 292278994 2966288784432217853L 297 299 299282585814624189L 2A0 2D 2FCS 2XX 2a0 2b4 2e 2h 2nd 2v 2xx 3 30 300 301 301029995663981 301077366599181567L 302 303 304 3042686055658047285L 305 3053995032091335093L 306 3072 308 309 3093736618740652951L 3094126758329070636L 30F3 30pm 31 310 312 314 316 3166 3193687207550431679L 32 320 3200 3206093459760846163L 322 324 3247 326 32767 32768 3286316764910316507L 32pm 32x32 33 330 3304312411574666869L 331 332 3326426625597282442L 334 335 3359745691033257079L 336 3387516993124229948L 3388685877147921107L 34 340 3402 342 344 345 3456 345E3 346 34e 35 350 352 353 354 3543 355 356 3581463369166924961L 359 36 360 3600000 36000000 3609922007826600659L 362 362498820763181265L 364 365 36524 365L 366 3665804199014368530L 367 3672 3692302836626095722L 37 370 371 372 3729780091441768983L 374 375 376 377 3786198910865385080L 3790 38 3856 3899 38f 39 3905348978240129619L 3D 3E 3E3 3L 3XX 3b 3xx 4 40 400 4001 4006245 401 402 4023755556366636806L 4028235e 403 403250971215465050L 404 405 4059614 406 4061116 407 4075310674757313071L 408 409 4096 40foo 41 410 4106658 4106667 411 4112352 4112578634029874840L 4114077 411787 412 4122683 4124460 4128923 413 414 4147706 4149677 415 4153860 4154308 4155217 4162852 4173516 4173604 4178589 4179 4181562 4186 42 420 4206021311591459213L 4217 4271 4285201 4290774380558885855L 4298000515446427739L 42pm 43 4300693 4301064 4320890 4328196481005934313L 4345857070255674764L 4348425 4350 4352819 4360508 4389284 4390019 4395290 44 4407610 4408108 4418903 4426 4450867 4461737 4497834738069338734L 4498 45 4503142729533789064L 4536902356223894379L 456 4567 456E3 456e 458 45f 46 4613797578919906343L 4620452533522760060L 4633 4696 47 4723952579491349524L 4724086851538908602L 473 4739377000350280650L 473L 4756 477 4774881970558875024L 4775845313121906682L 48 4814 48282 483174189758638095L 4863550261346652506L 4870 49 4923 4930327919388951260L 4940670005562187L 4975 4980196508277280342L 4A0 4E 4HEXDIG 4XX 4a0 4e 4x 4xx 5 50 500 5000 500000 501 502 5024744406713321676L 5025 503 5035145889651310422L 504 505 5074 509 5090210921595982017L 51 510 512 5120 513 5148567311918794206L 515 5166 5184291520170872969L 52 5210 52429 5253 5276940640259749850L 5295 53 535 54 5488922509400504703L 55 56 567 57 5772796243397350300L 58 5836846270535785031L 59 5920926903803293709L 594 594380845140740218L 597 5987973545549424702L 5B 5D 5L 5XX 5d 5f 5xx 6 60 600 60000 6034044314589513430L 6052424284110960213L 61 6108874887143696463L 6120832682080437368L 6190621106981774043L 62 6223554758134037936L 63 6314925228044966088L 639 64 6401253773779951803L 6460061437900069969L 6479157306784022952L 648 64K 65 6520786458950516097L 65535 65536 66 6603384152749567654L 6619395951570472985L 6640330810709497518L 67 673 678 6789 68 6849794470754667710L 69 6a 6b 6c 6g 6th 6x9 7 70 700 701 7034897190745766939L 7054464920481467219L 707 7088199405468872373L 71 7182818284590452354 7183698231559129828L 7187392471159151072L 72 7200000 7207038068494060240L 7218322306649953788L 7262534875583282631L 7270714317450821763L 728 73 74 75 7515723908773894738L 7523967970034938905L 754 7589 75f 76 7627629688361524110L 7644114512714619750L 768 77 7712 7754090372962971524L 7777 78 7930732926638008763L 7956609840827222915L 7976931348623157e 7997698588986878753L 7days 7th 7x9 8 80 800 8028237497568985504L 8080 8087809532704668744L 81 8125100834729963327L 8152710247442114228L 8192 82 822 8287574255936472291L 83 836B 837039928046 84 841 8433406075740433514L 8451667562882310543L 8455284893909696482L 85 8575799808933029326L 8601 86400 864000000L 864413376551465018L 8658291919501921765L 8683452581122892189L 87 8742448824652078965L 876323262645176354L 8774683716313001058L 88 8809584163345499784L 8838754796412211005L 8842843931221139166L 8859 8859_1 8888 8890392402588814465L 8988374069173025854L 8th 9 90 901 9090 91 9142742483513960612L 9149081749638150636L 917 9172774392245257468L 9176873029745254542L 919286545866124006L 92 9218657361741657110L 9223372036794351616 9223372036854775807 9223372036854775807L 9223372036854775808 93 94 941st 942 94303 95 96 97 978 98 99 999 9999 999999 999999999 9e 9x11 9x12 A A0 A1 A10 A2 A3 A4 A5 A6 A7 A8 A9 AA AAA AAD ABC ABCDEFGHIJKLMNOPQRSTUVWXYZ ABORT ABORTED ABSTRACT ACC ACCEPT ACCESS ACCESSIBLE_CHILD_PROPERTY ACCESSIBLE_STATE_PROPERTY ACCESSIBLE_TEXT_PROPERTY ACCESSIBLE_VALUE_PROPERTY ACK ACM ACP ACTION_EVENT ACTION_EVENT_MASK ACTION_FIRST ACTION_LAST ACTION_PERFORMED ACTIVE ACTIVE_CAPTION ACTIVE_CAPTION_BORDER ACTIVE_CAPTION_TEXT AD ADAND ADDRESS_BITS_PER_UNIT ADDR_TYPE_NOT_SUP ADJUSTMENT_EVENT_MASK ADJUSTMENT_FIRST ADJUSTMENT_LAST ADJUSTMENT_VALUE_CHANGED ADP ADisk AE AEARE AFAFG AFTER AFTER_LAST_LINE AFTER_LINE_ENDS AGATG AGP AIAIA AINSWORTH AL ALALB ALIAS ALIGN ALL ALLBITS ALL_FLAGS ALPHABETIC_PRESENTATION_FORMS ALPHA_INTERPOLATION_DEFAULT ALPHA_INTERPOLATION_QUALITY ALPHA_INTERPOLATION_SPEED ALREADY ALT ALTER ALT_DOWN_MASK ALT_GRAPH_MASK ALT_MASK ALWAYS AM AMARM AM_PM AM_PM_FIELD AN ANANT ANCESTOR_MOVED ANCESTOR_RESIZED AND ANSI ANSI92 ANY ANY_EVENT AOAGO API APIs APRIL AQATA ARABIC ARABIC_DECIMAL_SEPARATOR ARABIC_PERCENT_SIGN ARABIC_PRESENTATION_FORMS_A ARABIC_PRESENTATION_FORMS_B ARARG ARGB ARGUMENT ARMENIAN ARRAY ARRAYS ARRAY_SIZE_INCREMENT ARROWS ARchive AS ASASM ASCII ASCII_AMPERSAND ASCII_APOSTROPHE ASCII_CARRIAGE_RETURN ASCII_CENT_SIGN ASCII_COLON ASCII_COMMA ASCII_DOLLAR_SIGN ASCII_END_OF_TEXT ASCII_EXCLAMATION_MARK ASCII_FORM_FEED ASCII_FULL_STOP ASCII_HORIZONTAL_TABULATION ASCII_LINEFEED ASCII_NONBREAKING_SPACE ASCII_NUMBER_SIGN ASCII_PERCENT ASCII_POUND_SIGN ASCII_QUESTION_MARK ASCII_QUOTATION_MARK ASCII_SEMICOLON ASCII_SPACE ASCII_VERTICAL_TABULATION ASCII_YEN_SIGN ASC_OR_DESC ASN ASSERT AST AT ATAUT ATHLETES ATS ATTN ATTR_DEF ATTR_NAME ATTR_SIZE ATTR_TYPE_NAME AUAUS AUD AUGUST AUTOMATICALLY AUTO_INCREMENT AWABW AWT AWTAutoShutdown AWTError AWTEvent AWTEventListener AWTEventListenerProxy AWTEventListeners AWTEventMulticaster AWTEvents AWTException AWTInvocationLock AWTKeyStroke AWTKeyStrokes AWTPermission AWTTreeLock AWT_COMPONENT AZ AZAZE A_DATA A_TO_Z Abbrechen Aboriginal Above Absolute Absract Abstract AbstractButton AbstractChannel AbstractCollection AbstractList AbstractMap AbstractMethodError AbstractSelectableChannel AbstractSequentialList AbstractSet Accents Accept Acceptable Accepted Accepts Access AccessControl AccessControlContext AccessControlException AccessController AccessException Accessibility Accessible AccessibleAWTButton AccessibleAWTCanvas AccessibleAWTCheckbox AccessibleAWTCheckboxMenuItem AccessibleAWTChoice AccessibleAWTComponent AccessibleAWTComponentHandler AccessibleAWTContainer AccessibleAWTDialog AccessibleAWTFocusHandler AccessibleAWTFrame AccessibleAWTLabel AccessibleAWTList AccessibleAWTListChild AccessibleAWTMenu AccessibleAWTMenuBar AccessibleAWTMenuComponent AccessibleAWTMenuItem AccessibleAWTPanel AccessibleAWTPopupMenu AccessibleAWTScrollBar AccessibleAWTScrollPane AccessibleAWTTextArea AccessibleAWTTextComponent AccessibleAWTTextField AccessibleAWTWindow AccessibleAction AccessibleApplet AccessibleComponent AccessibleContainer AccessibleContainerHandler AccessibleContext AccessibleObject AccessibleRole AccessibleSelection AccessibleState AccessibleStateSet AccessibleStates AccessibleText AccessibleValue Accessing Accessor According Accumulating Accuracy Acme Acquires Action ActionEvent ActionListener ActionListenerK ActionListeners Actions Activatable Activate Activation ActivationSystem ActiveEvent Actually Ad Adapted Add Added Adding Addison Addition Additional Additionally Address Addresses Addressing Adds Adjacent Adjust AdjustForGravity Adjustable Adjustables Adjusting Adjustment AdjustmentEvent AdjustmentListener AdjustmentListeners Adjustments Adjusts Advance Advanced Advances AffineTransform AffineTransformOp After Again Aggressively Agreement Aho Akira Alan Alg Algorithm AlgorithmObject AlgorithmParameterGenerator AlgorithmParameterGeneratorSpi AlgorithmParameterSpec AlgorithmParameters AlgorithmParametersSpi Algorithms Alias Alice All AllPermission AllPermissionCollection AllPermissions Allocate Allocates Allow AllowUserInteraction Allowed Allowing Allows Almost Alpha AlphaComposite Alphabet Alphabetic Alphanumerics Already AlreadyBoundException Also Alt Alternate Alternatively Although Alto Always AmPmMarkers Ambiguity Amendment America American Among Amy An And Angles Ann Annex Anno Annotation Another Answer Antarctica Antialiasing Antonio Any AnyLocal Anything AppA AppContext AppContexts Appease Append Appendix Appends Applet AppletAudioClip AppletContext AppletInitializer AppletStub Applets Application Applications Applies Apply Applying Appropriate Approximate Apr April Arabic Architecture Are Area AreaAveragingScaleFilter Argh Argument ArgumentIndex Arial Arithmetic ArithmeticException Armenian Arnaud Arnold Arrange ArrangeGrid Array ArrayIndexOutOfBoundsException ArrayList ArrayPersistenceDelegate ArrayStoreException Arrays Arrow Arrows Art Arthur As Ascii Asian Aside Ask Asmus Assert Assertion AssertionError AssertionStatusDirectives Assign Assigns Assistive Associate Associated Associates Asssume Assume Assumes AsynchronousCloseException At Athletes Atomically Atop Attaches Attachments Attatching Attempt Attempted Attempting Attempts Attribute AttributeEntry AttributeList AttributeMap AttributeSet AttributeStrings AttributeValue AttributedCharacterIterator AttributedCharacterIterators AttributedString AttributedStringIterator AttributedStrings Attributes AudioClip Aug August Authentication Authenticator Author Authoritative Authorities Authority Automatic Automatically Averaging Avoid Away Axis B B0 B1 B10 B2 B3 B4 B5 B6 B7 B8 B9 BABIH BACKGROUND BACKWARD_TRAVERSAL_KEY BACKWARD_TRAVERSAL_KEYS BACK_SPACE BASE BASE_TYPE BASIC_LATIN BA_DIRECTORY BA_EXISTS BA_HIDDEN BA_REGULAR BBB BBBRB BC BCE BDBGD BDK BEBEL BEF BEFORE BEFORE_FIRST_LINE BEFORE_LINE_BEGINS BEGIN BEGINNING BEHK BENGALI BEVEL BFBFA BGBGR BGL BHBHR BIBDI BIDI_EMBEDDING BIGINT BIG_ENDIAN BIN BINARY BINARYSEARCH_THRESHOLD BIND BIRs BIT BITARRAYMASK BITMASK BITS_PER_BYTE BITS_PER_UNIT BIT_DEPTH_MULTI BIT_INDEX_MASK BJBEN BL BLACK BLOB BLOCK_DECREMENT BLOCK_ELEMENTS BLOCK_INCREMENT BLUE BMBMU BMP BN BNBRN BO BOBOL BOLD BOLDITALIC BOOLEAN BOPOMOFO BOPOMOFO_EXTENDED BORDER BOTH BOTTOM_ALIGNMENT BOV BOX_DRAWING BR BRAILLE_PATTERNS BRBRA BREAK BREAKING BSBHS BSD BTBTN BUFFER_LENGTH BUNDLED BUSY BUTT BUTTON1_DOWN_MASK BUTTON1_MASK BUTTON2_DOWN_MASK BUTTON2_MASK BUTTON3_DOWN_MASK BUTTON3_MASK BVBVT BWBWA BY BYB BYBLR BYTEMASK BYTEPOWER BYTES_PER_INT BYTES_PER_VALUE BZBLZ Back BackSpace Backing Backward Backwards Bad Bags Bail Balancing Ball Bar Base Basic BasicPermission BasicPermissionCollection BasicPermissions BasicSplitPaneUI BasicStroke BasicVerticalLayoutManager Basically BatchUpdateException Bbits Be Bean BeanBox BeanContext BeanContextChild BeanContextMembershipListener BeanContextMembershipListeners BeanDescriptor BeanInfo Beans BeansAppletContext BeansAppletStub Beauty Because Before Begin Beginning Behaves Behavior Being Below Bengali Benjamin Bentley Besides Best BevelBorder BevelBorderUIResource Bidi Big BigDecimal BigDecimals BigDecmal BigInteger BigIntegers BigObjectThatShouldNotBeSerializedWithAButton Bill Binary Bind BindException Binding Binds Bit BitSet BitSets BitSieve Bits Bitset Bitwise Black Blank Blends Blob Bloch Block BlockDataInputStream BlockDataOutputStream Blocking BltBufferStrategy Blue Bob Bold Bonus BoolEditor Boolean Booleans Bopomofo BorderLayout BorderUIResource Both Bottom Bounds Box BoxLayout Boynton Braille Break BreakDictionary BreakIterator BreakIteratorCache BreakIteratorClasses BreakIteratorRules BreakIterators Breaking Breaks Brown BuddhistCalendar Buffer BufferB BufferCapabilities BufferOverflowException BufferS BufferStrategy BufferU BufferUnderflowException Buffered BufferedImage BufferedImageOp BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter Buffering Bug BugTraq Build BuildAPI BuildDictionaryFile Builder Builds Bulk Bump Business But Button Button1 Button10 Button2 Button3 Button4 Button5 Button6 Button7 Button8 Button9 ButtonGrid ButtonPeer Buttons Bval By Byrne Byte ByteArrayInputStream ByteArrayOutputStream ByteBuffer ByteBufferAs ByteBufferAsCharBuffer ByteBufferAsCharBufferB ByteBufferAsCharBufferL ByteBufferAsCharBufferRB ByteBufferAsCharBufferRL ByteBufferAsDoubleBufferB ByteBufferAsDoubleBufferL ByteBufferAsDoubleBufferRB ByteBufferAsDoubleBufferRL ByteBufferAsFloatBufferB ByteBufferAsFloatBufferL ByteBufferAsFloatBufferRB ByteBufferAsFloatBufferRL ByteBufferAsIntBufferB ByteBufferAsIntBufferL ByteBufferAsIntBufferRB ByteBufferAsIntBufferRL ByteBufferAsLongBufferB ByteBufferAsLongBufferL ByteBufferAsLongBufferRB ByteBufferAsLongBufferRL ByteBufferAsShortBufferB ByteBufferAsShortBufferL ByteBufferAsShortBufferRB ByteBufferAsShortBufferRL ByteChannel ByteEditor ByteFilter ByteInterleavedRaster ByteOrder ByteOutputter ByteToCharConverter Bytes C C0 C1 C10 C2 C3 C4 C5 C6 C7 C8 C9 CA CACAN CACHE_LOAD_FACTOR CANADA CANADA_FRENCH CANCEL CANCELLED CANONICAL_DECOMPOSITION CANVAS CAPITAL CAPS_LOCK CAP_BUTT CAP_ROUND CAP_SQUARE CARDINALITY CARET_POSITION_CHANGED CARON CARRIAGE CASE_INSENSITIVE_ORDER CASE_SENSITIVE CCCCK CDT CE CEASE CENTER CENTER_ALIGNMENT CENTER_BASELINE CERTIFICATES CFCAF CGCOG CH CHANGE CHAR CHARACTER CHARACTER_INDEX CHARINDEX CHAR_BUF_SIZE CHAR_ERROR CHAR_OCTET_LENGTH CHAR_UNDEFINED CHCHE CHECKED CHECK_BOX CHEROKEE CHF CHINA CHINESE CICIV CJK CJK_COMPATIBILITY CJK_COMPATIBILITY_F900 CJK_COMPATIBILITY_FA2D CJK_COMPATIBILITY_FORMS CJK_COMPATIBILITY_IDEOGRAPHS CJK_RADICALS_SUPPLEMENT CJK_SYMBOLS_AND_PUNCTUATION CJK_UNIFIED_IDEOGRAPHS CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A CKCOK CLASSPATH CLASS_NAME CLCHL CLEAR CLEAR_GLOBAL_FOCUS_OWNER CLF CLI CLIENT CLOB CLOSE_ALL_RESULTS CLOSE_CURRENT_RESULT CLOSE_CURSORS_AT_COMMIT CLR CMCMR CMD_NOT_SUPPORTED CMYK CN CNCHN CNFException COCOL CODE COLLATIONKEYOFFSET COLON COLOR COLOR_RENDER_DEFAULT COLOR_RENDER_QUALITY COLOR_RENDER_SPEED COLS COLUMN_DEF COLUMN_NAME COLUMN_SIZE COLUMN_TYPE COL_COUNT COM COMBINING_DIACRITICAL_MARKS COMBINING_HALF_MARKS COMBINING_KATAKANA_HIRAGANA_VOICED_SOUND_MARK COMBINING_MARKS_FOR_SYMBOLS COMBINING_SPACING_MARK COMBO_BOX COMMON COMPLETE COMPLETELY COMPONENT_ADDED COMPONENT_EVENT_MASK COMPONENT_FIRST COMPONENT_HIDDEN COMPONENT_LAST COMPONENT_MOVED COMPONENT_REMOVED COMPONENT_RESIZED COMPONENT_SHOWN COMPOSE CONCUR_READ_ONLY CONCUR_UPDATABLE CONNECT CONNECTOR_PUNCTUATION CONN_REFUSED CONSTANTS CONSTRUCTOR CONTAINER_EVENT_MASK CONTAINER_FIRST CONTAINER_LAST CONTRACTCHARINDEX CONTROL CONTROL_DK_SHADOW CONTROL_HIGHLIGHT CONTROL_LT_HIGHLIGHT CONTROL_PICTURES CONTROL_SHADOW CONTROL_TEXT CONVERSION CONVERSIONS CONVERT COPIED COPY_THRESHOLD COUNTRY_TYPE_MASK COUNTRY_WITHOUT_CURRENCY_ENTRY CR CRCRI CREATE CREATED CREATE_PARAMS CROSSHAIR_CURSOR CRs CS CST CS_sRGB CTRL CTRL_DOWN_MASK CTRL_MASK CTT CT_ALPHA CT_COMMENT CT_DIGIT CT_QUOTE CT_WHITESPACE CUCUB CURRENCY CURRENCYSTYLE CURRENCY_SIGN CURRENCY_SYMBOL CURRENCY_SYMBOLS CUSTOM_CURSOR CUSTOM_ID CVCPV CXCXR CYAN CYCYP CYRILLIC CZCZE Cable Cache CacheEntry Cached Caches Caculate Calculate Calculates Calendar CalendarDate Calendars California Call CallableStatement Callback Callbacks Called Callers Calling Calls Can Canada Canadian Cancel CancelKey Cancelled CancelledKeyException Cancelling Cancels Candidate Candidates Cannot Canonical Canvas CanvasPeer Canvases Capabilities Capacity Caps CarSet Card CardLayout Care Careful Carl Carry Cartesian Case CaseInsensitiveComparator Cause Caused Causes Caution Caveats Cc Cd Center Centers Central CertPathBuilder CertPathValidator CertStore CertStoreParameters Certain Certificate CertificateEncodingException CertificateException CertificateFactory Cerven Cervenec Cf Ch Chaining Chamness Change Changes Changing Channel Channels Char CharArrayReader CharArrayWriter CharBuffer CharConversionException CharSequence CharSet CharSets CharToByteConverter Character CharacterBreakData CharacterBreakDictionary CharacterBreakRules CharacterCodingException CharacterExceptionFlags CharacterIterater CharacterIterator CharacterIteratorFieldDelegate CharacterIterators Characters Chararcter Charset CharsetByteOutputter CharsetDecoder CharsetEncoder CharsetFiller CharsetProvider CharsetSD CharsetSE Charsets Cheap Check CheckBoxMenuItem Checkbox CheckboxGroup CheckboxMenuItem CheckboxMenuItemPeer CheckboxPeer Checked Checking Checks Chen Cherokee Child China Chinese Choice ChoiceFormat ChoicePeer Choices Choose Chris Christ Christophe Cipher Circumvent Claim Class ClassCastException ClassCircularityError ClassDataSlot ClassDataSlots ClassDescriptor ClassFormatError ClassID ClassLoader ClassLoaders ClassName ClassNotFoundException ClassNotFoundExceptions Classes Clean Cleans Clear ClearInterrupted Clearing Clears Clicking Client Clients Clip Clipboard Clob Clock Clone CloneNotSupportedException Cloneable Clones Cloning Close Closed ClosedByInterruptException ClosedChannelException ClosedSelectorException Closes Closing ClsID Cn Co Code CodeSource Coder Col Colin CollatinKey Collation CollationDecomp CollationElementIterator CollationElementIterators CollationElements CollationKey CollationKeys CollationRules Collator Collators Collect Collection Collections Collects Collet Color ColorChooser ColorModel ColorPaintContext ColorSpace ColorType ColorUIResource Colors Column Columns Combinations Combine Combiner Combining Command Comments Common CompactArray CompactByteArray CompactIntArray CompactShortArray Compacts Company Comparable Comparator Comparators Compare Compares Comparing Comparison Compatibility Compiler Compiles Complements Complete Completes Compliant Component ComponentEvent ComponentEvents ComponentFactory ComponentListener ComponentOrienation ComponentOrientation ComponentPeer Components Compose ComposedCharIter Composes Composite CompositeContext Compositing CompositionArea CompoundBorder CompoundBorderUIResource CompoundEnumeration Comprehensive Compute Computed Computer Computes Concatenates Conceptually Concrete Concurrency Concurrent ConcurrentModificationException ConcurrentModificationExceptions Conditional Condtional Confidential Conflict Conformant Conjoining Connect ConnectException ConnectIOException Connection Connects Connelly Consecutive Consequently Consider Consortium Constant Constants Constrain ConstrainableGraphics Constrained Construct Constructed Constructor Constructors Constructs Consult Consumes Contact Container ContainerEvent ContainerListener ContainerListner ContainerOrderFocusTraversalPolicy ContainerPeer Containers Contains Content ContentHandler ContentHandlerFactory Contents Context Continue Continues Continuing Control Controls Convenience ConversionBufferFullException Convert Converted Converter ConverterByteOutputter ConverterFiller ConverterSD ConverterSE Converters Converts Coordinate Coordinates Copies CopiesList Copy Copying Copyright Core Cormen Corp Correct Corresponding Corresponds Could Couldn Count Countries Country Counts Courier Create Created Creates Creating Creation Credit Croatia Croatian Crosshair CrosshairCursor Crossings CryptoSpec Cryptogaphy Cryptographic Cryptography Cs Ctrl Cubic Currencies Currency CurrencyData CurrencySymbols Current Currently Curso Cursor CursorDotPrefix Custom Customizer Cut Cx Cycle Cyrillic Czech D D1 D2 D3 D4 D5 D6 D7 D8 DARK_GRAY DASH_PUNCTUATION DATALINK DATA_TYPE DATE DATE_FIELD DAY DAY_OF_MONTH DAY_OF_WEEK DAY_OF_WEEK_FIELD DAY_OF_WEEK_IN_MONTH DAY_OF_WEEK_IN_MONTH_FIELD DAY_OF_YEAR DAY_OF_YEAR_FIELD DBL_DIG DBMS DBMSs DC DD DDD DDDD DDDDD DDDDDE DDL DE DEBUG DEBUGGING DECEMBER DECIMA DECIMAL DECIMAL_DIGITS DECIMAL_DIGIT_NUMBER DECIMAL_SEPARATOR DECLARATIONS DECLARED DEDEU DEFAULT DEFAULTRULES DEFAULT_CAPACITY DEFAULT_CURSOR DEFAULT_NOT_FOUND DEFAULT_PORT DEFAULT_VISIBLE_ROWS DEFERRABILITY DEGREE_CELSIUS DEGREE_FAHRENHEIT DELETE DELETED DELETEDs DELETE_RULE DEM DEPRECATE DERIVED DESCRIPTION DESELECTED DESKTOP DEVANAGARI DEVIATION DIALOG DIDN DIFFERENT DIGITS DIN DINGBATS DIRECTION DIRECTIONALITY_ARABIC_NUMBER DIRECTIONALITY_BOUNDARY_NEUTRAL DIRECTIONALITY_COMMON_NUMBER_SEPARATOR DIRECTIONALITY_EUROPEAN_NUMBER DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR DIRECTIONALITY_LEFT_TO_RIGHT DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE DIRECTIONALITY_NONSPACING_MARK DIRECTIONALITY_OTHER_NEUTRALS DIRECTIONALITY_PARAGRAPH_SEPARATOR DIRECTIONALITY_POP_DIRECTIONAL_FORMAT DIRECTIONALITY_RIGHT_TO_LEFT DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE DIRECTIONALITY_SEGMENT_SEPARATOR DIRECTIONALITY_UNDEFINED DIRECTIONALITY_WHITESPACE DIR_MIXED DISPLAYABILITY_CHANGED DISTINCT DJDJI DK DKDNK DKK DL DMDMA DNS DO DODOM DOES DOESN DOM DOMAIN_NAME DOM_MODE DON DONE DONT_LOOP_FLAG DOS DOUBLE DOUBLE_FRACTION_DIGITS DOUBLE_INTEGER_DIGITS DOUBLE_PRIME DOW DOWN DOWN_CYCLE_TRAVERSAL_KEY DOWN_CYCLE_TRAVERSAL_KEYS DOW_AFTER_DOM DOW_BEFORE_DOM DOW_GE_DOM_MODE DOW_IN_MONTH DOW_IN_MONTH_MODE DOW_LE_DOM_MODE DOY DRAFT DSA DSAParameterSpec DSAPrivateKey DSAPublicKey DSAPublicKeySpec DST DST_ATOP DST_IN DST_OFFSET DST_OUT DST_OVER DT DZDZA Dash Data DataBufferInt DataFlavor DataFlavors DataInput DataInputStream DataInputStreams DataOuputStream DataOutput DataOutputStream DataSource DataTruncation Database DatabaseMetaData Datagram DatagramChannel DatagramPacket DatagramSocket DatagramSocketImpl DatagramSocketImplFactory DatagramSockets Date DateFormat DateFormatSymbols DateFormatZoneData DateFormats DateFormatters DateTimeElements DateTimePatterns Datei Dateien Dates David Davidson Davis Day DayAbbreviations DayNames Daylight Daylignt Days De Deal Debug DebugHelper Debugging Dec December Deciding Decimal DecimalFormat DecimalFormatSymbols DecimalNumeral Declarations Declare DecodableString Decode Decodes Decoding DecompIterator Decompose Decomposes Decomposition Decrements Default DefaultBufferCapabilities DefaultCellEditor DefaultComboBoxModel DefaultCursor DefaultFocusTraversalPolicy DefaultKeyboardFocusManager DefaultKeyboardFocusManagerSentEvent DefaultKeyboardFocusManagers DefaultListModel DefaultListSelectionModel DefaultPersistenceDelegate DefaultSelectionType DefaultTreeModel DefaultUseCaches Defaults Define Defines Definition Definitive DefulatPD Delay Delays Delegate Delegates Delete Deletes Deletion Delimiter Deliver Delivers Delta Denver Deny Depending Deprecated Derive Describes Description Descriptions Descriptive Descriptor Descriptors Deselects Deserialization Deserialized Deserializes Deserializing Design DesignMode Designated DesintationType Desired Despite DessertTopping Destination DestinationType Destroy DestroyJavaVM Destroys Detailed Details Detect Detecting Determine Determines DevAxisVec Devanagari Devanigiri Developers Deviation Device Dewey Diacritical Dialog DialogInput DialogPeer DialogType Dialogs Dick Dictionary DictionaryBasedBreakIterator Didn Die Different Differs Diffie Digest DigestException DigestInputStream DigestOutputStream Digit DigitList DigitOnes DigitTens Digital Digits Dimension Dimension2D Dingbats Direct DirectBuffer DirectByteBuffer DirectByteBufferR DirectCharBuffer DirectCharBufferRS DirectCharBufferRU DirectCharBufferS DirectCharBufferU DirectColorModel DirectDoubleBufferRS DirectDoubleBufferRU DirectDoubleBufferS DirectDoubleBufferU DirectFloatBufferRS DirectFloatBufferRU DirectFloatBufferS DirectFloatBufferU DirectIntBufferRS DirectIntBufferRU DirectIntBufferS DirectIntBufferU DirectLongBufferRS DirectLongBufferRU DirectLongBufferS DirectLongBufferU DirectShortBufferRS DirectShortBufferRU DirectShortBufferS DirectShortBufferU Directorate Directory Disable Disables Disabling Disallow Discard Discards Disconnects Discover Disk Dispatch Dispatched Dispatches Dispatching Display DisplayMode Disposal DisposeAction Disposes Disposing Dissect Distinct Distinguish Distributable Distribute Dithering Divide Dividend Division Diwanji DnD DnDConstants Do DoInput DoOutput Document Does Doing Dollar DomainCombiner DomainCombiners Domini Don Donald Dot DotFileSuffix DotHotspotSuffix DotNameSuffix Double DoubleBuffer DoubleEditor Doubles Doug Douglas Down DragGestureEvent DragGestureListener DragGestureRecognizer DragSource DragSourceContext DragSourceContextPeer DragSourceListener Drain Drawing Draws Driver DriverInfo DriverManager DriverPropertyInfo Drivers Drop DropTarget DropTargetEventTargetFilter Drops Dst DstAtop DstIn DstOut DstOver Due Duff Dummy Dump DumpConstraints DumpLayoutInfo Duplicate During Dynamic E E0 EAST ECECU EDITABLE EDT EEE EEEST EFFECT EG EGEGY EHESH EIGHTY EMPLOYEES EMPTY EMPTY_LIST EMPTY_MAP EMPTY_SET EN ENABLED ENCLOSED_ALPHANUMERICS ENCLOSED_CJK_LETTERS_AND_MONTHS ENCLOSING_MARK ENCODED END END_OF_STRING END_PUNCTUATION END_STATE END_STATE_FLAG ENGLISH ENTER ENTRIES ENV_10 ENV_10X13 ENV_10X14 ENV_10X15 ENV_11 ENV_12 ENV_14 ENV_6X9 ENV_7X9 ENV_9 ENV_9X11 ENV_9X12 ENV_INVITE ENV_ITALY ENV_MONARCH ENV_PERSONAL EOF EOFException EOL EOS EPOCH_JULIAN_DAY EPOCH_YEAR EQUAL ERA ERA_FIELD ERERI ERROR ERRORED EResizeCursor ES ESCAPE ESESP ESP EST ET ETETH ETHIOPIC EUC EUR EVEN EXACT EXECUTE EXECUTED EXECUTE_FAILED EXECUTIVE EXIST EXISTS EXPANDCHARINDEX EXPECTED_MAX EXPONENT EXPONENT_SIGN EXPONENT_SYMBOL E_RESIZE_CURSOR Each Earth Ease East Eastern Easy Ecks Edh Edition Editor Ee Effective Effectively Eight Either Element Elements Eliminate Ellison Else Emits Empties Empty EmptyBorder EmptyBorderUIResource EmptyEnumerator EmptyEvent EmptyFieldPositionArray EmptyIterator EmptyList EmptyMap EmptySet EmptyStackException Enable Enables Enabling Encapsulates Enclosed Encloses Encoded Encoder Encodes Encoding EncryptedPrivateKeyInfo End Ends Enforces Eng Engineering English Enhancement Ensure Ensures Enter Entering Enters Entity Entries Entry EntryIterator EntryPair EntrySet EntrySetView Enum Enumerate Enumerates Enumeration Enumerations Enumerator Envelope Environment Equal Equality Equivalent Equivalently Era Eras Error Errors Escape Establish Establishes Estimate Etats EtchedBorder EtchedBorderUIResource Ethernet Ethiopic Euclid Euclidean Euler Euro Europe European Evaluates Even EvenOdd Event EventDispatchThread EventHandler EventHandlers EventListener EventListenerProxy EventListerProxy EventObject EventQueue EventQueueItem EventQueues EventSetDescriptor EventSetDescriptors EventTargetFilter Events Eventually Every Ex Exact Exactly Examine Examines Examining Example Examples Except Exception ExceptionInInitializerError ExceptionListener ExceptionResources ExceptionResources_de ExceptionResources_fr Exceptional Exceptions Excludes Execute Executes Executing Execution Executive Existing Exists Expand Expanding Expands Expected Expecting Expects Experience ExpiredKeyException Explicitly Explorer Exponential Expression Expressions Extended Extension Extensions Externalizable Extract Extracts Extreme F F1 F10 F11 F12 F2 F3 F4 F5 F6 F7 F8 F9 FACTOR FAHRVERGN FALL FALLTHROUGH FALSE FAMILY FAQ FCS FDBigInt FDBigInts FEBRUARY FEED FETCH_FORWARD FETCH_REVERSE FETCH_UNKNOWN FF FFFF FIELD_COUNT FIELD_NAME FIFIN FIFTY FIGURE_SPACE FILE FILES FILL_THRESHOLD FILTER FILTER_CONDITION FIM FINAL FINALIZERS FINALLY FINAL_QUOTE_PUNCTUATION FIPS FIRST FIRST_LINE_END FIRST_LINE_START FIVE FIX FIXED_PREC_SCALE FIXME FJFJI FKCOLUMN_NAME FKFLK FKP FKTABLE_CAT FKTABLE_NAME FKTABLE_SCHEM FK_NAME FLAG_DIR_DEFAULT_LTR FLAG_DIR_DEFAULT_RTL FLAG_DIR_LTR FLAG_DIR_RTL FLOAT FMFSM FOCUSABLE FOCUSED FOCUS_EVENT_MASK FOCUS_FIRST FOCUS_GAINED FOCUS_LAST FOCUS_LOST FOCUS_TRAVERSABLE_DEFAULT FOCUS_TRAVERSABLE_SET FOCUS_TRAVERSABLE_UNKNOWN FOFRO FOLIO FOLLOWING FONT FOR FOREVER FORM FORMAT FORTY FORWARD_TRAVERSAL_KEY FORWARD_TRAVERSAL_KEYS FQDN FR FRACTION FRACTION_FIELD FRAME FRAMEBITS FRANCE FRENCH FRF FRFRA FRIDAY FROM FSS_UTF FULL FULLWIDTH_COMMA FULLWIDTH_EXCLAMATION_MARK FULLWIDTH_FULL_STOP FULLWIDTH_QUESTION_MARK FULL_DECOMPOSITION FXFXX Facility Factory FactoryURLClassLoader Fahrvergn Failed Failure Fall False Far Fast FastPathProducer Fault Fd FeatureDescriptor FeatureDescriptors Feb February Fell Fetch Fetches Fetchs Fett Few Fewer Fialli Field FieldDelegate FieldInfo FieldPosition FieldPositions FieldReflector FieldReflectorKey Fields Figure File FileChannel FileChannelImpl FileDescriptor FileDesecriptor FileDialog FileDialogPeer FileFilter FileInputStream FileNameFilter FileNameMap FileNotFoundException FileOutputStream FilePermission FilePermissionCollection FilePermissions FileReader FileReaders FileSystem FileWriter FileWriters Filename FilenameFilter Filesystem Fill FillAdapter Filler Filling Fills Filter FilterInputStream FilterOutputStream FilterReader FilterWriter FilteredImageSource Filtering Finalizer Finally Find Finds Finish Finishes Fire Fires First Fish Fist Fix Fixed Fixes Fixup Flag Flags FlashPix FlatteningPathIterator FlipBufferStrategy FlipContents Flipping Flips Float FloatBuffer FloatEditor FloatValue FloatingDecimal FloatingPointLiteral FloorWax Flow FlowLayout Flush Flushes Focus FocusEvent FocusEvents FocusListener FocusManager FocusTraversalPolicy Focuses Folio Following Font FontFormatException FontLineMetrics FontMetrics FontNameAliases FontPeer FontRenderContext FontSupport FontUIResource Foo FooBah FooBeanInfo FooServerSocket FooSocket Foote For Forbidden Force Forces Forcibly Form Format FormatElement FormatStyle FormatType Formats Formatted Formatter Formatters Forms Formulate Fortunately Forward Forwards Found Four Fowler FozEditor Fpx FpxClsidOffset Fraction Fragment Frame FramePeer Frames France Frank Fred FredEditor FredEvent FredListener Freely French Freytag Fri Friday Fries From Fs Full Fulltype Fullwidth Function Functions Fundamentally Funnel Further Furthermore Future G GAGAB GB GBGBR GBP GC GCD GDGRD GEGEO GEN GENERAL_FAILURE GENERAL_PUNCTUATION GENERATED GENERATION GEOMETRIC_SHAPES GEORGIAN GERMAN GERMANY GET GFGUF GGG GHGHA GIF GIFs GIGIB GLGRL GLOBAL GMGMB GMT GMT_ID GMT_ID_LENGTH GMT_MINUS GMT_PLUS GNGIN GOT_FOCUS GPGLP GPS GQGNQ GRANTEE GRANTOR GRAY GRD GREATER GREEK GREEK_EXTENDED GREEN GRGRC GROUP GROUPING_SEPARATOR GSSAPI GSSGS GTGTM GUGUM GUI GUIs GUJARATI GURMUKHI GV GWGNB GYGUY Gary Gateway GatheringByteChannel Gaussian General GeneralPath GeneralSecurityException Generally Generate GenerateCharacter GenerateCurrencyData Generates Generating Generator Generic GenericBeanInfo Geometric Georgian German Get GetBooleanAction GetField GetFieldImpl GetHeaderField GetLayoutInfo GetMinSize GetPropertyAction GetReflectionFactoryAction GetUnsafeAction Gets Getter Getters Gigantic Gillam Give Given Gives GlobalCursorManager GlobalCursormanager Glyph GlyphVector Go Goldsmith Gone Gong Gosling Gotcha GradientPaint GradientPaintContext Graham Gralund Granting Graphic Graphical Graphics Graphics2D GraphicsCallback GraphicsConfigTemplate GraphicsConfiguration GraphicsDevice GraphicsEnvironment Graphs Great Greater Greatest Greek Green Greenwich Gregorian GregorianCalendar GridBag GridBagConstraint GridBagConstraints GridBagEx1 GridBagLayout GridBagLayoutInfo GridLayout Group Grouping Grow Guaranteed Guard GuardedObject Gui Guide Gujarati Gurmukhi Guy GyMdkHmsSEDFwWahKz H HACK HALFWIDTH_AND_FULLWIDTH_FORMS HAND_CURSOR HANGING_BASELINE HANGUL_BASE HANGUL_CHOSEONG_HIGH HANGUL_CHOSEONG_LOW HANGUL_COMPATIBILITY_JAMO HANGUL_JAMO HANGUL_JONGSEONG_HIGH HANGUL_JONGSEONG_LOW HANGUL_JUNGSEONG_HIGH HANGUL_JUNGSEONG_LOW HANGUL_LIMIT HANGUL_SYLLABLES HANGUL_SYL_HIGH HANGUL_SYL_LOW HEAD HEADER_BLOCKED HEAVYWEIGHTS HEBREW HERE HH HIERARCHY_BOUNDS_EVENT_MASK HIERARCHY_CHANGED HIERARCHY_EVENT_MASK HIGH HIGH_PRIORITY HIRAGANA HIRAGANA_ITERATION_MARK HIRAGANA_LETTER_A HIRAGANA_LETTER_DI HIRAGANA_LETTER_E HIRAGANA_LETTER_I HIRAGANA_LETTER_MO HIRAGANA_LETTER_O HIRAGANA_LETTER_RO HIRAGANA_LETTER_SMALL_A HIRAGANA_LETTER_SMALL_E HIRAGANA_LETTER_SMALL_I HIRAGANA_LETTER_SMALL_O HIRAGANA_LETTER_SMALL_TU HIRAGANA_LETTER_SMALL_U HIRAGANA_LETTER_SMALL_WA HIRAGANA_LETTER_SMALL_YA HIRAGANA_LETTER_SMALL_YO HIRAGANA_LETTER_SMALL_YU HIRAGANA_LETTER_TU HIRAGANA_LETTER_U HIRAGANA_LETTER_VU HIRAGANA_LETTER_WA HIRAGANA_LETTER_YA HIRAGANA_LETTER_YO HIRAGANA_LETTER_YU HIRAGANA_SEMIVOICED_SOUND_MARK HIRAGANA_VOICED_ITERATION_MARK HKHKG HMHMD HNHND HOLD_CURSORS_OVER_COMMIT HOME HOOKS HORIZONTAL HORIZ_BIT HOST_UNREACHABLE HOUR HOUR0 HOUR0_FIELD HOUR1 HOUR1_FIELD HOUR_OF_DAY HOUR_OF_DAY0 HOUR_OF_DAY0_FIELD HOUR_OF_DAY1 HOUR_OF_DAY1_FIELD HREF HRHRV HSB HSBtoRGB HSPACE HShih HTHTI HTML HTTP HTTP_ACCEPTED HTTP_BAD_GATEWAY HTTP_BAD_METHOD HTTP_BAD_REQUEST HTTP_CLIENT_TIMEOUT HTTP_CONFLICT HTTP_CREATED HTTP_ENTITY_TOO_LARGE HTTP_FORBIDDEN HTTP_GATEWAY_TIMEOUT HTTP_GONE HTTP_INTERNAL_ERROR HTTP_LENGTH_REQUIRED HTTP_MOVED_PERM HTTP_MOVED_TEMP HTTP_MULT_CHOICE HTTP_NOT_ACCEPTABLE HTTP_NOT_AUTHORITATIVE HTTP_NOT_FOUND HTTP_NOT_IMPLEMENTED HTTP_NOT_MODIFIED HTTP_NO_CONTENT HTTP_OK HTTP_PARTIAL HTTP_PAYMENT_REQUIRED HTTP_PRECON_FAILED HTTP_PROXY_AUTH HTTP_REQ_TOO_LONG HTTP_RESET HTTP_SEE_OTHER HTTP_SERVER_ERROR HTTP_UNAUTHORIZED HTTP_UNAVAILABLE HTTP_UNSUPPORTED_TYPE HTTP_USE_PROXY HTTP_VERSION HUHUN HUMBUG HUNDRED HUP HW HYPHEN H_ALPHA H_ALPHANUM H_DASH H_DIGIT H_DOT H_ESCAPED H_HEX H_LOWALPHA H_MARK H_PATH H_PCHAR H_REG_NAME H_RESERVED H_SCHEME H_SERVER H_UNRESERVED H_UPALPHA H_URIC H_URIC_NO_SLASH H_USERINFO Half Halfwidth Hall Halt Halting Han Hand HandCursor Handle HandleList HandleTable Handler HandlerBase Handles Handling Hangul Hanpeter Hans Harbison Harder Harry Has HasNext Hash HashIterator HashMap HashSet HashSortedMap HashSortedSet Hashcode Hashtable Hastable Have Having Hazelnut HeadlessException HeadlessGraphicsEnvironment HeadlessToolkit Heap HeapByteBuffer HeapByteBufferR HeapCharBuffer HeapCharBufferR HeapDoubleBuffer HeapDoubleBufferR HeapFloatBuffer HeapFloatBufferR HeapIntBuffer HeapIntBufferR HeapLongBuffer HeapLongBufferR HeapShortBuffer HeapShortBufferR Heavyweight HeavyweightFocusRequest Hebrew Height Held Helena Hellman Hello Helper Helvetica Hence Herb Here HexDigits Hi Hide Hides Hierarchical Hierarchy HierarchyBoundsListener HierarchyEvent HierarchyEvents HierarchyListener High HighLevelException Higher Hindi Hinrichs Hint Hiragana Historically HistoricallyNamedCharset Hoff Holds Home Honolulu Hook Hope Hopefully Horizontal HorizontalLines Host HotSpot Hours How However HttpURLConnection Huang Hybrid HyperText I I18N IANA IBM IBME ICMP ICONIFIED ICON_COLOR_16x16 ICON_COLOR_32x32 ICON_MONO_16x16 ICON_MONO_32x32 ID IDENTICAL IDENT_TX_ATTRIBUTE IDEOGRAPHIC_DESCRIPTION_CHARACTERS IDEOGRAPHIC_ITERATION_MARK IDIDN IDs IEC IEEE IEEEremainder IEIRL IEP IETF IGNORABLEMASK IGNORABLES IGNORE IGNORE_ALL_BEANINFO IGNORE_HANGUL IGNORE_IMMEDIATE_BEANINFO IIOP ILISR ILS IMAGE_INCOMPATIBLE IMAGE_RESTORED IMF IMG IMPLEMENTATION IMPLEMENTATION_TITLE IMPLEMENTATION_VENDOR IMPLEMENTATION_VERSION IMPORTANT IN INACTIVE_CAPTION INACTIVE_CAPTION_BORDER INACTIVE_CAPTION_TEXT INADDRSZ INADDR_ANY INCLUDE_SELF INDEXOFSUBLIST_THRESHOLD INDEX_MASK INDEX_NAME INDEX_QUALIFIER INDICATE INF INFINITY INFO INFO_TEXT ININD INITIAL INITIALTABLESIZE INITIAL_CACHE_SIZE INITIAL_FORMATS INITIAL_QUOTE_PUNCTUATION INITIAL_STATE INOUT INPUT_METHODS_ENABLED_MASK INPUT_METHOD_EVENT_MASK INPUT_METHOD_FIRST INPUT_METHOD_LAST INPUT_METHOD_SEGMENT INPUT_METHOD_TEXT_CHANGED INSERT INSTALLED INSTANCE INT INT16SZ INTEGER INTEGERSTYLE INTEGER_FIELD INTERFACE INTERNAL INTERNALLY_SET INTERPOLATION_BICUBIC INTERPOLATION_BILINEAR INTERPOLATION_NEAREST_NEIGHBOR INVALIDATED INVALID_COUNTRY_ENTRY INVALID_FIELD_OFFSET INVARIANT INVITE INVITE_ENVELOPE INVOCATION_EVENT_MASK INVOCATION_FIRST INVOCATION_LAST INVOICE INVOKE IN_PROGRESS IO IOException IOExceptions IOIOT IP IPA IPA_EXTENSIONS IPP IPTOS_LOWCOST IPTOS_LOWDELAY IPTOS_RELIABILITY IPTOS_THROUGHPUT IPV4 IPV6 IP_MULTICAST_IF IP_MULTICAST_IF2 IP_MULTICAST_LOOP IP_TOS IPaddress IPs IPv4 IPv4address IPv6 IPv6address IQIRQ IRIRN ISISL ISO ISO646 ISO_2A0 ISO_3166 ISO_4A0 ISO_A0 ISO_A1 ISO_A10 ISO_A2 ISO_A3 ISO_A4 ISO_A5 ISO_A6 ISO_A7 ISO_A8 ISO_A9 ISO_B0 ISO_B1 ISO_B10 ISO_B2 ISO_B3 ISO_B4 ISO_B4_ENVELOPE ISO_B5 ISO_B5_ENVELOPE ISO_B6 ISO_B7 ISO_B8 ISO_B9 ISO_C0 ISO_C0_ENVELOPE ISO_C1 ISO_C10 ISO_C10_ENVELOPE ISO_C1_ENVELOPE ISO_C2 ISO_C2_ENVELOPE ISO_C3 ISO_C3_ENVELOPE ISO_C4 ISO_C4_ENVELOPE ISO_C5 ISO_C5_ENVELOPE ISO_C6 ISO_C6_ENVELOPE ISO_C7 ISO_C7_ENVELOPE ISO_C8 ISO_C8_ENVELOPE ISO_C9 ISO_C9_ENVELOPE ISO_DESIGNATED_LONG ISO_DESIGNATED_LONG_ENVELOPE IS_GRANTABLE IS_NULLABLE IT ITALIAN ITALIC ITALY ITALY_ENVELOPE ITEM_EVENT_MASK ITEM_FIRST ITEM_LAST ITEM_STATE_CHANGED ITITA ITL I_A I_ALL I_B I_BACKGROUND I_C I_COLOR I_COMMON I_COPIED I_D I_DRAFT I_E I_EXECUTIVE I_FILE I_FOLIO I_HIGH I_INVITE_ENVELOPE I_INVOICE I_ISO_2A0 I_ISO_4A0 I_ISO_A0 I_ISO_A1 I_ISO_A10 I_ISO_A2 I_ISO_A3 I_ISO_A4 I_ISO_A5 I_ISO_A6 I_ISO_A7 I_ISO_A8 I_ISO_A9 I_ISO_B0 I_ISO_B1 I_ISO_B10 I_ISO_B2 I_ISO_B3 I_ISO_B4 I_ISO_B5 I_ISO_B6 I_ISO_B7 I_ISO_B8 I_ISO_B9 I_ISO_C0 I_ISO_C1 I_ISO_C10 I_ISO_C2 I_ISO_C3 I_ISO_C4 I_ISO_C5 I_ISO_C6 I_ISO_C7 I_ISO_C8 I_ISO_C9 I_ISO_DESIGNATED_LONG I_ITALY_ENVELOPE I_JIS_B0 I_JIS_B1 I_JIS_B10 I_JIS_B2 I_JIS_B3 I_JIS_B4 I_JIS_B5 I_JIS_B6 I_JIS_B7 I_JIS_B8 I_JIS_B9 I_LANDSCAPE I_LEDGER I_MONARCH_ENVELOPE I_MONOCHROME I_NATIVE I_NA_10X13_ENVELOPE I_NA_10X14_ENVELOPE I_NA_10X15_ENVELOPE I_NA_6X9_ENVELOPE I_NA_7X9_ENVELOPE I_NA_9X11_ENVELOPE I_NA_9X12_ENVELOPE I_NA_LEGAL I_NA_LETTER I_NA_NUMBER_10_ENVELOPE I_NA_NUMBER_11_ENVELOPE I_NA_NUMBER_12_ENVELOPE I_NA_NUMBER_14_ENVELOPE I_NA_NUMBER_9_ENVELOPE I_NONE I_NORMAL I_ONE_SIDED I_PERSONAL_ENVELOPE I_PHYSICAL I_PORTRAIT I_PRINTABLE I_PRINTER I_PRIOR I_QUARTO I_RANGE I_SELECTION I_SEPARATE_DOCUMENTS_COLLATED_COPIES I_SEPARATE_DOCUMENTS_UNCOLLATED_COPIES I_TWO_SIDED_LONG_EDGE I_TWO_SIDED_SHORT_EDGE I_UNDEFINED Icon Id Ideally Identical Identically Identifier Identifiers Identifies Identify Identities Identity IdentityHashMap IdentityHashMapEntry IdentityHashMapIterator IdentityHashtable IdentityScope Ideographic Ideographs If Ignorable Ignore Ignored Ignores Illegal IllegalAccessError IllegalAccessException IllegalArgumentException IllegalBlockingModeException IllegalCharsetNameException IllegalComponentStateException IllegalMonitorStateException IllegalStateException IllegalThreadStateException Image ImageBlaster ImageCapabilities ImageFilter ImageIcon ImageMediaEntry ImageObserver ImageProducer Images Immutable ImmutableEntry Impl Implement Implementation Implementations Implemented ImplementedIn Implementing Implementors Implements Important Imports In InaccessibleBufferIndexException Inc Includes IncompatibleClassChangeError Incomplete Inconsistent Incorrect Increase Increases Increasing Increment Increments Independent Index IndexColorModel IndexOutOfBoundsException IndexedPropertyDescriptor Indexes Indic Indicate Indicates Individual Inet4Address Inet4AddressImpl Inet6Address Inet6AddressImpl InetAddress InetAddressCachePolicy InetAddressContainer InetAddressImpl InetAddressImplFactory InetAddresses InetAdress InetSocketAddress Inetaddress Inf Infinite Infinity Informally Information Informational Informative Inheritable InheritableThreadLocal Initial Initialization Initialize Initialized Initializes Initializing Initially Initiate Initiation Inner Input InputContext InputEvent InputListener InputMethodEvent InputMethodEvents InputMethodHighlight InputMethodListener InputMethodRequests InputMethodSupport InputStream InputStreamReader InputStreamReaders Inputstream Insert Insertion Inserts Insets Inside Installs Instance InstanceWrapper Instances Instantiate Instantiates Instantiating InstantiationError InstantiationException Instead Insufficient Int IntBuffer IntEditor IntHashtable Integer IntegerComponentRaster IntegerInterleavedRaster IntegerOnly Integers Integrity Intel Intended Intenet Interact Interestingly Interface Interfaces Internal InternalError Internally International Internet Interpolation Interpretation InterruptedException InterruptedIOException Interruptible Interrupts Intersects Introduction Intropector Introspect Introspected Introspection IntrospectionException Introspector Invalid InvalidAlgorithmParameterException InvalidClassException InvalidDnDOperationException InvalidDndOperationException InvalidKeyException InvalidKeySpecException InvalidMarkException InvalidObjectException InvalidParameterException InvalidParameterSpecException Invalidate Invalidates Invariant Invariants Inverse Invitation Invocation InvocationEvent InvocationHandler InvocationTargetException Invocations Invoice Invoke Invoked Invoker Invokes Invoking Is Isn Issues It Italic Italy Item ItemEvent ItemListener ItemListeners ItemSelectable Items Iterate Iterating Iteration Iterations Iterator Iterators Itr Its Itype ItypesPerOtype J J2SE JAMO_LBASE JAMO_LCOUNT JAMO_NCOUNT JAMO_TBASE JAMO_TCOUNT JAMO_VBASE JAMO_VCOUNT JANUARY JAN_1_1_JULIAN_DAY JAPAN JAPANESE JAR JAVA_HOME JAVA_OBJECT JButton JCA JCE JCheckBox JComboBox JComponent JComponents JDBC JDK JDK1 JDKClassLoader JDialog JFrame JIS JIS_B0 JIS_B1 JIS_B10 JIS_B2 JIS_B3 JIS_B4 JIS_B5 JIS_B6 JIS_B7 JIS_B8 JIS_B9 JIT JITing JITs JKS JLS JLabel JLayeredPane JList JMJAM JMenu JMenuBar JMenuItem JMenuItems JNI JNI_Load JNI_OnLoad JNI_Unload JO JOIN_BEVEL JOIN_MITER JOIN_ROUND JOJOR JP JPEG JPJPN JRE JRootPane JSR JSSE JScrollPane JSplitPane JTabbedPane JTable JTableHeader JTextComponent JTextField JULY JUNE JVM JVMs JViewport Jacobi James Jamo Jan January Japan Japanese Jar JarEntry JarException JarFile JarInputStream JarURLConnection Jaunary Java JavaBean JavaBeans JavaSoft Jean Jellinek Jim JobAttribute JobAttributes Joe John Join Joins Jon JonL Jonathan Jones Jonni Josh Joy Jsafe Jul Julian July Jun June Junk Jupiter Jurg Just K KANBUN KANGXI_RADICALS KANNADA KATAKANA KATAKANA_HIRAGANA_PROLONGED_SOUND_MARK KATAKANA_ITERATION_MARK KATAKANA_LETTER_A KATAKANA_LETTER_DI KATAKANA_LETTER_E KATAKANA_LETTER_I KATAKANA_LETTER_MO KATAKANA_LETTER_O KATAKANA_LETTER_RO KATAKANA_LETTER_SMALL_A KATAKANA_LETTER_SMALL_E KATAKANA_LETTER_SMALL_I KATAKANA_LETTER_SMALL_KA KATAKANA_LETTER_SMALL_KE KATAKANA_LETTER_SMALL_O KATAKANA_LETTER_SMALL_TU KATAKANA_LETTER_SMALL_U KATAKANA_LETTER_SMALL_WA KATAKANA_LETTER_SMALL_YA KATAKANA_LETTER_SMALL_YO KATAKANA_LETTER_SMALL_YU KATAKANA_LETTER_TU KATAKANA_LETTER_U KATAKANA_LETTER_VA KATAKANA_LETTER_VO KATAKANA_LETTER_VU KATAKANA_LETTER_WA KATAKANA_LETTER_YA KATAKANA_LETTER_YO KATAKANA_LETTER_YU KATAKANA_VOICED_ITERATION_MARK KEEP_CURRENT_RESULT KEKEN KEYS KEYSTORE_TYPE KEY_ACTION KEY_ACTION_RELEASE KEY_ALPHA_INTERPOLATION KEY_ANTIALIASING KEY_COLOR_RENDERING KEY_DITHERING KEY_EVENT KEY_EVENT_MASK KEY_FIRST KEY_FRACTIONALMETRICS KEY_INTERPOLATION KEY_LAST KEY_PRESS KEY_PRESSED KEY_RELEASE KEY_RELEASED KEY_RENDERING KEY_SEQ KEY_STROKE_CONTROL KEY_TEXT_ANTIALIASING KEY_TYPED KGKGZ KHKHM KHMER KIKIR KMCOM KNKNA KOREA KOREAN KPPRK KR KRKOR KWKWT KYCYM KZKAZ Kana Kanbun Kanerva Kangxi Kanji Kannada Katakana Keep Kejriwal Ken Kestrel Key KeyAdapter KeyAuthorizationFailureException KeyEvent KeyEventDispatcher KeyEventDispatchers KeyEventPostProcessor KeyEventPostProcessors KeyEvents KeyException KeyFactory KeyFactorySpi KeyIDConflictException KeyIterator KeyListener KeyManagementException KeyPair KeyPairGenerator KeyPairGeneratorSpi KeyPressed KeyReleased KeySet KeySize KeySpec KeyStore KeyStoreException KeyStoreSpi KeyStroke KeyTyped KeyUsage Keyboard KeyboardFocusManager KeyboardFocusManagers Keyed Keymap Keys Khan Khmer Kills Klaus Knippel Knowledgeable Known Knuth Kona Korean L LABEL LALAO LANDSCAPE LANGUAGE LAO LAST_LINE_END LAST_LINE_START LATIN LATIN1_DEGREE_SIGN LATIN1_SOFTHYPHEN LATIN_1_SUPPLEMENT LATIN_EXTENDED_A LATIN_EXTENDED_ADDITIONAL LATIN_EXTENDED_B LAYOUT_LEFT_TO_RIGHT LAYOUT_NO_LIMIT_CONTEXT LAYOUT_NO_START_CONTEXT LAYOUT_RIGHT_TO_LEFT LBLBN LC LCID LCLCA LD LEADING LEAP_MONTH_LENGTH LEAP_NUM_DAYS LEAST_MAX_VALUES LEDGER LEFT LEFT_ALIGNMENT LEFT_TO_RIGHT LEGAL LEGAL_BUTTON_MASK LENGTH LESS LETTER LETTERLIKE_SYMBOLS LETTER_NUMBER LF LFs LG_BYTES_PER_VALUE LI LIFO LIGHTWEIGHTS LIGHT_GRAY LIKE LILIE LINE LINENO LINES LINE_END LINE_INDEX LINE_SEPARATOR LINE_START LIST LISTEN LIST_DESELECT LIST_EVENT LIST_ITEM LIST_SELECT LITERAL_PREFIX LITERAL_SUFFIX LITTLE_ENDIAN LIU LJ LKLKA LOAD LOADING LOADSTARTED LOAD_FILE LOCAL LOCALIZE LOCALIZED LOCAL_TYPE_NAME LOCATOR LOCK LOG10 LONG LONGEST LONGVARBINARY LONGVARCHAR LONG_BITS LONG_MASK LONG_MIN LONG_MIN_REP LOOKAHEAD_STATE_FLAG LOST_FOCUS LOW LOWERCASE_LETTER LOW_PRIORITY LRE LRLBR LRO LRU LSD LSLSO LT LTLTU LTR LTR_BIT LUF LULUX LVLVA LWD_MOUSE_DRAGGED_OVER LWS LYLBY L_ALPHA L_ALPHANUM L_DASH L_DIGIT L_DOT L_ESCAPED L_HEX L_LOWALPHA L_MARK L_PATH L_PCHAR L_REG_NAME L_RESERVED L_SCHEME L_SERVER L_UNRESERVED L_UPALPHA L_URIC L_URIC_NO_SLASH L_USERINFO Label LabelPeer Labels Lacking Langley Language Languages Lao Large Larger Last Later Latin Latin1 Launcher Laura Laurence Lay Layout LayoutManager LayoutManager2 LayoutManagers Lays Le Lea Leading Leap Least Leave Ledger Lee Left Legacy Legal Lehmer Leiserson Len LenSquared Length Less Let Lets Letter Letterlike Letters Level Li LibFile Library License Lieh Lightweight LightweightDispatcher LightweightFocusRequest LightweightPeer Like Likewise Limit Line LineBorder LineBorderUIResource LineBreak LineBreakData LineBreakDictionary LineBreakRules LineExceptionFlags LineMetrics LineNumberInputStream LineNumberReader LineNumberTable Linear Lines Linger Link LinkageError Linked LinkedHashIterator LinkedHashMap LinkedHashSet LinkedList Links List ListIterator ListItr ListPeer ListResourceBundle Listen Listener Listeners Listens Lists Literal Liu Lj Ljava Ll Lm Lo Load LoadLibraryAction Loader Loads Locale LocaleData LocaleElements LocaleElements_ LocaleElements_fr_BE LocaleID LocaleNamePatterns LocaleString Locales Localization Localized Locate LocateRegistry Locates Location Locator Lock Locking Long LongBuffer LongEditor Look Looking Looks Lookup Loop Looping Loops Loosely Los_Angeles LowLevelException Lower Lt Ltd Lu Lucas Luehe M M2 M5 MAC MAD MAGENTA MAKE MALAYALAM MAMAR MAP_COW MAP_RO MAP_RW MARCH MARK MARK_MASK MATERIAL MATHEMATICAL_OPERATORS MATH_SYMBOL MAX MAXGRIDSIZE MAXIMIZED_BOTH MAXIMIZED_HORIZ MAXIMIZED_VERT MAXIMUM_CAPACITY MAXIMUM_SCALE MAXKEYSIZE MAX_BLOCK_SIZE MAX_BUNDLES_SEARCHED MAX_CONSTANT MAX_COUNT MAX_DELAY MAX_HEADER_SIZE MAX_PRIORITY MAX_RADIX MAX_RULE MAX_TARDINESS MAX_VALUE MAX_VALUES MAY MBZ MCMCO MD2 MD2withRSA MD5 MD5withRSA MDMDA MDT ME MEDIUM MENU MENU_BAR MENU_ITEM MENU_TEXT MESSAGE_ARGUMENT META_DOWN_MASK META_MASK METHOD MGMDG MHMHL MILLISECOND MILLISECOND_FIELD MIME MINIMUM_CAPACITY MINIMUM_SCALE MINIMUM_USER_SET MINIMUM_USER_STAMP MINSIZE MINUS MINUTE MINUTE_FIELD MIN_PRIORITY MIN_RADIX MIN_RULE MIN_VALUE MIN_VALUES MISCELLANEOUS_SYMBOLS MISCELLANEOUS_TECHNICAL MISC_EVENT MITER MKMKD MLMLI MM MMM MMMM MMMMM MMMMMx10 MMMMR MNMNG MODAL MODE MODIFIER MODIFIER_LETTER MODIFIER_SYMBOL MOMAC MONARCH MONARCH_ENVELOPE MONDAY MONGOLIAN MONOCHROME MONTH MONTH_FIELD MONTH_LENGTH MORE MOUSE_CLICKED MOUSE_DOWN MOUSE_DRAG MOUSE_DRAGGED MOUSE_ENTER MOUSE_ENTERED MOUSE_EVENT MOUSE_EVENT_MASK MOUSE_EXIT MOUSE_EXITED MOUSE_FIRST MOUSE_LAST MOUSE_MASK MOUSE_MOTION_EVENT_MASK MOUSE_MOVE MOUSE_MOVED MOUSE_PRESSED MOUSE_RELEASED MOUSE_UP MOUSE_WHEEL MOUSE_WHEEL_EVENT_MASK MOVE MOVE_CURSOR MPMNP MQMTQ MRMRT MSB MSD MSMSR MST MTMLT MToolkit MULTISELECTABLE MULTI_LINE MUMUS MUST MVMDV MWMWI MXMEX MXV MYANMAR MYMYS MZMOZ Ma Mac Machine Machines Macintosh Magic Magnitude Main MainName Maintained Make Makes Making Malayalam Malformed MalformedInputException MalformedURLException Malicious Management Manifest Manipulate Mantissa Many Map Mapped MappedByteBuffer Mapping Mappings Maps Mar March Marianne Mario Mark Marked Marker Marking Marks Mars Marsaglia MarshalException MarshalInputStream MarshalOutputStream MarshalledObject MarshalledObjectInputStream MarshalledObjectOutputStream Martak Mask Massachusetts Master Matched Matcher Matches Materials Math Mathematical MatteBorder MatteBorderUIResource Max Maximized Maximum May Mc McCloskey McIlroy Me Mean Meaning Measuring Media MediaEntry MediaTracker MediaType Meine Member MemberSignature Memory Mendenhall Menu MenuBar MenuBarPeer MenuComponent MenuComponentPeer MenuComponents MenuContainer MenuItem MenuItemPeer MenuPeer MenuShortcut MenuShortcuts Menubar Menus Mercury Merge MergeCollation Message MessageDigest MessageDigestSpi MessageFormat MessageFormatPattern Meta MetaData Method MethodDescriptor MethodDescriptors MethodInfo Methods Metrics Michael Microsoft Microsystems Mid MidLevelException Middle Midnight Might Mike Miller Millis Milne MimeTable Min MinimalDaysInFirstWeek Minimum Minus Mirrored Misc Miscellaneous Misplaced MissingResourceException Mixing Mn Mode Models Modes Modification Modifications Modified Modifier Modifiers Modifies Modify Modular Module Modulus Mon Monarch Monday Monetary Mongolian Monitor MonochromeExample Monospaced Montgomery Month MonthAbbreviations MonthNames Months More Moreover Most Mostly Motif Motion Mouse MouseAdapter MouseEvent MouseEventTargetFilter MouseEvents MouseListener MouseMotionEvent MouseMotionListener MouseWheel MouseWheelEvent MouseWheelEvents MouseWheelListener Move MoveCursor Moved Moves Moving Mr Mueller MulitcastSocket Muller Multi MultiScreen Multicast MulticastSocket MulticastSockets Multiple MultipleDocumentHandlingType Multiplication Multiplies Multiply Must MutableBigInteger MutableBigIntegers MutableBoolean MutableExpression Mval My MyActionListener MyApp MyClass MyDisk MyResources MyResources_de MyResources_de_CH MyResources_en MyResources_es_ES MyResources_fr MyResources_fr_CH Myanmar N NAME NAMES NAN NANAM NATIVE NA_10X13_ENVELOPE NA_10X14_ENVELOPE NA_10X15_ENVELOPE NA_6X9_ENVELOPE NA_7X9_ENVELOPE NA_9X11_ENVELOPE NA_9X12_ENVELOPE NA_LEGAL NA_LETTER NA_NUMBER_10_ENVELOPE NA_NUMBER_11_ENVELOPE NA_NUMBER_12_ENVELOPE NA_NUMBER_14_ENVELOPE NA_NUMBER_9_ENVELOPE NCNCL NEED_CHAR NEGATIVE NEGATIVE_INFINITY NEG_ZERO_BITS NENER NEResizeCursor NET_UNREACHABLE NEVER NEW NEXT NE_RESIZE_CURSOR NFNFK NFS NGNGA NINETY NINIC NIO NIST NLG NLNLD NO NOK NON NONBREAKING_HYPHEN NONE NONOR NON_SPACING_MARK NON_UNIQUE NOOP NOP NORMAL NORM_PRIORITY NORTH NORTHEAST NORTHWEST NOT NOTE NOTES NOTFOUND NOTHING NOT_ALLOWED NOV NOVEMBER NO_AUTH NO_DECOMPOSITION NO_FIELDS NO_GENERATED_KEYS NO_HANDLER NO_METHODS NO_ORIENTATION NPE NPNPL NRNRU NResizeCursor NSM NT NULL NULLABLE NULLORDER NULL_HANDLE NUMBER NUMBERSTYLE NUMBER_FORMS NUMERAL NUMERATOR NUMERIC NUMERICS NUMERIC_SHAPING NUMLEVELS NUM_COLORS NUM_DAYS NUM_LOCK NUM_PREC_RADIX NUM_PRIORITIES NUNIU NWResizeCursor NW_RESIZE_CURSOR NYI NZD NZNZL N_RESIZE_CURSOR NaN Nagle Naively Nakul Name NameGenerator NameService NameServiceDescriptor Names Naming Nan Native NativeFontWrapper NativeInLightFixer NativeLibrary Naval Nd Nearly Need Needn Needs Negative NegativeArraySizeException Neither Neptune Nested Net NetPerm NetPermission Netscape Network NetworkClassLoader NetworkInterface NetworkInterfaces Neutral Never Nevertheless New NewDirectByteBuffer Newly Newton Next Nievergelt Nl No NoClassDefFoundError NoRouteToHostException NoSuchAlgorithmException NoSuchElementException NoSuchFieldError NoSuchFieldException NoSuchMethodError NoSuchMethodException NoSuchObjectException NoSuchProviderException Nobody Node Non NonReadableChannelException NonSerializable NonWritableChannelException None Nonetheless NoninvertibleTransformException Nope Normal Normalization Normalize Normalizer NormalizerUtilities Normalizes Normally Normative North Northeast Northwest Norwegian Not NotActiveException NotBoundException NotSerializableException NotYetConnectedException Notation Note Noted Notes Nothing Notice Notifications Notified Notifies Notify Nov November Now Null NullComponentPeer NullPersistenceDelegate NullPointerException NullReferenceException Nullary Nullify Num Number NumberElements NumberFormat NumberFormatException NumberFormats NumberPattern NumberPatterns Numbers NumericShaper O OCO OCTOBER ODBC OE OF OFF OGHAM OID OK OL OLD OMOMN ON ONE ONEDAY ONE_DAY ONE_HOUR ONE_MINUTE ONE_SECOND ONE_SIDED ONE_WEEK ONLY ONSET OOBINLINE OOS OPAQUE OPEN OPENED OPERATION OPTICAL_CHARACTER_RECOGNITION OPTIONAL OPTIONS OP_ACCEPT OP_CONNECT OP_READ OP_WRITE OR ORANGE ORDER ORDINAL_POSITION ORIYA ORed OS OTHER OTHER_LETTER OTHER_NUMBER OTHER_PUNCTUATION OTHER_SYMBOL OUT OUT_BOTTOM OUT_LEFT OUT_RIGHT OUT_TOP ObejctStreamClass Obeys Object ObjectHandler ObjectInput ObjectInputStream ObjectInputStreamWithLoader ObjectInputStreams ObjectInputValidation ObjectInputstream ObjectOutput ObjectOutputStream ObjectStream ObjectStreamClass ObjectStreamConstants ObjectStreamException ObjectStreamExceptions ObjectStreamField ObjectStreamFields Objects Observable Observatory Observer Observerable Observers Obsolete Obtains Obvious Occasionally Occurs Oct Octal OctalDigits October Odd Of Offset Often Ogham Ok OkKey Okay Old On Once One Only Oops Opaque Open Opening Opens Operating Operation Operations Operators Ops Optical Optimization Optional OptionalDataException Optionally Or Oracle Order Ordering Ordinarily Orientation OrientationRequestedType Origin OriginType Originally Oriya Other OtherCoder Others Otherwise Otype Our OurButton OurButtonBeanInfo OurButtonCustomizer Out OutOfMemoryError Output OutputSteam OutputStream OutputStreamWriter OutputStreamWriters OutputStreams Over Overall Overflow OverlayLayout Overridden Override Overrides Overriding Overwrites Owing P P1 P2 P316 PAGES PAGE_END PAGE_START PAINT PAINT_EVENT_MASK PAINT_FIRST PAINT_LAST PANEL PAPAN PARAGRAPH_SEPARATOR PARAMS0 PARAMS1 PARAMS2 PARENTHESIS PARENT_CHANGED PATTERN_DECIMAL_SEPARATOR PATTERN_DIGIT PATTERN_EXPONENT PATTERN_GROUPING_SEPARATOR PATTERN_INDEX_TO_CALENDAR_FIELD PATTERN_INDEX_TO_DATE_FORMAT_FIELD PATTERN_INDEX_TO_DATE_FORMAT_FIELD_ID PATTERN_MINUS PATTERN_PERCENT PATTERN_PER_MILLE PATTERN_SEPARATOR PATTERN_ZERO_DIGIT PAUSE PB PD PDF PDT PDs PENDING PEPER PERCENT PERCENTSTYLE PERMILLE PERSONAL PERSONAL_ENVELOPE PER_MILLE_SIGN PER_TEN_THOUSAND_SIGN PFPYF PGDN PGP PGPNG PGUP PHPHL PHYSICAL PI PINK PIPE_SIZE PKCOLUMN_NAME PKCS PKPAK PKTABLE_CAT PKTABLE_NAME PKTABLE_SCHEM PK_NAME PLAIN PLDI PLPOL PM PMSPM PNG PNPCN POPUP_MENU PORTRAIT PORT_MAX PORT_MIN POSITIVEINFINITY POSITIVE_INFINITY POSIX POSSIBLY POST POSTURE POSTURE_OBLIQUE POSTURE_REGULAR PRC PRE PRECISION PREFERRED PREFERREDSIZE PRESENT PRIMALITY PRIMARY PRIMARYDIFFERENCEONLY PRIMARYORDERINCREMENT PRIMARYORDERMASK PRIMARYORDERSHIFT PRIME PRINTABLE PRINTER PRINT_SCREEN PRIOR PRIORITY_EVENT PRIVATE PRIVATES PRIVATE_USE PRIVATE_USE_AREA PRIVILEGE PRIV_PORT_MAX PRNG PROCEDURE_CAT PROCEDURE_NAME PROCEDURE_SCHEM PROCEDURE_TYPE PROPERTYNAME PROTECTED PROTOCOL_VERSION_1 PROTOCOL_VERSION_2 PROTO_VERS PROTO_VERS4 PROXY_EVENT_MASK PRPRI PSEUDO_COLUMN PST PTE PTPRT PUBLIC PUNCTUATION_HYPHENATION_POINT PUNCTUATION_IDEOGRAPHIC_COMMA PUNCTUATION_IDEOGRAPHIC_FULL_STOP PUNCTUATION_LINE_SEPARATOR PUNCTUATION_PARAGRAPH_SEPARATOR PUSH_BUTTON PUT PWPLW PYPRY Pacific Pack Package Packages Packet Pad Page PageAttribute PageAttributes Paint PaintAllCallback PaintCallback PaintContext PaintEvent PaintHeavyweightComponentsCallback Paints Palo Panel PanelPeer Panels Parameter ParameterDescriptor ParameterMetaData Parameters Parens Parentheses Paris Parry Parse ParseException ParseInfo ParseIntegerOnly ParsePosition ParseUtil ParsedNamingURL Parser ParserConfigurationException Parses Parsing Part Partial Pass Passes Passing PasswordAuthentication Past Path PathConsumer PathDasher PathException PathIterator PathStroker Pathname Pathnames Pattern PatternEntries PatternEntry PatternSyntaxException Patterns Pause Pavani Payment Payne Pc Pd Pe Pearls Peek PeekInputStream Peeks Peer PeerEvent PeerFixer PeerPaintCallback PeerPrintCallback Pending Per Perform Performance Performing Performs Perhaps Period Permanently Permission PermissionCollection PermissionCollections Permissions PermissionsEnumerator PermissionsHash PermissionsImpl PersistenceDelegate Persistent Peter Pf Phase Philip Phoenix Pi Pictures Pipe Piped PipedInputStream PipedOutputStream PipedReader PipedWriter PixelFormats PixelOf Pixels Place Placeholder Places Plain PlainDatagramSocketImpl PlainSocketImpl Platform PlatformFont Platte Plays Please Plumb Pluto Po Point Point2D Points Policy PolicyFile PolicyTool Polygon PolygonPathIterator Pop Populate Populates PopupMenu PopupMenuPeer PopupMenus Port PortUnreachableException Portable Porter Portions Pos Positional Positioning Positive Possible Post PostEventQueue Postal Postconditions Posting Postprocessing Posts Potential Potentially Practice Pre Precompute Precondition Preconditions Prefix Preliminary Prentice PreparedStatement PreparedStatements Prepares Prepend Preprocess Preprocessing Presentation Preserve Presses Presumably Prevent Prevents Previous Primality PrimeRun PrimeThread Primitive PrimitivePersistenceDelegate Principal Principals Principles Print PrintAllCallback PrintCallback PrintGraphics PrintHeavyweightComponentsCallback PrintJob PrintJobs PrintQualityType PrintStackTrace PrintStream PrintWriter Printer PrinterIOException Printing Prints Prinzing Prior Prioritized Priority Private PrivateKey PrivateKeyInfo Privates Privileged PrivilegedAction PrivilegedActionException PrivilegedExceptionAction PrivilgedActionException Probably Procedures Process Processes Processor Proclaim Produce Produces Programmatically Programming Programs Prohibited Prompts Propagation Proper Properly Properties Property PropertyChange PropertyChangeEvent PropertyChangeEvents PropertyChangeListener PropertyChangeListenerProxy PropertyChangeListenerProxys PropertyChangeListeners PropertyChangeSupport PropertyDescriptor PropertyDescriptors PropertyEditor PropertyEditorManager PropertyEditorSupport PropertyEditors PropertyExpander PropertyPermission PropertyPermissionCollection PropertyPermissions PropertyResourceBundle PropertyVetoException Proposed Protected ProtectionDomain ProtectionDomains Protocol ProtocolException ProtocolVersion Protocols Provide Provided Provider ProviderException ProviderProperty Providers Provides Proxy ProxyPersistenceDelegate Ps Pseudo Public PublicKey Punctuation PureJavaPrintDialogExample Purpose Push Pushback PushbackInputStream PushbackReader Pushes Pushing Put PutField PutFieldImpl Putfield Puts Putting Q QAQAT QCQCJ QUARTO QUOTE Quadratic Qualifier Quarto Queries Query Question Queue Queues Quinn Quit Quote QuotedPattern QuotedString Quux R RADIX RANGE RBCollationTables RBTableBuilder RCSFile RDBMSs RE READ READING REAL RECORD RECURSIVE RED REF REFERENCE_GENERATION REFRENCES REFRESH_RATE_UNKNOWN REF_GENERATION REGISTRY_PORT RELATIVE REMAINDER REMARKS REMIND REMOVE REPLACEALL_THRESHOLD REPRESENTATION REQUEST_OK REQUIRED REREU RESERVED_ID_MAX RESET RESIZABLE RESOLVE RETURN RETURN_GENERATED_KEYS REVERSE_ORDER REVERSE_THRESHOLD RFC RFC1323 RFC2373 RFC2396 RFC2732 RGB RGBA RGBtoHSB RIFF RIGHT RIGHT_ALIGNMENT RIGHT_TO_LEFT RLE RLEStringToByteArray RLEStringToShortArray RLO RMASK RMI RMISecurityException RMISecurityManager ROMAN ROMAN_BASELINE ROROM ROTATE_THRESHOLD ROUND ROUNDING ROUND_CEILING ROUND_DOWN ROUND_FLOOR ROUND_HALF_DOWN ROUND_HALF_EVEN ROUND_HALF_UP ROUND_UNNECESSARY ROUND_UP ROWID RSA RSAPrivateCrtKey RSAPrivateKey RSAPublicKey RST RT RTL RUB RUN RUNIC RUNNING RUN_DIRECTION RUN_DIRECTION_LTR RURUS RWRWA Rabin Radicals Radix Random RandomAccess RandomAccessFile RandomAccessSubList Randomly RangeCheck Ranges Raster RasterOutputManager Rasterizer RasterizerCaps RasterizerCorners Rasters Rather Raw Re Read ReadMethod ReadOnlyBufferException ReadableByteChannel Readback Reader Reading Reads Reallocate Reason Reassigns Rebinds Rebuild Recalculate Recall Receive Received Receives Reciprocals Recognition Recombine Recommendation Recomputation Recompute Reconstitute Reconstitutes Record Recover Rect Rectangle Rectangle2D RectangularShape Recurse Recursive Recursively Red Redirect Redirection Redispatches Reduction Ref Refer Reference ReferenceQueue References Refills Reflect ReflectPermission Reflection ReflectionFactory Refreshes Regardless Regex Register Registers Registration Registry Regular Rehash Rehashes Reilly Reinhold Rejections Relation Relative Relativization Relativizes Release Releases Reload Remainder Remaining Remember Remote RemoteException RemoteObject Removal Remove Removed Removes Removing Rename Renames Renaud Render RenderableImage RenderedImage Renderers RenderinHints Rendering RenderingHints Renders Reorder Rep RepaintArea Repaints Reparent Repeat Repeating ReplaceTable Replaced Replaces Replacing Replay ReplicateScaleFilter Reply Report Reports Repositions Representation Represents Reprocess Request Requests Required Requires Rescale Reseeds Reserved Reset Resets Resetting Resizable Resize Resizes Resolution Resolve Resolved Resolves Resolving Resource ResourceBundle ResourceBundles ResourceCacheKey Resources Respect Restore Restores Restrict ResulSetMetaData Result ResultSet ResultSetMetaData Resulting Results Resumes Retain Retains Retargets Retreives Retrieval Retrieve Retrieves Retrive Return Returned Returns Reuse ReuseAddr Reverse ReverseComparator Reverses Revision Rewinds Rewritten Richard Riggs Right Rights Risks Rivest Road Robi Robot RobotPeer Roger Roland Roll Rolling Roman Rose Ross Rotates Rotating Round Rounded Rounding Route Row Rows Rule RuleBasedBreakIterator RuleBasedCollator RuleBasedCollators Rules Run Runic Runnable Running Runs Runtime RuntimeException RuntimePermission S S2 S5 SALARY SAME SASAU SATURDAY SAVE SAVE_FILE SAXException SAXParser SAXParserFactory SBSLB SCALE SCALE_AREA_AVERAGING SCALE_DEFAULT SCALE_FAST SCALE_REPLICATE SCALE_SMOOTH SCHEDULED SCIENTIFICSTYLE SCOPE SCOPE_CATALOG SCOPE_CATLOG SCOPE_SCHEMA SCOPE_TABLE SCROLLBAR SCROLLBARS_ALWAYS SCROLLBARS_AS_NEEDED SCROLLBARS_BOTH SCROLLBARS_HORIZONTAL_ONLY SCROLLBARS_NEVER SCROLLBARS_NONE SCROLLBARS_VERTICAL_ONLY SCROLLPANE_ONLY SCROLL_ABSOLUTE SCROLL_BAR SCROLL_BEGIN SCROLL_END SCROLL_EVENT SCROLL_LINE_DOWN SCROLL_LINE_UP SCROLL_LOCK SCROLL_PAGE_DOWN SCROLL_PAGE_UP SCROLL_PANE SCSYC SC_BLOCK_DATA SC_EXTERNALIZABLE SC_SERIALIZABLE SC_WRITE_METHOD SDK SDSDN SDSI SE SEALED SEARCHABLE SEARCH_HEAVYWEIGHTS SECOND SECONDARY SECONDARYDIFFERENCEONLY SECONDARYORDERINCREMENT SECONDARYORDERMASK SECONDARYORDERSHIFT SECOND_FIELD SEG_CLOSE SEG_CUBICTO SEG_LINETO SEG_MOVETO SEG_QUADTO SELECT SELECTABLE SELECTED SELECTION SELF_REFERENCING_COLUMN SELF_REFERENCING_COL_NAME SENTENCE SENTENCE_INDEX SEPARATE_DOCUMENTS_COLLATED_COPIES SEPARATE_DOCUMENTS_UNCOLLATED_COPIES SEPARATOR SEPTEMBER SEP_RECURSIVE SEP_WILD SEResizeCursor SESWE SET SET_LOG_PERMISSION SEVENTY SE_RESIZE_CURSOR SGSGP SH SHA SHA1PRNG SHA1withDSA SHA1withRSA SHIFT SHIFT_DOWN_MASK SHIFT_MASK SHORT SHORTEN SHORTEST SHORT_MAX_VALUE SHOULD SHOWING SHOWING_CHANGED SHSHN SHUFFLE_THRESHOLD SHUT_RD SHUT_WR SI SIDE SIGGRAPH SIGINT SIGKILL SIGN SIGNED SIGNIFICAND SIGTERM SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_MASK SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK SIMPLE_CASE_COUNTRY_MASK SIMPLIFIED_CHINESE SINGLE SINGLE_LINE SINHALA SISVN SIXTY SIZE SI_STOP SJSJM SKIP_BUFFER_SIZE SKIP_LF SKSVK SLSLE SMALL SMALLINT SMALL_FORM_VARIANTS SMALL_PRIME_PRODUCT SMALL_PRIME_THRESHOLD SMB SMSMR SNFH_FAILURE SNFH_SUCCESS_HANDLED SNFH_SUCCESS_PROCEED SNSEN SOCKS SOCKS5 SOMEBITS SOSOM SOURCE_DATA_TYPE SOUTH SOUTHEAST SOUTHWEST SO_BINDADDR SO_BROADCAST SO_KEEPALIVE SO_LINGER SO_OOBINLINE SO_RCVBUF SO_REUSEADDR SO_SNDBUF SO_TIMEOUT SPACE SPACE_SEPARATOR SPACING_MODIFIER_LETTERS SPECIALS SPECIAL_CASE_COUNTRY_INDEX_DELTA SPECIAL_CASE_COUNTRY_INDEX_MASK SPECIAL_CASE_COUNTRY_MASK SPECIFICATION_TITLE SPECIFICATION_VENDOR SPECIFICATION_VERSION SPI SQL SQL92 SQL99 SQLData SQLException SQLExceptions SQLInput SQLOutput SQLPermission SQLSTATE SQLSTATEs SQLState SQLWarning SQL_DATA_TYPE SQL_DATETIME_SUB SQLstate SQUARE SRC SRC_ATOP SRC_IN SRC_OUT SRC_OVER SRSUR SResizeCursor SS STANDARD_TIME START START_PUNCTUATION START_STATE STATEMENT STATIC STATUS_EXCEPTION STATUS_INFINITE STATUS_LENGTH STATUS_OK STATUS_POSITIVE STATUS_UNKNOWN STERMINATOR STOP STOPPED STOP_STATE STREAMED STREAM_MAGIC STREAM_VERSION STROKE_DEFAULT STROKE_NORMALIZE STROKE_PURE STRONG STRUCT STSTP SUBCLASS_IMPLEMENTATION_PERMISSION SUBSTITUTION_PERMISSION SUCCESS_NO_INFO SUID SUN SUNDAY SUPERSCRIPTS_AND_SUBSCRIPTS SUPERTABLE_NAME SUPERTYPE_CAT SUPERTYPE_NAME SUPERTYPE_SCHEM SURROGATE SURROGATES_AREA SVSLV SWResizeCursor SW_RESIZE_CURSOR SYNCHRONIZATION SYNONYM SYRIAC SYSTEM SYSYR SZSWZ S_RESIZE_CURSOR Safe SafeCharIterator SafeKeyper Same Sami Sample San Sanity SansSerif Saraiya Sat Saturday Saturn Save Savepoint Savepoints Saves Saving Savings Sc Scale Scaling Scan Scanning Scattering ScatteringByteChannel Schedule Schedules Schema Scheme Schemers Schroeppel Scientific Screen Scroll ScrollBar ScrollPane ScrollPaneAdjustable ScrollPanePeer ScrollPaneWheelScroller ScrollPanes ScrollPosition Scrollbar ScrollbarDisplayPolicy ScrollbarPeer Scrollbars Scrolling Scrolls Search Searches Searching Second Secondly Section Sections Secure SecureClassLoader SecureRandom SecureRandomSpi Security SecurityException SecurityExceptions SecurityManager SecurityPermission Sedgewick See Seed Seek Segment Select Selectable SelectableChannel Selecting Selection SelectionKey SelectiveAWTEventListener Selector SelectorProvider Selectors Selects Self Semantic Semantics Seminumerical Send SendMessage Sends SentEvent Sentence SentenceBreak SentenceBreakBoundary SentenceBreakData SentenceBreakDictionary SentenceBreakRules SentenceExceptionFlags Sentinel Sep Separate Separates Separating Sept September SequenceInputStream SequencedEvent SequencedEvents Sequences Sequentially Serial SerialNum SerialVersionUID Serializability Serializable SerializablePermission Serialization Serialized SerializedDataVersion Serializes Serif Server ServerError ServerException ServerRuntimeException ServerSocket ServerSocketChannel ServerSockets Service Set SetScale Sets Setters Setting Setup Seven Several Shaio Shape Shapes Shared Shift Shifts Shih Shimmer Short ShortBuffer ShortCountry ShortEditor ShortLanguage Shorten Shorter Should Shouldn Show Shows Shuffle Shutdown Shuts Shutting Sides SidesType Sieve Sign Signal SignalHandler Signals Signature SignatureException SignatureIterator SignatureSpi Signed SignedMutableBigInteger SignedMutableBigIntegers SignedObject SignedObjects Signer Signers Signifies Signing Signs Signum Silently Similar Similarly Simple SimpleBeanInfo SimpleDateFormat SimpleTextBoundary SimpleTimeZone Simulate Simulates Since Single SingleBufferStrategy Singleton SingletonList SingletonMap SingletonSet Sinhala SinkChannel Sixteen Size Sk Skip Skips Sleeps Slurp Sm Small Smart Smith Snapshot Snarf So Socket SocketAddress SocketChannel SocketException SocketImpl SocketImplFactory SocketInputStream SocketOptions SocketOutputStream SocketPermission SocketPermissionCollection SocketPermissions SocketTimeoutException Sockets Socks SocksConsts SocksSocketImpl SocksSocketImplFactory SoftBevelBorder SoftBevelBorderUIResource SoftCache SoftReference Software Solaris Sole Some Someday Something Sometimes Somewhat Somone Sort Sorted SortedMap SortedSet Sorting Sorts Source SourceChannel SourceFile South Southeast Southwest Space Spaces Spacing Spanish Spec Special SpecialCasing SpecialMapping Specialization Specials Specific Specifically Specification Specified Specifies Specify Specifying Spi Split Splits Square Squares Src SrcAtop SrcIn SrcOut SrcOver Stack StackOverflowError StackTraceElement Stall Standard StandardCharsets StandardGlyphVector Start Starting Starts Stash State Statement Statements States Static StaticFieldsPersistenceDelegate Statment Status Std Steele Stein Step Steve Steven Still Stop Stopping Stops Storage Store Stored Stores Storing Strategy Stream StreamCorruptedException StreamTokenizer StrictMath String StringBuffer StringBufferInputStream StringCharBuffer StringCharacterIterator StringCoding StringDecoder StringEncoder StringIndexOutOfBoundsException StringPart StringReader StringSelection StringTokenizer StringWriter Strings Strip Stroke Strokes Stroking Strong Struct Structural Structurally Structured StubNotFoundException Stuff Style SubFormatPatternPart SubList SubMap Subclass Subclasses Subclassing Subformat SubformatPattern SubformatPatternPart SubjectPublicKeyInfo Submits Subpattern Subscripts Subsequent Subset Substitution Substitutions Subtract Subtracts Success Successive Such Sun SunCompositeContext SunDropTargetEvent SunDropTargetEvents SunGraphicsCallback SunGraphicsEnvironment SunHints SunToolkit Sunday Superclass Superscripts Supertables Supplement Support Supported Suppose Suppress Suppresses Surrogates Suspends Sval Swap Swapping Swaps Swing SwingSet2 Switzerland Syllabics Syllables Symbol Symbols SyncFailedException Synch Synchronization Synchronize Synchronized SynchronizedCollection SynchronizedList SynchronizedMap SynchronizedRandomAccessList SynchronizedSet SynchronizedSortedMap SynchronizedSortedSet Synchronizes Synchronizing Synchronously Synonym Syntax Synthesizes Syriac System SystemColor Systems T TAB TABLE TABLE2 TABLE_CAT TABLE_CATALOG TABLE_NAME TABLE_SCHEM TABLE_TYPE TABLOID TABULATION TAIWAN TAMIL TCP TCP_NODELAY TCTCA TC_ARRAY TC_BASE TC_BLOCKDATA TC_BLOCKDATALONG TC_CLASS TC_CLASSDESC TC_ENDBLOCKDATA TC_EXCEPTION TC_LONGSTRING TC_MAX TC_NULL TC_OBJECT TC_PROXYCLASSDESC TC_REFERENCE TC_RESET TC_RESETs TC_STRING TDTCD TELUGU TEMPORARY TEN TERM TERTIARY TERTIARYORDERINCREMENT TERTIARYORDERMASK TESTING TEXT TEXT_CURSOR TEXT_EVENT_MASK TEXT_FIRST TEXT_HIGHLIGHT TEXT_HIGHLIGHT_TEXT TEXT_INACTIVE_TEXT TEXT_LAST TEXT_TEXT TEXT_VALUE_CHANGED TFATF TGTGO TH THAANA THAI THE THEN THEORY THESE THIS THOUSAND THREAD THROUGH THTHA THURSDAY TIBETAN TIME TIMESTAMP TIMEZONE TIMEZONE_FIELD TIME_ZONE TINYINT TITLECASE_LETTER TJTJK TKTKL TL TM TMTKM TNTUN TO TODO TOP_ALIGNMENT TOS TOTON TPTMP TR TRACE TRACK TRADITIONAL_CHINESE TRAILING TRANSACTION_NONE TRANSACTION_READ_COMMITTED TRANSACTION_READ_UNCOMMITTED TRANSACTION_REPEATABLE_READ TRANSACTION_SERIALIZABLE TRANSFORM TRANSIENT TRANSLUCENT TRAVERSAL_KEY_LENGTH TRIPLE_PRIME TRTUR TRUE TRUETYPE TRUETYPE_FONT TT TTL TTL_EXPIRED TTTTO TT_EOF TT_EOL TT_NOTHING TT_NUMBER TT_WORD TUE TUESDAY TVTUV TW TWO TWO_PASSES TWO_SIDED_LONG_EDGE TWO_SIDED_SHORT_EDGE TWTWN TYPE TYPE_CAT TYPE_FORWARD_ONLY TYPE_IMAGE_BUFFER TYPE_NAME TYPE_PRINTER TYPE_RASTER_SCREEN TYPE_SCHEM TYPE_SCROLL_INSENSITIVE TYPE_SCROLL_SENSITIVE TZTZA Tab Table Tags Take Taken Takes Taking Taligent Tamil Tanaka Target Task TaskQueue Tasks Tear Technical Technique Technology Tell Tells Telugu Temporary Terminate TerminateProcess Terminates Termination Terminator Terminology Test Testing Tests Text TextArea TextAreaPeer TextAttribute TextBoundaryData TextComponent TextComponentPeer TextComponents TextCursor TextEvent TextField TextFieldPeer TextLayout TextListener Texture TexturePaint TexturePaintContext Thaana Thai That The Their Then Theorem There Therefore These They Think This Thomas Thorn Those Though Thread ThreadDeath ThreadDeathError ThreadGroup ThreadLocal Threads Three Throw Throwable Throwing Thrown Throws Ths Thu Thur Thurs Thursday Thus Tibetan Tim Time TimeZone Timeout TimeoutException Timer TimerTask TimerTasks TimerThread TimesRoman Timestamp Timestamps Timothy Tiny Titlebar TitledBorder TitledBorderUIResource To ToDefault ToIndex Today Together Token Tom Too TooManyListenersException Took Tool ToolTipManager Toolkit ToolkitEventMulticaster Top Tous Towards Track Tracks Traditional Traditional_WIN Trailing Transaction Transfer Transferable Transferring Transfers Transform TransformAttribute Transformation Transforming Transforms Transient Transition Translate Translates Transparency Transparent Traversal Traverse Treat Tree TreeMap TreePath TreeSet Tries Trim Trims Trivial True TrueType Truetype Truncates Trusted Truth Try Trying Tue Tuesday Tuning Turkey Turkish Turns Twice Two Tx Type TypeAheadMarker TypeMap TypeName Types Typical Typically U U0E01 U0E2E U0E40 U0E44 U0E81 U0EAE U0EC0 U0EC4 UAUKR UCS UDP UDP_ASSOC UDT UDTs UGUGA UI UID UK UL ULP UMUMI UNASSIGNED UNC UNDECIMBER UNDEFINED UNICODE UNICODE_HIGH_BOUND_HAN UNICODE_LOW_BOUND_HAN UNICODE_ZERO_WIDTH_NON_BREAKING_SPACE UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS UNINITIALIZED UNION UNIT UNIT_DECREMENT UNIT_INCREMENT UNIX UNIXProcess UNKNOWN UNK_BIT UNMAPPED UNMAPPEDCHARVALUE UNMARKED UNNECESSARY UNSET UNSIGNED UNSIGNED_ATTRIBUTE UP UPDATE UPDATE_RULE UPPERCASE_LETTER UP_CYCLE_TRAVERSAL_KEY UP_CYCLE_TRAVERSAL_KEYS URI URISyntaxException URIs URL URLClassLoader URLClassPath URLConnection URLConnections URLDecoder URLEncoder URLStreamHandler URLStreamHandlerFactory URLStreamHandlers URLs URNs US USD USER USER_DEFINED USER_PASSW USE_ALL_BEANINFO USN USS USUSA UT UT1 UTC UTC_TIME UTF UTFDataFormatError UTFDataFormatException UYURY UZUZB U_ARABIC_NUMBER U_RIGHT_TO_LEFT U_RIGHT_TO_LEFT_ARABIC U_RIGHT_TO_LEFT_EMBEDDING U_RIGHT_TO_LEFT_OVERRIDE Ullman Ulp2 Unable Unauthorized Unavailable Unbalanced Unbound Uncaught Unchecked UnconnectedChannelException UnconnectedSocketException UndeclaredThrowableException Undefined UndefinedProperty Under Underlying Undo Undoes Unexpected UnexpectedException Unfinished Unfortunately Unicast UnicastRemoteObject Unicode UnicodeBlock UnicodeClassMapping UnicodeData UnicodeLittle Unified Uniform Uninitialized Union Unique UniqueMethodInfo Unis Unit United Unix UnixFileSystem Unknown UnknownContentHandler UnknownContentHandlerP UnknownError UnknownHostException UnknownServiceException Unkonwn Unless Unlike Unlikely Unlocalized UnmappableCharacterException UnmarshalException Unmatched Unmodifiable UnmodifiableCollection UnmodifiableEntry UnmodifiableEntrySet UnmodifiableList UnmodifiableMap UnmodifiableRandomAccessList UnmodifiableSet UnmodifiableSortedMap UnmodifiableSortedSet Unnamed Unnecessary Unnormalize Unpack Unparseable Unquoted UnquotedPattern UnquotedString Unreachable Unrecognized UnrecoverableKeyException Unreserved Unresolved UnresolvedPermission UnresolvedPermissionCollection UnresolvedPermissions Unroll Unsafe UnsatisfiedLinkError Unsupported UnsupportedCharsetException UnsupportedClassVersionError UnsupportedEncodingException UnsupportedOperationException Unsynchronized Until Untitled Unused Up Update UpdaterInputStream Updates Updating Upon Upper Uranus Urgent Usage Use UseCaches Used Useful User UserVec Users Uses Using Usually Utilities Utility Uuml V V4 V5 VALUES VALUE_ALPHA_INTERPOLATION_DEFAULT VALUE_ALPHA_INTERPOLATION_QUALITY VALUE_ALPHA_INTERPOLATION_SPEED VALUE_ANTIALIAS_DEFAULT VALUE_ANTIALIAS_OFF VALUE_ANTIALIAS_ON VALUE_COLOR_RENDER_DEFAULT VALUE_COLOR_RENDER_QUALITY VALUE_COLOR_RENDER_SPEED VALUE_DITHER_DEFAULT VALUE_DITHER_DISABLE VALUE_DITHER_ENABLE VALUE_FRACTIONALMETRICS_DEFAULT VALUE_FRACTIONALMETRICS_OFF VALUE_FRACTIONALMETRICS_ON VALUE_INTERPOLATION_BICUBIC VALUE_INTERPOLATION_BILINEAR VALUE_INTERPOLATION_NEAREST_NEIGHBOR VALUE_RENDER_DEFAULT VALUE_RENDER_QUALITY VALUE_RENDER_SPEED VALUE_STROKE_DEFAULT VALUE_STROKE_NORMALIZE VALUE_STROKE_PURE VALUE_TEXT_ANTIALIAS_DEFAULT VALUE_TEXT_ANTIALIAS_OFF VALUE_TEXT_ANTIALIAS_ON VARBINARY VARCHAR VARIABLES VARIANT VAVAT VCVCT VERIFY VERTICAL VEVEN VGVGB VIEW VIRGIN VISIBLE VIVIR VK VK_ VK_A VK_ALT VK_CAPS_LOCK VK_CONTROL VK_DELETE VK_DOWN VK_END VK_ENTER VK_F1 VK_F10 VK_F11 VK_F12 VK_F2 VK_F3 VK_F4 VK_F5 VK_F6 VK_F7 VK_F8 VK_F9 VK_HOME VK_INSERT VK_KANA_LOCK VK_LEFT VK_NUM_LOCK VK_PAGE_DOWN VK_PAGE_UP VK_PAUSE VK_PRINTSCREEN VK_RIGHT VK_SCROLL_LOCK VK_SHIFT VK_SPACE VK_TAB VK_UNDEFINED VK_UP VK_X VK_XXX VM VMs VNVNM VRAM VSPACE VUVUT Valid Validate Validates ValidationList Value ValueCollection ValueData ValueIterator Values Variables Variants Various Vector Venus Verifies Verify VerifyError Verifying Verisign Version Versions Vertical Very VetoableChange VetoableChangeListener VetoableChangeListenerProxy VetoableChangeListenerProxys VetoableChangeListeners VetoableChangeSupport VetoableListener View Viewer Viewing Views Violation Virtual VirtualMachineError Virtually Visibility Vliet Void Vol VolatileImage Volume W WAIT_CURSOR WALL_TIME WARNING WAS WDW WEDNESDAY WEEK_OF_MONTH WEEK_OF_MONTH_FIELD WEEK_OF_YEAR WEEK_OF_YEAR_FIELD WEIGHT WEIGHT_BOLD WEIGHT_REGULAR WEST WFWLF WHERE WHITE WIDTH WILD WILL WIN WINDOW WINDOW_ACTIVATED WINDOW_BORDER WINDOW_CLOSED WINDOW_CLOSING WINDOW_DEACTIVATED WINDOW_DEICONIFIED WINDOW_DEICONIFY WINDOW_DESTROY WINDOW_EVENT WINDOW_EVENT_MASK WINDOW_EXPOSE WINDOW_FIRST WINDOW_FOCUS_EVENT_MASK WINDOW_GAINED_FOCUS WINDOW_ICONIFIED WINDOW_ICONIFY WINDOW_LAST WINDOW_LOST_FOCUS WINDOW_MOVED WINDOW_OPENED WINDOW_STATE_CHANGED WINDOW_STATE_EVENT_MASK WINDOW_TEXT WIND_EVEN_ODD WIND_NON_ZERO WITH WM WORD WORD_INDEX WORD_MASK WRITE WRONG WResizeCursor WS WSWSM WWW W_RESIZE_CURSOR Wait WaitCursor Waits Wake Wakes Walk Wall Wang Want Warning Warnings Warres Warth Was Wasn Watch We Weak WeakHasMap WeakHashMap WeakKey WeakKeys WeakReference WeakReferences Web Weber Wed Wednesday Weed Week Weekday Weeks Weights Well Werner Wesley West Western What Whatever Wheel When Whenever Where Whether Which While White Why Wide WidgetResource WidgetResources_de WidgetResources_fr Width Will Win16 Win32 Window WindowActivated WindowAdapter WindowClosed WindowClosing WindowClosingListener WindowClosingSupport WindowDeactivated WindowEvent WindowEvents WindowFocusListener WindowGainedFocus WindowListener WindowLostFocus WindowOpened WindowPeer WindowStateListener Windows With Within Without Wolczko Wollrath Won Word WordBreak WordBreakData WordBreakDictionary WordBreakRules WordBreakTable WordExceptionFlags Workaround Worker World Wormhole Wraparound WrappedHook Wrapper Wrappers Wrapping Wraps WritableByteChannel WritableRaster Write WriteAbortedException WriteObject Writer Writers Writes Writing Written Wrong X X11 X509Certificate X509EncodedKeySpec X9 XAF XAG XAU XB5 XBA XBB XBC XCD XDR XFO XFU XML XMLDecoder XMLEncoder XOF XOPEN XOR XPD XPF XPT XTEST XTS XXX X_DATA Xerces Xor XyZDescriptor Xz Y YEAR YEAR_FIELD YELLOW YES YET YEYEM YI_RADICALS YI_SYLLABLES YTMYT YUYUG Y_DATA Year Years Yellin Yen Yi Yingxian You Your YoyoDyne Z ZAZAF ZERO ZMZMB ZONE ZONE_OFFSET ZRZAR ZWZWE Zap ZapfDingbats Zero ZipEntry Zl ZoneInfo Zp Zs _ _DOWN_ _FIELD _GB _PersistenceDelegate __ ___ ____ ________ ____________ _________________________ _and_ _any_ _beginning_ _blank _g _get _last_ _parent _put _self _shortest_ _that_ _top _variant a a0 a1 a10 a2 a3 a4 a5 a6 a7 a8 a9 aB aButton aChar aClassCastException aComponent aContainer aCopy aKey aKeyFormat aLocale aPattern aRef aStart aStrength aWindow aZeros a_nanos aa aaa aaaabc aaaar ab ababk abandon abbreviated abbreviation abbreviations abc abcd abcde abcdefghijklmnopqrstuvwxyz ability able abnormal abnormally abort aborted aborting aborts about above abs abscissa absence absent absolute absolutely absolved absorb abstract abstractRecognizerClass abstraction abstractly abuse abuts ac acc accelKey accelerate accelerated acceleration accelerator accelerators accent accent_diacritic accented accents accept acceptDuplicates acceptable accepted accepting accepts acceptsURL access accessClassInPackage accessClipboard accessClipboardPermission accessDeclaredMembers accessEventQueue accessOrder accessable accessed accesses accessibility accessible accessibleAWTComponentHandler accessibleAWTFocusHandler accessibleContainerHandler accessibleContext accessibleDescription accessibleName accessibleParent accessing accessor accessors accidental accommodate accomodate accompanied accompany accompanying accomplish accomplished accordance according accordingly account accounted accounting acct accum accumA accumB accumG accumR accumlated accumulate accumulateLine accumulated accumulating accuracy accurate accurately achieve achieved achieves ackbarfaccept acknowledged acknowledgement acl acmp acos acquireFD acquired acquiring acronym across act action actionCommand actionKeyCodes actionL actionListener actionListenerK actionPerformed actions activatable activate activated activates activating activation active activeCaption activeCaptionBorder activeCaptionText activeCount activeGroupCount activeWindow actively activities activity acts actual actualGetExp actually acute acyclic ad adaptations adapted adapters adaptors add addAWTEventListener addAccessibleSelection addActionListener addAdjustmentListener addAll addAllForTreeSet addArg addAttribute addAttributeImpl addAttributeRunData addAttributes addBatch addBefore addCertificate addChildren addClass addComponentListener addComposedChars addContainerListener addContractFlags addContractOrder addElement addEvent addExpandOrder addExpansion addFirst addFocusListener addFooListener addFredListener addHelpMenu addHierarchyBoundsListener addHierarchyListener addIdentity addIdentityCertificate addImage addImpl addInputMethodListener addInternal addItem addItemListener addItemNoInvalidate addKeyEventDispatcher addKeyEventPostProcessor addKeyListener addLast addLayoutComponent addLightweightRequest addListenerMethod addListenerMethodName addMenu addMethod addMethodName addMouseListener addMouseMotionListener addMouseWheelListener addNotify addObserver addOn addOne addOrder addOwnedWindow addPattern addPoint addProperty addPropertyChangeListener addProvider addProviders addRenderingHints addRequestProperty addRules addSeparator addShutdownHook addTab addTable addTextListener addToBuffer addToCache addToFrameList addURL addVetoableChangeListener addWindowFocusListener addWindowListener addWindowStateListener addXyzEventListener added addedDecimalSeparator addedSerial addend adder adding addition additional additionalBeanInfo additionally additions addnotify addr addr1 addr_array address addressCache addressed addresses addressing addrs adds adequate adequately adhere adhered adherence adj adjacent adjust adjustDST adjustDecendantsOnParent adjustDescendants adjustForCurrencyDefaultFractionDigits adjustForGravity adjustListeningChildren adjustListeningChildrenOnParent adjustStamp adjustable adjustables adjusted adjusting adjustment adjustmentL adjustmentListener adjustmentListenerK adjustmentValueChanged adjustments adjusts administrative administrators admits adopted adoption adopts advance advanced advances advancing advantage advantages advertized advice advisable advise advised advises ae aeiou afafr affect affected affecting affects affix affixPattern affords aforementioned afresh after afterEvent afterLast afternoon afterwards again against age agency aggregate aggregateStamp aggressively agrave agree agreement aground ahead aid aim aimed aje ajust al algIndex algName algOID algorithm algorithm_or_provider algorithm_or_type algorithms algorythm alias aliasSet aliased aliases aliasing align aligned aligning alignment aligns alive all allChars allMethods allPermDomain allPermission allProceduresAreCallable allProviders allTablesAreSelectable allThere all_allowed allocate allocateDirect allocateMemory allocateNewInstance allocated allocates allocating allocation allocations allotted allow allowThreadSuspension allowUserInteraction allowable allowed allowing allows allowsMultipleSelections allowuserinteraction alluded allzero almost alone along alpha alphabet alphabetic alphabetical alphabets alphanum alphanumeric already alreadySelected als also alt alter altered altering alternate alternately alternates alternating alternation alternative alternatives alters although always am amamh ambTerm ambiguities ambiguity ambiguosTerm ambiguous ambiguousTwoDigitYear ambiguousYear amenable amended amiss ammended among amongst amortized amoung amount amounts amp ampersand ampm ampms an anArray anEvent anObject anOrder analog analogous analogue analogues analysis analyze analyzed analyzing anc ancestor ancestorMoved ancestorResized ancestors anchor anchorSelectionIndex anchored anchors and andNot angdeg anglais angle angles angrad angular anim animation animations animator annotate annotateClass annotateProxyClass annotated annotation annotations anomalous anonymous another anotherBits anotherByte anotherCharacter anotherDate anotherDouble anotherFloat anotherInteger anotherKey anotherKeyFormat anotherLong anotherShort anotherString anotherTime anotherVal answer antaliased ante anti antialiased antialiasing anticount any anyLocalAddress anymore anyone anything anyway anyways anywhere ap apart apostrophe apostrophes app appContext appRandom apparently appcontext appear appearance appearances appeared appearing appears append appendAffix appendAuthority appendContents appendCubic appendFragment appendLine appendQuadratic appendQuoted appendQuotedChars appendQuotedExtension appendSchemeSpecificPart appendText appended appending appendix appends apple applet appletResize appletWarning applets appletviewer applicable application applications applied applies apply applyComponentOrientation applyGetters applyLocalizedPattern applyPattern applyResourceBundle applySize applyStyle applyTransform applying appreciate approach approaches appropriate appropriately approval approved approx approximate approximately approximates approximating approximation approximations april ar arabic arara arary arbitrarily arbitrary arc arcAngle arcHeight arcWidth arcane arch architecture archive archived archives archiving are areAllFieldsSet areFieldsSet areFocusTraversalKeysSet areInputMethodsEnabled area areas aren arg arg1 arg2 argClasses argCount argRecursion argType argTypes argV argbRasRef argbmodel args arguably argumens argument argumentIndex argumentNumber argumentNumbers arguments argumnnt arise arises arithmetic arnold around arr arrLocal arrange arrangeGrid arranges arranging arrary array arrayClass arrayContentsEq arrayEquals arrayHandle arrayLen arrayLength arrayNameDiff arrayPersistenceDelegate arraycopy arrays arrive arrived arrives arrow arrows artifact as asCharBuffer asDoubleBuffer asFloatBuffer asIndex asIntBuffer asList asLongBuffer asReadOnlyBuffer asShortBuffer asasm ascending ascends ascent ascii ascii2ebcdic asciiValues asin ask asked asking asks aspect aspects assembled assert assertion assertionStatus assertions asserts assign assignable assigned assignedDomains assigning assignment assignments assigns assist assistive assistive_technologies associate associated associates associating association assume assumed assumes assuming assumption assumptions assurance assuring assymetry asterisk astronomical asymmetric asymptotically asynchronous asynchronously at atEnd atName atNames atan atan2 atomic atomicity atop attach attached attaching attachment attachments attack attacker attackers attacks attempt attempted attempting attempts attended attention attr attrIndex attrName attribure attribute attributeCount attributeIndex attributeKey attributeName attributeNamePattern attributeNames attributeNoNulls attributeNullable attributeNullableUnknown attributeValuesMatch attribute_name attribute_value attributed attributedStrings attributes attribution attrinute attrs attrsToString atttribute au audience audio audit auditSubclass aug augment august auml auromatically authentic authenticate authenticated authentication authenticator authenticity author authorities authority authorization auto autoCommit autoDelay autoFlush autoGeneratedKeys autoProcessMouseWheel autoTransferFocus autoWaitForIdle automagically automated automatic automatically automation autonumbering aux auxiliary avail available availableCharsets availableProcessors avaliable average averageBytesPerChar averageCharsPerByte avh avoid avoided avoiding avoidingGui avoids aw awakened aware away awriter awry awt axes axis ayaym az azaze b b0 b1 b10 b2 b3 b4 b5 b5p b6 b7 b8 b9 bCtxt bHeight bWidth bZeros ba babak back backBuffers backCaps backTableOffset backed backfill backfillLoopingStates backfilled backfilling backfills background backgroundSetByClientCode backing backlog backrefs backs backslash backtrace backup backward backwardDefaultFocusTraversalKeys backwardFocusTraversalKeys backwardStateTable backwardTextAreaFocusTraversalKey backwardTraversalKeys backwards backwardsStateTable bad badComponentString baddr badly bag baggage bah baht bail bais balanced banana bandmasks banner baos bar baronets bars base base2 baseCR baseForm baseIsLTR baseLF baseLevel baseName baseState baseToPow2 baseWireHandle baseclass baseclasses based baselevel baseline baselineIndex baselineOffsets baselines bases basic basing basis batch bathroom bayonets baz bb bc bcd bd bdata bdl be bean beanClass beanClassName beanContext beanDescriptor beanInfoCache beanName beanbox beancontext beaninfo beans bebel because become becomes becoming been beep befoer before beforeFirst began begin beginIndex beginLayout beginOffset beginPath beginRunIndex beginSubpath beginValidate begining beginning begins begun behalf behave behaved behaves behavior behavioral behaviors behaviour behind bein being beingBuilt believes believing bell belong belonged belonging belongs below bend beneath benefit bequeath berlin bert besides best bestBreakPositions bestMatch bestMatchLength bestNumber bestRowNotPseudo bestRowPseudo bestRowSession bestRowTemporary bestRowTransaction bestRowUnknown bestStamp beta better between bevelType beveled beyond bg bgbul bgcolor bhbih bi biRas bias bibis bidi bidirectional big big10pow big5pow bigB bigD bigD0 bigDecimalExponent bigEndian bigIndex bigIntExp bigIntNBits bigOne bigger bigint bigq bigr billion bin binExp binary binaryGCD binaryGcd binarySearch bind bindAddr bindV4 bindaddr binding bindings bindpoint binds binexp bir birds bis bison bit bitClump bitCnt bitCount bitDepth bitIndex bitLen bitLength bitMask bitSieve bitcount bitlen bitlength bitlengths bitmap bitmask bitmasks bitpos bits bitsInHighWord bitsLeftOf bitsPerDigit bitsRightOf bitset bitwise bl black blah blank blen blend blending bless blessing blindly blinking blitted blitting blk blkmode block blockIncrement blockStarts blocked blockedOn blocker blocking blockingLock blockquote blocks blt blue bluec bm bnExpModThreshTable bnben bnf bo bobEncodedPubKey bobPubKey bobPubKeySpec bobod body bogus boilerplate bold bolditalic bonus boo book bookkeeping books bool boolean booleanValue booleans boot bootclasspath bootstrap bootstrapClassPath border borders boring borrow borrowed botch both bother bothered bottom bottommost bound boundFields boundaries boundary bounded bounding bounds boundsCheck boundsMaxX boundsMaxY boundsMinX boundsMinY bout box boxes bp br brace braceStack braces bracket bracketLevel bracketed brackets brain branch branches brbre break breaker breaking breaks breve brevity brhavior bridge brief briefly briefs brighter brightness bring bringing brings brk broadcast broadcasts broke broken brown browser browsers brute bs bsi btc bubble bucket buckets buf bufImg bufLength bufSize buffer bufferCaps bufferFlushed bufferFull bufferLoop bufferStrategy bufferUnderflowException buffered bufferedStream buffering buffers buflen bug bugfix buggy bugs build buildBackwardsStateTable buildBreakIterator buildCharCategories buildFromSorted buildRuleList buildStateTable buildTree builder builders building builds built bulk bullet bummer bump bunch bunching bundle bundleClass bundleName bundles bundlesFound bursts busy but button button1 button2 button3 buttonDir buttonSerializedDataVersion buttons bw bwd by bypass bypasses bypassing byte byteAddr byteArray byteLen byteLength byteOrder byteOutputter byteVal byteValue byte_array bytearr bytes bytesCopied bytesRead bytesRemaining bytesToDoubles bytesToFloats bytesToTransfer bytesTransferred bytesWidth bytewise c c0 c1 c10 c2 c3 c4 c5 c6 c7 c8 c9 cFlgs cH cPeer cSize cTbl ca cacat cache cacheAddress cacheInitIfNeeded cacheKey cacheList cacheLookup cached cachedBreakPositions cachedConstructor cachedLocaleData cachedMat cachedModel cachedNumberFormatData cachedZoneData caches caching cal calc calculate calculateBounds calculateBundleNames calculateChildSize calculated calculates calculating calculation calculations calendar calendarField calendarToFieldMapping calendars call callable callback callbacks called caller callerC callerCL callerClassLoader callers calling calls came can canAccessClipboard canBlock canDisplay canDisplayUpTo canEncode canRead canRotate canWrite canbezero cancel cancelKey cancelRowUpdates canceling cancellation cancelled cancels cand candidate candidates candidatesArray cannot cannotHappen canonical canonicalHostName canonicalName canonical_path canonicalization canonicalize canonicalize_md canonicalized canonically canonicals cansIte cantaloupe canvas canvases cap capabilites capabilities capability capable capacity capacityIncrement capchi capiota capital capitalization capitalize capitalized capitals caps capsigma captheta capture captured capupsil card cardComponent cardName cardinality cards care careful cares caress caret caretPosition caretPositionChanged carol caron carriage carried carries carry carryout cascade case caseDiff cased cases cash casing cast casting casts catalog cataloging catalogs catch catches catching catchs categories category categoryFlags categoryMap cats caught causation causative cause caused causedTrace causes causing caution caveat caveats cb cbg cbuf cc ccl cd cdate cde cdt ce cease ceased ceases cector cedilla cee ceil cell cellIsPopulated cellRenderer cellValue cellar cellpadding cells cellspacing cent center centered centering centers centimeter central centralized centralizes cents century cert certType certain certainly certainty certificate certificates certifies certifying certs cf cfilorux cfs cg ch ch1 ch2 ch3 ch4 cha chacters chain chained chaining chains chance chandrabindu change changeFlags changeLastEntry changeSupport changed changedParent changeover changes changing channel channels channelsAvailable chaotic chapter chapter1 char char0 char1 char2 char3 charAt charCategoryTable charLength charLoop charMap charOut charPos charSetForCategory charSetFromCategory charType charValue charWidth characers character characterIterators characteristics characterists characterize characterized characters charactre charaters charenc charr chars charsInEntry charsThatCantPrecedeAsterisk charsWidth charset charsetForName charsetName charsets chartacters chase cheap check checkAccept checkAccess checkAll checkAndCreate checkAwtEventQueueAccess checkAwtEventQueuePermission checkBounds checkButtonsArgument checkCerts checkChar checkChars checkConnect checkCreateClassLoader checkDefaultSerialize checkDelayArgument checkDelete checkDeserialize checkError checkExec checkExit checkForComodification checkForEnableIM checkGD checkGuard checkHeadless checkID checkIO checkImage checkIndex checkInitted checkIsScreenDevice checkKeycodeArgument checkLayout checkLink checkListen checkLookupTable checkMapped checkMember checkMemberAccess checkMemberAccessPermission checkMemeberAccess checkMulticast checkName checkNotDispatchThread checkOffset checkPackageAccess checkPackageAcesss checkPackageDefinition checkPath checkPermission checkPrintJobAccess checkPropertiesAccess checkPropertyAccess checkRead checkResolve checkRobotAllowed checkScreenCaptureAllowed checkSecTer checkSecurityAccess checkSetFactory checkSpecifyHandler checkSuperclass checkSystemClipboardAccess checkTertiary checkTopLevelWindow checkURL checkValidRect checkWindowClosingException checkWrite checkbox checkboxMenuItemSerializedDataVersion checkboxSerializedDataVersion checkboxes checked checkedAddresses checkedExceptions checkedWithFactory checkfpx checking checks cheeses chemie chi child childListeners childMap childResized childSize childValue children childs chime chkmenuitem cho choice choiceFormats choiceLimits choiceSerializedDataVersion choices choose choosen chooses choosing chopping chose chosen choseong choses chugs chunk chunklen chunks chval ci circle circuit circuiting circuits circular circularities circularity circumference circumflex circumstances circumvent cited cities civil cjk cl cl1 cl2 clFields clHandle claim claimed claiming claims clarity clashes class classAssertionStatus classDepth classDesc classEnabled classForName classLoader classLoaderDepth classLoaderDepth0 classMods className classNames classNamesEqual classObjs classPath classToBeanInfo classdesc classdescriptor classes classic classified classloader classloaders classname classpath classses clause clauses clazz clean cleanUpConstructionList cleaner cleanly cleanup clear clearAccessibleSelection clearAssertionStatus clearBatch clearBit clearChanged clearFocusRequestList clearGlobalFocusOwner clearLoopingStates clearOnFailure clearParameters clearProviderProperties clearRect clearWarnings clearable cleared clearing clearingCurrentLightweightRequests clearly clears clen clever click clickCount clicked clicking clicks client clients clinit clip clipFillRaster clipRect clipboard clipped clipping clips cloader clock clocks clockwise clonable clone cloneStatement cloneability cloneable cloned cloning close close0 closeBracket closePath closePending closeable closed closedByReader closedByWriter closedSubpath closely closer closes closest closing closure cls clsName clsidOffset clump clustered clz cm cmap cmax cmd cmdIn cmdOut cmdSocket cmdarray cmdsock cmin cmp cmpFracHalf cmpResult cn cname cnse cnt coalesce coalesceEvents coalescePaintEvent coalesced coalescedEvent coalesces coalescing coce cocos code codeBase codebase coded coder coders codes codesource codify coding coincidence col colFirst colLastValue colName colString colincx colincxerr colincy colincyerr colinear coll collapse collapsed collapsing collar collated collation collator collators collect collectInterfaces collected collection collections collector collects collide collision collisions collusion colon colonp colons color color1 color2 colorModel colorOf colored colors colrel cols colspan column columnHeader columnIndex columnIndexes columnMap columnName columnNamePattern columnNames columnNoNulls columnNullable columnNullableUnknown columnWeights columnWidth columnWidths columns com comapare comarison combination combinations combine combined combinedPds combinedRowNum combiner combines combining comboboxes comceptual come comes coming comma command commands commas commence comment commentChar commented comments commercial commit commits committed commmands common common2 common2factor commonly communicate communicates communication communications community comonent comp comp1 comp2 compArray compParent compact compacting compactness companies company comparable comparator comparators compare compareArraysToCount compareCerts compareIgnoringCase compareMethods compareSec compareTer compareTo compareToIgnoreCase compareToRule compared comparing comparision comparison comparisons compatability compatibility compatibilty compatible compatiblity compatilibility compelling compensate compensates compete competes competing compilation compile compileClass compileClasses compiled compiler compilers compindex complement complementary complemented complete completed completely completeness completes completion completly complex compliance compliant complicated complicating complication complies comply complying componen componenets component componentAdded componentHidden componentL componentListener componentListenerK componentMoved componentOrientation componentRemoved componentResized componentSerializedDataVersion componentShown components compose composeList composeMapping composed composing composite composited composites compositing composition compound comprehensively compress compressed compressedIsoCountries compressedIsoLanguages comprise comprised comprises comprising compromise compromised comptable computatinally computation computations compute computeDefaultSUID computeFieldOffsets computeFields computeJulianDay computeRedLevel computeTime computed computer computerized computes computing con concat concatenate concatenated concatenating concatenation concatenations concatentation concept concepts conceptual conceptually concern concerned concerning concerns concise concisely concrete concurrency concurrent concurrently cond condition conditionalShow conditions confidential config configs configuration configurations configure configureBlocking configured conflict conflicting conflicts conform conformant conforming conforms confuse confused confusing confusion congruential conjoining conjuction conjunction connect connect0 connectInternal connectOwnedWindow connectToAddress connectV4 connectable connected connectedAddress connectedPort connecting connection connectionless connections connects cons consSigs consecutive consecutively consed consequence consequences conservation conservative conservatively consider considerably consideration considerations considered considering considers consist consistency consistent consistently consisting consists console consonant consonants constant constantce constants constists constituent constituents constitute constitutes constituting constrain constrained constraining constraint constraints construcion construct constructComponentName constructPow52 constructed constructing construction constructionCache constructor constructorArgs constructorPropertyNames constructors constructs consult consulted consume consumeNextKeyTyped consumed consumer consumes consuming cont contacted contain contained container containerL containerListener containerListenerK containerSerializedDataVersion containers containg containing containment contains containsAlias containsAll containsAllPDs containsKey containsMapping containsOpp containsValue contemporary content contentClassPrefix contentEquals contentHandlerClassName contentHandlerPkgPrefixes contentPane contentPathProp contentType contention contents contentsLost contentsRestored context contextClassLoader contexts contient contiguous continent continental continuation continue continueLine continues continuing continuous continuously contract contractChars contractFlags contractOrder contractTable contracting contractions contracts contractual contraints contrast contributes contributing control controlDkShadow controlDown controlHighlight controlLtHighlight controlShadow controlText controllable controlled controller controlling controls contructor contructors convenience convenient conveniently convention conventional conventionally conventions convered conversely conversion conversions converstion convert convertAny convertFromIPv4MappedAddress convertInto convertOldISOCodes convertToOld converted convertedStep converter converting converts convey cooperates cooperative coordinate coordinated coordinates coords copes copied copies copy copyAndFixQuotes copyArea copyAttrs copyInto copyMembers copyMemory copyOfBase copyPrivateDataInto copyValue copyValueOf copying copyright copyrighted copyw corba core corner cornered corners corporation correct correctEntry correction correctionLoop corrections correctly correctness corrects correlated correlation correponding corresonding correspond correspondence corresponding correspondingly corresponds corrupt corrupting corruption cos cosine cost costly costs could couldNotInstantiate couldn count countAWTEventListeners countBits countComponents countHierarchyMembers countItems countItemsImpl countMenus countObservers countProviders countStackFrames countTokens countdown counted counter counterpart counterparts counting countries country country1 country2 countryLength countryName country_variant counts couple course cousin cover covered covering covers cp cpath cpos cr crap cras crash crashed crashes create createAccessControlContext createAttributedCharacterIterator createBackBuffers createBreakInstance createBufferStrategy createBuffers createButton createCalendar createCanvas createCheckbox createCheckboxMenuItem createChildHierarchyEvents createChoice createClassLoader createClassLoaderPermission createCompatibleImage createCompatibleVolatileImage createCompatibleWritableRaster createComponent createContentHandler createContext createCustomCursor createDatagramSocketImpl createDialog createDirectory createDragGestureRecognizer createDragSourceContextPeer createFileDialog createFileExclusively createFont createFrame createGlyphVector createGraphics createHierarchyEvents createImage createImpl createIntersection createInverse createLabel createLineBidi createList createMenu createMenuBar createMenuItem createName createNameService createNewAppContext createNewFile createPackedRaster createPanel createPopupMenu createRegistry createRobot createRobotPermission createRunAttributeDataVectors createScreenCapture createScrollPane createScrollbar createSecurityManager createSocketImpl createStatement createStrokedShape createTempFile createTextArea createTextField createURLStreamHandler createUnion createVolatileImage createWindow created creates creating creation creator credit crispness critSet criteria criterion critical cross crosshair crucial crudely crummy crunch cruzeiro cryptically crypto crypto_service cryptographic cryptographically cryptography cs csName csces csize csn csname cspace cst ct ctb ctrl ctryCode ctxt ctype cultural culture cumbersome cumulative cur curCol curDesc curGet curHeight curObj curPut curRow curWidth curX curY curly curr currIndex currencies currency currencyCode currencySymbol current currentActiveWindow currentBlockRemaining currentBreakPositions currentCard currentChar currentClass currentClassLoader currentClassLoader0 currentDomains currentFocusCycleRoot currentFocusOwner currentFocusOwnerEvent currentFocusedWindow currentIndex currentKey currentLightweightRequests currentLoadedClass currentLoadedClass0 currentLoader currentLocale currentNativeFocusOwner currentPosition currentRunAttributeValues currentRunAttributes currentRunIndex currentRunLimit currentRunStart currentRuntime currentSegment currentSerialVersion currentState currentThread currentTime currentTimeMillis currentTime_1 currentTime_2 currentType currently currpos cursor cursorProperties cursorType cursors curtok curve curveTo curved curves curx cury custom customization customizations customize customized customizer customizerClass customizing customs cut cutoff cutover cutoverDay cw cws cwsl cwspos cwss cyan cycle cycleFillRaster cycleStart cycles cyclic cycym cyle d d1 d2 dBits dLong dValue da da_DK da_DKCollator da_DKRules dadan daemon damage damaged damn danger dangerous dangling dark darkGray darkened darker dash dash_phase dasher dashes dashing data dataDefinitionCausesTransactionCommit dataDefinitionIgnoredInTransactions dataLayout dataSize database databases datagram datagramSocketClose datagramSocketCreate datagrams datanase datastream datastructure datatabase datatransfer datatypes date dateModifierList dateString dateStyle dateTimeArgs dateTimePatterns date_s dated dates datum day dayOfMonth dayOfPeriod dayOfWeek dayOfYear day_of_month daylight days db dbg dc dc1 dc2 dc3 dc4 dcm dcount dd de deProxyAWTEventListener de_DE de__POSIX deactive dead deadlock deadlocks deal dealing deallocating deallocation deals dealt deamon death debug debugInit debugged debugging dec decExp decExponent decPt decSeen decapitalize decapitalized decapitalizing december decent decexp decide decided decides decimal decimalAt decimalPos decimalSeparator decimalSeparatorAlwaysShown decimals decipher decision decisionPointList decisionPointStack decisions declaration declarations declare declared declaredConstructors declaredFields declaredMethodCache declaredMethods declares declaring declaringClass decmp decmpLimit decmpMode decode decodeEndRule decodeRules decodeStartRule decodeStep decoded decoder decoders decodes decoding decomp decompose decomposed decomposing decomposition decompositionMode decompositions decorated decoration decorations decoupling decrease decreased decreases decreasing decrement decrementSize decremented decrementing decription dedeu dedicated deemed deems deep deepCopy deeper deepest deeply def defCl default defaultAllowUserInteraction defaultAssertionStatus defaultBufferCaps defaultBufferSize defaultByteBufferSize defaultCenturyStart defaultCenturyStartYear defaultCharBufferSize defaultConstraints defaultCountry defaultDataEnd defaultDomain defaultEvent defaultEventIndex defaultEventName defaultExceptionListener defaultExpectedLineLength defaultFocusTraversalKeyPropertyNames defaultFocusTraversalKeyStrings defaultFocusTraversalKeys defaultFocusTraversalPolicy defaultFractionDigits defaultImageCaps defaultLineMetrics defaultLocale defaultManager defaultPersistenceDelegate defaultPolicy defaultProperty defaultPropertyIndex defaultPropertyName defaultReadFields defaultReadObject defaultRenderer defaultSelection defaultSerializeEx defaultSubst defaultSubstName defaultUseCaches defaultVal defaultValue defaultWheelScroll defaultWriteFields defaultWriteObject defaultZone defaultallowuserinteraction defaulted defaulting defaults defaultusecaches defeats defensively defer deferrability deferred defers define defineClass defineClass0 defineClassInPackage definePackage defineSchemeSpecificPart defineString defineSystemPackage defineable defined defines definesEquals defining definitely definition definitions definitive deflt defocused deftransform degenerate degrade degrades degree degrees deisgn del delItem delItems delMenu delagatee delay delayed delays delegatation delegate delegated delegates delegating delegation delete deleteCharAt deleteEntry deleteObserver deleteObservers deleteOnExit deleteRow deleteShortcut deleted deletes deletesAreDetected deletion deletions delicate delim delimit delimited delimiter delimiters delimiting delimsChanged delineate deliver deliverEvent deliverMouseWheelToAncestor delivered delivers delivery delta deltaTransform deltaX deltaY demand demo demonstrates demos demoting demoweb den denial denied denies denom denominator denorm denormalized denotation denote denoted denotes denoting deny depend dependant dependencies dependency dependent dependents depending depends depicts deployed deployment deposited deprecate deprecated deprectated deprives deps depth depths deque dequeueKeyEvents dequeueResult deref deregister deregisterDriver deregistered deregistering deregistration derivation derive deriveFont derived derives desc descHandle descendant descendants descendantsCount descenders descending descends descent describe described describes describing description descriptions descriptive descriptor descriptors deselect deselected deselects deserializaiton deserialization deserialize deserializeEx deserialized deserializes deserializing desicion design designTime designate designated designates designating designator designed designfaq desirable desire desired desiredAssertionStatus desiredAssertionStatus0 desiredHeight desiredLanguage desiredLocale desiredPixelWidth desiredSpaceCount desiredWidth desires desirible desktop desktopProperties desktopPropsSupport despite dest destination destinations destined destroy destroyBuffers destroyProcess destroyed destroying destructiveMulAdd destructively detachDispatchThread detaches detail detailMessage detailed details detect detected detection detector detects determination determinations determine determined determines determining deterministic devBounds develop developLongDigits developer developers development deviate deviation deviations device deviceBounds devices devpress df dfd dg dge dgl dgt dh dhLong di dia diacrit diacritic diacritical diacriticals diacritics diaeresis diagnostic diagonal diagram dialog dialogs diameter diaresis dictionary dictionaryCharCount dictionaryChars dictionaryExpression dictionaryFilename dictionaryName dictionaryStream did didn die died dies diff differ difference differences differencing different differentiate differently differing differs diffh difficult diffw diffx diffy dig digest digestLen digestSpi digestSpiClone digesta digestb digests digit digitCount digitGroup digitIndex digitLeftCount digitList digitLoop digitPerLong digitRightCount digitTotalCount digital digitalSignature digitally digitno digits digitsPerInt digitsPerLong dim dimension dimensional dimensions din dinstint diode dir direct directed direction directional directionality directions directive directives directly directories directory dirs dirty disable disableEvents disableassertions disabled disabledIcon disables disabling disadvantage disallow disallowed disambiguate disambiguation disappear disappeared disc discard discardKeyEvents discarded discarding discards discerned disclose discloses disconnect disconnect0 disconnected disconnecting discontinuities discontinuity discouraged discover discovered discovers discrepancies discrete discretion discriminating discritics discuss discussing discussion disguise disguises disjoined disjoint disk dislay disparate dispatch dispatchEvent dispatchEventImpl dispatchEventToSelf dispatchKeyEvent dispatchMouseWheelToAncestor dispatchThread dispatched dispatcher dispatchers dispatches dispatching dispatchingEventTime disperses displaced display displayLocale displayName displayNames displayable displayed displaying displays disposal dispose disposeImpl disposed disposes disposing disque disregard disrupt distance distances distict distinct distinction distinctly distinguish distinguishable distinguishing distribute distributed distributes distribution disturbance dither dithered dithering div divLong divWord divadd divergent diverse divested divide divideAndRemainder divideOneWord divideUpDictionaryRange divided dividend dividendEstimate divides dividing dividingSpace divisible division divisor divisors divulge dk dkuug dl dle dlen dlist dlong dm dn dnd dnumber do doAccessibleAction doAutoTransfer doCallbacks doComplement doConnect doDispatch doGetImpl doInput doIntersection doLayout doLoad doMenuEvent doOutput doParseString doPrivileged doProperty doUnion doVerify doc doc4 docBase docRoot docbase docs document documentation documented documents does doesMaxRowSizeIncludeBlobs doesn doing doinput dollar dollars dom domStamp domain domainlabel domains dominated don done dong dont dontNeedEncoding dontUseGui doomed door dooutput dormant dot dotIndex dotless dots dotted double doubleArraySize doubleResult doubleToBigInt doubleToLongBits doubleToRawLongBits doubleValue doubled doubles doublesToBytes doubly dout dow dowStamp dowimStamp down downCycleDefaultFocusTraversalKeys downCycleFocusTraversalKeys downFocusCycle download downloaded downloading downstream downward downwards doyStamp dp1 dpi dpl dr drPepper draft drag dragged drags drain dramatic drastic draw draw3DRect drawArc drawBuffer drawBytes drawChars drawGlyphVector drawImage drawLine drawOval drawPolygon drawPolyline drawRect drawRenderableImage drawRenderedImage drawRoundRect drawString drawVBuffer drawable drawing drawn draws drift drive driven driver driverClass driverClassName drivers drives droits drop dropRaster dropTarget dropped drops ds dst dstArray dstBegin dstColorModel dstIn dstOffset dstOut dstSavings dst_position dstbegin dstoffset dstpixel dstpos dsts dsyOfWeek dt dtoa dtok dttl dude due duke dummy dump dumpConstraints dumpLayoutInfo dumpStack dumped dumps dup duplex duplicate duplicated duplicates duplicating duration during duty dval dver dx dx1 dx2 dy dy1 dy2 dynamic dynamicLayoutSupported dynamically dzdzo e e1 e123 e2 e3 eFieldStart eIndex eMask ePos eTbl ea each eagerly earlier earliest early earth easier easily easing east easts easy eat eating eats ebits echo echoChar echoCharIsSet echoed echoes echoing economical ed edge edges edh edit editable edited editing editor editorClass editorName editors edits edt edu education ee eetop ef effect effecting effective effectiveDecimalPos effectively effects efficiency efficient efficiently effort efforts eg eh ei eight eighth eine either ejection el elapsed elect elell elem element elementAt elementCount elementData elementary elements elen eleven eleventh eliminate eliminateBackfillStates eliminated eliminates eliminating elimination ellipse elliptical else elsewhere em email embLimit embStart embed embedded embedding embeddingLevel embeddingStart embeddings embodied embodies embraced emit emitPattern emits emitted emitting empirically employed employs emptiness empty emptyArray emptyEnumerator emptyIterator en en_US en_USCollator en_USRules en_US_WIN enable enableEvents enableExpertCommands enableInputMethods enableInputMethodsForTextComponent enableInputMethodsIfNecessary enableOverride enableReplace enableReplaceObject enableResolve enableResolveObject enableSubclassImplementation enableSubstitution enableTest enableassertions enabled enabledOnToolkit enables enabling enc encapsualtes encapsulate encapsulated encapsulates encapsulating enclose enclosed encloses enclosing encode encodeStep encoded encoder encoders encodes encoding encodingName encodings encompasses encounter encountered encounteredField encounters encourage encouraged encrypted encryption end endBitIndex endChar endCompare endComposition endDay endDayOfMonth endDayOfWeek endElement endIndex endLayout endMode endMonth endOfInput endPath endPos endPosition endRunIndex endState endStates endTime endTimeMode endUnitIndex endValidate endValue ended endian ending endoff endpoint endpoints ends endsWith eneng enforce enforced enforces enforcing eng engine engineAliases engineCache engineContainsAlias engineDeleteEntry engineDigest engineGenerateParameters engineGeneratePrivate engineGeneratePublic engineGenerateSeed engineGetCertificate engineGetCertificateAlias engineGetCertificateChain engineGetCreationDate engineGetDigestLength engineGetEncoded engineGetKey engineGetKeySpec engineGetParameter engineGetParameterSpec engineGetParameters engineInit engineInitSign engineInitVerify engineIsCertificateEntry engineIsKeyEntry engineLoad engineNextBytes engineReset engineSetCertificateEntry engineSetKeyEntry engineSetParameter engineSetSeed engineSign engineSize engineStore engineToString engineTranslateKey engineType engineUpdate engineVerify engineering engines enhancements enhancing enjoy enjoys enlarged enough enq enqueue enqueueKeyEvents enqueued enqueuedKeyEvents ensue ensure ensureCapacity ensureCapacityHelper ensureMemberAccess ensureOpen ensureRunBreak ensured ensures ensuring ent entail enter entered entering enters enth entire entirely entities entitled entity entries entry entryName entrySet entrySetCallCount entryTable enum enumerate enumerated enumerates enumerating enumeration enumerationValues enumerations enumerator env envelope environment environments envp eoepo eof eol eolIsSignificant eolIsSignificantP eot ephemeral epoch epochs epoint eq eqi equaivalent equal equalIgnoringCase equalPos equality equally equals equalsIgnoreCase equate equates equations equidistant equipped equiv equivalence equivalent equivalentTo equivalently equivalents er era eras erase err erratic errmsg erroneous erroneously error errorIndex errorOffset errors es esc escape escapeSpace escaped escapes escaping esd esds especially ess essential essentially esspa est estProduct establish established establishing estate estimate estimated et etb etc etchType etched etest eth etx euclidModInverse eueus euro ev eval evaluate evaluated evaluating evaluation even evenMod evenPart event eventBit eventDispatched eventEnabled eventException eventListener eventListenerType eventMask eventName eventPropertyName eventSetDescriptors eventSetName eventTypeEnabled eventlistener events eventsToDisable eventsToEnable eventually eventx eventy ever every everybody everyone everything everywhere evidence evident evolve evolved evt ex ex1 ex2 exact exactly exam examinations examine examined examines examining example examples exc excecute exceed exceeded exceeds except exception exceptionChars exceptionListener exceptionThrown exceptional exceptions excess excessBits excessChars excessive excessively excessivly exchange exchanged exchanges exclamation exclude excluded excludes excluding exclusive exclusively exec execInternal exeception execption executable execute executeBatch executeQuery executeStatements executeUpdate executed executes executing execution executionTime executions executive exemptions exercise exercised exhaust exhausted exhibit exist existed existence existing existingEntry existingEvent existingPaintEvent existingRect exists exit exitPoints exitStatus exitVM exitValue exitcode exited exiting exits exp expAffix expAt expBias expChars expIndex expLimit expLoop expMask expOffset expOne expOverflow expShift expSign expStack expVal expand expandAffix expandAffixes expandCapacity expandChars expandTable expanded expanding expandsion expansion expansions expect expectation expected expectedClose expectedMaxSize expectedModCount expecting expects expedite expeditiousness expend expense expensive exper experiment experimental experimentally expert experts expiration expire expired expires expiry explained explaing explaining explanation explanatory explicit explicitBeanInfo explicitEvents explicitMethods explicitProperties explicitly exponenet exponent exponentChar exponentDigits exponential exponentiate exponentiation exponents exported exports expose exposed exposes exposing expresison express expressed expressible expressing expression expressionCache expressions expressive exs ext extList extend extended extendidng extending extends extensible extension extensions extensively extent extentSize extents exterior external external_address externalizable externally extra extraAlpha extraByte extraInt extraPropFile extract extracted extracting extracts extraneous extraordinary extrapolating extreme extremely f f1 f2 f2ary fBits fDigits fExponent fFieldStart fRequestedAttributes fValue fa fabricate fac face faces facilitate facilitates facilities facility fact factor factored factories factors factory fafas fail failExpecting failed failing fails failure fair fairly fake faking fall fallback fallbackLanguage fallbackNames falls falpha false familiar families family fancy far farther farthest farthestEndPoint fashion fast fastTime faster fastest fatal faults faulty favor favorite fc fclz fd fdErr fdIn fdLock fdObj fdOut fdUseCount fdlibm fdm fdy fe fear feasible feature features feb28 feb29 feb31 february feed feeding feeds feel feels fequency fetch fetched fetching few fewer ff ffApply ffff fffffffff fi fichier fichiers field fieldID fieldInfo fieldName fieldNames fieldOffset fieldPosition fieldRefl fieldSigs fieldStart fieldType fieldValue fields fifin fifth fifty figits figure figures file fileName fileNameMap fileNameMapLoaded fileToEncodedURL filedlg fileform filelimits filename filenames filepart files filesystem fill fill3DRect fillArc fillBytes fillInStackTrace fillInTables fillOval fillPolygon fillRect fillRoundRect filled filler filling fills filter filterComponents filterKey filterValue filtered filtering filters final finalChar finalizable finalization finalizations finalize finalizeImpl finalized finalizer finalizers finally find findBootstrapClass findBootstrapClass0 findBundle findBundleInCache findClass findColumn findComponentAt findEditor findExplicitBeanInfo findInCharMap findIndexedPropertyType findKeyword findLastEntry findLastWithNoExtension findLibrary findLoadedClass findMethod findNative findPropertyType findPublicMethod findResource findResources findStringMatch findSystemClass findTraversalRoot finding finds fine finer fingerprint finish finishBuildingStateTable finishConnect finished finishing finite fins fire firePropertyChange fireVetoableChange fired fires firewall firing first firstChar firstColon firstDash firstDayOfWeek firstDot firstElement firstEntry firstExcluded firstExpansion firstGroupLen firstItem firstKey firstLength firstLine firstLower firstNonzeroByteNum firstNonzeroIntNum firstSearch firstSun firstTime firstUpper firstValue firstVisibleComponent fis fish fist fit fitness fits fitsIntoLong five fix fixAfterDeletion fixAfterInsertion fixCanonical fixDown fixEntry fixUp fixed fixedPoint fixup fjfij fl flag flagged flags flanked flat flatness flatten flattened flattening flattens flavor flavorMapFileURL flavormap flavors flexibility flexible flexiblity flip flipAction flipBit flipContents flipped flipping flips flm float floatToIntBits floatToRawIntBits floatValue floating floats floatsToBytes flocalized floor floorDivide flow flush flushAny flushBuffer flushCaches flushConvBuffer flushFromCaches flushInto flushPendingEvents flushed flushes flushing fly fmt fn fname focus focusCycleRoot focusGained focusGainedEvent focusL focusListener focusListenerK focusLost focusManagerIsDispatching focusMgr focusNextComponent focusOwner focusPreviousComponent focusRoot focusTraversalKeyPropertyNames focusTraversalKeys focusTraversalKeysEnabled focusTraversalPolicy focusability focusable focusableWindowState focused focusedComponent focusedWindow focusedWindowChangeAllowed focusedWindowChanged fofao folio follow followRedirects followed following follows font fontFile fontFormat fontName fontSerializedDataVersion fontSize fontSizeStr fontStream fontStyle fontType fontmanager fontname fonts foo fooBah fooBeanInfo fooEditor fooPattern foobah fool footprint for forCache forClass forDigit forName forName0 forParsing force force0 forceLower forced forceful forcefully forces forcibly forcing foregoing foreground foreign foreignCatalog foreignSchema foreignTable forever forgets forgetting forgotten forkAndExec forked form formal formally format formatData formatElementIndex formatError formatList formatNumber formatToCharacterIterator formats formatted formatter formatters formatting formed former formerly forms formula formulae forom forth forward forwardDefaultFocusTraversalKeys forwardFocusTraversalKeys forwardStateTable forwardTextAreaFocusTraversalKey forwardTraversalKeys forwarded forwarding forwards fos found foundInMainBranch four fourth fp fps fpx fr fr_FR fr__MAC fractAsInt fractBits fractHOB fractMask fraction fractionPresent fractional fractions fragment fragments frame frame1 frameList frameSerializedDataVersion frames framesInCommon framework franc fraught frc fred fredx fredxFIXME free freeMemory freed freeing french frenchSec frequency frequent frequently fresh freshly frfra frgbvalue friday friend friends fries from fromCIEXYZ fromClass fromElement fromIndex fromKey fromPage fromStart fromState fromType front frontCaps frozen frrom fruits fs ftp ftype fu fuction fudge fulfilling full fullClassName fullCopy fullName fullScreenExclusive fullScreenWindow fullSize fulltype fully fullyQualifiedClassName fum fun function functional functionality functionally functions fundamental fundamentally further furthest future fuzzy fvalue fwd fx fy fyfry g g1 g2 g2d gStart gagai gain gained gaining gains gap gap2 gaps garbage gathered gathering gc gcBounds gcd gct gd gdgdh ge geByAddr gen genKeyPair genParamSpec general generality generally generate generateCertificate generateFile generateKeyPair generateParameters generatePrivate generatePublic generateSeed generated generates generating generation generator generators generic generically genuine geographical geom geometric geometry gesture gestures get get2DigitYearStart getAWTEventListeners getAWTKeyStroke getAWTKeyStrokeForEvent getAbsoluteFile getAbsolutePath getAccessibleAction getAccessibleActionCount getAccessibleActionDescription getAccessibleAt getAccessibleChild getAccessibleChildrenCount getAccessibleComponent getAccessibleContext getAccessibleDescription getAccessibleIndexInParent getAccessibleName getAccessibleParent getAccessibleRole getAccessibleSelection getAccessibleSelectionCount getAccessibleStateSet getAccessibleText getAccessibleValue getAction getActionCommand getActionListeners getActions getActiveWindow getActualMaximum getActualMinimum getAddListenerMethod getAdditionalBeanInfo getAddress getAddressFromNameService getAdjustable getAdjustmentListeners getAdjustmentType getAdvance getAfterIndex getAlgorithm getAlgorithmProperty getAlgorithms getAlignment getAlignmentX getAlignmentY getAll getAllAttributeKeys getAllByName getAllByName0 getAllFonts getAllQualifyingCandidates getAllowUserInteraction getAlpha getAlphaMask getAmPmStrings getAnchorRect getAppContext getApplet getAppletContext getAppletInfo getApplets getArguments getArray getAsText getAscent getAsciiStream getAtIndex getAttribute getAttributeCheckRange getAttributes getAudioClip getAuthority getAutoCommit getAutoDelay getAvailableAttributes getAvailableFontFamilyNames getAvailableIDs getAvailableLocales getB getBackBuffer getBackBufferCapabilities getBackground getBaseLevel getBaseType getBaseTypeName getBaselineFor getBaselineIndex getBaselineOffsets getBeanClass getBeanDescriptor getBeanInfo getBeanInfoSearchPath getBeforeIndex getBeginIndex getBestConfiguration getBestCursorSize getBestRowIdentifier getBigDecimal getBinaryStream getBitDepth getBits getBlob getBlockDataMode getBlockIncrement getBlue getBlueMask getBoolean getBooleanAttributes getBooleanAttributes0 getBootstrapClassPath getBootstrapResource getBootstrapResources getBoundingBox getBounds getBounds2D getBreakInstance getBroadcast getBuffer getBufferCapabilities getBufferStrategy getBundle getBundleImpl getByAddr getByIndex getByName getByte getBytes getC getCPathConsumer getCachedAddress getCachedRaster getCachedStroke getCalendar getCalendarDate getCalendarField getCallerClass getCallerClassLoader getCalls getCanonName getCanonicalFile getCanonicalHostName getCanonicalPath getCapabilities getCaretPosition getCatalog getCatalogName getCatalogSeparator getCatalogTerm getCatalogs getCause getCeilEntry getCertificate getCertificateAlias getCertificateChain getCertificates getChannel getChar getCharB getCharCount getCharL getCharOrder getCharacterAttribute getCharacterBounds getCharacterEncoding getCharacterInstance getCharacterIterator getCharacterStream getChars getCharsetName getCheckBoxGroup getCheckboxGroup getChild getChildren getClass getClassContext getClassDataLayout getClassDataLayout0 getClassLoader getClassLoader0 getClassLoaderPerm getClassName getClassSignature getClasses getClickCount getClip getClipBounds getClipRect getClob getCodeBase getCodeSource getCodeSourceURL getCollationElementIterator getCollationKey getColor getColor1 getColor2 getColorComponents getColorModel getColorSpace getColumnClassName getColumnCount getColumnDisplaySize getColumnLabel getColumnName getColumnPrivileges getColumnType getColumnTypeName getColumns getComponent getComponentAfter getComponentAt getComponentBefore getComponentCount getComponentListeners getComponentOrientation getComponentType getComponents getComponents_NoClientCode getComposite getConcurrency getConfigurations getConnection getConstraints getConstructor getConstructor0 getConstructors getConstructors0 getConstructors1 getContainerListeners getContainingWindow getContent getContentEncoding getContentHandler getContentHandlerPkgPrefixes getContentLength getContentPane getContentType getContentTypeFor getContents getContext getContextClassLoader getContractOrder getContractValues getConverter getCopies getCount getCountry getCreationDate getCriticalExtensionOIDs getCrossReference getCrossings getCurrency getCurrencyCode getCurrencyInstance getCurrencySymbol getCurrent getCurrentAccessibleValue getCurrentFocusCycleRoot getCurrentKeyboardFocusManager getCursor getCursorName getCursorType getCustomEditor getCustomizerClass getD getDSTSavings getDashArray getDashPhase getData getDataElements getDataOffset getDataSize getDataStorage getDatabaseMajorVersion getDatabaseMinorVersion getDatabaseProductName getDatabaseProductVersion getDate getDateFormatSymbols getDateFormatZoneData getDateInstance getDateTimeInstance getDay getDayOfWeek getDebug getDecimalFormatSymbols getDecimalSeparator getDeclaredClasses getDeclaredClasses0 getDeclaredConstructor getDeclaredConstructors getDeclaredField getDeclaredFields getDeclaredMethod getDeclaredMethods getDeclaredSUID getDeclaredSerialFields getDeclaringClass getDecomposition getDecompositions getDefault getDefaultAllowUserInteraction getDefaultComponent getDefaultConfiguration getDefaultCursor getDefaultDomain getDefaultEncodingName getDefaultEventIndex getDefaultFocusTraversalKeys getDefaultFocusTraversalPolicy getDefaultFractionDigits getDefaultParent getDefaultPort getDefaultPropertyIndex getDefaultRequestProperty getDefaultScreenDevice getDefaultSelection getDefaultSerialFields getDefaultToolkit getDefaultTransactionIsolation getDefaultTransform getDefaultType getDefaultUseCaches getDescent getDesktopProperty getDestination getDevice getDeviceConfiguration getDialog getDigestLength getDigit getDirectionality getDirectory getDispatchThread getDispatcher getDispatchingEventTime getDisplayCountry getDisplayLanguage getDisplayMode getDisplayModes getDisplayName getDisplayVariant getDisplayVariantArray getDisplayXXX getDoInput getDoOutput getDocumentBase getDomainCombiner getDouble getDoubleB getDoubleL getDrawGraphics getDriver getDriverMajorVersion getDriverMinorVersion getDriverName getDriverProperties getDriverVersion getDrivers getDropTarget getDropTargetEventTarget getEchoChar getEditorSearchPath getElementAt getEncoded getEncoding getEndCap getEndIndex getEngineClassName getEntry getEntryName getEnumeration getEpochDay getEras getErrorCode getErrorIndex getErrorOffset getErrorStream getErrorsAny getErrorsID getEventMask getEventPropertyName getEventQueue getEventSetDescriptors getException getExceptionListener getExceptionTypes getExpandValueList getExpiration getExponentialSymbol getExportedKeys getExtendedState getExtension getExternalizableConstructor getExtraNameCharacters getFD getFamily getFamilyName getFamily_NoClientCode getFetchDirection getFetchSize getField getField0 getFieldAttribute getFieldDelegate getFieldInfo getFieldInfo0 getFieldOffset getFieldValue getFields getFields0 getFields1 getFile getFileDescriptor getFileName getFileNameMap getFilePointer getFileSystem getFilenameFIlter getFilenameFilter getFilterComponents getFirst getFirstComponent getFirstDayOfWeek getFlags getFlipContents getFloat getFloatB getFloatL getFocusCycleRootAncestor getFocusListeners getFocusOwner getFocusTraversalKey getFocusTraversalKeys getFocusTraversalKeysEnabled getFocusTraversalKeys_NoIDCheck getFocusTraversalPolicy getFocusableWindowState getFocusedWindow getFollowRedirects getFont getFontList getFontMetrics getFontName getFontPeer getFontRenderContext getFont_NoClientCode getFoo getFooListeners getForeground getFormat getFormats getFormatsByArgumentIndex getFragment getFrames getFred getFromCache getFromClass getFromPage getFrontBufferCapabilities getFullName getFullScreenWindow getGeneratedKeys getGetClassLoaderPerm getGetListenerMethod getGlobalActiveWindow getGlobalCurrentFocusCycleRoot getGlobalFocusOwner getGlobalFocusedWindow getGlobalPermanentFocusOwner getGraphics getGraphicsConfiguration getGreatestMinimum getGreen getGreenMask getGregorianChange getGroupingSeparator getGroupingSize getGuarantor getHAdjustable getHSBColor getHScrollbarHeight getHeaderField getHeaderFieldDate getHeaderFieldInt getHeaderFieldKey getHeaderFields getHeadlessProperty getHeight getHelpMenu getHgap getHierarchyBoundsListeners getHierarchyListeners getHoldability getHost getHostAddress getHostByAddr getHostFromNameService getHostName getHours getID getIDstring getIP getISO3Country getISO3Language getISOCountries getISOLanguages getISOYear getIcon getIconAt getIconImage getIdentifierQuoteString getIdentity getIfModifiedSince getIgnoreRepaint getImage getImageCapabilities getImpl getImplementationTitle getImplementationVendor getImplementationVersion getImplicitDownCycleTraversal getImportedKeys getInCheck getIndex getIndexAtPoint getIndexInfo getIndexedPropertyType getIndexedReadMethod getIndexedWriteMethod getInetAddress getInetAddresses getInfinity getInfo getInheritableMethod getInheritedAccessControlContext getInitialComponent getInput getInputContext getInputLength getInputMethodListeners getInputMethodRequests getInputStream getInsets getInstance getInstanceFollowRedirects getInstanceOf getInstanceof getInt getIntB getIntL getInteger getIntegerInstance getInterface getInterfaces getInternalPersistenceDelegate getInternationalCurrencySymbol getInternedColorModel getInvocationHandler getIssuerDN getItalicAngle getItem getItemAt getItemCount getItemImpl getItemListeners getItems getIterator getJDBCMajorVersion getJDBCMinorVersion getJarEntry getJarFile getJarFileURL getJavaInitializationString getKeepAlive getKey getKeyChar getKeyCode getKeyEventChar getKeyEventDispatchers getKeyEventPostProcessors getKeyEventType getKeyListeners getKeyModifiersText getKeySpec getKeyText getKeyUsage getKeymap getKeys getLabel getLanguage getLast getLastComponent getLastModifed getLastModified getLastModifiedTime getLauncher getLayout getLayoutAlignment getLayoutAlignmentX getLayoutAlignmentY getLayoutDimensions getLayoutInfo getLayoutOrigin getLayoutWeights getLcidFromLocale getLeading getLeastMaximum getLength getLevelAt getLimits getLineIncrement getLineInstance getLineIterator getLineJoin getLineMetrics getLineNumber getLineWidth getListener getListenerCount getListenerMethod getListenerMethodDescriptors getListenerMethodName getListenerMethods getListenerType getListeners getLoader getLocalAddress getLocalDesc getLocalGraphicsEnvironment getLocalHost getLocalHostName getLocalPatternChars getLocalPort getLocale getLocaleElements getLocalizedInputStream getLocalizedMessage getLocalizedOutputStream getLocation getLocationOnScreen getLocationOnScreen_NoTreeLock getLockingKeyState getLogStream getLogWriter getLogicalBounds getLoginTimeout getLong getLongB getLongL getLoopbackMode getLowestSetBit getMainAttributes getMainTableEntry getMajorVersion getManifest getMapSize getMask getMatrix getMaxAdvance getMaxAscent getMaxBinaryLiteralLength getMaxBytesPerChar getMaxCatalogNameLength getMaxCharBounds getMaxCharLiteralLength getMaxCharsPerByte getMaxColumnNameLength getMaxColumnsInGroupBy getMaxColumnsInIndex getMaxColumnsInOrderBy getMaxColumnsInSelect getMaxColumnsInTable getMaxConnections getMaxCursorNameLength getMaxDecent getMaxDescent getMaxExpansion getMaxFieldSize getMaxIndexLength getMaxPage getMaxPriority getMaxProcedureNameLength getMaxRowSize getMaxRows getMaxSchemaNameLength getMaxSecOrder getMaxStatementLength getMaxStatements getMaxTableNameLength getMaxTablesInSelect getMaxTerOrder getMaxUserNameLength getMaximizedBounds getMaximum getMaximumAccessibleValue getMaximumCursorColors getMaximumDecomposition getMaximumFractionDigits getMaximumIntegerDigits getMaximumSize getMedia getMenu getMenuBar getMenuComponents getMenuCount getMenuCountImpl getMenuImpl getMenuShortcutKeyMask getMesage getMessage getMessageDigest getMetaData getMethod getMethod0 getMethodDescriptors getMethodInfo getMethodInfo0 getMethodName getMethodSignature getMethods getMethods0 getMethods1 getMin getMinPage getMinSize getMinimalDaysInFirstWeek getMinimum getMinimumAccessibleValue getMinimumFractionDigits getMinimumIntegerDigits getMinimumSize getMinorVersion getMinusSign getMinutes getMissingGlyphCode getMiterLimit getMode getModifiers getMonetaryDecimalSeparator getMonth getMonths getMoreResults getMostRecentFocusOwner getMouseEventTarget getMouseEventTargetImpl getMouseListeners getMouseMotionListeners getMouseWheelListeners getMultipleDocumentHandling getMultiplier getNaN getName getNanos getNativeContainer getNativeFocusOwner getNativeFocusedWindow getNegative getNegativePrefix getNegativePrefixFieldPositions getNegativeSuffix getNegativeSuffixFieldPositions getNetworkInterface getNetworkInterfaces getNewValue getNextEnumWithMore getNextEvent getNextException getNextWarning getNormalizingTransform getNumChars getNumComponents getNumDataElements getNumGlyphs getNumObjFields getNumber getNumberFormat getNumberInstance getNumericFunctions getNumericValue getOOBInline getObjFieldValues getObject getObjectStreamClass getOffset getOffsets getOffsetsByWall getOldEventKey getOldValue getOppositeComponent getOppositeWindow getOption getOrientation getOrientationRequested getOrigin getOutputStream getOwnedWindows getOwner getOwningFrameDialog getPDperm getPSName getPackage getPackages getPageDimension getPageIncrement getPageRanges getPageResolution getPaint getParameter getParameterClassName getParameterCount getParameterDescriptors getParameterInfo getParameterMetaData getParameterMode getParameterSpec getParameterType getParameterTypeName getParameterTypes getParameters getParent getParentFile getParent_NoClientCode getPassword getPasswordAuthentication getPath getPathIterator getPathSeparator getPattern getPatternSeparator getPeer getPeer_NoClientCode getPerMill getPercent getPercentInstance getPermanentFocusOwner getPermission getPermissionCollection getPermissions getPersistenceDelegate getPixelColor getPixelSize getPixelStride getPoint getPoint1 getPoint2 getPolicy getPolicyNoCheck getPort getPositivePrefix getPositivePrefixFieldPositions getPositiveSuffix getPositiveSuffixFieldPositions getPrecedingEntry getPrecision getPredefinedCursor getPreferredSize getPrefixLength getPrimDataSize getPrimFieldValues getPrimaryKeys getPrimitiveClass getPrincipal getPrincipals getPrintJob getPrintQuality getPrinter getPrinterResolution getPriority getPrivate getPrivateField getPrivateKey getPrivateMethod getPrngAlgorithm getProcedureColumns getProcedureTerm getProcedures getPropagationId getProperties getProperty getPropertyChangeEvent getPropertyChangeListeners getPropertyDescriptor getPropertyDescriptors getPropertyEditorClass getPropertyInfo getPropertyName getPropertyType getProtectionDomain getProtectionDomain0 getProtocol getProtocolVersion getProvider getProviderName getProviderProperty getProviders getProvidersNotUsingCache getProxyClass getPublic getPublicDeclaredMethods getPublicKey getQuery getQueryTimeout getRGB getRGBColorComponents getRGBComponents getRGBPixel getRGBPixels getRGBdefault getRGBs getRanges getRaster getRawOffset getRead getReadMethod getReason getReceiveBufferSize getRed getRedMask getRef getReflectionFactory getReflector getRefreshRate getRegistry getRemoveListenerMethod getRenderingHint getRenderingHints getRequestMethod getRequestProperties getRequestProperty getRequestingHost getRequestingPort getRequestingPrompt getRequestingProtocol getRequestingScheme getRequestingSite getRequestingXXX getResolveParent getResource getResourceAsStream getResources getResponseCode getResponseMessage getResultSet getResultSetConcurrency getResultSetHoldability getResultSetType getReturnType getReuseAddress getRootGroup getRow getRows getRule getRules getRunCount getRunLevel getRunLimit getRunStart getRuntime getSQLKeywords getSQLState getSQLStateType getSQLType getSQLTypeName getSavepointId getSavepointName getScale getScaleX getScaleY getScaledInstance getScanlineStride getSchemaName getSchemaTerm getSchemas getScheme getSchemeSpecificPart getScientificInstance getScope getScreenDevices getScreenInsets getScreenResolution getScreenSize getScrollAmount getScrollPosition getScrollType getScrollbarDisplayPolicy getScrollbarVisibility getSearchStringEscape getSeconds getSecureRandomSpi getSecurityContext getSecurityManager getSeed getSelectedCheckbox getSelectedIndex getSelectedIndexes getSelectedItem getSelectedItems getSelectedObjects getSelectedText getSelectionEnd getSelectionStart getSendBufferSize getSentenceInstance getSentenceIterator getSeparator getSerialFields getSerialVersionUID getSerializableConstructor getShape getShearX getShearY getShort getShortB getShortDescription getShortL getShortMonths getShortWeekdays getShortcut getShortcutMenuItem getSides getSignature getSignerPrivateKey getSigners getSize getSize2D getSoLinger getSoTimeout getSocket getSocketAddress getSource getSourceString getSpecificationTitle getSpecificationVendor getSpecificationVersion getStackAccessControlContext getStackTrace getStackTraceDepth getStackTraceElement getStandardName getState getStateChange getStatement getStatus getStream getStreamKeys getStrength getStrikethroughOffset getStrikethroughThickness getString getStringArray getStringBounds getStringFunctions getStroke getStyle getSubElements getSubString getSubjectDN getSuperDesc getSuperTables getSuperTypes getSuperclass getSurfaceData getSymbol getSystemClassLoader getSystemClipboard getSystemCustomCursor getSystemEventQueue getSystemEventQueueImpl getSystemFunctions getSystemPackage getSystemPackage0 getSystemPackages getSystemPackages0 getSystemResource getSystemResourceAsStream getSystemResources getSystemScope getSystemSelection getSystemTimeZoneID getTTL getTabCount getTableName getTablePrivileges getTableTypes getTables getTags getTarget getTargetBeanDescriptor getTargetDefaultEventIndex getTargetDefaultPropertyIndex getTargetEventInfo getTargetException getTargetMethodInfo getTargetPropertyInfo getTcpNoDelay getTempDir getText getTextListeners getThreadGroup getTime getTimeDateFunctions getTimeImpl getTimeInMillis getTimeInstance getTimeOfDay getTimeToLive getTimeZone getTimeout getTimestamp getTimezoneOffset getTitle getTitleAt getToPage getToolkit getToolkitImpl getTrafficClass getTransactionIsolation getTransferData getTransferSize getTransform getTranslateX getTranslateY getTransparency getTreeLock getType getTypeCode getTypeInfo getTypeMap getTypeString getUDTs getURL getURLStreamHandler getURLs getUTFLength getUnderlineOffset getUnderlineThickness getUnderlyingToolkit getUnicodeOrder getUnicodeStream getUnitIncrement getUnresolvedPermissions getUpdateCount getUpdateCounts getUpdateRect getUseCaches getUserInfo getUserName getVAdjustable getVKValue getVScrollbarWidth getValue getValueData getValueIsAdjusting getValueString getVariant getVariantFor getVersion getVersionColumns getVetoableChangeListeners getVgap getViewportSize getVisible getVisibleAmount getVisibleIndex getWarningString getWarnings getWeekdays getWheelRotation getWhen getWidth getWidths getWindingRule getWindow getWindowFocusListeners getWindowListeners getWindowStateListeners getWordInstance getWordIterator getWriteMethod getX getXXX getXxxxInstance getY getYear getZeroDigit getZoneIndex getZoneStrings getenv getfield gets gett getter getterExc getterName getters getting gfx gif give given gives giving glglg global glue glyph glyphCode glyphCodes glyphs gmt gmtFormatter gname gngrn go goCombiner goal goals gods goes going gone good goodIterator gopher got gotDouble gotFocus gotNegative gotPositive gothic gotten govern governed governing governs grab grabbing grabs gracefully grade gradient grammar grammatical grant granted grantee granting grantor grants graph grapheme graphical graphics graphicsConfig graphicsenv graphs grave gray great greater greatest greatly greedy green greenc gregorianCutover gregorianCutoverYear gregorianEpochDay grey grid gridHeight gridWidth gridX gridY gridbag gridheight grids gridwidth gridx gridy groan group groupAddr groupChars groupList groupVal grouped grouping groupingCount groupingSeparator groupingSize groupingUsed groups groupsSnapshot grow growEntries growSpine growable growing grown grows growth gs gt guantlet guarantee guaranteed guaranteeing guarantees guarantor guard guarded guarding guards guess guessContentTypeFromName guessContentTypeFromStream guessVersion guessing guguj gui guiAvailable guide gv h h2 h3 h4 hAdjustable hAdjustableValue hacek hack had hadAnnotations hadn hahau hair half halfULP halfUlp halt halted halts halves hamburger hand handed handle handleError handleEvent handleException handleGetObject handleNext handlePrevious handleReset handleShortcut handleSpecialSubstitution handleWheel handleWheelScrolling handled handler handler2 handlerClassName handlerPropName handlers handles handlesWheelScrolling handling hands handy hang hanging hangs hangulToJamo happen happened happens happily happy hard hardValueOf hardcoded hardware harmless harmlessly has hasAllPermission hasBlockExternalData hasChanged hasData hasDesc hasException hasExited hasFocus hasJamo hasListeners hasMore hasMoreElements hasMoreTokens hasNext hasNonPublicInterface hasPrevious hasReadObjectMethod hasReadObjectNoDataMethod hasReadResolveMethod hasRemaining hasSameRules hasStaticInitializer hasUniformLineMetrics hasWriteObjectData hasWriteObjectMethod hasWriteReplaceMethod hasalpha hash hashBytes hashCode hashCodeCache hashCodes hashEntrySet hashIgnoringCase hashIterator hashcode hashcodes hashed hashes hashing hashmap hashtable hashtableFilter hashtableNull hashtables hasn hastable hat have haveDash haveEquals haveLeftoverChar haveNextNextGaussian havePipe haveTilde haven having havoc hb hbarHeight hbarOn hbuf he head headMap headSet header headerSize headers headless heap heavily heavy heavyweight heavyweightButtonDown heavyweightRequests hedge heheb height heights heirarchy held hello help helpMenu helper helps hemisphere hence henceforth her here hereinafter hertz heterogeneous heterogenous heuristic heuristics hex hex4 hexDigit hexadecimal hexidecimal hexpart hexpost hexseq hgap hh hhmm hi hibyte hid hidden hide hideAndDisposeHandler hides hiding hierarchical hierarchically hierarchies hierarchy hierarchyBounds hierarchyBoundsL hierarchyBoundsListener hierarchyBoundsListenerK hierarchyChanged hierarchyL hierarchyListener hierarchyListenerK high highBad highBit highBits highEndpoint highMask highPart highWord highbit highbyte higher highest highestLevel highestUnit highlight highlightInner highlightOuter highlighted highlighting highly hihin hinders hint hintKey hintValue hintmap hints hir hira hiragana his historial historical historicalName historically hit hitClip hits hjb hn hode hogs hoisted hold holdability holder holding holds holdsLock hole holes home homed homogeneous honor honored hoo hook hooks hope hopefully horizontal horizontalScrollBar horizontally horn horz host hostAddress hostName hosted hostile hosting hostname hostnames hostport hosts hostsEqual hot hotSpot hotjava hotspot hour hourOfDayStamp hourStamp hourString hours how howev however howto hr href hrhrv hrs hs hs122 hsbvals hsdev ht htab html html40 http hue huge huhun hulpbias human humans hung hurt hv hvvliet hw hwAncestor hwAncestorPeer hwFocusRequest hybridGCD hyhye hypen hyph hyphen hyphenated hyphens hypothetical i i1 i18n i2 i386 iCount iDigits iFieldEnd iFieldStart iValue ia iaContainerObj iaddr iae iae1 iaina iana ibm icm icmpContext icolrel icon iconKind iconic iconification iconified iconify icons icr ics id idName idString idea identical identically identifers identification identified identifier identifiers identifies identify identifying identities identity identityEquals identityHashCode identityName identitydb identitymap ideograph ideographic ideographs idind idiom idioms idle idref idrefName idrefs ids idx idy ie ieile ietf if ifModifiedSince ifaceNames ifaces ifcs iff ifmodifiedsince ignorable ignorables ignore ignoreCase ignoreChars ignoreEnabled ignoreLF ignoreNegativeZero ignoreRepaint ignored ignores ignoring ih ii iiRas iir ikipk ilim ill illegal illegally illustrates illustrating ilog10 ils im image imageCache imageCaps imageObserver imageUpdate imagedata imagelength imageoffset images imagine imaging img img1 imgs immediate immediately immediatly immune immunity immutable immutables impact imperative impl implAccept implClass implName implTitle implVendor implVersion implcitly implement implementable implementation implementations implemented implementer implementers implementing implementor implementors implements implication implications implicit implicitDownCycleTraversal implicitly implied implies impliesIgnoreMask impltitle implvendor implversion imply implying import importance important importantly imported importedKeyCascade importedKeyInitiallyDeferred importedKeyInitiallyImmediate importedKeyNoAction importedKeyNotDeferrable importedKeyRestrict importedKeySetDefault importedKeySetNull importedNoAction imports impose imposed imposes imposing imposition impositions impossible impractical improper improperly improve improved improving in inChars inCheck inClass inClassLoader inData inDaylightTime inDefaultEventSet inLimit inLocale inMark inOff inPalette inProxyWeTrust inQuote inRange inRange2 inReady inSendMessage inSpan inStream inaccessible inaccuracies inaccuracy inaccurate inactive inactiveCaption inactiveCaptionBorder inactiveCaptionText inactivity inadvertent inadvisable iname inapplicable inappropriate incCount incRate incXAcross incXDown incYAcross incYDown inch inclined include includeSelf included includes including inclusive incoming incompatibilites incompatibilities incompatibilities1 incompatible incompatibly incomplete inconceivable inconsistencies inconsistency inconsistent incorporate incorporated incorrect incorrectly increase increased increases increasing increment incrementSize incremental incrementalDraw incrementaldraw incrementally incremented incrementing increments incurred incurring ind indecated indeed indefinite indefinitely indent indentation indention independent independently indeterminate index indexBound indexInParent indexOf indexOfSubList indexStaticProviders indexed indexedBinarySearch indexedGetter indexedGetterName indexedPropertyType indexedReadMethod indexedSetter indexedSetterName indexedWriteMethod indexes indexing indicate indicated indicates indicating indication indications indicator indices indicies indirect indirectly indistinguishable individual individually induced ine inefficiency inefficient inet inetAddr inet_ntop inet_pton inet_pton4 inetaddr inexact inf infAddress infLock inferior infinite infinitely infinity influence info infoText infoflags inform information informationi informative informed infos infrastrcure infrastructure ing inherent inherently inherit inheritable inheritableThreadLocals inheritance inherited inheritedAccessControlContext inheritedContext inheriting inherits inind init initBean initCapacity initCause initCl initCursorDir initDispatchThread initIDs initNonProxy initPolicy initProperties initProto initProxy initRNG initSign initState initValue initVerify init_with_ip initial initialCapacity initialCheckSecTer initialSize initialState initialValue initialiser initialization initializations initialize initializeData initializeDefaultCentury initializeDesktopProperties initializeFocusTraversalKeys initializeFont initializeJavaAssertionMaps initializePath initializeStatic initializeSystemClass initializeSystemScope initialized initializer initializers initializes initializing initially initiate initiated initiates initiating initiation initted ink inline inlined inlines innards inner innerURL innocuous inplemented input inputContext inputContextLock inputLength inputListenerK inputMethodL inputMethodListener inputMethodListenerK inputMethodTextChanged inputMethodsEnabled input_method_segment inputs inquire ins insecure insenitive insensitive insert insertElementAt insertProvider insertProviderAt insertRow insertSeparator insertTargetMapping insertText inserted inserting insertion insertionIndex insertionPoint insertions inserts insertsAreDetected inset insets inside insideBorder insideness insignificant insist insisting insofar inspection install installFields installation installed installing instance instanceCountsByClassName instanceFollowRedirects instanceMap instanceName instanceNumber instanceOf instanceof instances instaniate instant instantiability instantiate instantiated instantiates instantiating instantiation instead insterface instituted institution instructed instruction instructions instructs insufficient insure int int0 int1 int2 int3 intArrayCmp intArrayCmpToLen intBitsToFloat intDecimalDigits intIndex intKey intLen intLength intLevel intList intNum intRadix intString intToRawIntBits intVal intVals intValue intact intances integer integerDigits integers integral integrated integrates integrity intel intend intended intends intent intentionally intents inter interQuoteCount interact interaction interactions interactive interafce interdependent interest interestMask interested interesting interests interface interfaces interfere interferes interior interleaved interline intermediate intermixed intern internal internalAt internalComplement internalDifference internalFindMethod internalGet internalGetEra internalIntersection internalPersistenceDelegates internalSet internalSetIndex internalUnion internally internals international internationalization internationalized interned internet interoperability interoperatbility interoperation interp interpolation interposed interpret interpretation interpretations interpreted interpreter interpreting interprets interprocess interrupt interrupt0 interruptBlocking interrupted interruptedException interruptible interrupting interruption interrupts intersect intersected intersection intersects interval intervals intervene intervening inteter intially intlCurrencySymbol into intricacies introduce introduced introduces introducing introduction introspection introspector ints intuitive intuitively intval inv invalid invalidate invalidateLayout invalidateSMCache invalidateTree invalidated invalidates invariant invariants invention inverse inverseIndex inverseMod32 inverses invert invertResult inverted invertible investigates invisible invisibly invite invocation invocations invoice invoke invokeAndWait invokeLater invokeReadObject invokeReadObjectNoData invokeReadResolve invokeStatement invokeWriteObject invokeWriteReplace invoked invoker invokerScreenLocation invokerSize invokes invoking involve involved involves involving io ioe ioffset iota ip ipaddress ipadx ipady iport ipv6 ipv6byteCount irast irowrel irregular irregularly irrelevant irrespective irrevocably is isAMappedBuffer isAbsolute isAccelerated isAcceptable isAccessible isAccessibleChildSelected isActionKey isActive isAdjusting isAfterLast isAlive isAncestor isAncestorOf isAntiAliased isAnyLocalAddress isArg isArgument isArray isAssignableFrom isAutoIncrement isAutoWaitForIdle isBackgroundSet isBeforeFirst isBlocking isBold isBound isBoundary isCaching isCaseSensitive isCatalogAtStart isCertificateEntry isClickOrphaned isClosed isClosedOrPending isCompatibleValue isCompatibleWith isConnectable isConnected isConstrained isConstraintSatisfied isConsumed isControlDown isCriterionSatisfied isCurrency isCurrencyFormat isCursorSet isCyclic isDaemon isDecimalSeparatorAlwaysShown isDefined isDefinitelyWritable isDesignTime isDestroyed isDigit isDirect isDirectory isDispatchThread isDispatching isDisplayChangeSupported isDisplayable isDone isDoubleBuffered isDynamicLayoutActive isDynamicLayoutSet isEditable isEmpty isEnabled isEnabledImpl isEndState isEqual isErrorAny isErrorID isEven isEventHandler isExceptional isExpert isExponent isExternalizable isFile isFilterableDCM isFilterableICM isFirst isFirstCallToNext isFocusCycleRoot isFocusOwner isFocusTraversable isFocusTraversableOverridden isFocusTraversalPolicySet isFocusable isFocusableWindow isFocused isFontSet isForegroundSet isForeignDrag isFrameStateSupported isFred isFrenchSec isFullScreenRequired isFullScreenSupported isGraphicsConfigSupported isGregorian isGroupingUsed isGuiAvailable isHeadless isHeadlessInstance isHelpMenu isHidden isHorizontal isIPv4CompatibleAddress isIPv4MappedAddress isIPv6Supported isISOControl isIdentifierIgnorable isIdentity isIgnorable isInDefaultEventSet isInc isIndexSelected isInfinite isInputOpen isInputShutdown isInstance isInstanceOf isInstantiable isInteger isInterface isInterrupted isItalic isJavaIdentifierPart isJavaIdentifierStart isJavaLetter isJavaLetterOrDigit isKeyEntry isLTR isLaoBaseConsonant isLaoPreVowel isLast isLeap isLeapYear isLeftToRight isLenient isLetter isLetterOrDigit isLightweight isLinkLocalAddress isLoaded isLoaded0 isLongMIN_VALUE isLoopbackAddress isLoopingState isLowerCase isMCGlobal isMCLinkLocal isMCNodeLocal isMCOrgLocal isMCSiteLocal isMarkState isMaskOK isMirrored isMixed isModal isMouseButtonPressed isMouseInNativeContainer isMouseOverMe isMultiBufferAvailable isMulticastAddress isMultipleMode isNaN isNativeMethod isNegative isNormal isNullable isOdd isOn isOnKeyRelease isOne isOpaque isOpen isOutputOpen isOutputShutdown isOverIgnore isPacked isPageFlipping isPaintPending isPaintable isParseIntegerOnly isPeerEvent isPeerOK isPlain isPopupTrigger isPositive isPreferred isPreferredSizeSet isPrim isPrimitive isPrivileged isProbablePrime isProxy isProxyClass isPublic isRTL isReadOnly isReadable isRecursivelyVisible isRegistered isRelPath isRelative isResizable isSEAsianSwapping isSealed isSearchable isSelected isSerializable isServer isSet isShiftDown isShowing isShutdown isSigned isSiteLocalAddress isSource isSpace isSpaceChar isSpecialChar isStandardAttr isStatic isSubclass isSuper isSupported isTearOff isTemporary isThaiBaseConsonant isThaiPreVowel isTimeSet isTitleCase isTransformed isTransient isTrueVolatile isUndecorated isUnicast isUnicodeIdentifierPart isUnicodeIdentifierStart isUnresolved isUnshared isUpperCase isValid isValidProtocol isVertical isVisible isWheelScrollingEnabled isWhitespace isWritable isZero isbn ish isi isisl isn iso iso4217currency iso639 isoCountries isoDoy isoLanguages isoYear isolate isolated isolating isolation isone issue issued issues istream isused it italic italicized italy ite item itemCopies itemL itemListener itemListenerK itemStateChanged itemized items itemsRead iter iterCache iterate iterated iterates iterating iteration iterations iterative iterator iteratorBinarySearch iterators ith itita itl itr its itself itype itypesPhrase iuiku iv ivalue iw iwheb ix iy j j2se ja jaString jacobiSymbol jajpn jamoToHangul jamos jan jan31 january january1 janx20 jar jarConnection jarFileURL jarFileURLConnection java java2d javaHome javaIncrement java_awt_BorderLayout_PersistenceDelegate java_awt_CardLayout_PersistenceDelegate java_awt_Choice_PersistenceDelegate java_awt_Component_PersistenceDelegate java_awt_Container_PersistenceDelegate java_awt_GridBagLayout_PersistenceDelegate java_awt_MenuShortcut_PersistenceDelegate java_awt_Menu_PersistenceDelegate java_awt_SystemColor_PersistenceDelegate java_g java_lang_Class_PersistenceDelegate java_lang_Compiler_start java_lang_String_PersistenceDelegate java_lang_reflect_Field_PersistenceDelegate java_lang_reflect_Method_PersistenceDelegate java_util_AbstractList_PersistenceDelegate java_util_AbstractMap_PersistenceDelegate java_util_Hashtable_PersistenceDelegate java_util_List_PersistenceDelegate java_util_Map_PersistenceDelegate javabeans javac javadoc javax javax_swing_DefaultComboBoxModel_PersistenceDelegate javax_swing_DefaultListModel_PersistenceDelegate javax_swing_JComponent_PersistenceDelegate javax_swing_JFrame_PersistenceDelegate javax_swing_JMenu_PersistenceDelegate javax_swing_JTabbedPane_PersistenceDelegate javax_swing_ToolTipManager_PersistenceDelegate jdbc jdbcCompliant jdk jfc jhome ji jis jit jiyid jks jls jniVersion job jobAttributes jobs jobtitle join joinGroup joined joining joins jong jongseong jpeg jpg jsafe julian julianDate julianDay julianDayToDayOfWeek julianDayToMillis julianEpochDay july jump jumps june jung jungseong just justified jwjaw jwrd k k1 k2 kAsciiValues kCanonicalIndex kCanonicalValues kCharacterAsciiValues kCharacterBackwardData kCharacterBackwardTable kCharacterForwardData kCharacterForwardTable kCharacterMap kClosePunctuation kCombiningSpacingMark kConnectorPunctuation kControlCharacter kCurrencySymbol kDashPunctuation kDecimalNumber kDigits kEnclosingMark kExceptionChar kExceptionFlags kFormatCharacter kLetterNumber kLineAsciiValues kLineBackward kLineBackwardData kLineForward kLineForwardData kLineMap kLineSeparator kLong kLowercaseLetter kMathSymbol kModifierLetter kModifierSymbol kNonCharacter kNonSpacingMark kOffsetIndex kOffsetValues kOpenPunctuation kOtherLetter kOtherNumber kOtherPunctuation kOtherSymbol kParagraphSeparator kPrivateUseCharacter kRawMapping kSTerminator kSentenceAsciiValues kSentenceBackward kSentenceBackwardData kSentenceForward kSentenceForwardData kSentenceMap kSpaceSeparator kSurrogate kTitlecaseLetter kUppercaseLetter kWordAsciiValues kWordBackward kWordBackwardData kWordForward kWordForwardData kWordMap kakat kan kanji kat kata katakana ke keep keepBlocking keepalive keeping keeps keine kept kernel key keyBits keyChar keyCode keyCodeName keyDown keyEquals keyEventDispatchers keyEventPostProcessors keyFacSpi keyFactory keyHash keyL keyListener keyListenerK keyOrNull keyPairGen keyPress keyPressed keyRelease keyReleased keySet keySpec keyStart keyStoreSpi keyTyped keyUp keyUsageInfo keyValueIndex keyValueSeparators keyboard keycode keycodes keydown keyed keypair keys keysize keystore keystores keystroke keystrokes keyword keywords kick kid kill killed killing kind kinds kiwi kkkaz klkal km kmkhm knkan know knowing knowledge known knows ko kokor kpairGenSpi ks ksc kskas kstype kukur kykir l lValue lWeekdays la label labeled labelled labels labor lack laddr laid lalat landscape lang langCode language language1 language2 languageLength languageName languages large largePrime largely larger largest last lastBase lastBaseIndex lastC lastCategory lastClass lastDescendant lastDoy lastElement lastEntry lastExp lastExpansion lastIndex lastIndexOf lastIndexOfSubList lastItem lastKey lastLength lastLine lastModified lastMon lastOffset lastOpen lastPageFirst lastPos lastProductLowWord lastRelDow lastResult lastRet lastReturned lastReturnedIndex lastState lastSum lastSun lastType lastValue lastWoy lasting lastly lastx lasty late later latest latestLoader latestUserDefinedLoader latter launcher lay layed layer layered laying layout layoutContainer layoutGlyphVector layoutInfo layoutMgr layouts lays lazily lazilyLoadDesktopProperty lazy lb lbits lceil lcid lcidAsString ldlen ldm ldpath le le0 lead leadDays leadSelectionIndex leading leadingZerosAfterDecimal leads leaf leak leap learn least leave leaveGroup leaves leaving ledger leeway left leftOf leftShift leftmost leftover leftoverChar leftovers leftx legacy legal legally legit legitimate legitimately leland len len1 len2 length lengthened lengthening lengths lenient less lessening lesser let lets letter letters letting level levelLimit levelStart levels lexical lexicographic lexicographically lf lfloor lg lhs li lib libX11 libawt libfile libfilename libname libraries library libs license licensing lie lies life lifetime ligature ligatures light lightGray lightParents lightweight lightweightMarker lightweightPaint lightweightPrint lightweightRequests lightweights like likelihood likely likes likewise lim limit limitation limitations limited limiting limits lin line lineBuffer lineColor lineIncrement lineLength lineLimit lineNum lineNumber lineSeparator lineStart lineTo linear linefeed lineno lines linewidth linger link linkage linked linking links lira list list1 list2 listFiles listItems listIterator listRoots listSerializedDataVersion listed listen listenToAllAWTEvents listenToAllAWTEventsPermission listene listened listener listener2SelectiveListener listenerCalls listenerClassName listenerInterface listenerMethodDescriptors listenerMethodName listenerMethodNames listenerMethods listenerName listenerOrNull listenerType listenerless listeners listening listeningBoundsChildren listeningChildren listens listing listings lists lit literal literally literals liternal litle little littleIndex liu live lived lj ll lm ln lnlin lo load load0 loadAssistiveTechnologies loadBundle loadClass loadClassData loadClassInternal loadConvert loadFactor loadFocusTraversalKeys loadImage loadImpl loadInitialDrivers loadLibraries loadLibrary loadLibrary0 loadLookup loadManifest loadOneMoreProvider loadProvider loadProviderProperties loadSystemColors loadSystemCustomCursorProperties loadTable loadZoneStrings loaded loadedLibraryNames loadedProps loader loaderRef loaders loadfactor loading loads loc locBytes locIn locOut local localAddr localDesc localDescs localEnv localFields localHost localL localListenPermission localMillis localName localParent localPatternChars localPort localSkipBuffer localTableEntry local_addrs locale localeSuffix locales localhost locality localizable localization localize localized localizers locally localport locals localy locate located locates locating location locationCorrect locations locator lock locked locking locks log log10 log2 logStream logSync logWriter logarithm logarithms logging logic logical logically login loginTimeout logoff logos logs lolao long long0 long1 long2 long3 long4 long5 long5pow long6 long7 longBitsToDouble longKey longRadix longRep longResult longToByteArray longValue longer longest longs look lookahead lookaheadResult lookaheadStates looked looking looks lookup lookupAllHostAddr lookupBackwardState lookupCategory lookupCharset lookupClass lookupConstraints lookupContentHandlerClassFor lookupException lookupObject lookupState lookupTable lookups lookuptable loooping loop loopback loopbackAddress looped looping loopingState loopingStateRowNum loopingStates loops loopup loosely loppedLine lose loses losing losingFocusWindow loss lost lostFocus lot lots lout low lowDep lowDigitDifference lowEndpoint lowGood lowLevelOp lowMask lowOrderZeros lowalpha lowbytes lower lowerCase lowerCaseMode lowercase lowercased lowest lowestOddLevel lowestSetBit lowmem lport lshift lshiftMe lst lt ltlit ltr lucasLehmerSequence luck luehe lunar luser lvalue lvlav lw lwFocusRequest lwIter lying m m1 m2 mLN mLe mNu mPattern machine machinery machines macron maddr made madeChange mag magBitCount magBitLength magInt magLen magPresent magSerializedForm magTrailingZeroCount magenta magic magically magnitude mail mailto main mainLoop mainName mainTable mainly maintain maintainability maintained maintainers maintaining maintains maintenance major majority make makeBuilder makeCacheKey makeChar makeFormat makeInt makeLong makePositive makeQualifiedMethodName makeRaster makeReorderedBuffer makeRulesCompatible makeShort makeStaticCalendars makeVisible makebutton makes making malevolent malfeasant malformed malfunction malicious maliciously malignant man manage managed management manager managers manages managing mandate mandated mandates mangles mango manifest manifests manipulate manipulated manipulates manipulating manipulation manner mans mant mantissa manual manually manufactured manufacturing manuscript many map mapChar mapFamilyName mapInputMethodHighlight mapLen mapLibraryName mapNewModifiers mapOldModifiers mapSize mapValue mapped mappedChar mappedValue mapping mappingTable mappings maps mapsDiffer mar3 march march1 marged mark markAsDeleted markClearGlobalFocusOwner markDependency markException markLineNumber markPushBack markSupported markValue marked markedChar markedLineNumber markedPos markedSkipLF marker markers marking marklimit markpos marks mars marshal marshaling marshalled marshalledobject marshalling marshals mash mask masking masks massaging masse master match matchArguments matchCerts matchFields matchKey matchLocation matchScale matchString matchZoneString matched matches matchesField matching matchlen material materialize materializing materials math mathematical mathematically mathetmatical matic matrix matter matters max maxBytesPerChar maxCandidate maxCharsPerByte maxDecimalCount maxDecimalDigits maxDecimalExponent maxDelimChar maxDigits maxFractionDigits maxIndex maxIntCount maxIntegerDigits maxLength maxMemory maxMinusMin maxNumDigitGroups maxOffset maxPage maxPosition maxPriority maxSecOrder maxSize maxSkipBufferSize maxSmallBinExp maxSmallTen maxTerOrder maxWidth maxima maximal maximization maximized maximizedBounds maximized_horiz maximized_vert maximum maximumArgumentNumber maximumCanonical maximumDecomposition maximumDigits maximumFractionDigits maximumIntegerDigits maximumLayoutSize maximumSize maxposition maxpri maxttl maxw maxwidth may maybe maybeAddLeadingDot mb mbManagement mbexample mc mcastSocket mcastaddr md mday mds mdt me mean meaning meaningful meanings means meant meantime measure measured measurement measurements measuring mechanically mechanism mechanisms med med3 media median medium meet meets member members membership memebership memory mentioned menu menuBar menuBarSerializedDataVersion menuItem menuItemSerializedDataVersion menuSerializedDataVersion menuText menubar menuitem menus merely merge mergeList mergePermissions mergeSort mergeStates merged mergedPerms merges mergesort merging meridian mesquite mess message messages messaging messiness messing met meta metaData metaDown metadata metafile metalab meth methSigs method methodCache methodInfo methodList methodName methods metric metrics mf mgmlg mgr mi mice micro microprocessor mid midBits midLetNum midLetter midNum midVal middle middlemost middot midnight midst might mil mile mill mille millis millisDelta millisInDay millisPerDay millisPerHour millisPerMinute millisSavedDuringDST millisToJulianDay millisec millisecond milliseconds milne mimetable mimetype mimic mimics mimri min min2 minBufferCap minCapacity minDecimalExponent minDigits minExponentDigits minFractionDigits minHeight minIntegerDigits minPage minPrime minSize minSmallBinExp minUnitsInUse minWidth min_int mind minima minimal minimalDaysInFirstWeek minimize minimized minimizes minimizing minimum minimumCapacity minimumCombining minimumDigits minimumFractionDigits minimumIntegerDigits minimumLayoutSize minimumSize minimun mininimum minor minsizes minumum minus minusSign minute minuteString minutes mirrored misbehave misc miscellaneous misconfiguration misleadingly mismatch mismatches misplaced miss missing missingGlyph mistake mistakenly miter miterlimit mitigate mix mixed mixes mixing mixture mkdir mkdirs mkmkd mlen mlmal mls mm mmmm mnmon mo mod mod2 modCount modInverse modInverseBP2 modInverseMP2 modLen modPow modPow2 modVal modal modality mode model modeled modeless models modern modes modifcations modifiable modification modifications modified modifier modifierKeywords modifierList modifiers modifies modify modifyThread modifyThreadGroup modifying mods modular module modules modulo modulus moment momol mon monadic monarch monday monetary monetarySeparator money monitor monitored monitors monkey mono monochrome monospaced monotonic monotonicity montReduce month monthLen monthLength monthNames monthStamp months more morning mosquito most mostRecent mostRecentFocusOwners mostly motif motion motivate mount mouse mouseClicked mouseDown mouseDrag mouseDragged mouseEnter mouseEntered mouseEvent mouseEventTarget mouseExit mouseExited mouseL mouseListener mouseListenerK mouseMotionL mouseMotionListener mouseMotionListenerK mouseMove mouseMoved mouseOver mousePress mousePressed mouseRelease mouseReleased mouseUp mouseWheel mouseWheelL mouseWheelListener mouseWheelListenerK mouseWheelMoved move moveComponents movePointLeft movePointRight moveTo moveToCurrentRow moveToInsertRow moved movement moves moveto moving mrmar ms ms1 ms2 msd msg msmsa mso mst mt mtmlt mto much mul mulAdd mulitplying mulsub mult multPow52 multaddMe multi multibyte multicast multicaster multicasting multicasts multihomed multilingual multiple multipleDocumentHandling multipleMode multiples multiplexed multiplexing multiplexor multiplication multiplications multiplicative multiplied multiplier multiplies multiply multiplyToLen multiplying multiprecision multipy multiscreen multisets multistep multithreaded multmin multpos mumble mungeExpressionList munged must mustSetRoundDir mutable mutableModInverse mutated mutatesTo mutation mutations mutator mutex mutually mx my myAppContext myBundle myButton myButtons myCollator myCollection myComponent myDate myDigitList myFRC myIntegers myInterfaces myJapaneseCollator myKeys myLocale myNorwegian myNumber myResources mySchemaName mySimple myString myapp mymya myobj myobject myself n n1 n100 n2 n4 n400 n5bits nArgs nBits nBits2 nBl nByte nBytes nChars nChunk nCopies nDigits nEnd nFractBits nInts nLeadZero nMoved nPoint nPoints nSignificantBits nTinyBits nTrailZero nWords na naddr naira naive naively nak name name1 name2 nameCounter nameExplicitlySet nameService named namely names nameservice naming nanau nano nanos nanos_s nanosecond nanoseconds narrow narrowing nary nasty national native native2ascii nativeBidiChars nativeByteOrder nativeContainer nativeCursor nativeGetDirectionCode nativeHost nativeLibraries nativeLibraryContext nativeSQL nativeSetSource nativeX nativeY natives natural naturally nature natures navigating navigation navy nb nbits nbsp nbuf nbytes nbytesButOne nc ncb ncheck nchildren nci ncols ncomponents ncsa ncws ncwslen nd nd0 ndeps ndigit ndigits ndir ndoubles ne ne1 near nearest nearly neccessarily neccessary necessarily necessary necessity need needCacheUpdate needDummies needQuote needRepaint needToChange needed needing needn needs needsGui needsNormalization nefarious neg negConst negPrefixPattern negSign negSuffixPattern neg_pattern negate negated negates negating negation negative negativeExponent negativePrefix negativePrefixFieldPositions negativeSuffix negativeSuffixFieldPositions negativeZeroDoubleBits negativeZeroFloatBits negatively negatives negotiate neighbor neighbors neither nenep nest nested nesting net netIF netIf netif netifs netlib nets network networking networks neutral never nevertheless new newActiveWindow newAddr newAddrs newAlign newAmount newAmpms newApplet newAppletBean newArgs newArgumentNumbers newArray newArraySize newAttributes newAttrs newAudioClip newBits newC newCalendar newCandidate newCandidates newCapacity newChannel newChar newChars newChildren newChoiceFormats newChoiceLimits newClass newCollator newConstructor newConstructorForSerialization newCount newDecoder newDeps newDigits newElementCount newEncoder newEntry newEntryIterator newEras newEvent newEventQueue newEventsOnly newExtension newField newFlags newFocusCycleRoot newFocusOwner newFocusOwnerEvent newFocusedWindow newFont newFormat newFormatData newFormatSymbols newFormats newGetExp newHour newIndex newInputStream newInstance newInstance0 newInstanceCallerCache newItem newKey newKeyIterator newKeys newL newLen newLength newLimit newLine newList newLocalPatternChars newLocale newLoopingStates newMWE newMag newMagLen newManager newMap newMask newMaximum newMethod newMinimum newMonths newNext newNumberFormat newO newObjs newOffset newOffsets newOutputStream newPaintEvent newPattern newPermissionCollection newPosition newPriority newProtocol newProxyInstance newQueue newReader newRect newReps newRow newRowNum newRunAttributeValues newRunAttributes newRunStarts newSAXParser newSet newShortMonths newShortWeekdays newSign newSize newSource newStamp newStart newStartingSpot newState newStates newStatus newStm newStrength newSubstitution newSymbols newTable newTarget newTasksMayBeScheduled newText newTime newUnitsInUse newV newVal newValue newValueIterator newValues newWeekdays newWriter newX newXcps newY newZoneStrings newbuf newcomponents newcount newdst newer newfont newgroups newid newing newline newlines newly newmode newpos news newsel newthreads newttl newx newy next nextBoolean nextBoundaryAt nextByte nextByteIndex nextBytes nextCand nextChar nextCharIndex nextClass nextClearBit nextColumn nextContractChar nextDouble nextElement nextEntry nextExecutionTime nextFloat nextFocus nextFocusHelper nextFocusableComponent nextGaussian nextGetIndex nextIndex nextInt nextLine nextLong nextNextGaussian nextPosition nextPrime nextPutIndex nextQueue nextRow nextSerialNum nextSetBit nextSize nextStamp nextStream nextThreadNum nextToken nextVal nextWordStartAfter nextseed nextx nexty nexus nf nfe nfields nfloats ng ngroups ngroupsSnapshot nh nh2 nhost ni nibble nice nilly nilnodes nine ninth nio nis nitems nl nlen nlevel nlnld nm nmembers nmenus nn nntp no noCaches noDelay noEvents nobody nocerts node nodes noise noisily noisy nojit nomenclature non nonBlank nonIdentityTx nonPublicLoader nonSerializable nonZeroDigitSeen none nonempty nonetheless nonexistent noninvertible nonmenu nonnegative nonor nonpositive nonprimality nonreachable nonsense nonstandard nonterminating nonuniformity nonwithstanding nonzero noon noop nor normal normalization normalize normalizeMe normalized normalizedDayOfWeek normalizedGregorianCutover normalizer normalizes normalizing normally normalx norminal north northern not notANumber notBoundary notLegal notPrivileged notation notches note noted notes noteworthy nothing notice noticeably notification notifications notified notifies notify notifyAWTEventListeners notifyAll notifyAncestors notifyID notifyObservers notifyThreadBusy notifyThreadFree notifying noting notion november now nowhere np npd npoints npopups nport nps nr nread nrows nruns ns nsae nsd nsfe nsm nsme nspe nsz nt nth nthreads null nullInputStream nullPeer nullPersistenceDelegate nullPlusNonNullIsNull nullPrintStream nullability nullable nullary nulled nullness nulls nullsAreSortedAtEnd nullsAreSortedAtStart nullsAreSortedHigh nullsAreSortedLow num numBits numBuckets numBuffers numBytes numBytesToTransfer numCategories numChars numColGroups numCols numDigits numFields numGlyphs numGot numGroups numIfaces numInts numLeadingZeros numListening numMoved numNegZeros numNew numObjFields numOfStaticProviders numPrimFields numPunct numRequested numRows numWords numZeros number numberElements numberFormat numberOfColumns numberPatterns numbered numbering numbers numbytes numchars numeral numerator numerators numeric numericToTextFormat numerical numerically numerous numerrors nval nzeros o o1 o2 oa ob obejct obey obeyCount obeying obeys obj objBytes objHandle objHandles objIn objOut objVals objcopy object objectEquals objectLocale objectStart objectURL objectUrl objects objectst objs oblique obs obscure obscured obscures observable observations observe observed observer observers observes obsolete obsoleted obtain obtainable obtained obtaining obtains obvious obviously occasionally occupied occupies occupy occupying occur occurances occured occurence occurences occuring occurred occurrence occurrences occurring occurs ococi octal octet octets october odd oddMod oddModPow oddPart odds oe of ofCalendarField off offending offer offered offers office official officially offscreen offset offset1 offset2 offsetMillis offsetNumber offsets offsetting often ogonek oins ois ok okKey okToUseGui okay ol old oldActiveWindow oldArgs oldC oldCapacity oldChar oldChildren oldChoice oldClass oldColor oldData oldDesc oldExp oldFocusCycleRoot oldFocusOwner oldFocusTraversalKeysEnabled oldFocusable oldFocusableWindowState oldFocusedWindow oldFont oldGet oldGetExp oldHandle oldHeight oldHour oldI oldIndex oldInstance oldJ oldKey oldKeys oldL oldMap oldMask oldMaxOffset oldMinDigits oldMode oldO oldObj oldPermanentFocusOwner oldPolicy oldPut oldResizable oldRow oldRowNum oldRules oldRunAttributeValues oldRunAttributes oldSize oldStart oldStartValue oldState oldStm oldTable oldTableSize oldTarget oldTitle oldUnitsInUse oldV oldVal oldValue oldValues oldWidth oldX oldY olde older oldest oldfont oldjavac oldl oldp omit omitLF omits omitted omorm on onKeyRelease onStroke once one oneDown oneFieldInfo oneMethodInfo ones onesLost ongoing only onset onto onward onwards ooffset oome oonnection oops oos op opaque opaquePart opcode opd open openAppend openBracket openConnection openDatagramChannel openPipe openSelector openServerSocketChannel openSocketChannel openStream opened opening operand operands operate operated operating operation operations operator operators opgretion opinion opmasks oppStroke opportunity opposed opposite oppositeComp oppositeWindow ops opt optID optimal optimally optimisation optimization optimizations optimize optimized optimizing option optional optionally options or orEventMasks orange order ordered ordering orderings orderly orders ordinal ordinary ordinaryChar ordinaryChars ordinate ore ored org organization organizations organize organized orginal orient orientation orientationRequested orientations oriented orig origin original originally originate originated originating origins origlength orori orphaned os ostream osw other otherBundle otherCurrencies otherCurrenciesDFD otherEntry otherIndexedReadMethod otherIndexedWriteMethod otherLen otherReadMethod otherWriteMethod otherkey otherref others othersDeletesAreVisible othersInsertsAreVisible othersUpdatesAreVisible otherwise otype otypes otypesPhrase oultine ouput our ourCause ourDriver ourThread ourself ourselves out outBuffer outCast outData outMark outOfBounds outOff outRas outSequence outSpan outStart outbuf outcode outcome outdated outer outerHandle outermost outgoing outline outlined outlines output outputFile outputIndex outputStatement outputValue outputs outputter outrageous outright outside outsideBorder outstanding outward oval over overall overallocated overdot overflow overflowed overflows overhead overidden overkill overlap overlapped overlaps overlay overline overload overloaded overloading overly overridable overridden override overrideAll overridePropertiesFile overriden overrides overriding overscore overshoot overstruck overvalue overwrite overwritten own ownDeletesAreVisible ownInsertsAreVisible ownIterator ownUpdatesAreVisible owned ownedInit ownedL ownedWindowK ownedWindowList ownedWindows owner ownerMode owners ownership owning owns p p1 p2 p5 pData pDispose pIndex pItems pLimit pLong pMN pName pNativeFont pSOrder pTOrder pa pac pack packRules packTimes package package2certs packageAccess packageAccessValid packageAssertionStatus packageDefinition packageDefinitionValid packageEnabled packageEquals packageName packagePrefix packagePrefixIter packagePrefixList packages packed packet packetAddress packets packing pad padded padding pads pae page pageAttributes pageIncrement pageRanges pageSize paged pages painValue paint paintAll paintComponents paintHeavyweightComponents paintValue paintable painted painting paints pair pairing pairs palBuf palatalized palette pals pane paneSize panel panels panes panic papan paper paradigm paragraph paragraphBreak paragraphLength parallel parallelism param paramGenSpi paramIndex paramSpec paramSpi paramString paramTypes parameter parameterDescriptors parameterIndex parameterModeIn parameterModeInOut parameterModeOut parameterModeUnknown parameterName parameterNoNulls parameterNullable parameterNullableUnknown parameterTypes parameterize parameterized parameters parametric params paramter paramters pararm parenStack parenheses parent parentKeys parentMap parentOf parentValue parentheses parenthesis parents parsable parse parseAmbiguousDatesAsAfter parseAuthority parseByte parseCustomTimeZone parseDouble parseFloat parseHierarchical parseHostname parseIPv4Address parseIPv6Reference parseInfo parseInt parseIntegerOnly parseLong parseNumber parseNumbers parseObject parsePort parsePosition parseRule parseServer parseServerAuthority parseShort parseSignature parseSpecs parseString parseURL parsed parsedDate parsedStr parseflags parser parsers parses parsing part partial partialWord partially participate participating particular particularly parties partition partly parts party pas pass passHandle passed passes passesLucasLehmer passesMillerRabin passing passwd password passwords past patch patents path pathClosed pathSeparator pathSeparatorChar pathname pathnames pathological paths pattern patternCharIndex patternChars patternOffset patternSeparator patterns pattform pause paused pay pays pc pcerts pchar pcl pd pd2 pdMapping pdVector pdcache pdp pds pdt pear peek peekByte peekData peekEvent peekPacket peekPort peekable peekb peekc peeked peer peerFont peers pen penalty pending pendingChars people per perMill percent percentage percentages perfect perfection perfectly perform performance performed performing performs perhaps period periodStartDayOfWeek periods perm perm1 perm2 permClass permanent permanentFocusOwner permanently permill permille permissible permission permissionimpl permissions permissive permit permits permitted perms permset permssible permutations permute permutes perpendicular perpendicularly persist persistence persistenceDelegate persistent person personal perspective pertaining pertains pertinent perturb peseta pg phantom phase phaseOneLength phaseOneStart phaseTwo phases pheight phrase physical physically pi pick picked picking picture pid piece pieces pin pinDayOfMonth pinfo pink pinning pins pipe piped pipelines pipes pixel pixelization pixels pixels_diff pixmap pixmaps pkg pkg1 pkg2 pkgName pkgname pkgs plVector place placed placeholder placeholders placement places placing plaf plain plain01 plainTextFlavor plan plane planes planet planning plans plant platform platforms play playback playing please plpol pluggable plugged plurals plus pm pmenu pname png po poJ poN point pointPos pointSize pointed pointer pointers pointing points pointsize pointwise polar policies policy policyDomain policyPerms policy_class political poll pollfd poly polygon polygons polymorphic polymorphism pool poor pop popped popping popular populate populateListenerArray populated populating popup popups porpoise port port1 port2 portability portable porting portion portions portnumber portrait portrange ports pos posConst posPrefixPattern posSuffixPattern pos_pattern poses position positionInCache positional positioned positioning positions positive positivePrefix positivePrefixFieldPositions positiveSuffix positiveSuffixFieldPositions positon posn possessed possesses possessing possibilities possibility possible possibleBreakPositions possiblity possibly post postAccept postEvent postEventPrivate postJwrd postNum postProcessKeyEvent postWeeks postWindowEvent postal postamble posted posting postion postprocessing posts postsOldMouseEvents postscript posture potential potentialNaN potentially pound pounds pow pow10 pow2 power powers powersOf2 pp pr prFirst prJ prLast prN prStr practical practically practice practise pre preDispatchKeyEvent preJwrd preMidNum preNum preProcessKeyEvent preSecIgnore preWeeks preamble preambleWritten precautions precede preceded precedence precedent precedes preceding preceeded precipitated precise precisely precision precisions precompilation precompiled precompiling precomposed precompute precomputed preconditions predates predecessor predefined predicate predictable predicted preexisting prefSize prefer preferIPv6Address preferIPv6Addresses preferable preference preferences preferentially preferrable preferred preferredHeight preferredLayoutSize preferredSize preferredWidth prefers prefetching prefix prefixLength prefixed prefixes prefixing prematurely premultiplied premunge preparation prepare prepareCall prepareImage prepareStatement prepared prepares prepend prepended preprocessed prescan prescribed presence present presentation presented presenting presents preserve preserved preserves preserving press pressed pressedReleasedID presses pressing presumably presume presumed pretty prev prevCh prevChar prevContractChar prevDoy prevMonthLen prevMonthLength prevc prevent prevented preventing prevents previous previousDouble previousIndex previousQueue previousSafePosition previously pri priamry primClasses primDataSize primResult primVals primality primarily primary primaryCatalog primaryOrder primarySchema primaryTable prime primeToCertainty primer primes primitive primitiveLeftShift primitivePersistenceDelegate primitiveRightShift primitiveType primitiveTypeFor primitiveTypeName primitives primordial primtitive principal principals principle print printAll printAt printCertificates printClassName printComponents printEachBackward printEachForward printFirst printHeavyweightComponents printIdentity printKeys printLast printQuality printStackTrace printStackTraceAsCause printWordList printable printed printer printerResolution printers printing printingThreads println printout printouts prints prio prior priori priorities priority pristine priv privacy private privateKey privatekey privately privates privilege privileged privilegedConnect privilegedContext privileges privilige privs prng probability probable probablePrime probably probe probes probing problem problematic problems proccess procedure procedureColumnIn procedureColumnInOut procedureColumnOut procedureColumnResult procedureColumnReturn procedureColumnUnknown procedureNamePattern procedureNoNulls procedureNoResult procedureNullable procedureNullableUnknown procedureResultUnknown procedureReturnsResult procedures proceed proceeds process processActionEvent processAdjustmentEvent processChar processComponentEvent processContainerEvent processDropTargetEvent processEvent processFocusEvent processHierarchyBoundsEvent processHierarchyEvent processInputMethodEvent processItemEvent processKeyEvent processMouseEvent processMouseMotionEvent processMouseWheelEvent processQueue processSection processSubstitution processTextEvent processWindowEvent processWindowFocusEvent processWindowStateEvent processed processes processing processor processors prod produce produced producer produces producing product productiive production products program programatic programmable programmatic programmatically programmer programmers programming programs progress progression progressively prohibited prohibition prohibitions prohibitively prohibits projection proleptic prolong promised promote promoting prompt prompting promptly prone pronunciation prop propFile propName propPrefix propURL propValue propagate propagated propagates propagating propagation propagationId proper properly properties property propertyChange propertyChangeSource propertyChangeSupportSerializedDataVersion propertyDescriptors propertyEditor propertyEditorClass propertyName propertyNames propertyType propname proportion proportional proportionally proposed proprietary props propsFile protcol protect protected protecting protection protectionDomain protects protocol protocolPathProp protocolname protocols prototype prototypical prov provClass prove provide provided provider providerMasterClassNames providerName providerPropertiesCache providers provides providing provoked provs proxied proxies proxy proxyEnableEvents proxyPersistenceDelegate prune ps pseudo pseudocode pseudomedian pseudorandom pseudorandomly pskip pspus pst pstmt pt pt1 pt2 ptDstOrigin ptSize ptSrcOrigin ptpor pub public publicConstructors publicFields publicKey publicMethods publickey publicly published publisher puff puffin pull pulled pump pumpApprovedKeyEvents pumpEvents pumpOneEvent pumped pumping pumps punct punctuation punt pure purely purge purgeStampedEvents purged purple purported purpose purposefully purposes push pushBack pushback pushbuttons pushed pushedBack pushes put putAll putAllProviderProperties putBoolean putBundleInCache putByte putCachedRaster putChar putCharB putCharL putCharsets putDouble putDoubleB putDoubleL putFields putFloat putFloatB putFloatL putInt putIntB putIntL putLong putLongB putLongL putObject putProviderProperty putShort putShortB putShortL puts putting pwidth px py q q2 qWord qhat qm qrem quad quadTo quadratic qualified qualifier qualifierNames qualifiers qualify qualifying qualitatively qualities quality quantified quantities quantity quarto queried queries query queryOnly queryStart querying question questionable questions queue queueJob queuePrintJob queues quick quickCheckMemberAccess quickly quicksort quicksorts quietly quite quo quoRemIteration quot quotation quote quoteChar quoteCharacters quoted quotes quotient quoting quque r r1 r2 r2d rValue race radians radiation radic radius radix radixes raise raised raises raising random randomBits randomBytes randomBytesUsed randomNumberGenerator randomenss randomize randomly randomness range rangeCheck rangeError rangeLimit rangeStart ranger ranges ranging rapid rapidly rare rarely ras rast raster rate rather ratio rational rats raw rawOffset rawYear rawoffset rb rbName rbs rceil re reach reachable reached reaches reaching reacts read read0 read1 readAheadLimit readArray readAsciiStream readBigDecimal readBinaryStream readBlob readBlockHeader readBoolean readBooleans readByte readBytes readChar readCharacterStream readChars readClass readClassDesc readClassDescriptor readClob readDate readDesc readDictionaryFile readDisplayPixels readDisplayPixelsPermission readDouble readDoubles readExternal readExternalData readFatalException readFields readFileDescriptor readFloat readFloats readFully readHandle readInt readInts readJavaFormatString readLine readLocation readLong readLongUTF readLongs readMethod readNonProxy readNonProxyDesc readNull readObject readObject0 readObjectMethod readObjectNoData readObjectNoDataMethod readObjectOverride readOnly readOrdinaryObject readProxyDesc readRef readResolve readResolveMethod readSQL readSerialData readShort readShorts readSide readSocksReply readSql readStreamHeader readString readTime readTimestamp readTreeSet readTypeString readURL readUTF readUTFBody readUTFChar readUTFSpan readUnshared readUnsignedByte readUnsignedShort readability readable reader readers readiness reading readjust readjusted readlimit readlong readonly reads ready readyMask real realCopy realOppositeComponent realOppositeWindow realSize realValue real_end realized realizes reallocate reallocated reallocation really reallyBig realm reaper reaping reason reasonable reasonably reasons reassign reassigning rebalance rebalancings rebind rebooted rebound rebuilding recalculate recalculateUnitsInUse recall recap recast receipt receive received receivedLast receiver receives receiving recent recently recipient recipients reciprocal reciprocity reclaim reclaimed recognition recognizable recognize recognized recognizer recognizes recognizing recommend recommendation recommendations recommended recommends recompile recomputation recompute recomputed recomputes reconcile reconciled reconciliation reconciling reconfigured reconnected reconsituted reconstitute reconstituted reconstruct reconstructed reconstructing recopy record recordAccess recordIdentity recorded records recouped recourse recover recoverable recovered recovering recovers recreatable recreate recreated rect rectanglar rectangle rectangles rectangular rects recur recurring recurse recurses recursion recursionProtection recursive recursively recv recycle recycling red redLevel redSlider redc redefined redirect redirected redirects redispatchEvent redo redraw redrawn redrawrate reduce reduced reduces reducing reduction redundancy redundant redundantly ref ref1 ref2 refer refered reference referenceable referenced references referencing referent referred referring refers refetch refetched refill refilled refine refined reflFactory reflect reflected reflecting reflection reflectionFactory reflective reflectively reflector reflectors reflects reflexive refresh refreshRate refreshRow refreshed refs refuse refused refuses regChars regLock reg_name regain regains regard regarded regarding regardless regenerate regenerated regex regexp regexps region regionMatches regions register registerConstructor registerConstructorWithBadEqual registerDriver registerEditor registerNatives registerOutParameter registerSubclass registerValidation registered registering registers registration registrations registry regular regularly rehash rehashed rehashing reimplemented reimplementing reinitialize reinitialized reinserted reinstate reject rejected rejects rejoin rel relDow relDowJan1 relate related relates relating relation relational relations relationship relative relatively relativization relativize relativized relativizing relaxation relaxing release releaseExpressionCache releaseFD releaseSavepoint released releases releasing relevant relevantAttributes reliable reliably relies relinquish relinquishes reload reloadProviders reloaded reloads relocation rely relying rem remLong remValue remain remainder remaining remains remap remember remembered remembering remembers remind remote remotely removable removal removals remove removeAWTEventListener removeAccessibleSelection removeActionListener removeAdjustmentListener removeAll removeAllElements removeCertificate removeComponentListener removeConstraints removeContainerListener removeDots removeElement removeElementAt removeEntry removeEntryForKey removeFirst removeFocusListener removeFocusRequest removeFooListener removeFredListener removeFromCache removeFromFrameList removeHierarchyBoundsListener removeHierarchyListener removeIdentity removeIdentityCertificate removeImage removeInputMethodListener removeInternal removeItemListener removeKeyEventDispatcher removeKeyEventPostProcessor removeKeyListener removeLast removeLayoutComponent removeListenerMethod removeListenerMethodName removeMapping removeMethod removeMethodName removeMin removeMouseListener removeMouseMotionListener removeMouseWheelListener removeNoInvalidate removeNotify removeOwnedWindow removeProperty removePropertyChangeListener removeProvider removeProviderProperty removeRange removeReferences removeShutdownHook removeSourceEvents removeTextListener removeVetoableChangeListener removeWindowFocusListener removeWindowListener removeWindowStateListener removed removes removing rename renameTo renaming render renderable rendered renderer renderers rendering renderingimage renderings renders rendershape rendertext renormalized renumber reopened reorder reorderVisually reordered reordering reorganizes rep repCl repaint repaints repair repeat repeatable repeated repeatedly repeating repeats repectively repetitive replace replaceAll replaceItem replaceKeyboardFocusManager replaceKeyboardFocusManagerPermission replaceObject replaceRange replaceText replaceWith replaceable replaced replacement replaces replacing replacment replicate replicated replicating reply repopulation report reported reporting reports reposition repositioning repositions repository represent representable representaion representation representations representative representatives represented representing represention represents reprocess reproduce reproducibility reps reqires request requestFocus requestFocusHelper requestFocusInWindow requestPasswordAuthentication requestPermission requested requestedSize requester requesting requestingHost requestingPort requestingPrompt requestingProtocol requestingScheme requestingSite requestor requests require requireServerAuthority required requirement requirements requires requiresBidi requiring reraise reread rereads res resName resampling rescale rescaling reschedule rescheduleMin reschedules resemble resembling reserve reserved reset resetGC resetProviderIndex resetSyntax resets resetting reshape reshaped reshapes reshaping reside resident resides residing residue residues resilient resizable resize resized resizes resizing resolution resolutions resolutuion resolve resolveClass resolveClass0 resolveName resolveObject resolveParent resolvePath resolveProxyClass resolved resolves resolving resort resource resourceName resources resp respect respected respective respectively respects respond responds response responseCode responseMessage responses responsibility responsible responsiblity rest restart restarted resting restore restoreFocus restored restores restoring restrict restricted restriction restrictions restrictive result result2 resultArray resultLen resultMag resultOffset resultSetConcurrency resultSetHoldability resultSetType resultType resultant resulted resulting results resume resume0 resumed resumes resupplied resurrection ret retDelims retType retVal retain retainAll retained retarget retargetFocusEvent retargetMouseEvent retargeted retargeting rethrow rethrown retransmitted retrieval retrieve retrieveDirectives retrieved retrieves retrieving retrofitted retroflex retry return returnDelims returnList returnType returnVal returned returning returns retval reuqires reuse reused reusing rev revalidate revealing reveals reverse reverseColumnMap reverseOrder reversed reverses reversible reversions revert reverting review revised revisited rewind rewinding rewinds rewritten rf rfc rfc2068 rfc2278 rfc2279 rfc2373 rfc2396 rfc2732 rfc2781 rfloor rfoe rgb rgb1 rgb2 rgba rgbs rh rhs rid right rightIndex rightNow rightOf rightShift rightToLeft rightmost rights rigorously rigth ring ringing rint risking risks risky rl rlen rlm rmi rmiTOC rmiregistry rmroh rnd rnrun rogue role roll rollback rollbacks rolled rolling rolls roman room root rootAncestor rootAncestorRootAncestor rootEntry rootEntryDirectory rootEntryOffset rootGroup rooted roots roron rotate rotate1 rotate2 rotateLeft rotateRight rotated rotates rotating rotation roughly round roundDir rounded rounding roundingMode roundoff rounds roundup route routed router routine routines row rowDeleted rowEnd rowHeader rowHeights rowIndex rowIndexFlags rowIndexFlagsIndex rowIndexShifts rowInserted rowNum rowNumMap rowStart rowUpdated rowWeights rowa rowh rowincx rowincxerr rowincy rowincyerr rowrel rows rowsBeingUpdated rowsToFollow rowspan rowx rowxerr rowy rowyerr rs rsa rsmd rsrc rstart rtg ru rule ruleDay ruleDayOfMonth ruleDayOfWeek ruleMillis ruleMode ruleMonth ruleStart rules rulesName ruleset run runAllFinalizers runArraySize runAttributeValues runAttributes runAttrs runComponents runCount runDirection runFinalization runFinalization0 runFinalizersOnExit runHooks runIndex runIndex1 runIndex2 runLimit runMoreFinalizers runOneComponent runStart runStarts runValues runnable running runs runsToCopy runtime rupee rurus rv rw rwkin rx rx1 rx2 ry ry1 ry2 rz s s1 s2 s3 s4 s5 s6 s7 s8 sFr sFr123 sIndex sIter sOrder sRGB sStart sTemp sWeekdays sa sael safe safely safest safety said sake salutations same sameFile sample sampled samples sanity sasan sat satellite satisfactory satisfied satisfies satisfy saturation saturday save saveAT saveConvert saveEntry saveInternal saved savedCalendar savedTile savepoint savepoints saves saving savings saw sawDecimal sawDigit sawEarlyBreak sawExponent sawVarName saw_digit saw_xdigit sax saxParser say saying says sb sbVisStr sbuf sc scCutOverTimes scNewCurrencies scNewCurrenciesDFD scOldCurrencies scOldCurrenciesDFD scale scaled scales scaling scan scanByte scanEscape scanHexPost scanHexSeq scanIPv4Address scanToken scanline scanned scanning scans scattering scavenge scenario scenes sched schedule scheduleAtFixedRate scheduled scheduledExecutionTime schedules scheduling schema schemaPattern scheme schemeSpecificPart schemes school scientific scl sclSet scope scopeName scoped scopes scoping scratch screen screenBounds screenCapCM screenInsets screenRect screenSize screen_magnifier_present screens script scripts scroll scrollBars scrollPosition scrollabar scrollable scrollbar scrollbarDisplayPolicy scrollbarSerializedDataVersion scrollbarVisibility scrollbars scrollbarsAlwaysVisible scrolled scroller scrolling scrollpane sd sdde sdebug sdpStr sdsnd se seAsianSwapping seagull seal sealBase sealbase sealed sealing search searchHeavyweightChildren searchHeavyweightDescendants searchHeavyweights searchLen searchMergeList searchName searchPath searchResultsCache searchSieve searched searches searching searchstr sec secOrder secResult secSOrder secTOrder second secondColon secondDash secondString second_edition secondary secondaryOrder seconds secret secrets sect sectDirStart section sections sectorSize secure secureRandomSpi security securityPropFile see seeAllp seed seedGenerator seeded seeding seeing seek seeked seeking seeks seem seemed seemingly seems seen seencomma seendot sees segment segments segs sel select selectAll selectAllAccessibleSelection selectNow selectable selected selectedCheckbox selectedComponent selectedIndex selectedIndexes selectedIndices selectedKeys selecting selection selectionEnd selectionStart selections selectiveListener selectively selector selectors selects self selop semantic semantically semantics semi semicolon semicolons send sendMessage sendTo sendUrgentData sender sending sends sense senses sensible sensitive sensitivity sent sentence sentences sentinel sep separate separated separately separates separating separation separator separatorChar separatorIndex separators seperated seperation seperator seperators september sequence sequences sequential sequentially ser serName serex serial serialData serialField serialNum serialPersistendFields serialPersistentFields serialVersionOnStream serialVersionUID serializable serialization serialize serialized serializes serializing serially serialzied series serious serv serv_addr serve server serverChars servers serves service serviceName services serving session set set2DigitYearStart setA setAccessible setAccessibleDescription setAccessibleName setAccessibleParent setActionCommand setAddress setAlignment setAllowUserInteraction setAmPmStrings setArray setAsText setAsciiStream setAttributes setAutoCommit setAutoDelay setAutoWaitForIdle setBackground setBeanInfoSearchPath setBeginIndex setBigDecimal setBinaryStream setBit setBlob setBlockDataMode setBlockIncrement setBoolean setBound setBounds setBroadcast setByte setBytes setCaching setCalendar setCaps setCaretPosition setCatalog setCertificateEntry setChanged setChar setCharAt setCharacterStream setCheckBoxGroup setCheckboxGroup setChoices setClassAssertionStatus setClip setClob setColor setColumns setComponent setComponentOrientation setComposite setConstrained setConstraints setContentHandler setContentHandlerFactory setContextClassLoader setCopies setCopiesToDefault setCorners setCurrency setCurrencySymbol setCurrent setCurrentAccessibleValue setCurrentKeyboardFocusManager setCursor setCursorName setDSTSavings setDaemon setDash setDashT4 setData setDataElements setDatagramSocketImplFactory setDate setDateFormatSymbols setDecimalFormatSymbols setDecimalSeparator setDecimalSeparatorAlwaysShown setDecomposition setDefault setDefaultAllowUserInteraction setDefaultAssertionStatus setDefaultAuthenticator setDefaultFocusTraversalKeys setDefaultFocusTraversalPolicy setDefaultPermission setDefaultRequestProperty setDefaultSelection setDefaultUseCaches setDesignTime setDesktopProperty setDestination setDialog setDigit setDirectory setDispatchingEventTime setDisplayMode setDisplayName setDoInput setDoOutput setDone setDouble setDropTarget setDynamicLayout setEOF setEchoChar setEchoCharacter setEditable setEditorSearchPath setElementAt setEnabled setEndIndex setEndRule setEras setErr setErr0 setError setErrorIndex setEscapeProcessing setExceptionListener setExpert setExponentialSymbol setExtendedState setFactory setFetchDirection setFetchSize setField setFile setFileName setFileNameMap setFilenameFilter setFirstDayOfWeek setFloat setFocusCycleRoot setFocusTraversalKey setFocusTraversalKeys setFocusTraversalKeysEnabled setFocusTraversalKeys_NoIDCheck setFocusTraversalPolicy setFocusable setFocusableWindowState setFollowRedirects setFont setFoo setForeground setFormat setFormatByArgumentIndex setFormats setFormatsByArgumentIndex setFred setFromPage setFullScreenWindow setGlobalActiveWindow setGlobalCurrentFocusCycleRoot setGlobalFocusOwner setGlobalFocusedWindow setGlobalPermanentFocusOwner setGregorianChange setGroupingSeparator setGroupingSize setGroupingUsed setGuiAvailable setHelpMenu setHgap setHidden setHoldability setHours setID setIO setIconImage setIdentityInfo setIdentityPublicKey setIfModifiedSince setIfNotSet setIgnoreRepaint setImpl setImplicitDownCycleTraversal setIn setIn0 setInDefaultEventSet setIndex setIndexedReadMethod setIndexedWriteMethod setInfinity setInfo setInputStream setInstanceFollowRedirects setInt setInterface setInternalPersistenceDelegate setInternationalCurrencySymbol setKeepAlive setKeyChar setKeyEntry setKeyPair setKeyValues setLabel setLastModified setLastModifiedTime setLayout setLength setLenient setLineIncrement setLineNumber setLocalPatternChars setLocale setLocation setLocationRelativeTo setLockingKeyState setLog setLogStream setLogWriter setLoginTimeout setLong setLoopbackMode setLoopingStates setMaxDelimChar setMaxFieldSize setMaxPage setMaxPriority setMaxRows setMaximizedBounds setMaximum setMaximumFractionDigits setMaximumInteger setMaximumIntegerDigits setMedia setMediaToDefault setMenuBar setMessageDigest setMethodName setMinPage setMinimalDaysInFirstWeek setMinimum setMinimumFractionDigits setMinimumIntegerDigits setMinusSign setMinutes setModal setMode setModifiers setMonetaryDecimalSeparator setMonochrome setMonth setMonths setMostRecentFocusOwner setMultipleDocumentHandling setMultipleDocumentHandlingToDefault setMultipleMode setMultipleSelections setMultiplier setNaN setName setNanos setNegativePrefix setNegativeSuffix setNetworkInterface setNextException setNextFocusableComponent setNextWarning setNull setNumberFormat setOOBInline setObjFieldValues setObject setOffset setOption setOrientation setOrientationRequested setOrientationRequestedToDefault setOrigin setOut setOut0 setOwner setPackageAssertionStatus setPageIncrement setPageRanges setPaint setPaintMode setParameter setParent setParseIntegerOnly setPattern setPatternSeparator setPenDiameter setPenT4 setPerMill setPercent setPersistenceDelegate setPolicy setPort setPositivePrefix setPositiveSuffix setPreferred setPrimFieldValues setPrintQuality setPrintQualityToDefault setPrinter setPrinterResolution setPrinterResolutionToDefault setPriority setPriority0 setPropagationId setProperties setProperty setPropertyAttribute setPropertyEditorClass setProtectionDomain0 setPublicKey setPureJavaPrintDialog setQueryTimeout setRaster setRawOffset setReadMethod setReadOnly setReceiveBufferSize setRect setRef setRenderingHint setRenderingHints setRequestMethod setRequestProperty setResizable setReuseAddress setRows setRunFinalizersOnExit setSavepoint setScale setScrollPosition setSeconds setSecurityManager setSecurityManager0 setSeed setSelectedCheckbox setSelectionEnd setSelectionStart setSendBufferSize setShared setShort setShortDescription setShortMonths setShortWeekdays setShortcut setSides setSidesToDefault setSignerKeyPair setSigners setSize setSoLinger setSoTimeout setSocket setSocketAddress setSocketFactory setSocketImplFactory setSource setSpan setStartRule setStartYear setState setStateInternal setStatus setStream setStrength setString setStroke setStub setSystemScope setTTL setTarget setTcpNoDelay setText setTime setTimeInMillis setTimeToLive setTimeZone setTimestamp setTitle setToPage setToScale setTrafficClass setTransactionIsolation setTransform setTypeMap setURL setURLStreamHandlerFactory setUndecorated setUnicast setUnicodeStream setUnitIncrement setUseCaches setV4 setValue setValueIsAdjusting setValues setVgap setVisible setVisibleAmount setWarningString setWeekCountData setWeekdays setWheelScrollingEnabled setWriteMethod setXORMode setXXX setXxx setYear setZeroDigit setZoneStrings setlogStream sets settable setter setterArgs setterName setting settings setup seuences seven seventeen seventh sever several severe sez sgn sgsag sh shadow shadowInner shadowOuter shall shallow shape shaped shaper shapes shaping sharable share shared sharedInstance shares sharing sharp shear sheared shearing sheet sheets shekel shell shft shift shiftBias shiftDown shiftLeft shiftRight shifted shifting shifts shipped short short0 short1 shortDescription shortMonths shortValue shortWeekdays shortcomings shortcut shortcuts shorted shorten shortened shortening shortens shorter shortest shorthand shorthanding shorts should shouldBother shouldEnable shouldFire shouldNativelyFocusHeavyweight shouldNotify shouldRoundUp shouldinvalidate shouldn show showDocument showExtension showStatus showType showWhiteSpace showWindowWithoutWarningBanner showed showing shown shows shrink shsrp shuffle shuffled shuffling shut shutIn shutOut shut_rd shut_wr shutdown shutdownHooks shutdownInput shutdownOutput shutdowns shuts shutting shx shy si sib sibling sic side sided sides sieve sieveSearch sieveSingle sieves sift sig sig1 sig2 sigBytes sigBytesCopy sigDiff sigSpi sigSpiClone sigh sigma1 sign signAttribute signBit signInt signMask signSeen signal signaling signals signature signatures signbit signed signedAdd signedSubtract signedness signer signerCerts signers significance significand significant significantly signifies signifing signify signifying signing signingEngine signingKey signs signum sigs silent silently silly similar similarity similarly simluate simple simpleFormatter simpler simplest simplex simplicity simplified simplifies simplify simplifying simply simulate simulateException simulated simulating simultaneously sin sin6_flowinfo since sine single singleExpBias singleExpMask singleExpShift singleFractHOB singleFractMask singleMaxDecimalDigits singleMaxDecimalExponent singleMaxSmallTen singleMinDecimalExponent singleSignMask singleSmall10pow single_step singleton singletonList singletonMap singular sink sisin sit site sites sitting situation situations six sixteen sixth size sizeBeforeIntegerPart sizeCorrect sizeInBits sizeModCount sizePts sized sizeflag sizes skeletal skeleton skeletons skewed skip skipAssigned skipBlockData skipBuffer skipBytes skipCorrection skipCustomData skipDelimiters skipLF skipStack skipped skipping skips skslk slack slash slashCount slashSlashComments slashSlashCommentsP slashStarComments slashStarCommentsP slashes slate slave slaves sleep sleeping sleeps slen slice slicing slider slides sliding slight slightly slop slope slot slotDesc slots slow slower slowest slowing slows slslv slurp sm small small10pow small5pow smallPrime smallSieve smaller smallest smallestPositiveDouble smart smiles smooth smoothness smsmo smt sn snapshot snk snoop snsna so soc socket socketAccept socketAvailable socketBind socketClose0 socketConnect socketCreate socketGetOption socketImpls socketInputStream socketListen socketRead0 socketSendUrgentData socketSetOption socketShutdown socketWrite socketWrite0 sockets socksPort socksProxyHost socksProxyPort soft software soh solar solaris sole solely solid some someCaller someFile someReflectionAPI somebody somehow somemethod someone someplace something sometimes somewhat somewhere somtimes son soon sophisticated sort sort1 sort2 sorted sorting sorts sosom sound sounds source sourceBean sourceClass sourceCount sourceCursor sourceDecomposition sourceIndex sourceOffset sourcePeer sourceSize sourceText sourceWords sources south southern sov sp space spaced spaces spacing span spanned spanning spans sparc spare spares sparring sparse spawn spb speaking spec specTitle specVendor specVersion specfied special specialSaveChars special_characters specialcasing specialization specializations specialize specialized specializes specially specifed specific specifically specification specifications specificed specifics specified specifier specifiers specifies specify specifyHandlerPerm specifyStreamHandler specifying specs spectitle specvendor specversion speed speeds spelled spent spf spi spill spine split splits splitting spoof spoofing spot spots sql sqlStateSQL99 sqlStateXOpen sqlType sqrt sqsqi square squareToLen squares squaring squarings squirreled sr src srcActions srcArray srcBegin srcColorModel srcComponent srcEnd srcEvent srcName srcOffset srcRas srcSize src_position srcb srccolor srcpos srcs srsrp ss ssl ssp ssssw st stable stack stackSize stackTrace stacking stacks stage stages staging stale stall stamp stamp_a stamp_b stamps stand standalone standard standardEditorsPackage standardName standardProvider standardized standards standpoint stands stanford starlet starring start startAngle startBitIndex startBoundary startChar startClass startCompare startDate startDay startDayOfMonth startDayOfWeek startElement startIndex startLength startListeningForOtherDrags startLoad startMode startMonth startOffset startOffsets startPos startPosition startSearchForFirstChar startSearchForLastChar startTime startTimeMode startUnitIndex startValue startYear started starting startle starts startsWith startup startx starty stash stashed stat state state1 state2 stateClasses stateTable stated stateless statement statementCount statementList statements states statesToBackfill static staticCal staticLeapMonthLength staticMonthLength staticPermissions statically statics statistics statment status statusAll statusArray statusID statusIndex stay stays stdName stderr stderr_fd stderr_stream stdin stdin_fd stdin_stream stdout stdout_fd stdout_stream steal steals step steps sterling sthe stick sticky stickyRound still stillborn stipulation stipulations stitched stitches stm stmt stok stokes stolen stomp stop stop0 stopClass stopDispatching stopDispatchingImpl stopDispatchingLater stopListeningForOtherDrags stopOrSuspend stopPostProcessing stopThread stopThreadPermission stopped stopping stops storage store stored stores storesLowerCaseIdentifiers storesLowerCaseQuotedIdentifiers storesMixedCaseIdentifiers storesMixedCaseQuotedIdentifiers storesUpperCaseIdentifiers storesUpperCaseQuotedIdentifiers storing str strLastChar strLastIndex strStyle strValue straddle straddling straight straightforward strange strangely strategies strategy stream streamHandlerLock streamed streaming streams strength strengthOrder strengthResult strengths stretch stretched stretches strftime strict strictKeyValueSeparators stricter strictfp strictly strikethroughOffset strikethroughThickness string stringFlavor stringID stringIndex stringList stringToExamine stringWidth stringbuffer strings strip stripLeadingZeroBytes stripLeadingZeroInts stripOffParameters stripped strive strlen stroes stroke stroked stroker stroking strong stronger strongly structural structurally structure structurec structured structures stsot stub study stuff stx style styles stylistic su sub subFormat subFormatter subIterator subList subLists subMap subN subParse subParseZoneString subSequence subSet subString subarray subcase subcategory subcl subclass subclassAudits subclassed subclassers subclasses subclassing subcomponent subcomponents subdirectories subdirectory subdivide subdivided subdivision subexpressions subformat subformatPattern subformats subgroup subgroups subimage subinterface subinterfaces subitems subject sublist sublists submap submenu submit subname subpackage subpackages subparse subpaths subpattern subpatterns subpixel subprocess subprotocol subqueries subquery subrange subranges subregion subs subscribe subscribes subscribing subsection subsequence subsequent subsequently subset subsets subsidiary subspace subst substFQType substType substTypeName substantially substitued substitute substituted substitution substitutionRule substitutions substr substract substream substring substrings subsystems subtle subtract subtracted subtracting subtraction subtracts subtree subtrees subtype subtypeName subtypes succeed succeeded succeeding succeeds succesfuly success successful successfully succession successive successively successor such suddenly suffer suffice suffices sufficient sufficiently suffix suffixes suggested suggestion suggestions suggests suicide suid suit suitable suited sum sum1 sum2 sum3 summarizing summary sums sun sunday sunk sup super superBeanInfo superCl superClass superConnectServer superDesc superListening superRadix superType supercede superceded superclass superclasses superinterface superinterfaces supers supertable supertype supertypes supplemental supplementary supplemented supplements supplied supplies supply support supported supportedVersion supporting supports supportsANSI92EntryLevelSQL supportsANSI92FullSQL supportsANSI92IntermediateSQL supportsAlterTableWithAddColumn supportsAlterTableWithDropColumn supportsBatchUpdates supportsCatalogsInDataManipulation supportsCatalogsInIndexDefinitions supportsCatalogsInPrivilegeDefinitions supportsCatalogsInProcedureCalls supportsCatalogsInTableDefinitions supportsColumnAliasing supportsConvert supportsCoreSQLGrammar supportsCorrelatedSubqueries supportsCustomEditor supportsDataDefinitionAndDataManipulationTransactions supportsDataManipulationTransactionsOnly supportsDifferentTableCorrelationNames supportsExpressionsInOrderBy supportsExtendedSQLGrammar supportsFullOuterJoins supportsGetGeneratedKeys supportsGroupBy supportsGroupByBeyondSelect supportsGroupByUnrelated supportsIntegrityEnhancementFacility supportsLikeEscapeClause supportsLimitedOuterJoins supportsMinimumSQLGrammar supportsMixedCaseIdentifiers supportsMixedCaseQuotedIdentifiers supportsMultipleOpenResults supportsMultipleResultSets supportsMultipleTransactions supportsNamedParameters supportsNonNullableColumns supportsOpenCursorsAcrossCommit supportsOpenCursorsAcrossRollback supportsOpenStatementsAcrossCommit supportsOpenStatementsAcrossRollback supportsOrderByUnrelated supportsOuterJoins supportsPositionedDelete supportsPositionedUpdate supportsResultSetConcurrency supportsResultSetHoldability supportsResultSetType supportsSavepoints supportsSchemasInDataManipulation supportsSchemasInIndexDefinitions supportsSchemasInPrivilegeDefinitions supportsSchemasInProcedureCalls supportsSchemasInTableDefinitions supportsSelectForUpdate supportsStoredProcedures supportsSubqueriesInComparisons supportsSubqueriesInExists supportsSubqueriesInIns supportsSubqueriesInQuantifieds supportsTableCorrelationNames supportsTransactionIsolationLevel supportsTransactions supportsUnion supportsUnionAll supportsUrgentData suppose supposed suppress suppressed suppresses supradecimal supress sure surface surfaces surgery surprised surprises surprising surprisingly surrogate surrogates surrounded surrounding survive survived susceptible suspend suspend0 suspended suspends suspension susun sval sver svswe swag swallow swallowing swap swapOrder swapped swapper swapping swing switch switched switches switching switchover swswa sx sx1 sx2 sy sy1 sy2 sychronization syllable syllables symbol symbolic symbols symmetric symmetry syn sync synch synched synchronization synchronize synchronized synchronizedCollection synchronizedList synchronizedMap synchronizedSet synchronizedSortedMap synchronizedSortedSet synchronizes synchronizing synchronous synchronously synonym syntactic syntactically syntax syntaxes synthesize synthesized synthetic sys_paths system systemClipboard systemColors systemCustomCursorDirPrefix systemCustomCursorProperties systemCustomCursorPropertiesFile systemCustomCursors systemNativeLibraries systems systime sytle sz t t0 t1 t2 tExamining tFile tHeight tLong tOrder tT tValue tWeight tWidth ta tab table tableEntry tableIndex tableIndexClustered tableIndexHashed tableIndexOther tableIndexStatisic tableIndexStatistic tableNamePattern tables tabs tack tag tagged tagging tags tail tailMap tailSet tailor tailored take takeIPv4Address taken takes taking talk talking tall tampered tan tangent target targetBeanInfo targetChars targetClass targetCount targetCursor targetDecomposition targetEnter targetIndex targetLastEntered targetMethod targetOffset targetOver targetSet targetSize targetSqlType targetToAppContext targetToStatementList targetType targetWords targeted targeting targets tarray task taskFired tasks taste tat tatam taught tba tbe tblmask tc tc1 tca tcertificate tcertificates tcl tcode td te tear tearOff teardown tearing tears technically technique techniques technology teh telephone tell telling tells temp temp1 temp2 tempBuffer tempComp tempHeight tempItems tempL tempLength tempNumber tempRuleList tempState tempStateNum tempStateTable tempStatus tempString tempText tempWidth tempX tempY template temporarily temporary ten tenSbits tenSval tend tends tens tentative tenth terOrder terResult terSOrder terTOrder term terminal terminate terminated terminates terminating termination terminator terminators terms terribly territories tertiary tertiaryOrder test test1 test2 testArgs testBit testColorValueRange testFile testFormats testIndex tested testing tests testvalid tetel text textArea textAreaSerializedDataVersion textBeginIndex textBuffer textComponent textComponentSerializedDataVersion textEndIndex textEvent textField textFieldSerializedDataVersion textHighlight textHighlightText textInactiveText textL textLength textListener textListenerK textMode textOut textStart textText textToNumericFormat textValueChanged textfield textfields textlayout texts textual textually texture textured tf1 tf2 tf3 tf4 tfor tfrom tgtgk th tha than thanks that thatHost thatPath that_ thatmat the theAuthenticator theContext theEnd theEvent theOutputStream theQueue theString theTime thealgorithm their them themselves then theoretically theory there thereafter thereby therefore therein thereof these theta they thickness thin thing things think thinks third thirteenth thirty this thisAddr thisAddrs thisBits thisGC thisHost thisMinusOne thisName thisPath thisPlusOne thisThread thisTime thisVal this_ thismat thorn those though thought thousands thow thread threadGroup threadGroupPermission threadInitNumber threadLocals threadPermission threadPrimitiveDeprecation threadQ threadReaper threaded threadgroup threads threadtest01 threat three threshold threw thrice through throughout throw throwException throwMiscException throwMissingResourceException throwable throwables throwing thrown throws throwsException thru tht ththa thumb thursday thus thwarted ti tickles ticks tidy tie tiebreaker tied tight tighter tilde tileIcon till time timeFields timeStyle timeToFields time_s timely timeout timeouts timer times timesTenToThe timestamp timestamps timezone timezones timg tiny tiny10pow tis titir title titleColor titleFont titleJustification titlePosition titlecase tk tktuk tl tlim tls tltgl tm tmp tmpFileLock tmpPropertyStr tmpdir tmpout tn tno tntsn to toAddTo toAppendTo toArray toBack toBigInteger toBinaryString toBoolean toByteArray toCIEXYZ toChapter1 toChapter1Digest toChapter2 toCharArray toDegrees toElement toEnd toExternalForm toFocus toFront toGMTString toHex toHexString toIndex toIntArray toJavaFormatString toKey toLocaleString toLocalizedPattern toLower toLowerCase toNormalizerMode toNotify toOctalString toPage toPages toPattern toRGB toRadians toSkip toStart toString toStub toTest toTitleCase toType toURL toUnsignedString toUpperCase toUpperCaseCharArray toUpperCaseEx today toffset together toggle toggles tok token tokenMask tokenization tokenize tokenized tokenizer tokens told tolerable tolerant tolerate tone too took tool toolbar toolbars toolboxes tooldocs toolkit toolkits tools tooltip tooltips top topLevelWindow topLevelWindowPermission topics toplabel toplevel topmost topology torn tortoise tos toss tossed total totalDigits totalMemory totally totals toton touch touching toward towards tp tpublic tr tr15 trace traceInstructions traceMethodCalls tracing track trackMouseEnterExit tracked tracker tracking tracks trade trademark tradeoff trading traditional traffic trafficClass trailing trailingZeroCnt trailingZeroTable trailingZeros trajectory trans transaction transactions transcoding transfer transferFocus transferFocusBackward transferFocusDownCycle transferFocusUpCycle transferFrom transferSize transferTo transferred transfers transform transformation transformations transformed transforming transforms transient transientProperties transition transitional transitioned transitioning transitions transitive transitively transitivity translate translateKey translatePattern translatePoint translated translates translating translation transmission transmitted transmitting transparency transparent transparently transport trap trated travels traversable traversal traversals traverse traverseBackward traverseForward traverseOut traversed traverses traversing travesability treat treated treates treating treatment treats tree treelock trees trial trialTime trials trick trickier trickiness tricks tricky trie tried tries trigger triggered triggering triggers trigonometric trim trimToSize trims trip triplets trivial trivially trouble troublesome trown trtur true truly truncate truncated truncates truncating truncation trust trustProxy trusted trustedStripLeadingZeroInts trusts trustworthy try tryLess tryLessOrEqual trying ts tsign tstso tt ttb ttf ttl ttlLock tttat ttype tuesday tumble tunable tuned tuning tunnel turn turned turning turns turtle tw twelfth twelve twice two twoDown twos twtwi tx tx1 tx2 txt txtr ty ty1 ty2 tycho tying typ type typeAheadAssertions typeAheadMarkers typeClass typeCodes typeList typeName typeNamePattern typeNameToClass typeNameToPrimitiveClass typeNoNulls typeNullable typeNullableUnknown typePredBasic typePredChar typePredNone typeSearchable typeToClass typeToField typeToPackageName typecode typecodes typed typedID typedKey types typesafe typical typically typing typographic typographical tz tzNumber tzoffset u u0000 u0001 u0001_ u0002 u0002_ u0003 u0004 u0005 u0005J u0006 u0007 u0008 u0009 u000A u000B u000C u000D u000E u000b u000e u000f u0010 u0011 u0011C u0012 u0013 u0014 u0015 u0016 u0017 u0018 u0019 u001B u001C u001D u001E u001F u001a u001b u001c u001d u001e u001f u0020 u0021 u0022 u0023 u0024 u0025 u0026 u0027 u0028 u0029 u002C u002D u002E u002F u002a u002b u002c u002d u002e u002f u0030 u0031 u0032 u0033 u0034 u0035 u0036 u0037 u0038 u0039 u003A u003B u003F u003a u003b u003c u003d u003e u003f u0040 u0041 u0042 u0043 u0044 u0045 u0046 u0047 u0048 u0049 u004A u004C u004E u004a u004b u004c u004d u004e u004f u0050 u0051 u0052 u0053 u0054 u0055 u0056 u0057 u0058 u0059 u005A u005B u005a u005b u005d u005e u005f u0060 u0061 u0062 u0063 u0064 u0065 u0066 u0067 u0068 u0069 u006B u006C u006a u006b u006c u006d u006e u006f u0070 u0071 u0072 u0073 u0074 u0075 u0076 u0077 u0078 u0079 u007A u007B u007E u007F u007a u007b u007c u007d u007e u007f u007fA u007fB u007fBO u007fC u007fCCA u007fCKK u007fCOS u007fCQJ u007fCS u007fF u007fFE u007fJ u007fJQ u007fK u007fKCF u007fKCM u007fL u007fLCO u007fM u007fN u007fO u007fOD u007fOK u007fQ u007fQM u007fR u007fRQ u007fS u007fTR u007fV u007fW u0080 u0080R u0081 u0081C u0081K u0081L u0081N u0082 u0082K u0082KQQJMQL u0083 u0084 u0084C u0085 u0086 u0086A u0086JSO u0086MC u0086R u0087 u0087JK u0087O u0088 u0088C u0088E u0088K u0088M u0088OJ u0089 u0089E u0089O u0089XO u008A u008D u008a u008b u008c u008d u008dA u008e u008eC u008f u008fC u0090 u0091 u0092 u0092P u0093 u0094 u0095 u0096 u0096K u0097 u0097JO u0098 u0099 u009C u009F u009a u009b u009c u009d u009e u009f u00A0 u00A1 u00A2 u00A4 u00A5 u00A6 u00A7 u00A8 u00A9 u00AA u00AB u00AC u00AD u00AE u00B0 u00B1 u00B2 u00B3 u00B4 u00B5 u00B6 u00B7 u00B9 u00BA u00BB u00BC u00BD u00BE u00BF u00C0 u00C1 u00C2 u00C3 u00C4 u00C5 u00C6 u00C7 u00C8 u00C9 u00CA u00CB u00CC u00CD u00CE u00CF u00D0 u00D1 u00D2 u00D3 u00D4 u00D5 u00D6 u00D7 u00D8 u00D9 u00DA u00DB u00DC u00DD u00DE u00DF u00E0 u00E1 u00E2 u00E3 u00E4 u00E5 u00E6 u00E7 u00E8 u00E9 u00EA u00EB u00EC u00ED u00EE u00EF u00F0 u00F1 u00F2 u00F3 u00F4 u00F5 u00F6 u00F7 u00F8 u00F9 u00FA u00FB u00FC u00FD u00FE u00FF u00a0 u00a1 u00a2 u00a3 u00a4 u00a5 u00a6 u00a7 u00a8 u00a9 u00ab u00ac u00ae u00af u00b0 u00b1 u00b4 u00b5 u00b6 u00b7 u00b8 u00bb u00bc u00bd u00be u00bf u00c0E u00c1C u00c2 u00c2C u00c3 u00c3E u00c4 u00c4E u00c5 u00c5U u00c6 u00c7 u00c7D u00c8I u00c9G u00ca u00caG u00cbH u00ccO u00cdK u00ceJ u00cf u00cfO u00d1O u00d2 u00d2U u00d3 u00d3P u00d4 u00d4S u00d5 u00d5U u00d6U u00d7 u00d8 u00d9 u00d9W u00da u00daW u00dbW u00dc u00dcW u00ddZ u00df u00e0e u00e0zy u00e1c u00e2 u00e2c u00e3 u00e3e u00e4 u00e4b u00e4e u00e5 u00e5u u00e6 u00e7 u00e7d u00e8i u00e9 u00e9g u00ea u00eag u00ebh u00eco u00edk u00eej u00ef u00efo u00f1o u00f2 u00f2u u00f3 u00f3p u00f4 u00f4s u00f5 u00f5u u00f6t u00f7 u00f8 u00f9 u00f9w u00fa u00faw u00fbw u00fc u00fdz u00ff u0100 u0100E u0101 u0101e u0102 u0102E u0103 u0103e u0104 u0104E u0105 u0105e u0106 u0106E u0107 u0107e u0108 u0108E u0109 u0109e u010A u010AD u010B u010Bd u010C u010CD u010D u010Dd u010E u010EE u010F u010Fe u0110 u0111 u0112 u0112G u0113 u0113g u0114 u0114G u0115 u0115g u0116 u0116F u0117 u0117f u0118 u0118I u0119 u0119i u011A u011AG u011B u011C u011CH u011D u011Dh u011E u011EI u011F u0120 u0120H u0121 u0121h u0122 u0122H u0123 u0123h u0124 u0124I u0125 u0125i u0126 u0127 u0128 u0128N u0129 u0129n u012A u012AO u012B u012Bo u012C u012CO u012D u012Do u012E u012EO u012F u012Fo u0130 u0130M u0131 u0132 u0133 u0134 u0134O u0135 u0135o u0136 u0136L u0137 u0137l u0138 u0139 u0139M u013A u013Am u013B u013BN u013C u013Cn u013D u013DN u013E u013En u013F u0140 u0141 u0142 u0143 u0143O u0144 u0144o u0145 u0145R u0146 u0146r u0147 u0148 u0148o u0149 u014A u014B u014C u014CU u014D u014Du u014E u014EU u014F u014Fu u0150 u0150U u0151 u0151u u0152 u0153 u0154 u0155 u0155s u0156 u0156S u0157 u0157s u0158 u0158S u0159 u0159s u015A u015AU u015B u015Bu u015C u015CU u015D u015Du u015E u015ET u015F u015Ft u0160 u0160T u0161 u0161t u0162 u0163 u0164 u0164U u0165 u0166 u0167 u0168 u0168V u0169 u0169v u016A u016Aa u016B u016C u016Ca u016D u016E u016Ea u016F u016Fw u0170 u0170o u0171 u0172 u0172a u0173 u0174 u0174Y u0175 u0175y u0176 u0176Z u0177 u0177z u0178 u0178a u0179 u0179a u017A u017B u017Bb u017C u017D u017Da u017E u017F u017f u0180 u0181 u0182 u0183 u0184 u0185 u0186 u0187 u0188 u0189 u018A u018B u018C u018D u018E u018F u018f u0190 u0191 u0192 u0193 u0194 u0195 u0196 u0198 u0199 u019A u019B u019C u019D u019E u019F u019f u01A0 u01A0U u01A1 u01A1u u01A2 u01A3 u01A4 u01A5 u01A6 u01A7 u01A8 u01A9 u01AA u01AB u01AC u01AD u01AE u01AF u01AFo u01B0 u01B1 u01B2 u01B3 u01B4 u01B5 u01B6 u01B7 u01B8 u01B9 u01BA u01BB u01BC u01BD u01BE u01BF u01C0 u01C2 u01C3 u01C4 u01C5 u01C6 u01C7 u01C8 u01C9 u01CA u01CB u01CC u01CD u01CDC u01CE u01CEc u01CF u01CFK u01D0 u01D0j u01D1 u01D1R u01D2 u01D2r u01D3 u01D3Z u01D4 u01D4z u01D5 u01D6 u01D7 u01D8 u01D9 u01DA u01DB u01DC u01DD u01DE u01DF u01E0 u01E1 u01E2 u01E3 u01E4 u01E5 u01E6 u01E6I u01E7 u01E7i u01E8 u01E8L u01E9 u01E9l u01EA u01EAU u01EB u01EC u01ED u01EE u01EF u01F0 u01F0k u01F1 u01F2 u01F3 u01F4 u01F4I u01F5 u01F5i u01F6 u01F8 u01FA u01FB u01FC u01FD u01FE u01FF u01b7 u0200 u0200E u0201 u0201e u0202 u0202E u0203 u0203e u0204 u0204I u0205 u0205i u0206 u0206I u0207 u0207i u0208 u0208O u0209 u020A u020AO u020B u020C u020CR u020D u020Dr u020E u020ER u020F u020Fr u0210 u0210U u0211 u0211u u0212 u0212U u0213 u0213u u0214 u0214a u0215 u0216 u0216a u0217 u0218 u021A u021B u021C u021E u021F u0220 u0222 u0223 u0224 u0226 u0227 u0228 u022A u022B u022C u022E u022F u0230 u0231 u0232 u0233 u0234 u0236 u0237 u0238 u023A u023C u023D u023E u0240 u0242 u0243 u0244 u0246 u0248 u0249 u024A u024C u024E u024F u0250 u0252 u0253 u0254 u0256 u0257 u0258 u0259 u025A u025C u025D u025E u0260 u0262 u0263 u0264 u0266 u0268 u026A u026C u026E u0270 u0271 u0272 u0274 u0275 u0276 u0277 u0278 u0279 u027A u027C u027D u027E u027b u0280 u0281 u0282 u0283 u0284 u0286 u0288 u0289 u028A u028C u028E u028F u0290 u0292 u0294 u0295 u0296 u0298 u029A u029B u029C u029E u02A0 u02A1 u02A2 u02A4 u02A7 u02A8 u02AA u02AD u02B0 u02B3 u02B6 u02B8 u02B9 u02BB u02BC u02BE u02BF u02C1 u02C2 u02C5 u02C8 u02CD u02D0 u02D1 u02D2 u02D5 u02D8 u02DB u02DE u02E0 u02E1 u02E4 u02E8 u02EB u02EE u02F1 u02F4 u02F7 u02FA u02FE u02b9 u02bc u0300 u0300A u0300zy u0301 u0301A u0302 u0302A u0303 u0303A u0304 u0304A u0305 u0306 u0306A u0307 u0307B u0308 u0308A u0309 u0309A u030A u030AA u030B u030BO u030C u030CA u030D u030E u030F u030FA u030a u030b u030c u030d u030e u030f u0310 u0311 u0311A u0312 u0313 u0314 u0315 u0316 u0317 u0318 u0319 u031BO u031C u031D u031F u031a u031b u031c u031d u031e u031f u0320 u0321 u0322 u0323 u0323A u0324 u0324U u0325 u0325A u0326 u0327 u0327C u0328 u0328A u0329 u032A u032B u032D u032DD u032E u032EH u032a u032b u032c u032d u032e u032f u0330 u0330E u0331 u0331B u0332 u0333 u0334 u0335 u0336 u0337 u0338 u0339 u033A u033D u033E u033a u033b u033c u033d u033e u033f u0340 u0341 u0342 u0343 u0344 u0345 u0346 u0349 u034A u034C u034D u034E u034F u0351 u0353 u0355 u0356 u0359 u035A u035B u035D u0360 u0361 u0363 u0365 u0366 u0369 u036A u036C u036D u036E u036F u0370 u0371 u0373 u0374 u0375 u0376 u0379 u037A u037C u037E u037F u0382 u0385 u0386 u0387 u0388 u0389 u038A u038C u038E u038F u0390 u0391 u0392 u0395 u0397 u0398 u0399 u039B u039C u039E u039F u039f u03A1 u03A3 u03A4 u03A5 u03A7 u03A9 u03AA u03AB u03AC u03AD u03AE u03AF u03B0 u03B1 u03B3 u03B5 u03B6 u03B7 u03B9 u03BC u03BF u03C1 u03C2 u03C5 u03C8 u03C9 u03CA u03CB u03CC u03CD u03CE u03D0 u03D1 u03D2 u03D3 u03D4 u03D5 u03D6 u03D7 u03DA u03DC u03DD u03DE u03E0 u03E2 u03E3 u03E4 u03E5 u03E6 u03E7 u03E8 u03E9 u03EA u03EB u03EC u03ED u03EE u03EF u03F2 u03F3 u03F5 u03F8 u03FB u03FE u03a1 u03a5 u03a9 u03b1 u03b5 u03b7 u03b9 u03bc u03bf u03c1 u03c5 u03c9 u03d2 u0400 u0401 u0403 u0404 u0406 u0407 u040A u040B u040C u040D u040E u0410 u0413 u0414 u0415 u0416 u0417 u0418 u0419 u041A u041C u041D u041E u041a u041e u0420 u0423 u0426 u0427 u0429 u042B u042C u042F u042b u0430 u0432 u0433 u0435 u0436 u0437 u0438 u0439 u043A u043B u043E u043a u043e u0441 u0443 u0444 u0447 u044A u044B u044E u044F u044b u0451 u0453 u0455 u0456 u0457 u0458 u045B u045C u045E u045F u0460 u0461 u0462 u0463 u0464 u0465 u0466 u0467 u0468 u0469 u046A u046B u046C u046D u046E u046F u0470 u0471 u0472 u0473 u0474 u0475 u0476 u0477 u0478 u0479 u047A u047B u047C u047D u047E u047F u0480 u0481 u0482 u0483 u0484 u0485 u0486 u048A u048D u048E u0490 u0491 u0492 u0493 u0494 u0495 u0496 u0497 u0498 u0499 u049A u049B u049C u049D u049E u049F u04A0 u04A1 u04A2 u04A3 u04A4 u04A5 u04A6 u04A7 u04A8 u04A9 u04AA u04AB u04AC u04AD u04AE u04AF u04B0 u04B1 u04B2 u04B3 u04B4 u04B5 u04B6 u04B7 u04B8 u04B9 u04BA u04BB u04BC u04BD u04BE u04BF u04C0 u04C1 u04C2 u04C3 u04C4 u04C7 u04C8 u04CB u04CC u04CF u04D0 u04D1 u04D2 u04D3 u04D4 u04D5 u04D6 u04D7 u04D8 u04D9 u04DA u04DB u04DC u04DD u04DE u04DF u04E0 u04E1 u04E2 u04E3 u04E4 u04E5 u04E6 u04E7 u04E8 u04E9 u04EA u04EB u04ED u04EE u04EF u04F0 u04F1 u04F2 u04F3 u04F4 u04F5 u04F6 u04F8 u04F9 u04FC u0500 u0504 u0506 u0507 u050A u050B u050D u0510 u0513 u0516 u0519 u051C u0520 u0524 u0527 u052A u052D u0530 u0531 u0533 u0535 u0536 u0539 u053B u053C u053D u053F u0541 u0542 u0544 u0545 u0546 u0548 u054B u054E u0551 u0552 u0554 u0556 u0557 u0559 u055A u055C u055E u055F u0561 u0562 u0565 u0566 u056A u056B u056E u056b u056d u0572 u0574 u0576 u057A u057D u057e u0580 u0581 u0582 u0583 u0586 u0587 u0589 u058C u058F u0590 u0591 u0592 u0596 u0598 u059A u059D u05A0 u05A1 u05A3 u05A6 u05A9 u05AB u05AC u05B0 u05B4 u05B7 u05B8 u05B9 u05BB u05BC u05BD u05BE u05BF u05C0 u05C1 u05C2 u05C3 u05C4 u05C7 u05CA u05CD u05D0 u05D1 u05D2 u05D3 u05D4 u05D5 u05D6 u05D8 u05D9 u05DA u05DB u05DC u05DE u05DF u05E0 u05E1 u05E2 u05E3 u05E4 u05E5 u05E6 u05E7 u05E8 u05E9 u05EA u05EB u05EE u05F0 u05F2 u05F3 u05F4 u05F6 u05FA u05FE u05b7 u05b8 u05b9 u05bc u05bf u05c1 u05c2 u05d0 u05d1 u05d2 u05d3 u05d4 u05d5 u05d6 u05d8 u05d9 u05da u05db u05dc u05dd u05de u05e0 u05e1 u05e2 u05e3 u05e4 u05e6 u05e7 u05e8 u05e9 u05ea u05f2 u0600 u0601 u0602 u0604 u0607 u0609 u060A u060B u060C u060D u0610 u0613 u0616 u0619 u061B u061C u061D u061E u061F u0621 u0622 u0623 u0624 u0625 u0626 u0627 u0628 u0629 u062B u062E u062a u062b u062c u062d u062e u062f u0630 u0631 u0632 u0633 u0634 u0635 u0636 u0637 u0638 u0639 u063A u063D u063a u0640 u0641 u0642 u0643 u0644 u0645 u0646 u0647 u0648 u0649 u064A u064B u064C u064F u064a u064b u064c u064d u064e u064f u0650 u0651 u0652 u0655 u065B u065E u0660 u0661 u0664 u0666 u0667 u0669 u066A u066B u066D u066F u0670 u0671 u0672 u0673 u0677 u0679 u067B u067D u067E u067F u067a u067b u067e u067f u0680 u0683 u0684 u0686 u0687 u0688 u068B u068F u068c u068d u068e u0691 u0693 u0697 u0698 u069B u069F u06A3 u06A7 u06A9 u06AA u06AB u06AF u06B3 u06B7 u06BA u06BD u06BE u06C0 u06C3 u06C6 u06C9 u06CB u06CD u06CE u06D0 u06D1 u06D3 u06D4 u06D5 u06D6 u06D9 u06DA u06DC u06DD u06DE u06DF u06E1 u06E4 u06E5 u06E6 u06E7 u06E8 u06E9 u06EA u06EB u06EC u06ED u06F0 u06F1 u06F4 u06F7 u06F9 u06FA u06FD u06a4 u06a6 u06a9 u06ad u06af u06b1 u06b3 u06ba u06bb u06be u06c0 u06c1 u06c5 u06c6 u06c7 u06c8 u06c9 u06cb u06cc u06d0 u06d2 u06d3 u0700 u0703 u0706 u0708 u0709 u070B u070D u0711 u0715 u0719 u071D u0721 u0722 u0725 u0729 u072B u072D u0731 u0735 u0736 u0739 u073D u0741 u0745 u0749 u074B u074D u0750 u0751 u0755 u0759 u075C u075F u0762 u0765 u0766 u0769 u076C u076D u0771 u0775 u0779 u077D u077F u0780 u0781 u0785 u0786 u0789 u078D u0790 u0793 u0796 u0799 u079C u079F u07A2 u07A5 u07A6 u07A8 u07AB u07AF u07B3 u07B7 u07BB u07BF u07C0 u07C3 u07C6 u07C9 u07CB u07CD u07D1 u07D5 u07D9 u07DD u07E1 u07E2 u07E4 u07E5 u07E6 u07E7 u07EB u07EF u07F3 u07F7 u07FA u07FD u07FE u07FF u07ff u0800 u0801 u0805 u0808 u0809 u080B u080D u0810 u0813 u0817 u0818 u081B u081F u0820 u0821 u0823 u0827 u082B u082E u0831 u0835 u0839 u083D u0841 u0845 u0849 u084C u084F u0853 u0857 u085B u085F u0863 u0865 u0866 u0867 u086A u086D u086F u0871 u0875 u0879 u087D u0881 u0884 u0885 u0888 u088B u088F u0893 u0897 u089B u089E u08A1 u08A5 u08A9 u08AD u08B1 u08B4 u08B7 u08BB u08BF u08C3 u08C7 u08CB u08CF u08D1 u08D2 u08D6 u08DA u08DE u08E1 u08E4 u08E8 u08EC u08F0 u08F4 u08F8 u08FC u08FF u0900 u0901 u0902 u0903 u0905 u0906 u0908 u090A u090E u0912 u0915 u0916 u0917 u091A u091C u091D u091c u0920 u0921 u0922 u0923 u0926 u0928 u0929 u092B u092C u092F u092b u092f u0930 u0931 u0932 u0933 u0934 u0935 u0938 u0939 u093B u093C u093D u093E u093c u0940 u0941 u0942 u0944 u0948 u0949 u094C u094D u0950 u0951 u0954 u0956 u0958 u0959 u095A u095B u095C u095D u095E u095F u0960 u0961 u0962 u0963 u0964 u0965 u0966 u096A u096E u096F u0970 u0972 u0977 u097C u0980 u0981 u0982 u0983 u0985 u0986 u098B u098C u098F u0990 u0993 u0994 u0998 u099D u09A1 u09A2 u09A7 u09A8 u09AA u09AC u09AF u09B0 u09B1 u09B2 u09B6 u09B9 u09BA u09BC u09BE u09C0 u09C1 u09C3 u09C4 u09C7 u09C8 u09CB u09CC u09CD u09D2 u09D7 u09DC u09DD u09DF u09E0 u09E1 u09E2 u09E3 u09E4 u09E6 u09E9 u09EE u09EF u09F0 u09F1 u09F2 u09F3 u09F4 u09F8 u09F9 u09FA u09FD u09a1 u09a2 u09ac u09af u09bc u09be u09c7 u09d7 u0A00 u0A02 u0A05 u0A06 u0A0A u0A0F u0A10 u0A13 u0A14 u0A16 u0A17 u0A19 u0A1C u0A1E u0A21 u0A23 u0A28 u0A2A u0A2B u0A2E u0A30 u0A32 u0A33 u0A35 u0A36 u0A38 u0A39 u0A3C u0A3E u0A40 u0A41 u0A42 u0A43 u0A46 u0A47 u0A48 u0A49 u0A4B u0A4C u0A4D u0A4F u0A54 u0A58 u0A59 u0A5A u0A5B u0A5C u0A5E u0A5F u0A62 u0A66 u0A69 u0A6C u0A6F u0A70 u0A71 u0A72 u0A74 u0A7E u0A80 u0A81 u0A82 u0A83 u0A84 u0A85 u0A88 u0A8B u0A8C u0A8D u0A8F u0A91 u0A93 u0A96 u0A99 u0A9C u0AA8 u0AAA u0AAB u0AAE u0AB0 u0AB2 u0AB3 u0AB5 u0AB6 u0AB9 u0ABC u0ABD u0ABE u0ABF u0AC0 u0AC1 u0AC3 u0AC5 u0AC6 u0AC7 u0AC8 u0AC9 u0ACB u0ACC u0ACD u0ACF u0AD0 u0AD8 u0ADC u0ADF u0AE0 u0AE3 u0AE6 u0AEA u0AED u0AEF u0AF0 u0AF3 u0AF6 u0AFF u0B00 u0B01 u0B02 u0B03 u0B05 u0B06 u0B09 u0B0A u0B0C u0B0F u0B10 u0B12 u0B13 u0B15 u0B18 u0B1B u0B1E u0B21 u0B22 u0B24 u0B27 u0B28 u0B2A u0B2D u0B2F u0B30 u0B32 u0B33 u0B36 u0B39 u0B3C u0B3D u0B3E u0B3F u0B40 u0B41 u0B42 u0B43 u0B45 u0B47 u0B48 u0B4B u0B4C u0B4D u0B4E u0B51 u0B54 u0B56 u0B57 u0B5A u0B5C u0B5D u0B5F u0B60 u0B61 u0B63 u0B66 u0B69 u0B6C u0B6E u0B6F u0B70 u0B73 u0B76 u0B79 u0B7C u0B7F u0B80 u0B82 u0B83 u0B85 u0B88 u0B8A u0B8B u0B8E u0B90 u0B91 u0B92 u0B94 u0B95 u0B97 u0B99 u0B9A u0B9C u0B9D u0B9E u0B9F u0BA0 u0BA3 u0BA4 u0BA6 u0BA8 u0BA9 u0BAA u0BAC u0BAE u0BAF u0BB2 u0BB5 u0BB7 u0BB8 u0BB9 u0BBB u0BBE u0BBF u0BC0 u0BC1 u0BC2 u0BC4 u0BC6 u0BC7 u0BC8 u0BCA u0BCB u0BCC u0BCD u0BD0 u0BD3 u0BD6 u0BD7 u0BD9 u0BDC u0BDF u0BE2 u0BE5 u0BE7 u0BE8 u0BEB u0BEE u0BEF u0BF0 u0BF1 u0BF2 u0BF4 u0BF7 u0BFA u0BFD u0C00 u0C01 u0C03 u0C05 u0C06 u0C09 u0C0C u0C0E u0C0F u0C10 u0C12 u0C15 u0C18 u0C1B u0C1E u0C21 u0C24 u0C28 u0C2A u0C2C u0C2F u0C32 u0C33 u0C35 u0C38 u0C39 u0C3B u0C3E u0C40 u0C41 u0C44 u0C46 u0C47 u0C48 u0C4A u0C4D u0C50 u0C53 u0C55 u0C56 u0C59 u0C5C u0C5F u0C60 u0C61 u0C62 u0C65 u0C66 u0C68 u0C6B u0C6E u0C6F u0C71 u0C74 u0C77 u0C7A u0C7D u0C80 u0C82 u0C83 u0C85 u0C86 u0C89 u0C8B u0C8C u0C8E u0C90 u0C92 u0C93 u0C95 u0C97 u0C9A u0C9C u0C9F u0CA1 u0CA3 u0CA7 u0CA8 u0CAA u0CAB u0CAF u0CB2 u0CB3 u0CB5 u0CB8 u0CB9 u0CBB u0CBE u0CBF u0CC0 u0CC1 u0CC2 u0CC4 u0CC6 u0CC7 u0CC8 u0CCA u0CCB u0CCC u0CCD u0CCF u0CD2 u0CD5 u0CD6 u0CD8 u0CDB u0CDE u0CE0 u0CE1 u0CE4 u0CE6 u0CE7 u0CE9 u0CEB u0CED u0CEF u0CF1 u0CF3 u0CF5 u0CF7 u0CF9 u0CFC u0CFF u0D00 u0D02 u0D03 u0D05 u0D08 u0D0B u0D0C u0D0D u0D0E u0D0F u0D10 u0D11 u0D12 u0D13 u0D15 u0D18 u0D1B u0D1F u0D22 u0D25 u0D28 u0D2A u0D2B u0D2E u0D31 u0D34 u0D37 u0D39 u0D3A u0D3D u0D3E u0D40 u0D41 u0D43 u0D46 u0D47 u0D48 u0D49 u0D4A u0D4B u0D4C u0D4D u0D4F u0D52 u0D55 u0D57 u0D58 u0D5B u0D5E u0D60 u0D61 u0D64 u0D66 u0D68 u0D6C u0D6F u0D70 u0D74 u0D78 u0D7B u0D7E u0D80 u0D81 u0D84 u0D87 u0D8B u0D8E u0D91 u0D94 u0D97 u0D9A u0D9D u0DA1 u0DA5 u0DA8 u0DAB u0DAE u0DB1 u0DB4 u0DB7 u0DBA u0DBD u0DBF u0DC0 u0DC3 u0DC6 u0DC9 u0DCC u0DCF u0DD2 u0DD5 u0DD8 u0DDB u0DDE u0DE1 u0DE4 u0DE7 u0DEA u0DED u0DF0 u0DF3 u0DF6 u0DF9 u0DFC u0DFF u0E00 u0E01 u0E02 u0E05 u0E08 u0E0C u0E0F u0E12 u0E16 u0E19 u0E1C u0E1F u0E22 u0E25 u0E28 u0E2B u0E2E u0E2F u0E30 u0E31 u0E32 u0E33 u0E34 u0E37 u0E3A u0E3E u0E3F u0E40 u0E42 u0E45 u0E46 u0E47 u0E48 u0E4B u0E4E u0E4F u0E50 u0E52 u0E55 u0E58 u0E59 u0E5A u0E5B u0E5F u0E63 u0E67 u0E6A u0E6D u0E70 u0E74 u0E77 u0E7B u0E7E u0E80 u0E81 u0E82 u0E84 u0E87 u0E88 u0E8A u0E8B u0E8D u0E8E u0E91 u0E94 u0E97 u0E99 u0E9A u0E9D u0E9F u0EA0 u0EA1 u0EA3 u0EA5 u0EA6 u0EA7 u0EA9 u0EAA u0EAB u0EAC u0EAD u0EAE u0EAF u0EB0 u0EB1 u0EB2 u0EB3 u0EB4 u0EB5 u0EB8 u0EB9 u0EBB u0EBC u0EBD u0EBE u0EBF u0EC0 u0EC1 u0EC4 u0EC6 u0EC7 u0EC8 u0ECA u0ECD u0ED0 u0ED3 u0ED7 u0ED9 u0EDA u0EDC u0EDD u0EE0 u0EE3 u0EE6 u0EE9 u0EEC u0EF0 u0EF3 u0EF6 u0EFA u0EFD u0F00 u0F01 u0F03 u0F04 u0F05 u0F09 u0F0D u0F0E u0F11 u0F12 u0F13 u0F15 u0F17 u0F18 u0F19 u0F1A u0F1B u0F1E u0F1F u0F20 u0F21 u0F24 u0F27 u0F29 u0F2A u0F2D u0F2E u0F31 u0F33 u0F34 u0F35 u0F36 u0F37 u0F38 u0F39 u0F3A u0F3B u0F3C u0F3D u0F3E u0F3F u0F40 u0F42 u0F43 u0F46 u0F47 u0F49 u0F4C u0F4D u0F4F u0F51 u0F52 u0F55 u0F56 u0F57 u0F58 u0F59 u0F5B u0F5C u0F5F u0F62 u0F65 u0F68 u0F69 u0F6B u0F6E u0F71 u0F72 u0F73 u0F74 u0F75 u0F76 u0F77 u0F78 u0F79 u0F7A u0F7D u0F7E u0F7F u0F80 u0F81 u0F83 u0F84 u0F85 u0F86 u0F87 u0F8B u0F8F u0F90 u0F92 u0F93 u0F95 u0F97 u0F99 u0F9B u0F9C u0F9D u0F9F u0FA1 u0FA2 u0FA3 u0FA6 u0FA7 u0FAA u0FAB u0FAC u0FAD u0FB0 u0FB1 u0FB2 u0FB3 u0FB4 u0FB5 u0FB6 u0FB7 u0FB8 u0FB9 u0FBA u0FBC u0FBE u0FC0 u0FC2 u0FC4 u0FC6 u0FC8 u0FCB u0FCC u0FCD u0FD0 u0FD4 u0FD7 u0FDB u0FDE u0FE2 u0FE5 u0FE8 u0FEA u0FEC u0FEE u0FF0 u0FF2 u0FF4 u0FF6 u0FF8 u0FFA u0FFC u0FFE u0a16 u0a17 u0a1c u0a21 u0a2b u0a3c u0b21 u0b22 u0b2f u0b3c u0b3e u0b47 u0b56 u0b57 u0b92 u0bbe u0bc6 u0bc7 u0bd7 u0c46 u0c56 u0cbf u0cc2 u0cc6 u0cd5 u0cd6 u0d3e u0d46 u0d47 u0d57 u0e01 u0e2e u0e32 u0e3f u0e40 u0e44 u0e4d u0e81 u0e99 u0ea1 u0eab u0eae u0eb2 u0ec0 u0ec4 u0ecd u0f40 u0f42 u0f4c u0f51 u0f56 u0f5b u0f71 u0f72 u0f74 u0f80 u0f90 u0f92 u0f9c u0fa1 u0fa6 u0fab u0fb2 u0fb3 u0fb5 u0fb7 u1 u1000 u1002 u1004 u1006 u1008 u100A u100C u100E u100F u1010 u1012 u1014 u1016 u1018 u101A u101C u101E u1020 u1023 u1025 u1028 u102A u102D u102F u1031 u1033 u1035 u1037 u1039 u103B u103D u103F u1041 u1043 u1046 u1048 u104A u104C u104E u1050 u1052 u1055 u1059 u105C u105E u1060 u1062 u1064 u1066 u1068 u106A u106C u106E u1070 u1072 u1074 u1076 u107A u107E u1082 u1086 u108A u108E u1092 u1096 u109A u109E u10A0 u10A2 u10A6 u10A9 u10AB u10AE u10B2 u10B5 u10B7 u10BA u10BE u10C3 u10C5 u10C6 u10C8 u10CA u10CB u10CF u10D0 u10D1 u10D3 u10D5 u10D7 u10D9 u10DC u10E0 u10E3 u10E5 u10E8 u10EC u10F1 u10F4 u10F6 u10F9 u10FB u10FD u10FF u1100 u1101 u1102 u1103 u1105 u1106 u1107 u1108 u1109 u110C u110F u110b u110c u110e u110f u1110 u1111 u1112 u1113 u1115 u1117 u1119 u111B u111D u111F u1121 u1123 u1125 u1127 u112A u112D u1130 u1133 u1136 u1139 u113C u113F u113c u113e u1140 u1142 u1145 u1147 u1149 u114B u114D u114F u114c u114e u1150 u1151 u1153 u1155 u1157 u1159 u115B u115D u115F u115f u1160 u1161 u1163 u1165 u1167 u1169 u116B u116D u116F u116d u116e u1171 u1172 u1173 u1175 u1177 u1179 u117B u117D u117F u1181 u1183 u1185 u1187 u1189 u118B u118D u118F u1191 u1193 u1195 u1197 u1199 u119B u119D u119F u119e u11A1 u11A2 u11A3 u11A5 u11A7 u11A8 u11A9 u11AB u11AD u11AF u11B1 u11B3 u11B6 u11B9 u11BB u11BE u11C1 u11C3 u11C6 u11C9 u11CB u11CE u11D0 u11D3 u11D6 u11D9 u11DC u11DF u11E2 u11E5 u11E7 u11E9 u11EC u11EF u11F1 u11F4 u11F6 u11F8 u11F9 u11FB u11FD u11FF u11a8 u11ab u11ae u11af u11b7 u11b8 u11ba u11bc u11bd u11be u11bf u11c0 u11c1 u11c2 u11eb u11f0 u11f9 u1200 u1201 u1203 u1205 u1207 u120A u120C u120F u1211 u1214 u1216 u1219 u121B u121E u1222 u1225 u1227 u1229 u122C u1230 u1233 u1235 u1237 u123A u123C u123E u1241 u1244 u1247 u1249 u124A u124E u1251 u1255 u1258 u125B u125E u1261 u1264 u1267 u126A u126D u1271 u1275 u1278 u127B u127E u1282 u1285 u1288 u128B u128E u1291 u1293 u1296 u1298 u129B u129E u12A1 u12A4 u12A6 u12A9 u12AD u12B0 u12B3 u12B7 u12BA u12BC u12BF u12C1 u12C3 u12C5 u12C7 u12C9 u12CB u12CD u12CF u12D1 u12D3 u12D5 u12D7 u12D9 u12DB u12DF u12E3 u12E7 u12EB u12EF u12F3 u12F7 u12FB u12FF u1303 u1307 u130B u130F u1313 u1318 u131D u1322 u1327 u132C u1331 u1336 u133B u1340 u1345 u1349 u134A u134F u1354 u1359 u135E u1362 u1366 u136A u136E u1372 u1375 u1376 u1377 u1378 u1379 u137A u137B u137C u137E u1380 u1382 u1386 u138A u138E u1392 u1396 u139A u139E u13A0 u13A2 u13A6 u13AA u13AE u13B2 u13B6 u13BA u13BE u13C2 u13C6 u13C9 u13CA u13CE u13D2 u13D6 u13DA u13DE u13E2 u13E6 u13EA u13EE u13F0 u13F2 u13F4 u13F6 u13F8 u13FA u13FC u13FE u1400 u1402 u1404 u1406 u1408 u140A u140D u1410 u1413 u1416 u1419 u141C u141F u1422 u1425 u1428 u142B u142E u1431 u1434 u1436 u1438 u143A u143C u143E u1440 u1442 u1444 u1446 u1448 u1449 u144A u144C u144E u1450 u1452 u1454 u1456 u1458 u145A u145C u145E u1460 u1462 u1464 u1466 u1468 u146A u146C u146E u1470 u1472 u1474 u1476 u1478 u147A u147C u147E u1480 u1482 u1484 u1486 u1488 u148A u148C u148E u1490 u1492 u1494 u1496 u1499 u149C u149F u14A2 u14A5 u14A8 u14AB u14AE u14B1 u14B5 u14B9 u14BD u14BF u14C1 u14C3 u14C5 u14C7 u14C9 u14CB u14CD u14CF u14D1 u14D3 u14D5 u14D7 u14D9 u14DB u14DD u14DF u14E1 u14E3 u14E5 u14E7 u14E9 u14EB u14ED u14EF u14F1 u14F3 u14F5 u14F7 u14F9 u14FB u14FD u14FF u1501 u1503 u1505 u1507 u1509 u150B u150D u150F u1511 u1513 u1515 u1517 u1519 u151B u1521 u1526 u152C u1530 u1536 u153A u153E u1545 u1549 u154A u154E u1552 u1556 u155B u1560 u1565 u1566 u156A u156F u1574 u1579 u1580 u1583 u1586 u158A u1591 u1597 u159C u15A3 u15AA u15AF u15B3 u15B7 u15BC u15C1 u15C7 u15C9 u15CD u15D1 u15D5 u15DA u15DE u15E2 u15E5 u15E8 u15EC u15F0 u15F7 u15FC u1602 u1609 u160E u1612 u1615 u1616 u161D u1622 u1629 u162D u1633 u1637 u163C u1640 u1645 u1648 u164B u1650 u1656 u165B u165E u1664 u1668 u166C u1671 u1675 u1679 u167D u1680 u1683 u1688 u168B u1692 u1696 u169C u16A0 u16A1 u16A6 u16AA u16AE u16B3 u16B6 u16BB u16C1 u16C4 u16C8 u16CB u16CF u16D2 u16D5 u16D8 u16DB u16DE u16E1 u16E4 u16E7 u16EA u16ED u16F1 u16F5 u16F9 u16FD u1700 u1701 u1705 u1709 u170D u1711 u1715 u1717 u1719 u171D u1721 u1725 u1729 u172D u1730 u1733 u1737 u173A u173D u1740 u1743 u1746 u1748 u1749 u174E u1751 u1754 u1757 u175A u175D u1760 u1763 u1766 u176A u176F u1772 u1775 u1778 u177B u177E u1780 u1781 u1784 u1788 u178C u1790 u1794 u1797 u179A u179D u17A0 u17A3 u17A6 u17A9 u17AC u17AF u17B2 u17B6 u17BA u17BD u17C1 u17C5 u17C9 u17CC u17D0 u17D4 u17D9 u17DC u17E0 u17E4 u17E8 u17EC u17F2 u17F9 u17FC u17FF u1800 u1802 u1805 u1808 u180B u180E u1811 u1814 u1817 u181A u181D u1820 u1823 u1826 u1829 u182C u182F u1834 u1837 u183A u183D u1842 u1846 u1849 u184C u184F u1852 u1855 u1858 u185B u185E u1861 u1864 u1868 u186B u186E u1872 u1876 u1879 u187E u1882 u1885 u1888 u188B u188E u1891 u1894 u1897 u189A u189D u18A0 u18A3 u18A6 u18A9 u18AD u18B0 u18B1 u18B5 u18B9 u18BD u18C1 u18C5 u18C9 u18CD u18D1 u18D5 u18D9 u18DD u18E1 u18E5 u18E9 u18ED u18F1 u18F5 u18F9 u18FD u1901 u1904 u1907 u190A u190E u1912 u1915 u1918 u191B u191E u1921 u1924 u1927 u192A u192C u192E u1930 u1932 u1934 u1936 u1938 u193A u193C u193E u1941 u1943 u1945 u1947 u1949 u194B u194D u194F u1951 u1953 u1955 u1957 u1959 u195B u195D u195F u1961 u1963 u1965 u1967 u1969 u196B u196D u196F u1971 u1973 u1975 u1977 u1979 u197B u197D u197F u1981 u1983 u1985 u1987 u1989 u198B u198D u198F u1991 u1993 u1995 u1997 u1999 u199B u199D u199F u19A1 u19A3 u19A5 u19A7 u19A9 u19AB u19AD u19AF u19B1 u19B3 u19B5 u19B7 u19B9 u19BB u19BD u19BF u19C1 u19C3 u19C5 u19C7 u19C9 u19CB u19CD u19CF u19D1 u19D3 u19D5 u19D7 u19D9 u19DB u19DD u19DF u19E1 u19E3 u19E5 u19E7 u19E9 u19EB u19ED u19EF u19F1 u19F3 u19F5 u19F7 u19F9 u19FB u19FD u19FF u1A01 u1A03 u1A05 u1A07 u1A09 u1A0B u1A0D u1A0F u1A11 u1A13 u1A15 u1A17 u1A19 u1A1B u1A1D u1A1F u1A21 u1A23 u1A25 u1A27 u1A29 u1A2B u1A2D u1A2F u1A31 u1A33 u1A35 u1A37 u1A3A u1A3C u1A3E u1A41 u1A44 u1A46 u1A48 u1A4A u1A4C u1A4E u1A50 u1A52 u1A54 u1A56 u1A58 u1A5A u1A5C u1A5E u1A60 u1A62 u1A64 u1A67 u1A6A u1A6D u1A70 u1A73 u1A76 u1A79 u1A7B u1A7D u1A7F u1A80 u1A81 u1A83 u1A85 u1A87 u1A89 u1A8B u1A8D u1A8F u1A91 u1A93 u1A95 u1A97 u1A99 u1A9B u1A9D u1A9F u1AA1 u1AA3 u1AA5 u1AA7 u1AA9 u1AAB u1AAD u1AB0 u1AB3 u1AB6 u1AB9 u1ABC u1ABF u1AC2 u1AC5 u1AC8 u1ACB u1ACE u1AD1 u1AD4 u1AD7 u1AD9 u1ADB u1ADD u1ADF u1AE1 u1AE3 u1AE5 u1AE7 u1AE9 u1AEB u1AED u1AEF u1AF1 u1AF3 u1AF5 u1AF7 u1AF9 u1AFB u1AFD u1AFF u1B01 u1B03 u1B05 u1B07 u1B09 u1B0B u1B0D u1B0F u1B11 u1B13 u1B15 u1B17 u1B19 u1B1A u1B1B u1B1D u1B1F u1B21 u1B23 u1B25 u1B27 u1B29 u1B2B u1B2D u1B2F u1B31 u1B33 u1B35 u1B37 u1B39 u1B3B u1B3D u1B3F u1B41 u1B43 u1B45 u1B47 u1B49 u1B4B u1B4D u1B4F u1B51 u1B53 u1B55 u1B57 u1B59 u1B5B u1B5D u1B5F u1B61 u1B63 u1B65 u1B67 u1B69 u1B6B u1B6D u1B6F u1B71 u1B73 u1B75 u1B77 u1B79 u1B7B u1B7D u1B7F u1B81 u1B83 u1B85 u1B87 u1B89 u1B8B u1B8D u1B8F u1B91 u1B93 u1B95 u1B97 u1B99 u1B9B u1B9D u1B9F u1BA1 u1BA3 u1BA5 u1BA7 u1BA9 u1BAB u1BAD u1BAF u1BB1 u1BB3 u1BB5 u1BB7 u1BB9 u1BBB u1BBD u1BBF u1BC1 u1BC3 u1BC5 u1BC7 u1BC9 u1BCB u1BCD u1BCF u1BD1 u1BD3 u1BD5 u1BD7 u1BD9 u1BDB u1BDD u1BDF u1BE1 u1BE3 u1BE5 u1BE7 u1BE9 u1BEB u1BED u1BEF u1BF1 u1BF3 u1BF5 u1BF7 u1BF9 u1BFB u1BFD u1BFF u1C01 u1C03 u1C05 u1C07 u1C09 u1C0B u1C0D u1C0F u1C11 u1C13 u1C15 u1C17 u1C19 u1C1B u1C1D u1C1F u1C21 u1C23 u1C25 u1C27 u1C29 u1C2B u1C2D u1C2F u1C31 u1C33 u1C35 u1C37 u1C39 u1C3B u1C3E u1C41 u1C44 u1C46 u1C48 u1C4A u1C4C u1C4E u1C50 u1C52 u1C54 u1C56 u1C58 u1C5A u1C5C u1C5E u1C60 u1C62 u1C64 u1C66 u1C68 u1C6A u1C6C u1C6E u1C70 u1C72 u1C74 u1C76 u1C78 u1C7A u1C7C u1C7E u1C80 u1C82 u1C84 u1C86 u1C88 u1C8A u1C8C u1C8E u1C90 u1C92 u1C94 u1C96 u1C98 u1C9A u1C9C u1C9E u1CA0 u1CA2 u1CA4 u1CA6 u1CA8 u1CAA u1CAC u1CAE u1CB0 u1CB2 u1CB4 u1CB6 u1CB8 u1CBA u1CBC u1CBE u1CC0 u1CC2 u1CC4 u1CC6 u1CC8 u1CCA u1CCC u1CCE u1CD0 u1CD2 u1CD4 u1CD6 u1CD8 u1CDA u1CDC u1CDE u1CE0 u1CE2 u1CE4 u1CE6 u1CE8 u1CEA u1CEC u1CEE u1CF0 u1CF2 u1CF4 u1CF6 u1CF8 u1CFA u1CFD u1D00 u1D02 u1D04 u1D07 u1D0A u1D0C u1D0F u1D12 u1D14 u1D17 u1D19 u1D1C u1D1F u1D22 u1D25 u1D28 u1D2B u1D2E u1D30 u1D32 u1D35 u1D38 u1D3A u1D3D u1D3F u1D41 u1D44 u1D46 u1D48 u1D4A u1D4C u1D4E u1D50 u1D53 u1D55 u1D58 u1D5A u1D5D u1D5F u1D62 u1D64 u1D67 u1D6B u1D6E u1D70 u1D72 u1D75 u1D79 u1D7C u1D7E u1D80 u1D83 u1D85 u1D87 u1D89 u1D8B u1D8E u1D90 u1D92 u1D94 u1D96 u1D98 u1D9A u1D9C u1D9E u1DA0 u1DA2 u1E00 u1E00a u1E01 u1E02 u1E02C u1E03 u1E04 u1E04D u1E05 u1E05d u1E06 u1E06D u1E07 u1E08 u1E09 u1E0A u1E0AE u1E0B u1E0Be u1E0C u1E0CE u1E0D u1E0De u1E0E u1E0EK u1E0F u1E0Fh u1E10 u1E10G u1E11 u1E11g u1E12 u1E12E u1E13 u1E13e u1E14 u1E15 u1E16 u1E17 u1E18 u1E18L u1E19 u1E19l u1E1A u1E1AI u1E1B u1E1Bi u1E1C u1E1D u1E1E u1E1EG u1E1F u1E1Fg u1E20 u1E20I u1E21 u1E22 u1E22I u1E23 u1E23m u1E24 u1E24I u1E25 u1E25i u1E26 u1E26I u1E27 u1E27i u1E28 u1E28K u1E29 u1E29k u1E2A u1E2Ah u1E2B u1E2C u1E2CU u1E2D u1E2Du u1E2E u1E2F u1E30 u1E30L u1E31 u1E31l u1E32 u1E32L u1E33 u1E33l u1E34 u1E34L u1E35 u1E35l u1E36 u1E36M u1E37 u1E37m u1E38 u1E39 u1E3A u1E3AN u1E3B u1E3Bn u1E3C u1E3CN u1E3D u1E3E u1E3EN u1E3F u1E3Fn u1E40 u1E41 u1E41n u1E42 u1E43 u1E43n u1E44 u1E44P u1E45 u1E45p u1E46 u1E46O u1E47 u1E48 u1E48R u1E49 u1E49r u1E4A u1E4AT u1E4B u1E4Bt u1E4C u1E4D u1E4E u1E4F u1E50 u1E51 u1E52 u1E53 u1E54 u1E54R u1E55 u1E55r u1E56 u1E56R u1E57 u1E57r u1E58 u1E58S u1E59 u1E5A u1E5AS u1E5B u1E5Bs u1E5C u1E5D u1E5E u1E5ET u1E5F u1E5Ft u1E60 u1E60T u1E61 u1E61t u1E62 u1E62T u1E63 u1E63t u1E64 u1E65 u1E66 u1E67 u1E68 u1E69 u1E6A u1E6AW u1E6B u1E6Bw u1E6C u1E6CU u1E6D u1E6Du u1E6E u1E6EZ u1E6F u1E6Fz u1E70 u1E70U u1E71 u1E71u u1E72 u1E72u u1E73 u1E74 u1E74e u1E75 u1E76 u1E76d u1E77 u1E78 u1E79 u1E7A u1E7B u1E7C u1E7CY u1E7D u1E7Dy u1E7E u1E7EW u1E7F u1E7Fw u1E80 u1E80Y u1E81 u1E81y u1E82 u1E82Y u1E83 u1E83y u1E84 u1E84X u1E85 u1E85x u1E86 u1E86X u1E87 u1E87x u1E88 u1E88Y u1E89 u1E89y u1E8A u1E8AY u1E8B u1E8By u1E8C u1E8CY u1E8D u1E8Dy u1E8E u1E8EZ u1E8F u1E8Fz u1E90 u1E91 u1E92 u1E93 u1E94 u1E94b u1E95 u1E96 u1E96k u1E97 u1E97u u1E98 u1E98y u1E99 u1E9A u1E9B u1EA0 u1EA0B u1EA1 u1EA1b u1EA2 u1EA2E u1EA3 u1EA3e u1EA4 u1EA5 u1EA6 u1EA7 u1EA8 u1EA9 u1EAA u1EAB u1EAC u1EAD u1EAE u1EAF u1EB0 u1EB1 u1EB2 u1EB3 u1EB4 u1EB5 u1EB6 u1EB7 u1EB8 u1EB8H u1EB9 u1EB9h u1EBA u1EBAI u1EBB u1EBBi u1EBC u1EBCI u1EBD u1EBDi u1EBE u1EBF u1EC0 u1EC1 u1EC2 u1EC3 u1EC4 u1EC5 u1EC6 u1EC7 u1EC8 u1EC8O u1EC9 u1ECA u1ECAK u1ECB u1ECBk u1ECC u1ECCR u1ECD u1ECDr u1ECE u1ECEU u1ECF u1ECFu u1ED0 u1ED1 u1ED2 u1ED3 u1ED4 u1ED5 u1ED6 u1ED7 u1ED8 u1ED9 u1EDA u1EDB u1EDC u1EDD u1EDE u1EDF u1EE0 u1EE1 u1EE2 u1EE3 u1EE4 u1EE4V u1EE5 u1EE5v u1EE6 u1EE6Y u1EE7 u1EE7y u1EE8 u1EE9 u1EEA u1EEB u1EEC u1EED u1EEE u1EEF u1EF0 u1EF1 u1EF2 u1EF2a u1EF3 u1EF4 u1EF4Z u1EF5 u1EF5z u1EF6 u1EF6a u1EF7 u1EF8 u1EF8a u1EF9 u1F00 u1F01 u1F02 u1F03 u1F04 u1F05 u1F06 u1F07 u1F08 u1F09 u1F0A u1F0B u1F0C u1F0D u1F0E u1F0F u1F10 u1F11 u1F12 u1F13 u1F14 u1F15 u1F18 u1F19 u1F1A u1F1B u1F1C u1F1D u1F1E u1F20 u1F21 u1F22 u1F23 u1F24 u1F25 u1F26 u1F27 u1F28 u1F29 u1F2A u1F2B u1F2C u1F2D u1F2E u1F2F u1F30 u1F31 u1F32 u1F33 u1F34 u1F35 u1F36 u1F37 u1F38 u1F39 u1F3A u1F3B u1F3C u1F3D u1F3E u1F3F u1F40 u1F41 u1F42 u1F43 u1F44 u1F45 u1F48 u1F49 u1F4A u1F4B u1F4C u1F4D u1F50 u1F51 u1F52 u1F53 u1F54 u1F55 u1F56 u1F57 u1F59 u1F5B u1F5D u1F5F u1F60 u1F61 u1F62 u1F63 u1F64 u1F65 u1F66 u1F67 u1F68 u1F69 u1F6A u1F6B u1F6C u1F6D u1F6E u1F6F u1F70 u1F71 u1F72 u1F73 u1F74 u1F75 u1F76 u1F77 u1F78 u1F79 u1F7A u1F7B u1F7C u1F7D u1F80 u1F81 u1F82 u1F83 u1F84 u1F85 u1F86 u1F87 u1F88 u1F89 u1F8A u1F8B u1F8C u1F8D u1F8E u1F8F u1F90 u1F91 u1F92 u1F93 u1F94 u1F95 u1F96 u1F97 u1F98 u1F99 u1F9A u1F9B u1F9C u1F9D u1F9E u1F9F u1FA0 u1FA1 u1FA2 u1FA3 u1FA4 u1FA5 u1FA6 u1FA7 u1FA8 u1FA9 u1FAA u1FAB u1FAC u1FAD u1FAE u1FAF u1FB0 u1FB1 u1FB2 u1FB3 u1FB4 u1FB6 u1FB7 u1FB8 u1FB9 u1FBA u1FBB u1FBC u1FBE u1FBF u1FC1 u1FC2 u1FC3 u1FC4 u1FC6 u1FC7 u1FC8 u1FC9 u1FCA u1FCB u1FCC u1FCD u1FCE u1FCF u1FD0 u1FD1 u1FD2 u1FD3 u1FD6 u1FD7 u1FD8 u1FD9 u1FDA u1FDB u1FDD u1FDE u1FDF u1FE0 u1FE1 u1FE2 u1FE3 u1FE4 u1FE5 u1FE6 u1FE7 u1FE8 u1FE9 u1FEA u1FEB u1FEC u1FED u1FEE u1FF2 u1FF3 u1FF4 u1FF6 u1FF7 u1FF8 u1FF9 u1FFA u1FFB u1FFC u1FFE u1fbf u1ffe u2 u2000 u2001 u2002 u2003 u2004 u2005 u2006 u2007 u2008 u2009 u200A u200B u200C u200D u200E u200F u2010 u2011 u2012 u2013 u2014 u2015 u2016 u2017 u2018 u2019 u201A u201C u201D u201E u201F u2020 u2027 u2028 u2029 u202A u202B u202C u202D u202E u202F u202e u2030 u2031 u2032 u2033 u2034 u2035 u2038 u2039 u203A u203B u203E u203F u2040 u2041 u2043 u2044 u2045 u2046 u206A u206F u206f u2070 u2074 u2079 u207A u207C u207D u207E u207F u2080 u2089 u208A u208C u208D u208E u20A0 u20AB u20D0 u20D1 u20D2 u20D3 u20D4 u20D5 u20D6 u20D7 u20D8 u20D9 u20DA u20DB u20DC u20DD u20DE u20DF u20E0 u20E1 u20a1 u20a2 u20a3 u20a4 u20a5 u20a6 u20a7 u20a8 u20a9 u20aa u20ab u20ac u2100 u2101 u2102 u2103 u2106 u2107 u2108 u2109 u210A u210B u210D u210E u210F u2110 u2112 u2113 u2114 u2115 u2116 u2117 u2118 u211D u211E u2123 u2124 u2125 u2126 u2127 u2128 u2129 u212A u212B u212D u212E u212F u2130 u2131 u2132 u2133 u2134 u2135 u2138 u2150 u2153 u215F u2160 u216C u216D u216E u216F u217C u217D u217E u217F u2180 u2181 u2182 u2190 u2191 u2192 u2193 u2194 u2195 u21D1 u21D2 u21D3 u21D4 u21D5 u21EA u2200 u2203 u2204 u2208 u2209 u220B u220C u220b u2212 u2215 u221E u2223 u2224 u2225 u2226 u222b u222e u2241 u2243 u2244 u2245 u2247 u2248 u2249 u224D u224d u2260 u2261 u2262 u2264 u2265 u226D u226E u226F u2270 u2271 u2272 u2273 u2274 u2275 u2276 u2277 u2278 u2279 u227A u227B u227C u227D u227a u227b u227c u227d u2280 u2281 u2282 u2283 u2284 u2285 u2286 u2287 u2288 u2289 u2291 u2292 u22A2 u22A8 u22A9 u22AB u22AC u22AD u22AE u22AF u22B2 u22B3 u22B4 u22B5 u22E0 u22E1 u22E2 u22E3 u22EA u22EB u22EC u22ED u22F1 u22a2 u22a8 u22a9 u22ab u22b2 u22b3 u22b4 u22b5 u2300 u2302 u2307 u2308 u230B u230C u231F u2320 u2321 u2322 u2328 u2329 u232A u232B u237A u2400 u2424 u2435 u2440 u244A u245D u2460 u2467 u246A u249B u249C u24AA u24D6 u24E9 u24EA u2500 u2502 u2524 u2580 u2595 u25A0 u25EF u25a0 u25cb u2600 u2613 u261A u266F u2700 u2701 u2704 u2706 u2709 u270C u2726 u2727 u2729 u274B u274D u274F u2752 u2756 u2758 u275E u2761 u2767 u2776 u2793 u2794 u2798 u27AF u27B1 u27BE u27C0 u2800 u2900 u2928 u2A80 u2B2A u2D2C u2E80 u2F00 u2F2E u2FE0 u2FF0 u3000 u3001 u3002 u3003 u3004 u3005 u3006 u3007 u3008 u3009 u300A u300B u300C u300D u300E u300F u300a u300b u300c u300d u300e u300f u3010 u3011 u3012 u3013 u3014 u3015 u3016 u3017 u3018 u3019 u301A u301B u301C u301D u301E u301F u3020 u3021 u3029 u302A u302F u3030 u3031 u3035 u3036 u3037 u303F u3040 u3041 u3042 u3043 u3044 u3045 u3046 u3047 u3048 u3049 u304A u304B u304C u304D u304E u304F u304b u304d u304f u3050 u3051 u3052 u3053 u3054 u3055 u3056 u3057 u3058 u3059 u305A u305B u305C u305D u305E u305F u305b u305d u305f u3060 u3061 u3062 u3063 u3064 u3065 u3066 u3067 u3068 u3069 u306F u306f u3070 u3072 u3073 u3075 u3076 u3078 u3079 u307B u307C u307b u3082 u3083 u3084 u3085 u3086 u3087 u3088 u308D u308E u308F u3094 u3099 u309A u309B u309C u309D u309E u309a u309d u30A0 u30A1 u30A2 u30A3 u30A4 u30A5 u30A6 u30A7 u30A8 u30A9 u30AA u30AB u30AC u30AD u30AE u30AF u30B0 u30B1 u30B2 u30B3 u30B4 u30B5 u30B6 u30B7 u30B8 u30B9 u30BA u30BB u30BC u30BD u30BE u30BF u30C0 u30C1 u30C2 u30C3 u30C4 u30C5 u30C6 u30C7 u30C8 u30C9 u30CF u30D0 u30D2 u30D3 u30D5 u30D6 u30D8 u30D9 u30DB u30DC u30DD u30DF u30E1 u30E2 u30E3 u30E4 u30E5 u30E6 u30E7 u30E8 u30ED u30EE u30EF u30F0 u30F1 u30F2 u30F4 u30F5 u30F6 u30F7 u30F8 u30F9 u30FA u30FB u30FC u30FD u30FE u30a1 u30a2 u30a3 u30a4 u30a5 u30a6 u30a7 u30a8 u30a9 u30aa u30ab u30ad u30af u30b1 u30b3 u30b5 u30b7 u30b9 u30bb u30bd u30bf u30c1 u30c3 u30c4 u30c6 u30c8 u30ca u30cb u30cc u30cd u30ce u30cf u30d2 u30d5 u30d8 u30db u30de u30df u30e0 u30e1 u30e2 u30e3 u30e4 u30e5 u30e6 u30e7 u30e8 u30e9 u30ea u30eb u30ec u30ed u30ef u30f0 u30f1 u30f2 u30f3 u30fb u30fc u30fd u3100 u3105 u312C u3130 u3131 u3180 u318E u3190 u3191 u3192 u3195 u3196 u319F u31A0 u31C0 u3200 u321C u3220 u3229 u322A u3231 u3243 u3260 u327B u327F u3280 u3289 u328A u32B0 u32C0 u32CB u32D0 u32FE u3300 u3376 u337B u33DD u33E0 u33FE u3400 u3409 u3433 u3609 u3630 u3709 u3749 u3800 u3837 u3980 u3A39 u3A80 u3C3B u3E3D u4000 u400C u400D u400E u400F u403F u4180 u4241 u4443 u4645 u46B1 u473B u4800 u4948 u4A4A u4AA5 u4B4A u4B80 u4D4C u4DB6 u4E00 u4F4E u4e00 u4e01 u4e03 u4e09 u4e0a u4e0b u4e19 u4e2d u4e59 u4e5d u4e8c u4e94 u4eba u4ee3 u4f01 u4f11 u4f1a u5000 u5017 u512a u5150 u5154 u5156 u516b u516d u5199 u52b4 u533b u5341 u5352 u5354 u5370 u53f3 u540d u547c u548c u5552 u56db u571f u5730 u5800 u5857 u591c u5927 u5929 u5973 u5A59 u5A64 u5BC3 u5C4A u5C5B u5C5C u5C66 u5C80 u5CA5 u5F5E u5b66 u5b97 u5de6 u5e73 u5f0f u6000 u601A u6060 u6180 u6210 u6261 u6463 u6580 u65e5 u660e u662d u665C u665E u6665 u6666 u6680 u6681 u6689 u66A5 u6708 u6709 u6728 u6800 u6824 u682a u6858 u685B u685E u6868 u686E u6871 u6872 u6874 u687B u6880 u68A5 u6968 u6A6A u6B24 u6D6C u6F68 u6b63 u6c34 u6cbb u6ce8 u7001 u7002 u7004 u7005 u700A u7068 u706b u70b9 u7279 u740A u742A u7473 u748A u7532 u7537 u762A u764A u7675 u76e3 u772A u776A u7800 u780A u7877 u793e u795d u7968 u796d u79d8 u7A68 u7C68 u7D68 u7F7E u7FE1 u7FE2 u7FFF u7FFFNQTWZ u800F u8058 u805C u8066 u8080 u8086 u8087 u8088 u8089 u8094 u8097 u8098 u80A3 u80A5 u80A6 u80B0 u80B7 u80BC u80BE u80C0 u80C4 u80C9 u80CC u80CD u80D0 u80D1 u80D4 u80D7 u80DC u80DD u80DE u80E3 u80EA u80F2 u80FA u8166 u8181 u81A5 u81ea u81f3 u8281 u82C7 u8368 u8508 u8780 u8786 u87A5 u88A5 u8980 u8988 u89A5 u8A8B u8B8A u8C8D u8D8C u8E8F u8F8E u8ca1 u8cc7 u9069 u9091 u9190 u91d1 u9293 u9392 u9594 u9596 u9796 u9805 u9980 u9998 u9AA5 u9B9A u9B9C u9D9C u9D9E u9DAB u9F9E u9FA0 u9FA5 u9fff uA000 uA1A0 uA1A2 uA3A2 uA490 uA4D0 uA504 uA505 uA506 uA508 uA509 uA50B uA50C uA50D uA512 uA514 uA51B uA51D uA51E uA522 uA539 uA53E uA53F uA540 uA550 uA556 uA579 uA580 uA5A4 uA5A5 uA5A50 uA5A51 uA5A53 uA5A55 uA5A56 uA5A5A uA5A5C uA5A5F uA5A5H uA5A5J uA5A5L uA5A5W uA5A5Y uA5A5h uA5A5x uA7A6 uA7A8 uA8A8 uA9A8 uA9AA uABAB uABAC uABB7 uABBF uAC00 uACAB uADA5 uAEAD uAEAF uB0AF uB1A5 uB2A5 uB2B1 uB3B4 uB4B3 uB5B6 uB6B5 uB8A5 uB8AB uB9A5 uBAB9 uBABB uBCBB uBD80 uBEBD uBF89 uC0B3 uC1A5 uC2C1 uC3C2 uC468 uC5C6 uC6C5 uC7C8 uC9C8 uCAA5 uCBA5 uCBCA uCDCC uCECF uCFCE uCFD1 uD0A8 uD268 uD2D3 uD368 uD5D4 uD5D6 uD768 uD7A3 uD7A4 uD800 uD8D8 uD8D9 uD9D9 uDA68 uDADB uDBFF uDC00 uDCDB uDE30 uDFE0 uDFFF uE000 uE030 uE1A5 uE280 uE4E3 uE4E5 uE524 uE6E7 uE7E6 uE800 uE830 uE8E9 uEAE9 uEBEC uECEB uEDEE uEEED uEFF0 uF001 uF002 uF003 uF0EF uF180 uF3F4 uF5F6 uF780 uF8F9 uF900 uFA2D uFB00 uFB01 uFB02 uFB03 uFB04 uFB05 uFB06 uFB13 uFB14 uFB15 uFB16 uFB17 uFB1E uFB1F uFB28 uFB29 uFB2A uFB2B uFB2C uFB2D uFB2E uFB2F uFB30 uFB31 uFB32 uFB33 uFB34 uFB35 uFB36 uFB38 uFB39 uFB3A uFB3B uFB3C uFB3E uFB40 uFB41 uFB43 uFB44 uFB46 uFB47 uFB48 uFB49 uFB4A uFB4B uFB4C uFB4D uFB4E uFB50 uFBB1 uFBD3 uFBFC uFD3D uFD3E uFD3F uFD50 uFD8F uFD92 uFDC7 uFDF0 uFDFB uFDFE uFE00 uFE20 uFE23 uFE30 uFE31 uFE32 uFE33 uFE34 uFE35 uFE36 uFE37 uFE38 uFE39 uFE3A uFE3B uFE3C uFE3D uFE3E uFE3F uFE40 uFE41 uFE42 uFE43 uFE44 uFE49 uFE4C uFE4D uFE4F uFE50 uFE52 uFE54 uFE57 uFE58 uFE59 uFE5A uFE5B uFE5C uFE5D uFE5E uFE5F uFE61 uFE62 uFE63 uFE64 uFE66 uFE68 uFE69 uFE6A uFE6B uFE70 uFE72 uFE74 uFE76 uFEFC uFEFF uFF00 uFF01 uFF03 uFF04 uFF05 uFF07 uFF08 uFF09 uFF0A uFF0B uFF0C uFF0D uFF0E uFF0F uFF10 uFF19 uFF1A uFF1B uFF1C uFF1E uFF1F uFF20 uFF21 uFF3A uFF3B uFF3C uFF3D uFF3F uFF41 uFF5A uFF5B uFF5C uFF5D uFF5E uFF61 uFF62 uFF63 uFF64 uFF65 uFF66 uFF6F uFF70 uFF71 uFF9D uFF9E uFF9F uFFA0 uFFA5 uFFBE uFFC2 uFFC7 uFFCA uFFCF uFFD2 uFFD7 uFFDA uFFDC uFFE0 uFFE1 uFFE2 uFFE4 uFFE5 uFFE6 uFFE8 uFFEC uFFED uFFEE uFFF0 uFFFD uFFFE uFFFF uOdd uSectorShift ub uc uci ucl ucp udp udx udy ue uf uffff ugly uguig uhe uiuc ukukr ul ulenSq ulp ulps ulpval ultimately umlaut un unable unaccelerated unacceptable unaffected unaligned unalignedKnown unaltered unambiguous unappealing unascribed unassigned unauthorized unavailable unavoidable unbalanced unbiased unbind unblock unblocked unbound unbounded unc uncancelled uncaught uncaughtException uncertainty unchanged unchecked unclosed uncollated uncomment uncommitted uncommon unconditionally unconnected unconsumed undecorated undefined under underConstruction underallocation underbar underbars underdot underflow underflowed underline underlineOffset underlineThickness underlyhing underlying underneath underscore underscores understable understand understands understood undesirable undetermined undisplayable undo undone unduplicated unencoded unequal unescaped uneven unexpected unexpectedly unexportObject unflattened unforgeable unfortunate unfortunately unhappy unicast unicode unicodeBlockStarts unicodes unidirectional unifies uniform uniformity uniformly unify unimportant uninitialized uninitializedMap uninstantiable unintentionally uninterpreted uninvoked union unioning uniq unique uniqueMethods uniquely uniqueness unit unitInUse unitIncrement unitIndex units unitsInCommon unitsInUse unitsRequired universal universally unknown unknownAddress unknown_array unknowns unlabeled unless unlike unlikely unlimited unlink unload unloaded unlocalized unlock unlocks unmap unmappable unmapped unmapping unmaps unmarshaling unmarshalled unmarshalling unmatched unmodifiable unmodifiableCollection unmodifiableList unmodifiableMap unmodifiableSet unmodifiableSortedMap unmodifiableSortedSet unmodified unmounting unnamed unnecessarily unnecessary unneeded unnormalized unordered unpack unpackRules unpackTimes unpacking unparseable unparsed unpopulated unpredicable unpredictability unpredictable unprepared unpublished unqiue unqualifiedClassName unquoted unreachable unread unreadAvail unreasonably unrecognized unreferenced unregistered unrelated unreliable unreserved unresolvable unresolved unroll unrolled unsafe unsatisfactory unscaled unscaledVal unscaledValue unscrupulous unset unshared unsharedMarker unsightly unsigned unsignedLongCompare unspecified unstarted unsuccessful unsupported unsuspendSomeThreads unsynchronized until untilFocused unto untouched untransformed untrusted unusable unused unusual unwrap unwrapped up upCycleDefaultFocusTraversalKeys upCycleFocusTraversalKeys upFocusCycle upalpha upcalls upcates upcoming updatable update updateArray updateAsciiStream updateBigDecimal updateBinaryStream updateBlob updateBoolean updateBounds updateByte updateBytes updateCharacterStream updateClob updateCounts updateCur updateCursorImmediately updateDate updateDouble updateFloat updateInt updateLong updateLookupTable updateNull updateObject updateRef updateRow updateRunInfo updateShort updateStateTable updateString updateSystemColors updateTime updateTimestamp updated updater updates updatesAreDetected updating upercase uphold upon upper upperCase upperCaseChar upperChar upperCharArray upperMap uppercase uppercased upscaled upsilon upto upward upwards ur urge urgent uri uric uric_no_slash url urlc urlencoded urls urn urp ururd us usCollator usable usage use useCaches useDaylight useDaylightTime useDeferredClose useDouble useExponentialNotation useMonth usePlatformFontMetrics useProtocolVersion useProxy useShiftModifier useSocks useThousands useV4 usecaches used usedInContractSeq useful usefull usefully useless user userBounds userInfo userName userinfo username usernames users uses usesFractionalMetrics usesLocalFilePerTable usesLocalFiles usesPlatformFont usesShift usesShiftModifier using usingProxy usno usr usr_paths usual usually ut utc utcCal utf utflen util utilities utility utilize utilized uuml uwe uxxxx uzuzb v v1 v2 v4 v4addr v5 v6 vAdjustable vAdjustableValue val val1 val2 valBits valEquals valid validAttribs validMask validate validateFields validateObject validateTree validated validatedContents validation validations validity valign vals value value1 value2 valueHash valueIndex valueIsAdjusting valueList valueOf valueSearchNonNull valueSearchNull valueToExpression valueToName valued values valuesMatch van var variable variables variant variant1 variant2 variantLength variantNames variants variation variations varies variety various vary varying vast vbarOn vbarWidth vcap ve vec vecswap vector vectors vendor vendorCode vendors ver verification verificationEngine verificationKey verified verifier verifies verify verifySubclass verifying versa version versionColumnNotPseudo versionColumnPseudo versionColumnUnknown versioning versions vert vertex vertical verticalScrollBar vertically vertices very veto vetoable vetoableChange vetoableChangeSupportSerializedDataVersion vetoableSupport vetoed vetos vgap via vice victim video vie view viewHeight viewWidth viewable viewed viewedBuffer viewer viewers viewport views violate violated violates violating violation virgin virtual virtualBounds viruses vis visibility visible visibleAmount visibleIndex visibly visit visited visual vivie vkMap vlist vm vmAllowSuspension vmspec vnd void volatile volume vovol vowel vowels vs vt vulnerability vulnerable w w3 wIsReal wa wait waitFor waitForAll waitForID waitForIdle waitForProcessExit waited waiters waiting waits wake wakeup walk walked walks wall wallSec walls want wants war warn warning warningString warnings warrant was wasNull wasn waste wasted wasting watch watermelon wav way ways wb wbits we weak weakChild weakThis weakValue weakWindow weaker wednesday weeded weeding week weekCount weekNo weekNumber weekday weekdays weeks weight weightX weightY weight_diff weights weightx weighty weird well went were weren west westward wether wh what whatever whatsoever wheel wheelAmt wheelScrollingEnabled when whenever where whereas whereby wherein whereupon wherever whether which whichever while whim white whiteSpaceChars whitespace whitespaceChars whitespaces whitespce who whoever whole wholly whose why wich wide widening wider widget widgets width widthToAlignmentPoint widths wiht wild wildcard wildcards will willing willy win win32 wind winding window windowActivated windowBorder windowBounds windowClosed windowClosing windowClosingDelivered windowClosingException windowClosingNotify windowDeactivated windowDeiconfied windowDeiconified windowFocusL windowFocusListener windowFocusListenerK windowFocusWindowK windowGainedFocus windowIconified windowL windowListener windowListenerK windowLostFocus windowOpened windowSerializedDataVersion windowStateChanged windowStateL windowStateListener windowStateListenerK windowText windowed windowedModeBounds windowing windowless windows wins wire wise wish wishes wishing with withWhiteSpace within without wk wlen wls womStamp wombat won word wordChars wordcount words wordwise work workaround worker workhorse working workingLocale works world worry wors worst worth would wouldn wowol woy woyStamp wr wrap wrapped wrapper wrappers wrapping wraps wrinkle writable write writeArray writeAsciiStream writeBigDecimal writeBinaryStream writeBlob writeBlockHeader writeBoolean writeBooleans writeBuffer writeBufferSize writeByte writeBytes writeChar writeCharacterStream writeChars writeClass writeClassDesc writeClassDescriptor writeClob writeDate writeDouble writeDoubles writeExpression writeExternal writeExternalData writeFatalException writeFields writeFileDescriptor writeFloat writeFloats writeHandle writeInt writeInts writeLocation writeLong writeLongUTF writeLongs writeMethod writeNonProxy writeNonProxyDesc writeNull writeObject writeObject0 writeObject1 writeObjectMethod writeObjectOverride writeOrdinaryObject writeProxyDesc writeRef writeReplace writeReplaceMethod writeSQ writeSQL writeSerialData writeShort writeShorts writeSide writeStatement writeStreamHeader writeString writeStruct writeTime writeTimestamp writeTo writeTypeString writeURL writeUTF writeUTFBody writeUnshared writeable writeln writer writes writing writtem written wrong wrongBreakPositions wrongly wroteUnencodedChar wrt ws wst wt wtb www x x0 x1 x10 x2 xAlign xDec xIndex xInt xLen xLong xMax xOrg xPoints xbgrmodel xcp xcps xerr xes xform xhi xhxho xlen xlo xm xml xmul xn xoffs xor xorcolor xpoints xr xrgbRasRef xrgbmodel xstart xt xvec xx xxx xxxx xxyxyyyxyxyxxyxyx xxyxyyyxyxyxxyxyxyy xy xyz y y0 y1 y2 yAlign yIndex yLen yMax yOrg yPoints y_amount year yearLength years yellow yen yerr yes yet yhi yi yield yielding yields yiyid ylen ylo ylong ym ymul yn yoffs yomi you your yourself yoyor ypoints yr ystart yucky yvec yxyyyxyxyxxyxyxyy yy yyyy yyyyMMdd yyyyy z za zapParsedStr zazha zed zero zeroDelta zeroDigit zeroDigitCount zeroPaddingNumber zeroed zeroes zeroeth zeroing zeros zeroth zet zh zhzho zi zip zlen zlong zone zoneID zoneIndex zoneOffset zoneResource zoneString zoneStrings zones zoro zuzul zval zy zzz zzzz jsr166/src/test/loops/SetBash.java0000644000000000000000000001075511537741072014114 0ustar /* * Written by Doug Lea and Josh Bloch with assistance from members of * JCP JSR-166 Expert Group and released to the public domain, as * explained at http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; public class SetBash { static Random rnd = new Random(); public static void main(String[] args) { int numItr = Integer.parseInt(args[1]); int setSize = Integer.parseInt(args[2]); Class cl = null; try { cl = Class.forName(args[0]); } catch (ClassNotFoundException e) { fail("Class " + args[0] + " not found."); } boolean synch = (args.length>3); for (int i=0; i 0) nthreads = Integer.parseInt(args[0]); System.out.printf("max %d Threads\n", nthreads); for (int k = 2; k <= nthreads; k *= 2) { ForkJoinPool pool = new ForkJoinPool(k); for (int size = FIRST_SIZE; size <= LAST_SIZE; size *= 10) { long startTime = System.nanoTime(); Phaser phaser = new Phaser(); final PhaserAction[] actions = new PhaserAction[k]; for (int i = 0; i < k; ++i) { actions[i] = new PhaserAction(i, phaser, size); } pool.invoke(new RecursiveAction() { public void compute() { invokeAll(actions); }}); long elapsed = System.nanoTime() - startTime; long bs = (NPS * size) / elapsed; System.out.printf("%4d Threads %8d iters: %11d barriers/sec\n", k, size, bs); } pool.shutdown(); } } } jsr166/src/test/loops/Integrate.java0000644000000000000000000001630211537741071014476 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; /** * Sample program using Guassian Quadrature for numerical integration. * This version uses a simplified hardwired function. Inspired by a * * Filaments demo program. * */ public final class Integrate { static final double errorTolerance = 1.0e-12; /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static final int SERIAL = -1; static final int DYNAMIC = 0; static final int FORK = 1; static int forkPolicy = DYNAMIC; static String forkArg = "dynamic"; // the function to integrate static double computeFunction(double x) { return (x * x + 1.0) * x; } static final double start = 0.0; static final double end = 1536.0; /* * The number of recursive calls for * integrate from start to end. * (Empirically determined) */ static final int calls = 263479047; public static void main(String[] args) throws Exception { int procs = 0; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) { forkArg = args[1]; if (forkArg.startsWith("s")) forkPolicy = SERIAL; else if (forkArg.startsWith("f")) forkPolicy = FORK; } } catch (Exception e) { System.out.println("Usage: java Integrate3 threads "); return; } oneTest(procs); oneTest(procs); oneTest(procs); } static void oneTest(int procs) { ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); System.out.println("Number of procs=" + g.getParallelism()); System.out.println("Integrating from " + start + " to " + end + " forkPolicy = " + forkArg); long lastTime = System.nanoTime(); for (int i = 0; i < 20; ++i) { double a; if (forkPolicy == SERIAL) a = SQuad.computeArea(g, start, end); else if (forkPolicy == FORK) a = FQuad.computeArea(g, start, end); else a = DQuad.computeArea(g, start, end); long now = System.nanoTime(); double s = ((double)(now - lastTime))/NPS; lastTime = now; System.out.printf("Calls/sec: %12d", (long) (calls / s)); System.out.printf(" Time: %7.3f", s); System.out.printf(" Threads: %5d", g.getPoolSize()); // System.out.printf(" Area: %12.1f", a); System.out.println(); } System.out.println(g); g.shutdown(); } // Sequential version static final class SQuad extends RecursiveAction { static double computeArea(ForkJoinPool pool, double l, double r) { SQuad q = new SQuad(l, r, 0); pool.invoke(q); return q.area; } final double left; // lower bound final double right; // upper bound double area; SQuad(double l, double r, double a) { this.left = l; this.right = r; this.area = a; } public final void compute() { double l = left; double r = right; area = recEval(l, r, (l * l + 1.0) * l, (r * r + 1.0) * r, area); } static final double recEval(double l, double r, double fl, double fr, double a) { double h = (r - l) * 0.5; double c = l + h; double fc = (c * c + 1.0) * c; double hh = h * 0.5; double al = (fl + fc) * hh; double ar = (fr + fc) * hh; double alr = al + ar; if (Math.abs(alr - a) <= errorTolerance) return alr; else return recEval(c, r, fc, fr, ar) + recEval(l, c, fl, fc, al); } } //.................................... // ForkJoin version static final class FQuad extends RecursiveAction { static double computeArea(ForkJoinPool pool, double l, double r) { FQuad q = new FQuad(l, r, 0); pool.invoke(q); return q.area; } final double left; // lower bound final double right; // upper bound double area; FQuad(double l, double r, double a) { this.left = l; this.right = r; this.area = a; } public final void compute() { double l = left; double r = right; area = recEval(l, r, (l * l + 1.0) * l, (r * r + 1.0) * r, area); } static final double recEval(double l, double r, double fl, double fr, double a) { double h = (r - l) * 0.5; double c = l + h; double fc = (c * c + 1.0) * c; double hh = h * 0.5; double al = (fl + fc) * hh; double ar = (fr + fc) * hh; double alr = al + ar; if (Math.abs(alr - a) <= errorTolerance) return alr; FQuad q = new FQuad(l, c, al); q.fork(); ar = recEval(c, r, fc, fr, ar); if (!q.tryUnfork()) { q.quietlyJoin(); return ar + q.area; } return ar + recEval(l, c, fl, fc, al); } } // ........................... // Version using on-demand Fork static final class DQuad extends RecursiveAction { static double computeArea(ForkJoinPool pool, double l, double r) { DQuad q = new DQuad(l, r, 0); pool.invoke(q); return q.area; } final double left; // lower bound final double right; // upper bound double area; DQuad(double l, double r, double a) { this.left = l; this.right = r; this.area = a; } public final void compute() { double l = left; double r = right; area = recEval(l, r, (l * l + 1.0) * l, (r * r + 1.0) * r, area); } static final double recEval(double l, double r, double fl, double fr, double a) { double h = (r - l) * 0.5; double c = l + h; double fc = (c * c + 1.0) * c; double hh = h * 0.5; double al = (fl + fc) * hh; double ar = (fr + fc) * hh; double alr = al + ar; if (Math.abs(alr - a) <= errorTolerance) return alr; DQuad q = null; if (getSurplusQueuedTaskCount() <= 3) (q = new DQuad(l, c, al)).fork(); ar = recEval(c, r, fc, fr, ar); if (q != null && !q.tryUnfork()) { q.quietlyJoin(); return ar + q.area; } return ar + recEval(l, c, fl, fc, al); } } } jsr166/src/test/loops/OfferDrainToLoops.java0000644000000000000000000001477311537741071016125 0ustar /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ /* * This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * However, the following notice accompanied the original version of this * file: * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @bug 6805775 6815766 * @run main OfferDrainToLoops 300 * @summary Test concurrent offer vs. drainTo */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; //import jsr166y.*; @SuppressWarnings({"unchecked", "rawtypes"}) public class OfferDrainToLoops { final long testDurationMillisDefault = 10L * 1000L; final long testDurationMillis; OfferDrainToLoops(String[] args) { testDurationMillis = (args.length > 0) ? Long.valueOf(args[0]) : testDurationMillisDefault; } void checkNotContainsNull(Iterable it) { for (Object x : it) check(x != null); } void test(String[] args) throws Throwable { test(new LinkedBlockingQueue()); test(new LinkedBlockingQueue(2000)); test(new LinkedBlockingDeque()); test(new LinkedBlockingDeque(2000)); test(new ArrayBlockingQueue(2000)); test(new LinkedTransferQueue()); } void test(final BlockingQueue q) throws Throwable { System.out.println(q.getClass().getSimpleName()); final long testDurationNanos = testDurationMillis * 1000L * 1000L; final long quittingTimeNanos = System.nanoTime() + testDurationNanos; final long timeoutMillis = 10L * 1000L; /** Poor man's bounded buffer. */ final AtomicLong approximateCount = new AtomicLong(0L); abstract class CheckedThread extends Thread { CheckedThread() { setDaemon(true); start(); } /** Polls for quitting time. */ protected boolean quittingTime() { return System.nanoTime() - quittingTimeNanos > 0; } /** Polls occasionally for quitting time. */ protected boolean quittingTime(long i) { return (i % 1024) == 0 && quittingTime(); } abstract protected void realRun(); public void run() { try { realRun(); } catch (Throwable t) { unexpected(t); } } } Thread offerer = new CheckedThread() { protected void realRun() { long c = 0; for (long i = 0; ! quittingTime(i); i++) { if (q.offer(c)) { c++; if ((c % 1024) == 0) { approximateCount.getAndAdd(1024); while (approximateCount.get() > 10000) Thread.yield(); } } else { Thread.yield(); }}}}; Thread drainer = new CheckedThread() { protected void realRun() { final ThreadLocalRandom rnd = ThreadLocalRandom.current(); while (! quittingTime()) { List list = new ArrayList(); int n = rnd.nextBoolean() ? q.drainTo(list) : q.drainTo(list, 100); approximateCount.getAndAdd(-n); equal(list.size(), n); for (int j = 0; j < n - 1; j++) equal((Long) list.get(j) + 1L, list.get(j + 1)); Thread.yield(); }}}; Thread scanner = new CheckedThread() { protected void realRun() { final ThreadLocalRandom rnd = ThreadLocalRandom.current(); while (! quittingTime()) { switch (rnd.nextInt(3)) { case 0: checkNotContainsNull(q); break; case 1: q.size(); break; case 2: Long[] a = (Long[]) q.toArray(new Long[0]); int n = a.length; for (int j = 0; j < n - 1; j++) { check(a[j] < a[j+1]); check(a[j] != null); } break; } Thread.yield(); }}}; for (Thread thread : new Thread[] { offerer, drainer, scanner }) { thread.join(timeoutMillis + testDurationMillis); check(! thread.isAlive()); } } //--------------------- Infrastructure --------------------------- volatile int passed = 0, failed = 0; void pass() {passed++;} void fail() {failed++; Thread.dumpStack();} void fail(String msg) {System.err.println(msg); fail();} void unexpected(Throwable t) {failed++; t.printStackTrace();} void check(boolean cond) {if (cond) pass(); else fail();} void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { new OfferDrainToLoops(args).instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } jsr166/src/test/loops/TimeoutExchangerLoops.java0000644000000000000000000001234711537741072017052 0ustar /* * Written by Bill Scherer and Doug Lea with assistance from members * of JCP JSR-166 Expert Group and released to the public domain, as * explained at http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.concurrent.locks.*; public class TimeoutExchangerLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final int DEFAULT_THREADS = NCPUS + 2; static final long DEFAULT_PATIENCE_NANOS = 500000; static final long DEFAULT_TRIAL_MILLIS = 10000; public static void main(String[] args) throws Exception { int maxThreads = DEFAULT_THREADS; long trialMillis = DEFAULT_TRIAL_MILLIS; long patienceNanos = DEFAULT_PATIENCE_NANOS; int nReps = 3; // Parse and check args int argc = 0; while (argc < args.length) { String option = args[argc++]; if (option.equals("-t")) trialMillis = Integer.parseInt(args[argc]); else if (option.equals("-p")) patienceNanos = Long.parseLong(args[argc]); else if (option.equals("-r")) nReps = Integer.parseInt(args[argc]); else maxThreads = Integer.parseInt(option); argc++; } // Display runtime parameters System.out.print("TimeoutExchangerTest"); System.out.print(" -t " + trialMillis); System.out.print(" -p " + patienceNanos); System.out.print(" -r " + nReps); System.out.print(" max threads " + maxThreads); System.out.println(); System.out.println("Warmups.."); long warmupTime = 1000; long sleepTime = 500; if (false) { for (int k = 0; k < 10; ++k) { for (int j = 0; j < 10; ++j) { oneRun(2, (j + 1) * 1000, patienceNanos); Thread.sleep(sleepTime); } } } oneRun(3, warmupTime, patienceNanos); Thread.sleep(sleepTime); for (int i = maxThreads; i >= 2; i -= 1) { oneRun(i, warmupTime, patienceNanos); Thread.sleep(sleepTime); } for (int j = 0; j < nReps; ++j) { System.out.println("Replication " + j); for (int i = 2; i <= maxThreads; i += 2) { oneRun(i, trialMillis, patienceNanos); Thread.sleep(sleepTime); } } } static void oneRun(int nThreads, long trialMillis, long patienceNanos) throws Exception { System.out.printf("%4d threads", nThreads); System.out.printf("%9dms", trialMillis); final CountDownLatch start = new CountDownLatch(1); Exchanger x = new Exchanger(); Runner[] runners = new Runner[nThreads]; Thread[] threads = new Thread[nThreads]; for (int i = 0; i < nThreads; ++i) { runners[i] = new Runner(x, patienceNanos, start); threads[i] = new Thread(runners[i]); threads[i].start(); } long startTime = System.nanoTime(); start.countDown(); Thread.sleep(trialMillis); for (int i = 0; i < nThreads; ++i) threads[i].interrupt(); long elapsed = System.nanoTime() - startTime; for (int i = 0; i < nThreads; ++i) threads[i].join(); int iters = 0; long fails = 0; for (int i = 0; i < nThreads; ++i) { iters += runners[i].iters; fails += runners[i].failures; } if (iters <= 0) iters = 1; long rate = iters * 1000L * 1000L * 1000L / elapsed; long npt = elapsed / iters; double failRate = (fails * 100.0) / (double) iters; System.out.printf("%9d it/s ", rate); System.out.printf("%9d ns/it", npt); System.out.printf("%9.5f%% fails", failRate); System.out.println(); // x.printStats(); } static final class Runner implements Runnable { final Exchanger exchanger; final CountDownLatch start; final long patience; volatile int iters; volatile int failures; Runner(Exchanger x, long patience, CountDownLatch start) { this.exchanger = x; this.patience = patience; this.start = start; } public void run() { int i = 0; try { Exchanger x = exchanger; Object m = new Integer(17); long p = patience; start.await(); for (;;) { try { Object e = x.exchange(m, p, TimeUnit.NANOSECONDS); if (e == null || e == m) throw new Error(); m = e; ++i; } catch (TimeoutException to) { if (Thread.interrupted()) { iters = i; return; } ++i; ++failures; } } } catch (InterruptedException ie) { iters = i; } } } } jsr166/src/test/loops/DynamicAsyncFib.java0000644000000000000000000000554611537741071015567 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; public final class DynamicAsyncFib extends BinaryAsyncAction { int number; public DynamicAsyncFib(int n) { this.number = n; } public final boolean exec() { DynamicAsyncFib f = this; int n = f.number; while (n > 1 && getSurplusQueuedTaskCount() <= 3) { DynamicAsyncFib l = new DynamicAsyncFib(--n); DynamicAsyncFib r = new DynamicAsyncFib(n - 1); f.linkSubtasks(l, r); r.fork(); f = l; } f.number = seqFib(n); f.complete(); return false; } protected void onComplete(BinaryAsyncAction x, BinaryAsyncAction y) { number = ((DynamicAsyncFib)x).number + ((DynamicAsyncFib)y).number; } static long lastStealCount; public static void main(String[] args) throws Exception { int procs = 0; int num = 45; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) num = Integer.parseInt(args[1]); } catch (Exception e) { System.out.println("Usage: java DynamicAsyncFib ]"); return; } for (int reps = 0; reps < 2; ++reps) { ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); lastStealCount = g.getStealCount(); for (int i = 0; i < 20; ++i) { test(g, num); // Thread.sleep(1000); } System.out.println(g); g.shutdown(); } } /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static void test(ForkJoinPool g, int num) throws Exception { int ps = g.getParallelism(); long start = System.nanoTime(); DynamicAsyncFib f = new DynamicAsyncFib(num); g.invoke(f); long time = System.nanoTime() - start; double secs = ((double)time) / NPS; long number = f.number; System.out.print("DAFib " + num + " = " + number); System.out.printf("\tTime: %9.3f", secs); long sc = g.getStealCount(); long ns = sc - lastStealCount; lastStealCount = sc; System.out.printf(" Steals/t: %5d", ns/ps); System.out.printf(" Workers: %8d", g.getPoolSize()); System.out.println(); } // Sequential version for arguments less than threshold static final int seqFib(int n) { // unroll left only int r = 1; do { int m = n - 2; r += m <= 1 ? m : seqFib(m); } while (--n > 1); return r; } } jsr166/src/test/loops/UncheckedLockLoops.java0000644000000000000000000003223311537741072016275 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @summary basic safety and liveness of ReentrantLocks, and other locks based on them */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class UncheckedLockLoops { static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static boolean doBuiltin = true; public static void main(String[] args) throws Exception { int maxThreads = 100; int iters = 10000000; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); rng.setSeed(3122688L); print = false; System.out.println("Warmup..."); oneTest(1, 100000); Thread.sleep(1000); oneTest(3, 10000); Thread.sleep(1000); oneTest(2, 10000); Thread.sleep(100); oneTest(1, 100000); Thread.sleep(100); oneTest(1, 100000); Thread.sleep(1000); print = true; System.out.println("Threads:" + 1); oneTest(1, iters / 1); Thread.sleep(100); for (int i = 1; i <= maxThreads; i += (i+1) >>> 1) { System.out.println("Threads:" + i); oneTest(i, iters / i); Thread.sleep(100); } } static void oneTest(int nthreads, int iters) throws Exception { int fairIters = (nthreads <= 1) ? iters : iters/20; int v = rng.next(); if (print) System.out.print("NoLock (1 thread) "); new NoLockLoop().test(v, 1, iters * nthreads); Thread.sleep(10); if (print) System.out.print("ReentrantLock "); new ReentrantLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (false) { if (print) System.out.print("FairReentrantLock "); new FairReentrantLockLoop().test(v, nthreads, fairIters); Thread.sleep(10); } if (doBuiltin) { if (print) System.out.print("builtin lock "); new BuiltinLockLoop().test(v, nthreads, fairIters); Thread.sleep(10); } if (print) System.out.print("Mutex "); new MutexLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("LongMutex "); new LongMutexLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("Semaphore "); new SemaphoreLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairSemaphore "); new FairSemaphoreLoop().test(v, nthreads, fairIters); Thread.sleep(10); if (print) System.out.print("ReentrantWriteLock "); new ReentrantWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairRWriteLock "); new FairReentrantWriteLockLoop().test(v, nthreads, fairIters); Thread.sleep(10); if (print) System.out.print("ReentrantReadWriteLock"); new ReentrantReadWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairRReadWriteLock "); new FairReentrantReadWriteLockLoop().test(v, nthreads, fairIters); Thread.sleep(10); } abstract static class LockLoop implements Runnable { int value; int checkValue; int iters; volatile int result; volatile int failures; final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier; final int setValue(int v) { checkValue = v ^ 0x55555555; value = v; return v; } final int getValue() { int v = value; if (checkValue != ~(v ^ 0xAAAAAAAA)) ++failures; return v; } final void test(int initialValue, int nthreads, int iters) throws Exception { setValue(initialValue); this.iters = iters; barrier = new CyclicBarrier(nthreads+1, timer); for (int i = 0; i < nthreads; ++i) new Thread(this).start(); barrier.await(); barrier.await(); long time = timer.getTime(); if (print) { long tpi = time / (iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per update"); // double secs = (double) time / 1000000000.0; // System.out.print("\t " + secs + "s run time"); System.out.println(); } if (result == 0) // avoid overoptimization System.out.println("useless result: " + result); if (failures != 0) throw new Error("protection failure?"); } abstract int loop(int n); public final void run() { try { barrier.await(); result += loop(iters); barrier.await(); } catch (Exception ie) { return; } } } private static class NoLockLoop extends LockLoop { private volatile int readBarrier; final int loop(int n) { int sum = 0; int x = 0; while (n-- > 0) { int r1 = readBarrier; x = setValue(LoopHelpers.compute1(getValue())); int r2 = readBarrier; if (r1 == r2 && (x & 255) == 0) ++readBarrier; sum += LoopHelpers.compute2(x); } return sum; } } private static class BuiltinLockLoop extends LockLoop { final int loop(int n) { int sum = 0; int x = 0; while (n-- > 0) { synchronized (this) { x = setValue(LoopHelpers.compute1(getValue())); } sum += LoopHelpers.compute2(x); } return sum; } } private static class ReentrantLockLoop extends LockLoop { private final ReentrantLock lock = new ReentrantLock(); final int loop(int n) { final ReentrantLock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class MutexLoop extends LockLoop { private final Mutex lock = new Mutex(); final int loop(int n) { final Mutex lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class LongMutexLoop extends LockLoop { private final LongMutex lock = new LongMutex(); final int loop(int n) { final LongMutex lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class FairReentrantLockLoop extends LockLoop { private final ReentrantLock lock = new ReentrantLock(true); final int loop(int n) { final ReentrantLock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class ReentrantWriteLockLoop extends LockLoop { private final Lock lock = new ReentrantReadWriteLock().writeLock(); final int loop(int n) { final Lock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class FairReentrantWriteLockLoop extends LockLoop { final Lock lock = new ReentrantReadWriteLock(true).writeLock(); final int loop(int n) { final Lock lock = this.lock; int sum = 0; int x = 0; while (n-- > 0) { lock.lock(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class SemaphoreLoop extends LockLoop { private final Semaphore sem = new Semaphore(1, false); final int loop(int n) { final Semaphore sem = this.sem; int sum = 0; int x = 0; while (n-- > 0) { sem.acquireUninterruptibly(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { sem.release(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class FairSemaphoreLoop extends LockLoop { private final Semaphore sem = new Semaphore(1, true); final int loop(int n) { final Semaphore sem = this.sem; int sum = 0; int x = 0; while (n-- > 0) { sem.acquireUninterruptibly(); try { x = setValue(LoopHelpers.compute1(getValue())); } finally { sem.release(); } sum += LoopHelpers.compute2(x); } return sum; } } private static class ReentrantReadWriteLockLoop extends LockLoop { private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final int loop(int n) { final Lock rlock = lock.readLock(); final Lock wlock = lock.writeLock(); int sum = 0; int x = 0; while (n-- > 0) { if ((n & 16) != 0) { rlock.lock(); try { x = LoopHelpers.compute1(getValue()); x = LoopHelpers.compute2(x); } finally { rlock.unlock(); } } else { wlock.lock(); try { setValue(x); } finally { wlock.unlock(); } sum += LoopHelpers.compute2(x); } } return sum; } } private static class FairReentrantReadWriteLockLoop extends LockLoop { private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); final int loop(int n) { final Lock rlock = lock.readLock(); final Lock wlock = lock.writeLock(); int sum = 0; int x = 0; while (n-- > 0) { if ((n & 16) != 0) { rlock.lock(); try { x = LoopHelpers.compute1(getValue()); x = LoopHelpers.compute2(x); } finally { rlock.unlock(); } } else { wlock.lock(); try { setValue(x); } finally { wlock.unlock(); } sum += LoopHelpers.compute2(x); } } return sum; } } } jsr166/src/test/loops/CachedThreadPoolLoops.java0000644000000000000000000001227611551700072016720 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ //import jsr166y.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; public class CachedThreadPoolLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final AtomicInteger remaining = new AtomicInteger(); static final int maxIters = 1000000; public static void main(String[] args) throws Exception { int maxThreads = NCPUS * 3 / 2; // 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); System.out.print("Warmup:"); for (int j = 0; j < 1; ++j) { int k = 1; for (int i = 1; i <= maxThreads;) { System.out.print(" " + i); oneTest(i, 10000, false); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } } System.out.println(); int k = 1; for (int i = 1; i <= maxThreads;) { System.out.println("Threads:" + i); oneTest(i, maxIters, true); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } } static void oneTest(int nThreads, int iters, boolean print) throws Exception { Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue "); oneRun(new LinkedTransferQueue(), nThreads, iters, print); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(), nThreads, iters, print); Thread.sleep(100); // System.gc(); if (print) System.out.print("SynchronousQueue "); oneRun(new SynchronousQueue(false), nThreads, iters, print); Thread.sleep(100); // System.gc(); if (print) System.out.print("SynchronousQueue(fair) "); oneRun(new SynchronousQueue(true), nThreads, iters, print); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue(xfer)"); oneRun(new LTQasSQ(), nThreads, iters, print); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue(half)"); oneRun(new HalfSyncLTQ(), nThreads, iters, print); Thread.sleep(100); // System.gc(); if (print) System.out.print("ArrayBlockingQueue(256) "); oneRun(new ArrayBlockingQueue(256), nThreads, iters, print); } static final class Task implements Runnable { final ThreadPoolExecutor pool; final CountDownLatch done; Task(ThreadPoolExecutor p, CountDownLatch d) { pool = p; done = d; } public void run() { done.countDown(); remaining.incrementAndGet(); int n; while (!Thread.interrupted() && (n = remaining.get()) > 0 && done.getCount() > 0) { if (remaining.compareAndSet(n, n-1)) { try { pool.execute(this); } catch (RuntimeException ex) { System.out.print("*"); while (done.getCount() > 0) done.countDown(); return; } } } } } static void oneRun(BlockingQueue q, int nThreads, int iters, boolean print) throws Exception { ThreadPoolExecutor pool = new ThreadPoolExecutor(nThreads+1, Integer.MAX_VALUE, 1L, TimeUnit.SECONDS, q); CountDownLatch done = new CountDownLatch(iters); remaining.set(nThreads-1); pool.prestartAllCoreThreads(); Task t = new Task(pool, done); long start = System.nanoTime(); pool.execute(t); done.await(); long time = System.nanoTime() - start; if (print) System.out.println("\t: " + LoopHelpers.rightJustify(time / iters) + " ns per task"); q.clear(); Thread.sleep(100); pool.shutdown(); Thread.sleep(100); pool.shutdownNow(); } static final class LTQasSQ extends LinkedTransferQueue { LTQasSQ() { super(); } public void put(T x) { try { super.transfer(x); } catch (InterruptedException ex) { throw new Error(); } } } static final class HalfSyncLTQ extends LinkedTransferQueue { int calls; HalfSyncLTQ() { super(); } public void put(T x) { if ((++calls & 1) == 0) super.put(x); else { try { super.transfer(x); } catch (InterruptedException ex) { throw new Error(); } } } } } jsr166/src/test/loops/Mutex.java0000644000000000000000000000262511537741071013661 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.*; import java.io.*; /** * A sample user extension of AbstractQueuedSynchronizer. */ public final class Mutex extends AbstractQueuedSynchronizer implements Lock, java.io.Serializable { public boolean isHeldExclusively() { return getState() == 1; } public boolean tryAcquire(int acquires) { return compareAndSetState(0, 1); } public boolean tryRelease(int releases) { setState(0); return true; } public Condition newCondition() { return new ConditionObject(); } private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); setState(0); // reset to unlocked state } public void lock() { acquire(1); } public boolean tryLock() { return tryAcquire(1); } public void lockInterruptibly() throws InterruptedException { acquireInterruptibly(1); } public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException { return tryAcquireNanos(1, unit.toNanos(timeout)); } public void unlock() { release(1); } } jsr166/src/test/loops/Microscope.java0000644000000000000000000011075311537741071014664 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.awt.*; import javax.swing.*; import java.util.*; import java.awt.event.*; import javax.swing.event.*; import java.util.concurrent.*; /** * Microscope implements a version of the 7th Guest * game found looking in the Microscope in the laboratory. * See * Microscope version for instructions. *

* The code has been mangled beyond recognition * as a test of ForkJoin. */ public class Microscope extends JPanel { static final CountDownLatch cd = new CountDownLatch(1); /* * If true, the move finder uses a repeatable evaluation * strategy, so all self-play games at same level have same outcome. * This is useful for testing purposes, but much less fun to watch. */ static boolean DETERMINISTIC = false; static boolean headless = false; // Command-line parameters static int nprocs; static int lookAheads = 4; static boolean autostart = true; static ForkJoinPool group; static long startTime; public static void main(String[] args) throws Exception { nprocs = 0; try { if (args.length > 0) { nprocs = Integer.parseInt(args[0]); autostart = false; if (args.length > 1) { autostart = true; lookAheads = Integer.parseInt(args[1]); DETERMINISTIC = true; } } } catch (Exception e) { System.out.println("Usage: java Microscope []"); return; } group = nprocs == 0 ? new ForkJoinPool() : new ForkJoinPool(nprocs); startTime = System.currentTimeMillis(); System.out.print("Score: "); oneRun(); cd.await(); long now = System.currentTimeMillis(); System.out.println(); System.out.println("time: " + (now - startTime) + "ms"); System.out.println(group.toString()); System.exit(0); } static void onExit() { long now = System.currentTimeMillis(); System.out.println("time: " + (now - startTime) + "ms"); System.out.println(group.toString()); System.exit(0); } static void oneRun() { if (java.awt.GraphicsEnvironment.isHeadless()) { headless = true; Microscope t = new Microscope(); t.init(); } else { JFrame frame = new JFrame(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {onExit();}}); Microscope t = new Microscope(); frame.setSize(new Dimension(400, 400)); frame.getContentPane().add(t); // frame.pack(); frame.setVisible(true); t.init(); } } // representations: Board board = new Board(); // The current board representation synchronized Board getBoard() { return board; } synchronized void setBoard(Board b) { board = b; System.out.print(b.score(player) + " "); if (boardPanel != null) boardPanel.repaint(); } Player player = Player.Blue; // current player (BLUE, GREEN) synchronized Player getPlayer() { return player; } synchronized void setPlayer(Player p) { player = p; } final AutoMover auto; // The move finder. final User user; // Mover for user moves Mover mover = null; // the current Mover (always == auto or user or null) synchronized Mover getMover() { return mover; } synchronized void setMover(Mover m) { mover = m; } synchronized boolean isMoving() { return mover != null; } Vector history = new Vector(); // List of completed moves; boolean demoMode = true; synchronized boolean getDemoMode() { return demoMode; } synchronized void setDemoMode(boolean b) { demoMode = b; } synchronized boolean toggleDemoMode() { return demoMode = !demoMode; } final BoardPanel boardPanel; JLabel scoreLabel; JButton autoButton; JButton undoButton; JButton modeButton; JSlider levelSlider; public Microscope() { if (headless) { boardPanel = null; auto = new AutoMover(this); user = new User(this); return; } boardPanel = new BoardPanel(); scoreLabel = new JLabel("Score: 0"); autoButton = new JButton(" Start "); undoButton = new JButton("Undo"); modeButton = new JButton("Demo mode"); levelSlider = new JSlider(JSlider.VERTICAL, 2, 6, lookAheads); auto = new AutoMover(this); user = new User(this); JPanel topPanel = new JPanel(); autoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!isMoving()) { startMover(auto); autoButton.setText("Cancel"); } else { stopMover(); if (getDemoMode()) autoButton.setText(" Start "); else autoButton.setText(" Find "); } }}); modeButton.addActionListener(new ActionListener() { public synchronized void actionPerformed(ActionEvent e) { toggleDemoMode(); updateStatus(); }}); undoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { undo(); }}); levelSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { setLevel(((JSlider)(e.getSource())).getValue()); }}); // Dimension labDim = new Dimension(40, 16); // Dimension labDim = new Dimension(72, 24); // scoreLabel.setMinimumSize(labDim); // scoreLabel.setPreferredSize(labDim); topPanel.add(autoButton); topPanel.add(modeButton); topPanel.add(undoButton); topPanel.add(scoreLabel); add(topPanel); levelSlider.setLabelTable(levelSlider.createStandardLabels(1)); levelSlider.setPaintLabels(true); JPanel botPanel = new JPanel(); botPanel.add(boardPanel); JPanel sliderPanel = new JPanel(); sliderPanel.setLayout(new BoxLayout(sliderPanel, BoxLayout.Y_AXIS)); sliderPanel.add(levelSlider); sliderPanel.add(new JLabel("Level")); botPanel.add(sliderPanel); add(botPanel); } void initializeBoard() { board.reset(); board.occupy(Player.Blue, 0, 0); board.occupy(Player.Blue, Board.RANKS-1, Board.RANKS-1); board.occupy(Player.Green, 0, Board.RANKS-1); board.occupy(Player.Green, Board.RANKS-1, 0); setPlayer(Player.Blue); if (boardPanel != null) boardPanel.repaint(); } public void init() { initializeBoard(); if (autostart) { startMover(auto); } } synchronized void setLevel(int l) { lookAheads = l; if (lookAheads <= 1) lookAheads = 2; } public int level () { return Microscope.lookAheads; } // process a move (called only from mover) public void move(Move m, Mover mvr) { if (mvr != mover || m == null || (mvr == user && !m.isLegal())) { setMover(null); if (mvr == auto && autostart) { cd.countDown(); return; // System.exit(0); } } else { m.commit(); setBoard(m.board()); setPlayer(m.player().opponent()); history.addElement(m); if (mvr == auto && getDemoMode() && !m.isPass()) { if (getBoard().gameOver()) { if (autostart) { cd.countDown(); return; // System.exit(0); } else setMover(null); } else { auto.startTurn(new Board(getBoard()), getPlayer()); } } else { setMover(null); } } } // start up a Mover void startMover(Mover m) { Mover mvr = getMover(); if (mvr == null) { setMover(m); m.startTurn(new Board(getBoard()), player); } } // stop current Mover void stopMover() { Mover mvr = getMover(); if (mvr != null) { setMover(null); mvr.cancel(); } } // handle Undo button synchronized void undo() { if (mover == null) { if (history.size() > 1) { history.removeElementAt(history.size()-1); Move m = history.lastElement(); setPlayer(m.player().opponent()); setBoard(m.board()); } else if (history.size() == 1) { history.removeAllElements(); initializeBoard(); } } } // handle click on tile void userMove(int row, int col) { startMover(user); user.choose(row, col); } void updateStatus() { // normally called from board update Player p = getPlayer(); int s = getBoard().score(p); if (scoreLabel == null) { System.out.print(s + " "); return; } scoreLabel.setForeground(displayColor(p)); scoreLabel.setText("Score: " + s); if (getDemoMode()) modeButton.setText("Demo mode"); else { if (getPlayer().isBlue()) modeButton.setText("Blue turn"); else modeButton.setText("Green turn"); } } static final int CELL_SIZE = 40; // size of a tile/cell static final Color paleGreen = new Color(152, 251, 152); static final Color darkGreen = new Color(60, 179, 113); static final Color possibleMoveColor = Color.yellow; public static Color displayColor(Player pl) { if (pl.isBlue()) return Color.blue; else if (pl.isGreen()) return darkGreen; else return Color.white; } public static Color lightDisplayColor(Player pl) { if (pl.isBlue()) return Color.cyan; else if (pl.isGreen()) return paleGreen; else return Color.gray; } class BoardPanel extends Canvas implements MouseListener { BoardPanel() { setSize(new Dimension(Board.RANKS * CELL_SIZE + 5, Board.RANKS * CELL_SIZE + 5)); addMouseListener(BoardPanel.this); } public void paint(Graphics g) { Board b = getBoard(); Player p = getPlayer(); // the cells for (int row = 0; row < Board.RANKS; row++) { for (int col = 0; col < Board.RANKS; col++) { // Highlight selected tile and legal destinations if (user.placing()) { if (user.hasMovedFrom(row, col)) g.setColor(lightDisplayColor(p)); else if (user.canMoveTo(row, col)) g.setColor(possibleMoveColor); else g.setColor(displayColor(b.occupant(row, col))); } else g.setColor(displayColor(b.occupant(row, col))); // tiles are just filled rectangles g.fillRect(row * CELL_SIZE, col * CELL_SIZE, CELL_SIZE, CELL_SIZE); } } // the grid over the cells g.setColor(Color.black); for ( int i = 0; i <= Board.RANKS; i++) { g.drawLine(0, i * CELL_SIZE, Board.RANKS * CELL_SIZE, i * CELL_SIZE); g.drawLine(i * CELL_SIZE, 0, i * CELL_SIZE, Board.RANKS * CELL_SIZE); } updateStatus(); } public void mouseReleased(MouseEvent evt) { int x = evt.getX(); int y = evt.getY(); int row = x / CELL_SIZE; int col = y / CELL_SIZE; if (Board.inBounds(row, col)) { // cell selection userMove(row, col); repaint(); } } public void mouseClicked(MouseEvent e) {} public void mousePressed(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} } /** * Player is just a glorified enumeration */ static final class Player { public static final int EMPTY = 0; public static final int BLUE = 1; public static final int GREEN = 2; public static final int ILLEGAL_PLAYER_VALUE = 3; public static final Player Empty = new Player(EMPTY); public static final Player Blue = new Player(BLUE); public static final Player Green = new Player(GREEN); public static final Player Illegal = new Player(ILLEGAL_PLAYER_VALUE); /* private */ int code_; public Player(int code) { code_ = code; } public Player(Player p) { code_ = p.code_; } public boolean same(Player p) { return code_ == p.code_; } public boolean isEmpty() { return code_ == EMPTY; } public boolean isBlue() { return code_ == BLUE; } public boolean isGreen() { return code_ == GREEN; } public boolean isLegal() { return code_ <= GREEN; } public Player opponent() { if (code_ == GREEN) return Blue; else if (code_ == BLUE) return Green; else return Illegal; } } /** * Board configurations are represented by bit vectors. * Since there are only 49 cells, the bits can be held in `longs', * one for each player. *

* Boards are not immutable, but are never passed around across * threads (instead new ones are constructed), so don't * need any synch. */ static final class Board { /* First, some Constants and utilities that might as well be here */ public static final int RANKS = 7; public static final int CELLS = RANKS * RANKS; static final long FULL = (1L << CELLS) - 1; // The finder uses a spare bit to remember whose move it is. static final long BLUEBIT = (1L << CELLS); // Bits representing the adjacent cells for every position static final long[] adjacentMasks = new long[CELLS]; // bit pattern associated with each tile static final long[] cellBits = new long[CELLS]; // locations of all cells reachable by a jump for every position static final byte[][] jumpDestinations = new byte[CELLS][]; // initialize tables static { byte[] dests = new byte[CELLS]; for (int j = 0; j < RANKS; ++j) { for (int i = 0; i < RANKS; ++i) { int k = i + j * RANKS; long nmask = 0; int jumpCount = 0; for (int c = j-2; c <= j+2; ++c) { for (int r = i-2; r <= i+2; ++r) { if (c >= 0 && c < RANKS && r >= 0 && r < RANKS) { int cellIndex = r + c * RANKS; if (r == i-2 || r == i+2 || c == j-2 || c == j+2) { dests[jumpCount++] = (byte)cellIndex; } else if (!(r == i && c == j)) { nmask |= 1L << cellIndex; } } } } adjacentMasks[k] = nmask; cellBits[k] = 1L << k; jumpDestinations[k] = new byte[jumpCount]; for (int l = 0; l < jumpCount; ++l) jumpDestinations[k][l] = dests[l]; } } } public static boolean inBounds(int row, int col) { return (0 <= row) && (row < RANKS) && (0 <= col) && (col < RANKS); } // The representation long blue_; // bit vector; true if occupied by blue long green_; // same for green; // constructors and intializers: public Board() { blue_ = 0L; green_ = 0L; } public Board(Board b) { blue_ = b.blue_; green_ = b.green_; } public Board(long b, long g) { blue_ = b; green_ = g; } public void copyState(Board b) { blue_ = b.blue_; green_ = b.green_; } void reset() { blue_ = 0L; green_ = 0L; } long getBlue() { return blue_; } long getGreen() { return green_; } public Player occupant(int row, int col) { if ((0 <= row) && (row < RANKS) && (0 <= col) && (col < RANKS)) { long m = 1L << (row + col * RANKS); if ((blue_ & m) != 0L) return Player.Blue; else if ((green_ &m) != 0L) return Player.Green; else return Player.Empty; } else return Player.Illegal; } // place a tile without taking opponent tiles public void occupy(Player player, int row, int col) { long m = 1L << (row + col * RANKS); long nm = ~m; if (player.code_ == Player.BLUE) { blue_ |= m; green_ &= nm; } else if (player.code_ == Player.GREEN) { blue_ &= nm; green_ |= m; } else { blue_ &= nm; green_ &= nm; } } public void unoccupy(int row, int col) { long nm = ~(1L << (row + col * RANKS)); blue_ &= nm; green_ &= nm; } // place a tile, taking all adjacent tiles of opponent public void take(Player player, int row, int col) { int k = (row + col * RANKS); long dest = 1L << k; long nbrMask = adjacentMasks[k]; long sourceBlue = blue_; long sourceGreen = green_; if (player.code_ == Player.BLUE) { blue_ = sourceBlue | dest | (sourceGreen & nbrMask); green_ = sourceGreen & ~(sourceGreen & nbrMask); } else { blue_ = sourceBlue & ~(sourceBlue & nbrMask); green_ = sourceGreen | dest | (sourceBlue & nbrMask); } } public boolean gameOver() { return (((blue_ | green_) & FULL) == FULL) || ((blue_ & ~BLUEBIT) == 0) || ((green_ & ~BLUEBIT) == 0); } public int score(Player player) { if (player.isBlue()) { return score(blue_, green_); } else { return score(green_, blue_); } } static int score(long b, long g) { // much faster by splitting into ints // and using clever shift-based bit counter int lb = (int)(b & ((1L << 32) - 1)); int hb = ((int)(b >>> 32)) & ((1 << (CELLS - 32)) - 1); lb -= (0xaaaaaaaa & lb) >>> 1; lb = (lb & 0x33333333) + ((lb >>> 2) & 0x33333333); lb = lb + (lb >>> 4) & 0x0f0f0f0f; lb += lb >>> 8; lb += lb >>> 16; hb -= (0xaaaaaaaa & hb) >>> 1; hb = (hb & 0x33333333) + ((hb >>> 2) & 0x33333333); hb = hb + (hb >>> 4) & 0x0f0f0f0f; hb += hb >>> 8; hb += hb >>> 16; hb = ((lb + hb) & 0xff); int lg = (int)(g & ((1L << 32) - 1)); int hg = ((int)(g >>> 32)) & ((1 << (CELLS - 32)) - 1); lg -= (0xaaaaaaaa & lg) >>> 1; lg = (lg & 0x33333333) + ((lg >>> 2) & 0x33333333); lg = lg + (lg >>> 4) & 0x0f0f0f0f; lg += lg >>> 8; lg += lg >>> 16; hg -= (0xaaaaaaaa & hg) >>> 1; hg = (hg & 0x33333333) + ((hg >>> 2) & 0x33333333); hg = hg + (hg >>> 4) & 0x0f0f0f0f; hg += hg >>> 8; hg += hg >>> 16; return hb - ((lg + hg) & 0xff); } static int slowscore(long b, long g) { int score = 0; for (int l = 0; l < CELLS; ++l) { score += (int)(b & 1); b >>>= 1; score -= (int)(g & 1); g >>>= 1; } return score; } } /** * Moves represent transitions across Board states */ static final class Move { static final int NO_VALUE = -1; // row/col value if not yet set static final int PASS_VALUE = -2; // special value for pass moves // utilities for classifying moves public static boolean twoFrom(int a, int b) { return (a - b == 2) || (b - a == 2); } public static boolean withinTwo(int a, int b) { int diff = a - b; return -2 <= diff && diff <= 2; } // representations int fromRow; int fromCol; int toRow; int toCol; Player player_; Board board_; boolean committed = false; // true if board reflects move // constructors and intializers public Move(Player turn, Board board) { fromRow = NO_VALUE; fromCol = NO_VALUE; toRow = NO_VALUE; toCol = NO_VALUE; player_ = turn; board_ = board; } public Move(Player turn, Board board, boolean isCommitted) { fromRow = NO_VALUE; fromCol = NO_VALUE; toRow = NO_VALUE; toCol = NO_VALUE; player_ = turn; board_ = board; committed = isCommitted; } synchronized void reset() { fromRow = NO_VALUE; fromCol = NO_VALUE; toRow = NO_VALUE; toCol = NO_VALUE; } // setters: synchronized void player(Player p) { player_ = p; } synchronized void board(Board b) { board_ = b; } synchronized void from(int sr, int sc) { fromRow = sr; fromCol = sc; } synchronized void to(int dr, int dc) { toRow = dr; toCol = dc; } // accessors: synchronized boolean isFrom(int r, int c) { return fromRow== r && fromCol == c; } synchronized boolean isTo(int r, int c) { return toRow == r && toCol == c; } synchronized Board board() { return board_; } synchronized Player player() { return player_; } // status checks: synchronized boolean isPass() { // is this a `pass' move? return (toRow == PASS_VALUE || fromRow == PASS_VALUE); } synchronized boolean isJump() { return (fromRow - toRow == 2) || (toRow - fromRow == 2) || (fromCol - toCol == 2) || (toCol - fromCol == 2); } synchronized boolean hasFrom() { // is from set? return fromRow != NO_VALUE && fromCol != NO_VALUE; } synchronized boolean hasTo() { // is to set? return toRow != NO_VALUE && toCol != NO_VALUE; } synchronized boolean possibleTo(int r, int c) { // is (r, c) a legal `to'? return hasFrom() && withinTwo(fromRow, r) && withinTwo(fromCol, c) && board_.occupant(r, c).isEmpty(); } synchronized boolean isLegal() { if (isPass()) return true; else if (!board_.occupant(toRow, toCol).isEmpty()) return false; else if (!board_.occupant(fromRow, fromCol).same(player_)) return false; else if (!(withinTwo(fromRow, toRow) && withinTwo(fromCol, toCol))) return false; else return true; } synchronized void commit() { // update board to reflect move if (!committed) { committed = true; if (isLegal() && !isPass()) { if (isJump()) board_.occupy(Player.Empty, fromRow, fromCol); board_.take(player_, toRow, toCol); } } } } /** * Mover is an abstract class to simplify code dealing with * either user moves or auto moves. */ abstract static class Mover { // caller for move callbacks protected Microscope game; protected Mover(Microscope ap) { game = ap; } // start a turn as player on given board public abstract void startTurn(Board b, Player p); // cancel current partial move public abstract void cancel(); // return true if move not yet ready public abstract boolean placing(); } /** * User builds moves via instructions/clicks by users */ static class User extends Mover { private Move current; public User(Microscope ap) { super(ap); current = null; } public synchronized void startTurn(Board b, Player p) { current = new Move(p, b); } public boolean placing() { return current != null && current.hasFrom() && !current.hasTo(); } public synchronized void cancel() { if (current != null) { current.reset(); current = null; } } public synchronized void choose(int row, int col) { if (current != null) { if (row == Move.PASS_VALUE) { current.from(row, col); game.move(current, this); current = null; } else if (!current.hasFrom()) { if (current.board().occupant(row, col).same(current.player())) { current.from(row, col); } } else { current.to(row, col); game.move(current, this); current = null; } } } public synchronized boolean canMoveTo(int row, int col) { return placing() && current.possibleTo(row, col); } public synchronized boolean hasMovedFrom(int row, int col) { return current != null && current.isFrom(row, col); } } /** * AutoMover constructs Finders that compute actual moves */ static class AutoMover extends Mover { boolean cancelled = false; RootFinder currentFinder = null; public AutoMover(Microscope ap) { super(ap); } public synchronized boolean placing() { return currentFinder != null; } synchronized void stopPlacing() { currentFinder = null; } public synchronized void cancel() { if (placing()) { currentFinder.cancel(false); stopPlacing(); } } public synchronized void startTurn(Board board, Player player) { if (!placing()) { currentFinder = new RootFinder(board, player, Microscope.lookAheads, this); group.execute(currentFinder); } } synchronized void relay(Move move) { // relay callback from finder if (placing()) { stopPlacing(); game.move(move, this); } } } /** * Implements a classic all-possible-move search algorith using * ForkJoinTasks. The move finder is not all that smart. Among * other possible improvements, it could keep a cache of explored * moves and avoid repeating them. This would likely speed it up * since most expansions are duplicates of others. It could also * be changed to prune moves, although this is unlikely to work * well without better partial evaluation functions. */ static class Finder extends RecursiveAction { static final int NOMOVE = Integer.MIN_VALUE; static final int LOSE = NOMOVE+1; static final int WIN = -LOSE; final long ours; // bits for our tiles final long theirs; // bits for opponent tiles final int level; // current number of lookAheads final Finder next; // Each Finder is placed in a linked list by parent // Assigned once; must be volatile since accessed by parents volatile int bestScore; Finder(long ours, long theirs, int level, Finder next) { this.ours = ours; this.theirs = theirs; this.level = level; this.next = next; } protected final void compute() { // Handle sure wins and losses here if ((ours & ~Board.BLUEBIT) == 0) bestScore = LOSE; else if ((theirs & ~Board.BLUEBIT) == 0) bestScore = WIN; else if (((ours | theirs) & Board.FULL) == Board.FULL) { int score = Board.score(ours, theirs); if (score > 0) bestScore = WIN; else if (score < 0) bestScore = LOSE; else bestScore = 0; } else search(); } final void search() { int best = NOMOVE; // For direct evaluation when level == 1 Finder forked = null; // list of forked subtasks when level > 1 long open = ~(ours | theirs); // currently empty cells long here = 1; // travserse through bits for (int k = 0; k < Board.CELLS; ++k, here <<= 1) { if ((here & ours) != 0) { /* * Step through possible destinations to find * jumps for this tile */ byte[] dests = Board.jumpDestinations[k]; for (int j = 0; j < dests.length; ++j) { byte d = dests[j]; long dest = 1L << d; if ( (dest & open) != 0) { long adjacent = Board.adjacentMasks[d]; long nTheirs = theirs & ~adjacent; long nOurs = (ours & ~here) | dest | (theirs & adjacent); if (level > 1) (forked = new Finder(nTheirs, nOurs, level-1, forked)).fork(); else { int sc = Board.score(nOurs, nTheirs); if (sc > best) best = sc; } } } } else if ((here & open) != 0) { /* * If this cell is open, and is within 1 of one of * our tiles, it can be taken in some copy move. * It doesn't matter which of the adjacent cells * is considered to be source of copy move */ long adjacent = Board.adjacentMasks[k]; if ((ours & adjacent) != 0) { long nTheirs = theirs & ~adjacent; long nOurs = ours | here | (theirs & adjacent); if (level > 1) (forked = new Finder(nTheirs, nOurs, level-1, forked)).fork(); else { int sc = Board.score(nOurs, nTheirs); if (sc > best) best = sc; } } } } if (level > 1) collect(forked); else bestScore = best; } /** * Join all subtasks and evaluate moves. Default is sub-finder version. * Overridden in RootFinder. */ void collect(Finder forked) { int best = NOMOVE; while (forked != null) { while (!forked.isDone()) { // interleave joins with status checks if (isDone()) { cancelAll(forked); return; } else { ForkJoinTask t = pollTask(); if (t != null) t.quietlyInvoke(); } } int score = -forked.bestScore; // negate opponent score if (score > best) { best = score; if (score >= WIN) { cancelAll(forked.next); break; } } forked = forked.next; } bestScore = best; } /** * Cancels all forked subtasks in list. */ void cancelAll(Finder forked) { while (forked != null) { forked.cancel(false); forked = forked.next; } } } /** * Root Finder class -- wait out other finders and issue callback to game. */ static class RootFinder extends Finder { final AutoMover automover; final Player player; RootFinder(Board board, Player p, int level, AutoMover automover) { super( (p.isBlue() ? (board.getBlue()| Board.BLUEBIT) : board.getGreen()), (p.isBlue() ? board.getGreen() : (board.getBlue()| Board.BLUEBIT)), level, null); this.player = p; this.automover = automover; } /** * This differs from default version by recording * and calling back with best move */ void collect(Finder forked) { int best = NOMOVE; Finder bestFinder = null; while (forked != null) { while (!forked.isDone()) { if (isDone()) { cancelAll(forked); return; } else { ForkJoinTask t = pollTask(); if (t != null) t.quietlyInvoke(); } } int score = -forked.bestScore; // negate opponent score if (bestFinder == null || score > best) { best = score; bestFinder = forked; if (score >= WIN) { cancelAll(forked.next); break; } } // Just for fun, introduce a little randomness via hashcodes else if (score == best && !Microscope.DETERMINISTIC && (System.identityHashCode(forked) > System.identityHashCode(bestFinder))) { bestFinder = forked; } forked = forked.next; } Move move = null; if (bestFinder != null) { /* Even though accessed here, the ours and theirs vars of Finders do not need to be volatile because they are immutably established in constructors. */ long nextOurs = bestFinder.theirs; long nextTheirs = bestFinder.ours; long blue = player.isBlue() ? nextOurs : nextTheirs; long green = player.isBlue() ? nextTheirs: nextOurs; move = new Move(player, new Board(blue, green), true); } automover.relay(move); } } } jsr166/src/test/loops/CancelledLockLoops.java0000644000000000000000000001001011537741071016242 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class CancelledLockLoops { static final Random rng = new Random(); static boolean print = false; static final int ITERS = 10000000; static final long TIMEOUT = 100; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; for (int i = 2; i <= maxThreads; i += (i+1) >>> 1) { System.out.print("Threads: " + i); try { new ReentrantLockLoop(i).test(); } catch (BrokenBarrierException bb) { // OK, ignore } } } static final class ReentrantLockLoop implements Runnable { private int v = rng.nextInt(); private int completed; private volatile int result = 17; private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { Thread[] threads = new Thread[nthreads]; for (int i = 0; i < threads.length; ++i) threads[i] = new Thread(this); for (int i = 0; i < threads.length; ++i) threads[i].start(); Thread[] cancels = threads.clone(); Collections.shuffle(Arrays.asList(cancels), rng); barrier.await(); Thread.sleep(TIMEOUT); for (int i = 0; i < cancels.length-2; ++i) { cancels[i].interrupt(); // make sure all OK even when cancellations spaced out if ( (i & 3) == 0) Thread.sleep(1 + rng.nextInt(10)); } barrier.await(); if (print) { long time = timer.getTime(); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int c; lock.lock(); try { c = completed; } finally { lock.unlock(); } if (c != 2) throw new Error("Completed != 2"); int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v; int x = 0; int n = ITERS; boolean done = false; do { try { lock.lockInterruptibly(); } catch (InterruptedException ie) { break; } try { v = x = LoopHelpers.compute1(v); } finally { lock.unlock(); } sum += LoopHelpers.compute2(x); } while (n-- > 0); if (n <= 0) { lock.lock(); try { ++completed; } finally { lock.unlock(); } } barrier.await(); result += sum; } catch (Exception ex) { // ex.printStackTrace(); return; } } } } jsr166/src/test/loops/MapCheck.java0000644000000000000000000005423411537741071014235 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * @test * @synopsis Times and checks basic map operations * * When run with "s" second arg, this requires file "testwords", which * is best used with real words. We can't check in this file, but you * can create one from a real dictionary (1 line per word) and then run * linux "shuf" to randomize entries. */ import java.util.*; import java.io.*; public class MapCheck { static final Object MISSING = new Object(); static TestTimer timer = new TestTimer(); static Class eclass; static Class mapClass = java.util.concurrent.ConcurrentHashMap.class; static final LoopHelpers.SimpleRandom srng = new LoopHelpers.SimpleRandom(); static final Random rng = new Random(3152688); static volatile int checkSum; static void reallyAssert(boolean b) { if (!b) throw new Error("Failed Assertion"); } public static void main(String[] args) throws Exception { int numTests = 100; int size = 36864; // about midway of HashMap resize interval if (args.length == 0) System.out.println("Usage: MapCheck mapclass [int|float|string|object] [trials] [size] [serialtest]"); if (args.length > 0) { try { mapClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } if (args.length > 1) { String et = args[1].toLowerCase(); if (et.startsWith("i")) eclass = java.lang.Integer.class; else if (et.startsWith("f")) eclass = java.lang.Float.class; else if (et.startsWith("s")) eclass = java.lang.String.class; else if (et.startsWith("d")) eclass = java.lang.Double.class; } if (eclass == null) eclass = Object.class; if (args.length > 2) numTests = Integer.parseInt(args[2]); if (args.length > 3) size = Integer.parseInt(args[3]); boolean doSerializeTest = args.length > 4; while ((size & 3) != 0) ++size; System.out.print("Class: " + mapClass.getName()); System.out.print(" elements: " + eclass.getName()); System.out.print(" trials: " + numTests); System.out.print(" size: " + size); System.out.println(); Object[] key = new Object[size]; Object[] absent = new Object[size]; initializeKeys(key, absent, size); precheck(size, key, absent); for (int rep = 0; rep < numTests; ++rep) { mainTest(newMap(), key, absent); if ((rep & 3) == 3 && rep < numTests - 1) { shuffle(key); // Thread.sleep(10); } } TestTimer.printStats(); checkNullKey(); if (doSerializeTest) serTest(newMap(), size); } static Map newMap() { try { return (Map) mapClass.newInstance(); } catch (Exception e) { throw new RuntimeException("Can't instantiate " + mapClass + ": " + e); } } static void precheck(int n, Object[] key, Object[] abs) { int ck = 0; Map s = newMap(); for (int i = 0; i < n; i++) { Object k = key[i]; if (k == null) throw new Error("Null key at" + i); ck += System.identityHashCode(k); Object v = s.put(k, k); if (v != null) throw new Error("Duplicate " + k + " / " + v); } for (int i = 0; i < n; i++) { Object k = abs[i]; if (k == null) throw new Error("Null key at" + i); ck += System.identityHashCode(k); Object v = s.put(k, k); if (v != null) throw new Error("Duplicate " + k + " / " + v); } checkSum += ck; } static void checkNullKey() { Map m = newMap(); Object x = new Object(); Object v; try { m.put(null, x); v = m.get(null); } catch (NullPointerException npe) { System.out.println("Map does not allow null keys"); return; } if (v != x) throw new Error(); if (m.remove(null) != v) throw new Error(); if (m.get(null) != null) throw new Error(); } static void getTest(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { Object v = s.get(key[i]); if (v != null && v.getClass() == eclass) ++sum; } timer.finish(); reallyAssert(sum == expect); checkSum += sum; } // unused static void getTestBoxed(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; Map intMap = (Map)s; timer.start(nm, n); for (int i = 0; i < n; i++) { if (intMap.get(i) != i) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void remTest(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.remove(key[i]) != null) ++sum; } timer.finish(); reallyAssert(sum == expect); checkSum += sum; } static void clrTest(int n, Map s) { String nm = "Remove Present "; timer.start(nm, n); s.clear(); timer.finish(); reallyAssert(s.isEmpty()); } static void putTest(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { Object k = key[i]; Object v = s.put(k, k); if (v == null) ++sum; } timer.finish(); reallyAssert(sum == expect); checkSum += sum; } static void keyTest(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.containsKey(key[i])) ++sum; } timer.finish(); reallyAssert(sum == expect); checkSum += sum; } // version without timing for uncategorized tests static void untimedKeyTest(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; for (int i = 0; i < n; i++) { if (s.containsKey(key[i])) ++sum; } reallyAssert(sum == expect); checkSum += sum; } static void remHalfTest(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; timer.start(nm, n/2); for (int i = n-2; i >= 0; i-=2) { if (s.remove(key[i]) != null) ++sum; } timer.finish(); reallyAssert(sum == expect); checkSum += sum; } static void valTest(Map s, Object[] key) { int size = s.size(); int sum = 0; timer.start("Traverse key or value ", size); if (s.containsValue(MISSING)) ++sum; timer.finish(); reallyAssert(sum == 0); checkSum += sum; } static Object kitTest(Map s, int size) { Object last = null; int sum = 0; timer.start("Traverse key or value ", size); for (Iterator it = s.keySet().iterator(); it.hasNext(); ) { Object x = it.next(); if (x != last && x != null && x.getClass() == eclass) ++sum; last = x; } timer.finish(); reallyAssert(sum == size); checkSum += sum; return last; } static Object vitTest(Map s, int size) { Object last = null; int sum = 0; timer.start("Traverse key or value ", size); for (Iterator it = s.values().iterator(); it.hasNext(); ) { Object x = it.next(); if (x != last && x != null && x.getClass() == eclass) ++sum; last = x; } timer.finish(); reallyAssert(sum == size); checkSum += sum; return last; } static void eitTest(Map s, int size) { int sum = 0; timer.start("Traverse entry ", size); for (Iterator it = s.entrySet().iterator(); it.hasNext(); ) { Map.Entry e = (Map.Entry)it.next(); Object k = e.getKey(); Object v = e.getValue(); if (k != null && k.getClass() == eclass && v != null && v.getClass() == eclass) ++sum; } timer.finish(); reallyAssert(sum == size); checkSum += sum; } static void itRemTest(Map s, int size) { int sz = s.size(); reallyAssert(sz == size); timer.start("Remove Present ", size); int sum = 0; for (Iterator it = s.keySet().iterator(); it.hasNext(); ) { it.next(); it.remove(); ++sum; } timer.finish(); reallyAssert(sum == sz); checkSum += sum; } static void itHalfRemTest(Map s, int size) { int sz = s.size(); reallyAssert(sz == size); timer.start("Remove Present ", size); int sum = 0; for (Iterator it = s.keySet().iterator(); it.hasNext(); ) { it.next(); it.remove(); if (it.hasNext()) it.next(); ++sum; } timer.finish(); reallyAssert(sum == sz / 2); checkSum += sum; } static void putAllTest(String nm, int n, Map src, Map dst) { timer.start(nm, n); dst.putAll(src); timer.finish(); reallyAssert(src.size() == dst.size()); } static void serTest(Map s, int size) throws Exception { if (!(s instanceof Serializable)) return; System.out.print("Serialize : "); for (int i = 0; i < size; i++) { s.put(new Integer(i), Boolean.TRUE); } long startTime = System.currentTimeMillis(); FileOutputStream fs = new FileOutputStream("MapCheck.dat"); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(fs)); out.writeObject(s); out.close(); FileInputStream is = new FileInputStream("MapCheck.dat"); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(is)); Map m = (Map) in.readObject(); long endTime = System.currentTimeMillis(); long time = endTime - startTime; System.out.print(time + "ms"); if (s instanceof IdentityHashMap) return; reallyAssert(s.equals(m)); } static void mainTest(Map s, Object[] key, Object[] absent) { int size = key.length; putTest("Add Absent ", size, s, key, size); reallyAssert(s.size() == size); getTest("Access Present ", size, s, key, size); getTest("Search Absent ", size, s, absent, 0); kitTest(s, size); vitTest(s, size); eitTest(s, size); putTest("Modify Present ", size, s, key, 0); reallyAssert(s.size() == size); untimedKeyTest("Access Present ", size, s, key, size); keyTest("Search Absent ", size, s, absent, 0); valTest(s, key); remTest("Search Absent ", size, s, absent, 0); reallyAssert(s.size() == size); remHalfTest("Remove Present ", size, s, key, size / 2); reallyAssert(s.size() == size / 2); getTest("Access Present ", size, s, key, size / 2); putTest("Add Absent ", size, s, key, size / 2); reallyAssert(s.size() == size); getTest("Access Present ", size, s, key, size); getTest("Search Absent ", size, s, absent, 0); itRemTest(s, size); putTest("Add Absent ", size, s, key, size); reallyAssert(s.size() == size); getTest("Access Present ", size, s, key, size); untimedKeyTest("Access Present ", size, s, key, size); kitTest(s, size); vitTest(s, size); eitTest(s, size); twoMapTest1(s, key, absent); twoMapTest2(s, key, absent); } static void twoMapTest1(Map s, Object[] key, Object[] absent) { int size = s.size(); Map s2 = newMap(); putAllTest("Add Absent ", size, s, s2); getTest("Access Present ", size, s2, key, size); itHalfRemTest(s2, size); reallyAssert(s2.size() == size / 2); itHalfRemTest(s2, size / 2); reallyAssert(s2.size() == size / 4); putTest("Add Absent ", size, s2, absent, size); putTest("Add Absent ", size, s2, key, size * 3 / 4); reallyAssert(s2.size() == size * 2); clrTest(size, s2); } static void twoMapTest2(Map s, Object[] key, Object[] absent) { int size = key.length; Map s2 = newMap(); putAllTest("Add Absent ", size, s, s2); putAllTest("Modify Present ", size, s, s2); Object lastkey = kitTest(s2, size); Object hold = s2.get(lastkey); int sum = 0; timer.start("Traverse entry ", size * 12); // 12 until finish int sh1 = s.hashCode() - s2.hashCode(); reallyAssert(sh1 == 0); boolean eq1 = s2.equals(s); boolean eq2 = s.equals(s2); reallyAssert(eq1 && eq2); Set es2 = s2.entrySet(); for (Iterator it = s.entrySet().iterator(); it.hasNext(); ) { Object entry = it.next(); if (es2.contains(entry)) ++sum; } reallyAssert(sum == size); s2.put(lastkey, MISSING); int sh2 = s.hashCode() - s2.hashCode(); reallyAssert(sh2 != 0); eq1 = s2.equals(s); eq2 = s.equals(s2); reallyAssert(!eq1 && !eq2); sum = 0; for (Iterator it = s.entrySet().iterator(); it.hasNext(); ) { Map.Entry e = (Map.Entry)it.next(); e.setValue(absent[sum++]); } reallyAssert(sum == size); for (Iterator it = s2.entrySet().iterator(); it.hasNext(); ) { Map.Entry e = (Map.Entry)it.next(); e.setValue(s.get(e.getKey())); } timer.finish(); int rmiss = 0; timer.start("Remove Present ", size * 2); Iterator s2i = s2.entrySet().iterator(); Set es = s.entrySet(); while (s2i.hasNext()) { if (!es.remove(s2i.next())) ++rmiss; } timer.finish(); reallyAssert(rmiss == 0); clrTest(size, s2); reallyAssert(s2.isEmpty() && s.isEmpty()); } static void itTest4(Map s, int size, int pos) { IdentityHashMap seen = new IdentityHashMap(size); reallyAssert(s.size() == size); int sum = 0; timer.start("Iter XEntry ", size); Iterator it = s.entrySet().iterator(); Object k = null; Object v = null; for (int i = 0; i < size-pos; ++i) { Map.Entry x = (Map.Entry)(it.next()); k = x.getKey(); v = x.getValue(); seen.put(k, k); if (x != MISSING) ++sum; } reallyAssert(s.containsKey(k)); it.remove(); reallyAssert(!s.containsKey(k)); while (it.hasNext()) { Map.Entry x = (Map.Entry)(it.next()); Object k2 = x.getKey(); seen.put(k2, k2); if (x != MISSING) ++sum; } reallyAssert(s.size() == size-1); s.put(k, v); reallyAssert(seen.size() == size); timer.finish(); reallyAssert(sum == size); reallyAssert(s.size() == size); } static void initializeKeys(Object[] key, Object[] absent, int size) { if (eclass == Object.class) { for (int i = 0; i < size; ++i) key[i] = new Object(); for (int i = 0; i < size; ++i) absent[i] = new Object(); } else if (eclass == Integer.class) { initInts(key, absent, size); } else if (eclass == Float.class) { initFloats(key, absent, size); } else if (eclass == Double.class) { initDoubles(key, absent, size); } else if (eclass == String.class) { initWords(size, key, absent); } else throw new Error("unknown type"); } static void initInts(Object[] key, Object[] absent, int size) { for (int i = 0; i < size; ++i) key[i] = Integer.valueOf(i); Map m = newMap(); int k = 0; while (k < size) { int r = srng.next(); if (r < 0 || r >= size) { Integer ir = Integer.valueOf(r); if (m.put(ir, ir) == null) absent[k++] = ir; } } } static void initFloats(Object[] key, Object[] absent, int size) { Map m = newMap(); for (int i = 0; i < size; ++i) { float r = Float.valueOf(i); key[i] = r; m.put(r, r); } int k = 0; while (k < size) { float r = rng.nextFloat(); Float ir = Float.valueOf(r); if (m.put(ir, ir) == null) absent[k++] = ir; } } static void initDoubles(Object[] key, Object[] absent, int size) { Map m = newMap(); for (int i = 0; i < size; ++i) { double r = Double.valueOf(i); key[i] = r; m.put(r, r); } int k = 0; while (k < size) { double r = rng.nextDouble(); Double ir = Double.valueOf(r); if (m.put(ir, ir) == null) absent[k++] = ir; } } // Use as many real words as possible, then use fake random words static void initWords(int size, Object[] key, Object[] abs) { String fileName = "testwords.txt"; int ki = 0; int ai = 0; try { FileInputStream fr = new FileInputStream(fileName); BufferedInputStream in = new BufferedInputStream(fr); while (ki < size || ai < size) { StringBuffer sb = new StringBuffer(); for (;;) { int c = in.read(); if (c < 0) { if (ki < size) randomWords(key, ki, size); if (ai < size) randomWords(abs, ai, size); in.close(); return; } if (c == '\n') { String s = sb.toString(); if (ki < size) key[ki++] = s; else abs[ai++] = s; break; } sb.append((char) c); } } in.close(); } catch (IOException ex) { System.out.println("Can't read words file:" + ex); throw new Error(ex); } } static void randomWords(Object[] ws, int origin, int size) { for (int i = origin; i < size; ++i) { int k = 0; int len = 2 + (srng.next() & 0xf); char[] c = new char[len * 4 + 1]; for (int j = 1; j < len; ++j) { int r = srng.next(); c[k++] = (char) (' ' + (r & 0x7f)); r >>>= 8; c[k++] = (char) (' ' + (r & 0x7f)); r >>>= 8; c[k++] = (char) (' ' + (r & 0x7f)); r >>>= 8; c[k++] = (char) (' ' + (r & 0x7f)); } c[k++] = (char) ((i & 31) | 1); // never == to any testword ws[i] = new String(c); } } static final class TestTimer { private String name; private long numOps; private long startTime; static final java.util.TreeMap accum = new java.util.TreeMap(); static void printStats() { for (Iterator it = accum.entrySet().iterator(); it.hasNext(); ) { Map.Entry e = (Map.Entry) it.next(); Stats stats = (Stats) e.getValue(); System.out.print(e.getKey() + ": "); long s; long n = stats.number; if (n == 0) { n = stats.firstn; s = stats.first; } else s = stats.sum; double t = ((double) s) / n; long nano = Math.round(t); System.out.printf("%6d", + nano); System.out.println(); } } void start(String name, long numOps) { this.name = name; this.numOps = numOps; startTime = System.nanoTime(); } void finish() { long elapsed = System.nanoTime() - startTime; Object st = accum.get(name); if (st == null) accum.put(name, new Stats(elapsed, numOps)); else ((Stats) st).addTime(elapsed, numOps); } } static final class Stats { long sum; long number; long first; long firstn; Stats(long t, long n) { first = t; firstn = n; } void addTime(long t, long n) { sum += t; number += n; } } static void shuffle(Object[] keys) { int size = keys.length; for (int i= size; i>1; i--) { int r = rng.nextInt(i); Object t = keys[i-1]; keys[i-1] = keys[r]; keys[r] = t; } } static void shuffle(ArrayList keys) { int size = keys.size(); for (int i= size; i>1; i--) { int r = rng.nextInt(i); Object t = keys.get(i-1); keys.set(i-1, keys.get(r)); keys.set(r, t); } } } jsr166/src/test/loops/LoopHelpers.java0000644000000000000000000001221011537741071015002 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Misc utilities in JSR166 performance tests */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; class LoopHelpers { static final SimpleRandom staticRNG = new SimpleRandom(); // Some mindless computation to do between synchronizations... /** * generates 32 bit pseudo-random numbers. * Adapted from http://www.snippets.org */ public static int compute1(int x) { int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } return lo; } /** * Computes a linear congruential random number a random number * of times. */ public static int compute2(int x) { int loops = (x >>> 4) & 7; while (loops-- > 0) { x = (x * 2147483647) % 16807; } return x; } /** * Yet another random number generator */ public static int compute3(int x) { int t = (x % 127773) * 16807 - (x / 127773) * 2836; return (t > 0) ? t : t + 0x7fffffff; } /** * Yet another random number generator */ public static int compute4(int x) { return x * 134775813 + 1; } /** * Yet another random number generator */ public static int compute5(int x) { return 36969 * (x & 65535) + (x >> 16); } /** * Marsaglia xorshift (1, 3, 10) */ public static int compute6(int seed) { seed ^= seed << 1; seed ^= seed >>> 3; seed ^= (seed << 10); return seed; } /** * Marsaglia xorshift (6, 21, 7) */ public static int compute7(int y) { y ^= y << 6; y ^= y >>> 21; y ^= (y << 7); return y; } // FNV: (x ^ 0x811c9dc5) * 0x01000193; 15485863; /** * Marsaglia xorshift for longs */ public static long compute8(long x) { x ^= x << 13; x ^= x >>> 7; x ^= (x << 17); return x; } public static final class XorShift32Random { static final AtomicInteger seq = new AtomicInteger(8862213); int x = -1831433054; public XorShift32Random(int seed) { x = seed; } public XorShift32Random() { this((int) System.nanoTime() + seq.getAndAdd(129)); } public int next() { x ^= x << 6; x ^= x >>> 21; x ^= (x << 7); return x; } } /** Multiplication-free RNG from Marsaglia "Xorshift RNGs" paper */ public static final class MarsagliaRandom { static final AtomicInteger seq = new AtomicInteger(3122688); int x; int y = 842502087; int z = -715159705; int w = 273326509; public MarsagliaRandom(int seed) { x = seed; } public MarsagliaRandom() { this((int) System.nanoTime() + seq.getAndAdd(129)); } public int next() { int t = x ^ (x << 11); x = y; y = z; z = w; return w = (w ^ (w >>> 19) ^ (t ^ (t >>> 8))); } } /** * Unsynchronized version of java.util.Random algorithm. */ public static final class SimpleRandom { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong( -715159705); private long seed; SimpleRandom(long s) { seed = s; } SimpleRandom() { seed = System.nanoTime() + seq.getAndAdd(129); } public void setSeed(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int) (nextseed >>> 17)) & 0x7FFFFFFF; } } public static class BarrierTimer implements Runnable { volatile boolean started; volatile long startTime; volatile long endTime; public void run() { long t = System.nanoTime(); if (!started) { started = true; startTime = t; } else endTime = t; } public void clear() { started = false; } public long getTime() { return endTime - startTime; } } public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; String num = Long.toString(n); if (num.length() >= field.length()) return num; StringBuffer b = new StringBuffer(field); b.replace(b.length()-num.length(), b.length(), num); return b.toString(); } } jsr166/src/test/loops/StringMapLoops.java0000644000000000000000000001446111537741072015502 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; public class StringMapLoops { static int nkeys = 75000; static int pinsert = 60; static int premove = 2; static int maxThreads = 100; static int nops = 8000000; static int removesPerMaxRandom; static int insertsPerMaxRandom; static final ExecutorService pool = Executors.newCachedThreadPool(); public static void main(String[] args) throws Exception { Class mapClass = null; if (args.length > 0) { try { mapClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } else mapClass = java.util.concurrent.ConcurrentHashMap.class; if (args.length > 1) maxThreads = Integer.parseInt(args[1]); if (args.length > 2) nkeys = Integer.parseInt(args[2]); if (args.length > 3) pinsert = Integer.parseInt(args[3]); if (args.length > 4) premove = Integer.parseInt(args[4]); if (args.length > 5) nops = Integer.parseInt(args[5]); // normalize probabilities wrt random number generator removesPerMaxRandom = (int)(((double)premove/100.0 * 0x7FFFFFFFL)); insertsPerMaxRandom = (int)(((double)pinsert/100.0 * 0x7FFFFFFFL)); System.out.print("Class: " + mapClass.getName()); System.out.print(" threads: " + maxThreads); System.out.print(" size: " + nkeys); System.out.print(" ins: " + pinsert); System.out.print(" rem: " + premove); System.out.print(" ops: " + nops); System.out.println(); String[] key = makeKeys(nkeys); int k = 1; int warmups = 2; for (int i = 1; i <= maxThreads;) { Thread.sleep(100); test(i, nkeys, key, mapClass); shuffleKeys(key); if (warmups > 0) --warmups; else if (i == k) { k = i << 1; i = i + (i >>> 1); } else if (i == 1 && k == 2) { i = k; warmups = 1; } else i = k; } for (int j = 0; j < 10; ++j) { Thread.sleep(100); test(1, nkeys, key, mapClass); // shuffleKeys(key); } pool.shutdown(); } static String[] makeKeys(int n) { LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); String[] key = new String[n]; for (int i = 0; i < key.length; ++i) { int k = 0; int len = 1 + (rng.next() & 0xf); char[] c = new char[len * 4]; for (int j = 0; j < len; ++j) { int r = rng.next(); c[k++] = (char) (' ' + (r & 0x7f)); r >>>= 8; c[k++] = (char) (' ' + (r & 0x7f)); r >>>= 8; c[k++] = (char) (' ' + (r & 0x7f)); r >>>= 8; c[k++] = (char) (' ' + (r & 0x7f)); } key[i] = new String(c); } return key; } static void shuffleKeys(String[] key) { Random rng = new Random(); for (int i = key.length; i > 1; --i) { int j = rng.nextInt(i); String tmp = key[j]; key[j] = key[i-1]; key[i-1] = tmp; } } static void test(int i, int nkeys, String[] key, Class mapClass) throws Exception { System.out.print("Threads: " + i + "\t:"); Map map = (Map)mapClass.newInstance(); // Uncomment to start with a non-empty table // for (int j = 0; j < nkeys; j += 4) // start 1/4 occupied // map.put(key[j], key[j]); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(i+1, timer); for (int t = 0; t < i; ++t) pool.execute(new Runner(t, map, key, barrier)); barrier.await(); barrier.await(); long time = timer.getTime(); long tpo = time / (i * (long) nops); System.out.print(LoopHelpers.rightJustify(tpo) + " ns per op"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); map.clear(); } static class Runner implements Runnable { final Map map; final String[] key; final LoopHelpers.SimpleRandom rng; final CyclicBarrier barrier; int position; int total; Runner(int id, Map map, String[] key, CyclicBarrier barrier) { this.map = map; this.key = key; this.barrier = barrier; position = key.length / 2; rng = new LoopHelpers.SimpleRandom((id + 1) * 8862213513L); rng.next(); } int step() { // random-walk around key positions, bunching accesses int r = rng.next(); position += (r & 7) - 3; while (position >= key.length) position -= key.length; while (position < 0) position += key.length; String k = key[position]; String x = map.get(k); if (x != null) { if (r < removesPerMaxRandom) { if (map.remove(k) != null) { position = total % key.length; // move from position return 2; } } } else if (r < insertsPerMaxRandom) { ++position; map.put(k, k); return 2; } total += r; return 1; } public void run() { try { barrier.await(); int ops = nops; while (ops > 0) ops -= step(); barrier.await(); } catch (Exception ex) { ex.printStackTrace(); } } } } jsr166/src/test/loops/ConcurrentHashSet.java0000644000000000000000000000432111537741071016154 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ // A set wrapper over CHM for testing import java.util.*; import java.util.concurrent.*; import java.io.*; public class ConcurrentHashSet extends AbstractSet implements Set, Serializable { private final ConcurrentHashMap m; // The backing map private transient Set keySet; // Its keySet public ConcurrentHashSet() { m = new ConcurrentHashMap(); keySet = m.keySet(); } public ConcurrentHashSet(int initialCapacity) { m = new ConcurrentHashMap(initialCapacity); keySet = m.keySet(); } public ConcurrentHashSet(int initialCapacity, float loadFactor, int concurrencyLevel) { m = new ConcurrentHashMap(initialCapacity, loadFactor, concurrencyLevel); keySet = m.keySet(); } public int size() { return m.size(); } public boolean isEmpty() { return m.isEmpty(); } public boolean contains(Object o) { return m.containsKey(o); } public Iterator iterator() { return keySet.iterator(); } public Object[] toArray() { return keySet.toArray(); } public T[] toArray(T[] a) { return keySet.toArray(a); } public boolean add(E e) { return m.put(e, Boolean.TRUE) == null; } public boolean remove(Object o) { return m.remove(o) != null; } public boolean removeAll(Collection c) { return keySet.removeAll(c); } public boolean retainAll(Collection c) { return keySet.retainAll(c); } public void clear() { m.clear(); } public boolean equals(Object o) { return keySet.equals(o); } public int hashCode() { return keySet.hashCode(); } private static final long serialVersionUID = 2454657854757543876L; private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); keySet = m.keySet(); } } jsr166/src/test/loops/SingleProducerMultipleConsumerLoops.java0000644000000000000000000001606611551700072021745 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; //import jsr166y.*; public class SingleProducerMultipleConsumerLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); // Number of puts by producers or takes by consumers static final int ITERS = 1 << 20; static final ExecutorService pool = Executors.newCachedThreadPool(); static boolean print = false; // Number of elements passed around -- must be power of two // Elements are reused from pool to minimize alloc impact static final int POOL_SIZE = 1 << 8; static final int POOL_MASK = POOL_SIZE-1; static final Integer[] intPool = new Integer[POOL_SIZE]; static { for (int i = 0; i < POOL_SIZE; ++i) intPool[i] = Integer.valueOf(i); } public static void main(String[] args) throws Exception { int maxn = 12; if (args.length > 0) maxn = Integer.parseInt(args[0]); print = false; warmup(); print = true; int k = 1; for (int i = 1; i <= maxn;) { System.out.println("Consumers:" + i); oneTest(i, ITERS); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static void warmup() throws Exception { print = false; System.out.print("Warmup "); int it = 2000; for (int j = 5; j > 0; --j) { oneTest(j, it); System.out.print("."); it += 1000; } System.gc(); it = 20000; for (int j = 5; j > 0; --j) { oneTest(j, it); System.out.print("."); it += 10000; } System.gc(); System.out.println(); } static void oneTest(int n, int iters) throws Exception { int fairIters = iters/16; Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue "); oneRun(new LinkedTransferQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingQueue(cap)"); oneRun(new LinkedBlockingQueue(POOL_SIZE), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingDeque "); oneRun(new LinkedBlockingDeque(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("ArrayBlockingQueue "); oneRun(new ArrayBlockingQueue(POOL_SIZE), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("SynchronousQueue "); oneRun(new SynchronousQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("SynchronousQueue(fair) "); oneRun(new SynchronousQueue(true), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue(xfer)"); oneRun(new LTQasSQ(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue(half)"); oneRun(new HalfSyncLTQ(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("PriorityBlockingQueue "); oneRun(new PriorityBlockingQueue(), n, fairIters); Thread.sleep(100); // System.gc(); if (print) System.out.print("ArrayBlockingQueue(fair)"); oneRun(new ArrayBlockingQueue(POOL_SIZE, true), n, fairIters); } abstract static class Stage implements Runnable { final int iters; final BlockingQueue queue; final CyclicBarrier barrier; volatile int result; Stage(BlockingQueue q, CyclicBarrier b, int iters) { queue = q; barrier = b; this.iters = iters; } } static class Producer extends Stage { Producer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public void run() { try { barrier.await(); int r = hashCode(); for (int i = 0; i < iters; ++i) { r = LoopHelpers.compute7(r); Integer v = intPool[r & POOL_MASK]; queue.put(v); } barrier.await(); result = 432; } catch (Exception ie) { ie.printStackTrace(); return; } } } static class Consumer extends Stage { Consumer(BlockingQueue q, CyclicBarrier b, int iters) { super(q, b, iters); } public void run() { try { barrier.await(); int l = 0; int s = 0; for (int i = 0; i < iters; ++i) { Integer item = queue.take(); s += item.intValue(); } barrier.await(); result = s; if (s == 0) System.out.print(" "); } catch (Exception ie) { ie.printStackTrace(); return; } } } static void oneRun(BlockingQueue q, int nconsumers, int iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(nconsumers + 2, timer); pool.execute(new Producer(q, barrier, iters * nconsumers)); for (int i = 0; i < nconsumers; ++i) { pool.execute(new Consumer(q, barrier, iters)); } barrier.await(); barrier.await(); long time = timer.getTime(); if (print) System.out.println("\t: " + LoopHelpers.rightJustify(time / (iters * nconsumers)) + " ns per transfer"); } static final class LTQasSQ extends LinkedTransferQueue { LTQasSQ() { super(); } public void put(T x) { try { super.transfer(x); } catch (InterruptedException ex) { throw new Error(); } } } static final class HalfSyncLTQ extends LinkedTransferQueue { int calls; HalfSyncLTQ() { super(); } public void put(T x) { if ((++calls & 1) == 0) super.put(x); else { try { super.transfer(x); } catch (InterruptedException ex) { throw new Error(); } } } } } jsr166/src/test/loops/ProducerConsumerLoops.java0000644000000000000000000002007511537741071017072 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; //import jsr166y.*; public class ProducerConsumerLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final Random rng = new Random(); static final ExecutorService pool = Executors.newCachedThreadPool(); static boolean print = false; static int producerSum; static int consumerSum; static synchronized void addProducerSum(int x) { producerSum += x; } static synchronized void addConsumerSum(int x) { consumerSum += x; } static synchronized void checkSum() { if (producerSum != consumerSum) throw new Error("CheckSum mismatch"); } // Number of elements passed around -- must be power of two // Elements are reused from pool to minimize alloc impact static final int POOL_SIZE = 1 << 7; static final int POOL_MASK = POOL_SIZE-1; static final Integer[] intPool = new Integer[POOL_SIZE]; static { for (int i = 0; i < POOL_SIZE; ++i) intPool[i] = Integer.valueOf(i); } // Number of puts by producers or takes by consumers static final int ITERS = 1 << 20; // max lag between a producer and consumer to avoid // this becoming a GC test rather than queue test. // Used only per-pair to lessen impact on queue sync static final int LAG_MASK = (1 << 12) - 1; public static void main(String[] args) throws Exception { int maxPairs = NCPUS * 3 / 2; if (args.length > 0) maxPairs = Integer.parseInt(args[0]); warmup(); print = true; int k = 1; for (int i = 1; i <= maxPairs;) { System.out.println("Pairs:" + i); oneTest(i, ITERS); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static void warmup() throws Exception { print = false; System.out.print("Warmup "); int it = 2000; for (int j = 5; j > 0; --j) { oneTest(j, it); System.out.print("."); it += 1000; } System.gc(); it = 20000; for (int j = 5; j > 0; --j) { oneTest(j, it); System.out.print("."); it += 10000; } System.gc(); System.out.println(); } static void oneTest(int n, int iters) throws Exception { int fairIters = iters/16; Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue "); oneRun(new LinkedTransferQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingQueue(cap)"); oneRun(new LinkedBlockingQueue(POOL_SIZE), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedBlockingDeque "); oneRun(new LinkedBlockingDeque(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("ArrayBlockingQueue "); oneRun(new ArrayBlockingQueue(POOL_SIZE), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("SynchronousQueue "); oneRun(new SynchronousQueue(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("SynchronousQueue(fair) "); oneRun(new SynchronousQueue(true), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue(xfer)"); oneRun(new LTQasSQ(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("LinkedTransferQueue(half)"); oneRun(new HalfSyncLTQ(), n, iters); Thread.sleep(100); // System.gc(); if (print) System.out.print("PriorityBlockingQueue "); oneRun(new PriorityBlockingQueue(), n, fairIters); Thread.sleep(100); // System.gc(); if (print) System.out.print("ArrayBlockingQueue(fair)"); oneRun(new ArrayBlockingQueue(POOL_SIZE, true), n, fairIters); } abstract static class Stage implements Runnable { final int iters; final BlockingQueue queue; final CyclicBarrier barrier; final Phaser lagPhaser; Stage(BlockingQueue q, CyclicBarrier b, Phaser s, int iters) { queue = q; barrier = b; lagPhaser = s; this.iters = iters; } } static class Producer extends Stage { Producer(BlockingQueue q, CyclicBarrier b, Phaser s, int iters) { super(q, b, s, iters); } public void run() { try { barrier.await(); int ps = 0; int r = hashCode(); for (int i = 0; i < iters; ++i) { r = LoopHelpers.compute7(r); Integer v = intPool[r & POOL_MASK]; int k = v.intValue(); queue.put(v); ps += k; if ((i & LAG_MASK) == LAG_MASK) lagPhaser.arriveAndAwaitAdvance(); } addProducerSum(ps); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static class Consumer extends Stage { Consumer(BlockingQueue q, CyclicBarrier b, Phaser s, int iters) { super(q, b, s, iters); } public void run() { try { barrier.await(); int cs = 0; for (int i = 0; i < iters; ++i) { Integer v = queue.take(); int k = v.intValue(); cs += k; if ((i & LAG_MASK) == LAG_MASK) lagPhaser.arriveAndAwaitAdvance(); } addConsumerSum(cs); barrier.await(); } catch (Exception ie) { ie.printStackTrace(); return; } } } static void oneRun(BlockingQueue q, int n, int iters) throws Exception { LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(n * 2 + 1, timer); for (int i = 0; i < n; ++i) { Phaser s = new Phaser(2); pool.execute(new Producer(q, barrier, s, iters)); pool.execute(new Consumer(q, barrier, s, iters)); } barrier.await(); barrier.await(); long time = timer.getTime(); checkSum(); if (print) System.out.println("\t: " + LoopHelpers.rightJustify(time / (iters * n)) + " ns per transfer"); } static final class LTQasSQ extends LinkedTransferQueue { LTQasSQ() { super(); } public void put(T x) { try { super.transfer(x); } catch (InterruptedException ex) { throw new Error(); } } } static final class HalfSyncLTQ extends LinkedTransferQueue { int calls; HalfSyncLTQ() { super(); } public void put(T x) { if ((++calls & 1) == 0) super.put(x); else { try { super.transfer(x); } catch (InterruptedException ex) { throw new Error(); } } } } } jsr166/src/test/loops/CyclicAction.java0000644000000000000000000000633511537741071015125 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.*; /** * A computation that is broken into a series of task executions, each * separated by a Phaser arrival. Concrete subclasses must * define method compute, that performs the action occurring * at each step of the barrier. Upon invocation of this task, the * compute method is repeatedly invoked until the barrier * isTerminated or until its execution throws an exception. * *

Sample Usage. Here is a sketch of a set of CyclicActions * that each perform 500 iterations of an imagined image smoothing * operation. Note that the aggregate ImageSmoother task itself is not * a CyclicTask. * *

 * class ImageSmoother extends RecursiveAction {
 *   protected void compute() {
 *     Phaser b = new Phaser() {
 *       protected boolean onAdvance(int cycle, int registeredParties) {
 *          return registeredParties <= 0 || cycle >= 500;
 *       }
 *     }
 *     int n = pool.getParallelismLevel();
 *     CyclicAction[] actions = new CyclicAction[n];
 *     for (int i = 0; i < n; ++i) {
 *       action[i] = new CyclicAction(b) {
 *         protected void compute() {
 *           smoothImagePart(i);
 *         }
 *       }
 *     }
 *     invokeAll(actions);
 *   }
 * }
 * 
*/ public abstract class CyclicAction extends ForkJoinTask { final Phaser barrier; boolean deregistered; int lastArrived; /** * Constructs a new CyclicAction using the supplied barrier, * registering for this barrier upon construction. * @param barrier the barrier */ public CyclicAction(Phaser barrier) { this.barrier = barrier; lastArrived = barrier.register() - 1; } /** * The computation performed by this task on each cycle of the * barrier. While you must define this method, you should not in * general call it directly. */ protected abstract void step(); /** * Returns the barrier */ public final Phaser getBarrier() { return barrier; } /** * Returns the current cycle of the barrier */ public final int getCycle() { return barrier.getPhase(); } public final Void getRawResult() { return null; } protected final void setRawResult(Void mustBeNull) { } private void deregister() { if (!deregistered) { deregistered = true; barrier.arriveAndDeregister(); } } protected final boolean exec() { Phaser b = barrier; if (!isDone()) { b.awaitAdvance(lastArrived); if (b.getPhase() >= 0) { try { step(); } catch (Throwable rex) { deregister(); completeExceptionally(rex); return false; } if ((lastArrived = b.arrive()) >= 0) { this.fork(); return false; } } } deregister(); return true; } } jsr166/src/test/loops/IntMapCheck.java0000644000000000000000000004634611537741071014715 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * @test * @synopsis Times and checks basic map operations */ import java.util.*; import java.io.*; public class IntMapCheck { static int absentSize; static int absentMask; static Integer[] absent; static final Integer MISSING = new Integer(Integer.MIN_VALUE); static TestTimer timer = new TestTimer(); static void reallyAssert(boolean b) { if (!b) throw new Error("Failed Assertion"); } public static void main(String[] args) throws Exception { Class mapClass = java.util.concurrent.ConcurrentHashMap.class; int numTests = 50; int size = 75000; if (args.length > 0) { try { mapClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } if (args.length > 1) numTests = Integer.parseInt(args[1]); if (args.length > 2) size = Integer.parseInt(args[2]); boolean doSerializeTest = args.length > 3; System.out.println("Testing " + mapClass.getName() + " trials: " + numTests + " size: " + size); absentSize = 4; while (absentSize < size) absentSize <<= 1; absentMask = absentSize-1; absent = new Integer[absentSize]; for (int i = 0; i < absentSize/2; ++i) absent[i] = Integer.valueOf(-i - 1); for (int i = absentSize/2; i < absentSize; ++i) absent[i] = Integer.valueOf(size + i + 1); Integer[] key = new Integer[size]; for (int i = 0; i < size; ++i) key[i] = Integer.valueOf(i); for (int rep = 0; rep < numTests; ++rep) { runTest(newMap(mapClass), key); if ((rep & 3) == 3 && rep < numTests - 1) { shuffle(key); // Thread.sleep(50); } } TestTimer.printStats(); if (doSerializeTest) stest(newMap(mapClass), size); } static Map newMap(Class cl) { try { Map m = (Map)cl.newInstance(); return m; } catch (Exception e) { throw new RuntimeException("Can't instantiate " + cl + ": " + e); } } static void runTest(Map s, Integer[] key) { int size = key.length; long startTime = System.nanoTime(); test(s, key); long time = System.nanoTime() - startTime; } static void t1(String nm, int n, Map s, Integer[] key, int expect, int iters) { int sum = 0; timer.start(nm, n * iters); for (int j = 0; j < iters; ++j) { for (int i = 0; i < n; i++) { if (s.get(key[i]) != null) ++sum; } } timer.finish(); reallyAssert(sum == expect * iters); } static void t1Boxed(String nm, int n, Map s, Integer[] key, int expect) { int sum = 0; int iters = 8; timer.start(nm, n * iters); for (int j = 0; j < iters; ++j) { for (int i = 0; i < n; i++) { if (s.get(i) != i) ++sum; } } timer.finish(); reallyAssert(sum == expect * iters); } static void t2(String nm, int n, Map s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.remove(key[i]) != null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t3(String nm, int n, Map s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { Integer k = key[i]; Integer v = absent[i & absentMask]; if (s.put(k, v) == null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t4(String nm, int n, Map s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.containsKey(key[i])) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t5(String nm, int n, Map s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n/2); for (int i = n-2; i >= 0; i-=2) { if (s.remove(key[i]) != null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t6(String nm, int n, Map s, Integer[] k1, Integer[] k2) { int sum = 0; timer.start(nm, n * 2); for (int i = 0; i < n; i++) { if (s.get(k1[i]) != null) ++sum; if (s.get(k2[i & absentMask]) != null) ++sum; } timer.finish(); reallyAssert(sum == n); } static void t7(String nm, int n, Map s, Integer[] k1, Integer[] k2) { int sum = 0; timer.start(nm, n * 2); for (int i = 0; i < n; i++) { if (s.containsKey(k1[i])) ++sum; if (s.containsKey(k2[i & absentMask])) ++sum; } timer.finish(); reallyAssert(sum == n); } static void t8(String nm, int n, Map s, Integer[] key, int expect) { int sum = 0; timer.start(nm, n); for (int i = 0; i < n; i++) { if (s.get(key[i]) != null) ++sum; } timer.finish(); reallyAssert(sum == expect); } static void t9(Map s) { int sum = 0; int iters = 20; timer.start("ContainsValue (/n) ", iters * s.size()); int step = absentSize / iters; for (int i = 0; i < absentSize; i += step) if (s.containsValue(absent[i])) ++sum; timer.finish(); reallyAssert(sum != 0); } static void ktest(Map s, int size, Integer[] key) { timer.start("ContainsKey ", size); Set ks = s.keySet(); int sum = 0; for (int i = 0; i < size; i++) { if (ks.contains(key[i])) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest1(Map s, int size) { int sum = 0; timer.start("Iter Key ", size); for (Iterator it = s.keySet().iterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); // if (sum != size) // System.out.println("iters " + sum + " size " + size); reallyAssert(sum == size); } static void ittest2(Map s, int size) { int sum = 0; timer.start("Iter Value ", size); for (Iterator it = s.values().iterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); // if (sum != size) // System.out.println("iters " + sum + " size " + size); reallyAssert(sum == size); } static void ittest3(Map s, int size) { int sum = 0; timer.start("Iter Entry ", size); for (Iterator it = s.entrySet().iterator(); it.hasNext(); ) { if (it.next() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void ittest4(Map s, int size, int pos) { IdentityHashMap seen = new IdentityHashMap(size); reallyAssert(s.size() == size); int sum = 0; timer.start("Iter XEntry ", size); Iterator it = s.entrySet().iterator(); Integer k = null; Integer v = null; for (int i = 0; i < size-pos; ++i) { Map.Entry x = (Map.Entry)(it.next()); k = x.getKey(); v = x.getValue(); seen.put(k, k); if (v != MISSING) ++sum; } reallyAssert(s.containsKey(k)); it.remove(); reallyAssert(!s.containsKey(k)); while (it.hasNext()) { Map.Entry x = (Map.Entry)(it.next()); Integer k2 = x.getKey(); seen.put(k2, k2); if (k2 != MISSING) ++sum; } reallyAssert(s.size() == size-1); s.put(k, v); reallyAssert(seen.size() == size); timer.finish(); reallyAssert(sum == size); reallyAssert(s.size() == size); } static void ittest(Map s, int size) { for (int i = 0; i < 4; ++i) { ittest1(s, size); ittest2(s, size); ittest3(s, size); } // for (int i = 0; i < size-1; ++i) // ittest4(s, size, i); } static void entest1(Hashtable ht, int size) { int sum = 0; timer.start("Iter Enumeration Key ", size); for (Enumeration en = ht.keys(); en.hasMoreElements(); ) { if (en.nextElement() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void entest2(Hashtable ht, int size) { int sum = 0; timer.start("Iter Enumeration Value ", size); for (Enumeration en = ht.elements(); en.hasMoreElements(); ) { if (en.nextElement() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void entest3(Hashtable ht, int size) { int sum = 0; timer.start("Iterf Enumeration Key ", size); Enumeration en = ht.keys(); for (int i = 0; i < size; ++i) { if (en.nextElement() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void entest4(Hashtable ht, int size) { int sum = 0; timer.start("Iterf Enumeration Value", size); Enumeration en = ht.elements(); for (int i = 0; i < size; ++i) { if (en.nextElement() != MISSING) ++sum; } timer.finish(); reallyAssert(sum == size); } static void entest(Map s, int size) { if (s instanceof Hashtable) { Hashtable ht = (Hashtable) s; // entest3(ht, size); // entest4(ht, size); entest1(ht, size); entest2(ht, size); entest1(ht, size); entest2(ht, size); entest1(ht, size); entest2(ht, size); } } static void rtest(Map s, int size) { timer.start("Remove (iterator) ", size); for (Iterator it = s.keySet().iterator(); it.hasNext(); ) { it.next(); it.remove(); } reallyAssert(s.isEmpty()); timer.finish(); } static void stest(Map s, int size) throws Exception { if (!(s instanceof Serializable)) return; System.out.print("Serialize : "); for (int i = 0; i < size; i++) { s.put(Integer.valueOf(i), Integer.valueOf(1)); } long startTime = System.nanoTime(); FileOutputStream fs = new FileOutputStream("IntMapCheck.dat"); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(fs)); out.writeObject(s); out.close(); FileInputStream is = new FileInputStream("IntMapCheck.dat"); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(is)); Map m = (Map)in.readObject(); long endTime = System.nanoTime(); long time = endTime - startTime; System.out.print(time + "ms"); if (s instanceof IdentityHashMap) return; reallyAssert(s.equals(m)); } static void test(Map s, Integer[] key) { int size = key.length; t3("Put (absent) ", size, s, key, size); reallyAssert(s.size() == size); t1("Get (present) ", size, s, key, size, 8); t1Boxed("Get boxed (present) ", size, s, key, size); ittest1(s, size); t3("Put (present) ", size, s, key, 0); reallyAssert(s.size() == size); t7("ContainsKey ", size, s, key, absent); t4("ContainsKey ", size, s, key, size); ktest(s, size, key); t4("ContainsKey ", absentSize, s, absent, 0); t6("Get ", size, s, key, absent); t1("Get (present) ", size, s, key, size, 8); t1("Get (absent) ", absentSize, s, absent, 0, 1); reallyAssert(s.size() == size); t2("Remove (absent) ", absentSize, s, absent, 0); reallyAssert(s.size() == size); t5("Remove (present) ", size, s, key, size / 2); reallyAssert(s.size() == size / 2); t1("Get ", size, s, key, size / 2, 8); ittest1(s, size / 2); t3("Put (half present) ", size, s, key, size / 2); reallyAssert(s.size() == size); t1("Get (present) ", size, s, key, size, 4); entest(s, size); t9(s); reallyAssert(s.size() == size); timer.start("Clear ", size); s.clear(); timer.finish(); t1("Get (absent) ", size, s, key, 0, 1); t4("ContainsKey ", size, s, key, 0); t2("Remove (absent) ", size, s, key, 0); t3("Put (presized) ", size, s, key, size); t1("Get (present) ", size, s, key, size, 4); reallyAssert(s.size() == size); ittest(s, size); rtest(s, size); reallyAssert(s.size() == 0); timer.start("Clear ", size); s.clear(); timer.finish(); t3("Put (presized) ", size, s, key, size); timer.start("Put (putAll) ", size * 2); Map s2 = null; try { s2 = (Map) (s.getClass().newInstance()); s2.putAll(s); } catch (Exception e) { e.printStackTrace(); return; } timer.finish(); timer.start("Iter Equals ", size * 2); boolean eqt = s2.equals(s) && s.equals(s2); reallyAssert(eqt); timer.finish(); timer.start("Iter HashCode ", size * 2); int shc = s.hashCode(); int s2hc = s2.hashCode(); reallyAssert(shc == s2hc); timer.finish(); timer.start("Put (present) ", size * 2); s2.putAll(s); timer.finish(); timer.start("Put (present) ", size); int ipsum = 0; for (Iterator i0 = s.entrySet().iterator(); i0.hasNext(); ) { Map.Entry me = (Map.Entry)(i0.next()); if (s2.put(me.getKey(), me.getValue()) != null) ++ipsum; } reallyAssert(ipsum == s.size()); timer.finish(); timer.start("Iter EntrySet contains ", size * 2); Set es2 = s2.entrySet(); int sum = 0; for (Iterator i1 = s.entrySet().iterator(); i1.hasNext(); ) { Object entry = i1.next(); if (es2.contains(entry)) ++sum; } timer.finish(); reallyAssert(sum == size); Integer hold = s2.get(key[size-1]); s2.put(key[size-1], absent[0]); timer.start("Iter Equals ", size * 2); eqt = s2.equals(s) && s.equals(s2); reallyAssert(!eqt); timer.finish(); timer.start("Iter HashCode ", size * 2); int s1h = s.hashCode(); int s2h = s2.hashCode(); reallyAssert(s1h != s2h); timer.finish(); s2.put(key[size-1], hold); timer.start("Remove (present) ", size * 2); Iterator s2i = s2.entrySet().iterator(); Set es = s.entrySet(); while (s2i.hasNext()) reallyAssert(es.remove(s2i.next())); timer.finish(); reallyAssert(s.isEmpty()); timer.start("Clear ", size); s2.clear(); timer.finish(); reallyAssert(s2.isEmpty() && s.isEmpty()); } static class TestTimer { private String name; private long numOps; private long startTime; private String cname; static final java.util.TreeMap accum = new java.util.TreeMap(); static void printStats() { for (Iterator it = accum.entrySet().iterator(); it.hasNext(); ) { Map.Entry e = (Map.Entry)(it.next()); Stats stats = ((Stats) (e.getValue())); long n = stats.number; double t; if (n > 0) t = stats.sum / n; else t = stats.least; long nano = Math.round(t); System.out.println(e.getKey() + ": " + nano); } } void start(String name, long numOps) { this.name = name; this.cname = classify(); this.numOps = numOps; startTime = System.nanoTime(); } String classify() { if (name.startsWith("Get")) return "Get "; else if (name.startsWith("Put")) return "Put "; else if (name.startsWith("Remove")) return "Remove "; else if (name.startsWith("Iter")) return "Iter "; else return null; } void finish() { long endTime = System.nanoTime(); long time = endTime - startTime; double timePerOp = ((double) time)/numOps; Object st = accum.get(name); if (st == null) accum.put(name, new Stats(timePerOp)); else { Stats stats = (Stats) st; stats.sum += timePerOp; stats.number++; if (timePerOp < stats.least) stats.least = timePerOp; } if (cname != null) { st = accum.get(cname); if (st == null) accum.put(cname, new Stats(timePerOp)); else { Stats stats = (Stats) st; stats.sum += timePerOp; stats.number++; if (timePerOp < stats.least) stats.least = timePerOp; } } } } static class Stats { double sum = 0; double least; long number = 0; Stats(double t) { least = t; } } static Random rng = new Random(3152688); static void shuffle(Integer[] keys) { int size = keys.length; for (int i=size; i>1; i--) { int r = rng.nextInt(i); Integer t = keys[i-1]; keys[i-1] = keys[r]; keys[r] = t; } } } jsr166/src/test/loops/SimpleWriteLockLoops.java0000644000000000000000000000646711537741072016662 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class SimpleWriteLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 10000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; int reps = 2; for (int i = 1; i <= maxThreads; i += (i+1) >>> 1) { int n = reps; if (reps > 1) --reps; while (n-- > 0) { System.out.print("Threads: " + i); new WriteLockLoop(i).test(); Thread.sleep(100); } } pool.shutdown(); } static final class WriteLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private volatile int readBarrier; private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; WriteLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { final Lock lock = this.lock.writeLock(); try { barrier.await(); int sum = v + 1; int x = 0; int n = iters; while (n-- > 0) { lock.lock(); int k = (sum & 3); if (k > 0) { x = v; while (k-- > 0) x = LoopHelpers.compute6(x); v = x; } else x = sum + 1; lock.unlock(); if ((x += readBarrier) == 0) ++readBarrier; for (int l = x & 7; l > 0; --l) sum += LoopHelpers.compute6(sum); } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/CancelledFutureLoops.java0000644000000000000000000000707611537741071016646 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * @test * @summary Checks for responsiveness of futures to cancellation. * Runs under * the assumption that ITERS computations require more than TIMEOUT * msecs to complete. */ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain. Use, modify, and * redistribute this code in any way without acknowledgement. */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class CancelledFutureLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static final int ITERS = 10000000; static final long TIMEOUT = 100; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; for (int i = 2; i <= maxThreads; i += (i+1) >>> 1) { System.out.print("Threads: " + i); new FutureLoop(i).test(); Thread.sleep(TIMEOUT); } pool.shutdown(); } static final class FutureLoop implements Callable { private int v = rng.next(); private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; FutureLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { Future[] futures = new Future[nthreads]; for (int i = 0; i < nthreads; ++i) futures[i] = pool.submit(this); barrier.await(); Thread.sleep(TIMEOUT); boolean tooLate = false; for (int i = 1; i < nthreads; ++i) { if (!futures[i].cancel(true)) tooLate = true; // Unbunch some of the cancels if ( (i & 3) == 0) Thread.sleep(1 + rng.next() % 10); } Object f0 = futures[0].get(); if (!tooLate) { for (int i = 1; i < nthreads; ++i) { if (!futures[i].isDone() || !futures[i].isCancelled()) throw new Error("Only one thread should complete"); } } else System.out.print("(cancelled too late) "); long endTime = System.nanoTime(); long time = endTime - timer.startTime; if (print) { double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } } public final Object call() throws Exception { barrier.await(); int sum = v; int x = 0; int n = ITERS; while (n-- > 0) { lock.lockInterruptibly(); try { v = x = LoopHelpers.compute1(v); } finally { lock.unlock(); } sum += LoopHelpers.compute2(LoopHelpers.compute2(x)); } return new Integer(sum); } } } jsr166/src/test/loops/SynchronizedCollection.java0000644000000000000000000000460311537741072017251 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ // Stand-alone version of java.util.Collections.synchronizedCollection import java.util.*; import java.io.*; public final class SynchronizedCollection implements Collection, Serializable { final Collection c; // Backing Collection final Object mutex; // Object on which to synchronize public SynchronizedCollection(Collection c) { if (c==null) throw new NullPointerException(); this.c = c; mutex = this; } public SynchronizedCollection(Collection c, Object mutex) { this.c = c; this.mutex = mutex; } public SynchronizedCollection() { this(new ArrayList()); } public final int size() { synchronized (mutex) {return c.size();} } public final boolean isEmpty() { synchronized (mutex) {return c.isEmpty();} } public final boolean contains(Object o) { synchronized (mutex) {return c.contains(o);} } public final Object[] toArray() { synchronized (mutex) {return c.toArray();} } public final T[] toArray(T[] a) { synchronized (mutex) {return c.toArray(a);} } public final Iterator iterator() { return c.iterator(); } public final boolean add(E e) { synchronized (mutex) {return c.add(e);} } public final boolean remove(Object o) { synchronized (mutex) {return c.remove(o);} } public final boolean containsAll(Collection coll) { synchronized (mutex) {return c.containsAll(coll);} } public final boolean addAll(Collection coll) { synchronized (mutex) {return c.addAll(coll);} } public final boolean removeAll(Collection coll) { synchronized (mutex) {return c.removeAll(coll);} } public final boolean retainAll(Collection coll) { synchronized (mutex) {return c.retainAll(coll);} } public final void clear() { synchronized (mutex) {c.clear();} } public final String toString() { synchronized (mutex) {return c.toString();} } private void writeObject(ObjectOutputStream s) throws IOException { synchronized (mutex) {s.defaultWriteObject();} } } jsr166/src/test/loops/Fib.java0000644000000000000000000000660011537741071013254 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; /** * Recursive task-based version of Fibonacci. Computes: *
 * Computes fibonacci(n) = fibonacci(n-1) + fibonacci(n-2);  for n> 1
 *          fibonacci(0) = 0;
 *          fibonacci(1) = 1.
 * 
*/ public final class Fib extends RecursiveAction { // Performance-tuning constant: static int sequentialThreshold; static long lastStealCount; public static void main(String[] args) throws Exception { int procs = 0; int num = 45; sequentialThreshold = 2; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) num = Integer.parseInt(args[1]); if (args.length > 2) sequentialThreshold = Integer.parseInt(args[2]); } catch (Exception e) { System.out.println("Usage: java Fib []"); return; } for (int reps = 0; reps < 2; ++reps) { ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); lastStealCount = g.getStealCount(); for (int i = 0; i < 20; ++i) { test(g, num); // if (i == 0) // Thread.sleep(100); } System.out.println(g); g.shutdown(); if (!g.awaitTermination(10, TimeUnit.SECONDS)) throw new Error(); g = null; Thread.sleep(500); } } /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static void test(ForkJoinPool g, int num) throws Exception { int ps = g.getParallelism(); // g.setParallelism(ps); long start = System.nanoTime(); Fib f = new Fib(num); g.invoke(f); long time = System.nanoTime() - start; double secs = ((double)time) / NPS; long result = f.getAnswer(); System.out.print("Fib " + num + " = " + result); System.out.printf("\tTime: %7.3f", secs); long sc = g.getStealCount(); long ns = sc - lastStealCount; lastStealCount = sc; System.out.printf(" Steals/t: %5d", ns/ps); System.out.printf(" Workers: %5d", g.getPoolSize()); System.out.println(); } // Initialized with argument; replaced with result int number; Fib(int n) { number = n; } int getAnswer() { return number; } public final void compute() { int n = number; if (n > 1) { if (n <= sequentialThreshold) number = seqFib(n); else { Fib f1 = new Fib(n - 1); Fib f2 = new Fib(n - 2); // forkJoin(f1, f2); invokeAll(f1, f2); number = f1.number + f2.number; } } } // Sequential version for arguments less than threshold static final int seqFib(int n) { // unroll left only int r = 1; do { int m = n - 2; r += m <= 1 ? m : seqFib(m); } while (--n > 1); return r; } } jsr166/src/test/loops/FJSums.java0000644000000000000000000002436111537741071013727 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; // parallel sums and cumulations public class FJSums { static final long NPS = (1000L * 1000 * 1000); static int THRESHOLD; public static void main (String[] args) throws Exception { int procs = 0; int n = 1 << 25; int reps = 10; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) n = Integer.parseInt(args[1]); if (args.length > 2) reps = Integer.parseInt(args[1]); } catch (Exception e) { System.out.println("Usage: java FJSums threads n reps"); return; } ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); System.out.println("Number of procs=" + g.getParallelism()); // for now hardwire Cumulate threshold to 8 * #CPUs leaf tasks THRESHOLD = 1 + ((n + 7) >>> 3) / g.getParallelism(); long[] a = new long[n]; for (int i = 0; i < n; ++i) a[i] = i; long expected = ((long)n * (long)(n - 1)) / 2; for (int i = 0; i < 2; ++i) { System.out.print("Seq: "); long last = System.nanoTime(); long ss = seqSum(a, 0, n); double elapsed = elapsedTime(last); System.out.printf("sum = %24d time: %7.3f\n", ss, elapsed); if (ss != expected) throw new Error("expected " + expected + " != " + ss); } for (int i = 0; i < reps; ++i) { System.out.print("Par: "); long last = System.nanoTime(); Summer s = new Summer(a, 0, a.length, null); g.invoke(s); long ss = s.result; double elapsed = elapsedTime(last); System.out.printf("sum = %24d time: %7.3f\n", ss, elapsed); if (i == 0 && ss != expected) throw new Error("expected " + expected + " != " + ss); System.out.print("Cum: "); last = System.nanoTime(); g.invoke(new Cumulater(null, a, 0, n)); long sc = a[n - 1]; elapsed = elapsedTime(last); System.out.printf("sum = %24d time: %7.3f\n", ss, elapsed); if (sc != ss) throw new Error("expected " + ss + " != " + sc); } System.out.println(g); g.shutdown(); } static double elapsedTime(long startTime) { return (double)(System.nanoTime() - startTime) / NPS; } static long seqSum(long[] array, int l, int h) { long sum = 0; for (int i = l; i < h; ++i) sum += array[i]; return sum; } static long seqCumulate(long[] array, int lo, int hi, long base) { long sum = base; for (int i = lo; i < hi; ++i) array[i] = sum += array[i]; return sum; } /** * Adapted from Applyer demo in RecursiveAction docs */ static final class Summer extends RecursiveAction { final long[] array; final int lo, hi; long result; Summer next; // keeps track of right-hand-side tasks Summer(long[] array, int lo, int hi, Summer next) { this.array = array; this.lo = lo; this.hi = hi; this.next = next; } protected void compute() { int l = lo; int h = hi; Summer right = null; while (h - l > 1 && getSurplusQueuedTaskCount() <= 3) { int mid = (l + h) >>> 1; right = new Summer(array, mid, h, right); right.fork(); h = mid; } long sum = seqSum(array, l, h); while (right != null) { if (right.tryUnfork()) // directly calculate if not stolen sum += seqSum(array, right.lo, right.hi); else { right.join(); sum += right.result; } right = right.next; } result = sum; } } /** * Cumulative scan, adapted from ParallelArray code * * A basic version of scan is straightforward. * Keep dividing by two to threshold segment size, and then: * Pass 1: Create tree of partial sums for each segment * Pass 2: For each segment, cumulate with offset of left sibling * See G. Blelloch's http://www.cs.cmu.edu/~scandal/alg/scan.html * * This version improves performance within FJ framework mainly by * allowing second pass of ready left-hand sides to proceed even * if some right-hand side first passes are still executing. It * also combines first and second pass for leftmost segment, and * for cumulate (not precumulate) also skips first pass for * rightmost segment (whose result is not needed for second pass). * * To manage this, it relies on "phase" phase/state control field * maintaining bits CUMULATE, SUMMED, and FINISHED. CUMULATE is * main phase bit. When false, segments compute only their sum. * When true, they cumulate array elements. CUMULATE is set at * root at beginning of second pass and then propagated down. But * it may also be set earlier for subtrees with lo==0 (the * left spine of tree). SUMMED is a one bit join count. For leafs, * set when summed. For internal nodes, becomes true when one * child is summed. When second child finishes summing, it then * moves up tree to trigger cumulate phase. FINISHED is also a one * bit join count. For leafs, it is set when cumulated. For * internal nodes, it becomes true when one child is cumulated. * When second child finishes cumulating, it then moves up tree, * executing complete() at the root. * */ static final class Cumulater extends ForkJoinTask { static final short CUMULATE = (short)1; static final short SUMMED = (short)2; static final short FINISHED = (short)4; final Cumulater parent; final long[] array; Cumulater left, right; final int lo; final int hi; volatile int phase; // phase/state long in, out; // initially zero static final AtomicIntegerFieldUpdater phaseUpdater = AtomicIntegerFieldUpdater.newUpdater(Cumulater.class, "phase"); Cumulater(Cumulater parent, long[] array, int lo, int hi) { this.parent = parent; this.array = array; this.lo = lo; this.hi = hi; } public final Void getRawResult() { return null; } protected final void setRawResult(Void mustBeNull) { } /** Returns true if can CAS CUMULATE bit true */ final boolean transitionToCumulate() { int c; while (((c = phase) & CUMULATE) == 0) if (phaseUpdater.compareAndSet(this, c, c | CUMULATE)) return true; return false; } public final boolean exec() { if (hi - lo > THRESHOLD) { if (left == null) { // first pass int mid = (lo + hi) >>> 1; left = new Cumulater(this, array, lo, mid); right = new Cumulater(this, array, mid, hi); } boolean cumulate = (phase & CUMULATE) != 0; if (cumulate) { long pin = in; left.in = pin; right.in = pin + left.out; } if (!cumulate || right.transitionToCumulate()) right.fork(); if (!cumulate || left.transitionToCumulate()) left.exec(); } else { int cb; for (;;) { // Establish action: sum, cumulate, or both int b = phase; if ((b & FINISHED) != 0) // already done return false; if ((b & CUMULATE) != 0) cb = FINISHED; else if (lo == 0) // combine leftmost cb = (SUMMED|FINISHED); else cb = SUMMED; if (phaseUpdater.compareAndSet(this, b, b|cb)) break; } if (cb == SUMMED) out = seqSum(array, lo, hi); else if (cb == FINISHED) seqCumulate(array, lo, hi, in); else if (cb == (SUMMED|FINISHED)) out = seqCumulate(array, lo, hi, 0L); // propagate up Cumulater ch = this; Cumulater par = parent; for (;;) { if (par == null) { if ((cb & FINISHED) != 0) ch.complete(null); break; } int pb = par.phase; if ((pb & cb & FINISHED) != 0) { // both finished ch = par; par = par.parent; } else if ((pb & cb & SUMMED) != 0) { // both summed par.out = par.left.out + par.right.out; int refork = ((pb & CUMULATE) == 0 && par.lo == 0) ? CUMULATE : 0; int nextPhase = pb|cb|refork; if (pb == nextPhase || phaseUpdater.compareAndSet(par, pb, nextPhase)) { if (refork != 0) par.fork(); cb = SUMMED; // drop finished bit ch = par; par = par.parent; } } else if (phaseUpdater.compareAndSet(par, pb, pb|cb)) break; } } return false; } } } jsr166/src/test/loops/Finals.java0000644000000000000000000000413211537741071013766 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ public class Finals { static int npairs = 2; static int iters = 10000000; static final int LEN = 4; static final Long[] nums = new Long[LEN]; static volatile boolean done; static volatile long total; public static void main(String[] args) { for (int i = 0; i < LEN; ++i) nums[i] = new Long(i+1); Thread[] ps = new Thread[npairs]; Thread[] as = new Reader[npairs]; for (int i = 0; i < npairs; ++i) { ps[i] = new Writer(); as[i] = new Reader(); } for (int i = 0; i < as.length; ++i) { ps[i].start(); as[i].start(); } } static long nextRandom(long seed) { return (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1); } static long initialSeed(Object x) { return (System.currentTimeMillis() + x.hashCode()) | 1; } static class Writer extends Thread { public void run() { long s = initialSeed(this); int n = iters; while (!done && n-- > 0) { int k = (int) (s & (LEN-1)); int l = (k+1) & (LEN-1); nums[k] = new Long(s); nums[l] = new Long(s); s = nextRandom(s); if (s == 0) s = initialSeed(this); } done = true; total += s; } } static class Reader extends Thread { public void run() { int n = iters; long s = initialSeed(this); while (s != 0 && n > 0) { long nexts = nums[(int) (s & (LEN-1))].longValue(); if (nexts != s) --n; else if (done) break; s = nexts; } done = true; total += s; if (s == 0) throw new Error("Saw uninitialized value"); } } } jsr166/src/test/loops/Heat.java0000644000000000000000000001712511537741071013441 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ // Adapted from a cilk benchmark import java.util.concurrent.*; public class Heat { static final long NPS = (1000L * 1000 * 1000); // Parameters static int nx; static int ny; static int nt; static int leafmaxcol; // the matrix representing the cells static double[][] newm; // alternating workspace matrix static double[][] oldm; public static void main(String[] args) throws Exception { int procs = 0; nx = 4096; ny = 1024; nt = 1000; leafmaxcol = 16; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) nx = Integer.parseInt(args[1]); if (args.length > 2) ny = Integer.parseInt(args[2]); if (args.length > 3) nt = Integer.parseInt(args[3]); if (args.length > 4) leafmaxcol = Integer.parseInt(args[4]); } catch (Exception e) { System.out.println("Usage: java Heat threads rows cols steps granularity"); return; } ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); System.out.print("parallelism = " + g.getParallelism()); System.out.print(" granularity = " + leafmaxcol); System.out.print(" rows = " + nx); System.out.print(" columns = " + ny); System.out.println(" steps = " + nt); oldm = new double[nx][ny]; newm = new double[nx][ny]; for (int i = 0; i < 5; ++i) { long last = System.nanoTime(); RecursiveAction main = new RecursiveAction() { public void compute() { for (int timestep = 0; timestep <= nt; timestep++) { (new Compute(0, nx, timestep)).invoke(); } } }; g.invoke(main); double elapsed = elapsedTime(last); System.out.printf("time: %7.3f", elapsed); System.out.println(); } System.out.println(g); g.shutdown(); } static double elapsedTime(long startTime) { return (double)(System.nanoTime() - startTime) / NPS; } // constants (at least for this demo) static final double xu = 0.0; static final double xo = 1.570796326794896558; static final double yu = 0.0; static final double yo = 1.570796326794896558; static final double tu = 0.0; static final double to = 0.0000001; static final double dx = (xo - xu) / (nx - 1); static final double dy = (yo - yu) / (ny - 1); static final double dt = (to - tu) / nt; static final double dtdxsq = dt / (dx * dx); static final double dtdysq = dt / (dy * dy); // the function being applied across the cells static final double f(double x, double y) { return Math.sin(x) * Math.sin(y); } // random starting values static final double randa(double x, double t) { return 0.0; } static final double randb(double x, double t) { return Math.exp(-2*t) * Math.sin(x); } static final double randc(double y, double t) { return 0.0; } static final double randd(double y, double t) { return Math.exp(-2*t) * Math.sin(y); } static final double solu(double x, double y, double t) { return Math.exp(-2*t) * Math.sin(x) * Math.sin(y); } static final class Compute extends RecursiveAction { final int lb; final int ub; final int time; Compute(int lowerBound, int upperBound, int timestep) { lb = lowerBound; ub = upperBound; time = timestep; } public void compute() { if (ub - lb > leafmaxcol) { int mid = (lb + ub) >>> 1; Compute left = new Compute(lb, mid, time); left.fork(); new Compute(mid, ub, time).compute(); left.join(); } else if (time == 0) // if first pass, initialize cells init(); else if (time %2 != 0) // alternate new/old compstripe(newm, oldm); else compstripe(oldm, newm); } /** Updates all cells. */ final void compstripe(double[][] newMat, double[][] oldMat) { // manually mangled to reduce array indexing final int llb = (lb == 0) ? 1 : lb; final int lub = (ub == nx) ? nx - 1 : ub; double[] west; double[] row = oldMat[llb-1]; double[] east = oldMat[llb]; for (int a = llb; a < lub; a++) { west = row; row = east; east = oldMat[a+1]; double prev; double cell = row[0]; double next = row[1]; double[] nv = newMat[a]; for (int b = 1; b < ny-1; b++) { prev = cell; cell = next; double twoc = 2 * cell; next = row[b+1]; nv[b] = cell + dtdysq * (prev - twoc + next) + dtdxsq * (east[b] - twoc + west[b]); } } edges(newMat, llb, lub, tu + time * dt); } // the original version from cilk final void origcompstripe(double[][] newMat, double[][] oldMat) { final int llb = (lb == 0) ? 1 : lb; final int lub = (ub == nx) ? nx - 1 : ub; for (int a = llb; a < lub; a++) { for (int b = 1; b < ny-1; b++) { double cell = oldMat[a][b]; double twoc = 2 * cell; newMat[a][b] = cell + dtdxsq * (oldMat[a+1][b] - twoc + oldMat[a-1][b]) + dtdysq * (oldMat[a][b+1] - twoc + oldMat[a][b-1]); } } edges(newMat, llb, lub, tu + time * dt); } /** Initializes all cells. */ final void init() { final int llb = (lb == 0) ? 1 : lb; final int lub = (ub == nx) ? nx - 1 : ub; for (int a = llb; a < lub; a++) { /* inner nodes */ double[] ov = oldm[a]; double x = xu + a * dx; double y = yu; for (int b = 1; b < ny-1; b++) { y += dy; ov[b] = f(x, y); } } edges(oldm, llb, lub, 0); } /** Fills in edges with boundary values. */ final void edges(double [][] m, int llb, int lub, double t) { for (int a = llb; a < lub; a++) { double[] v = m[a]; double x = xu + a * dx; v[0] = randa(x, t); v[ny-1] = randb(x, t); } if (lb == 0) { double[] v = m[0]; double y = yu; for (int b = 0; b < ny; b++) { y += dy; v[b] = randc(y, t); } } if (ub == nx) { double[] v = m[nx - 1]; double y = yu; for (int b = 0; b < ny; b++) { y += dy; v[b] = randd(y, t); } } } } } jsr166/src/test/loops/SMap.java0000644000000000000000000000375011537741071013417 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; /** * This is an incomplete implementation of a wrapper class * that places read-write locks around unsynchronized Maps. * Exists as a sample input for MapLoops test. */ public class SMap implements Map { private final Map m; public SMap(Map m) { if (m == null) throw new NullPointerException(); this.m = m; } public SMap() { this(new TreeMap()); // use TreeMap by default } public synchronized int size() { return m.size(); } public synchronized boolean isEmpty() { return m.isEmpty(); } public synchronized Object get(Object key) { return m.get(key); } public synchronized boolean containsKey(Object key) { return m.containsKey(key); } public synchronized boolean containsValue(Object value) { return m.containsValue(value); } public synchronized Set keySet() { // Not implemented return m.keySet(); } public synchronized Set entrySet() { // Not implemented return m.entrySet(); } public synchronized Collection values() { // Not implemented return m.values(); } public synchronized boolean equals(Object o) { return m.equals(o); } public synchronized int hashCode() { return m.hashCode(); } public synchronized String toString() { return m.toString(); } public synchronized Object put(Object key, Object value) { return m.put(key, value); } public synchronized Object remove(Object key) { return m.remove(key); } public synchronized void putAll(Map map) { m.putAll(map); } public synchronized void clear() { m.clear(); } } jsr166/src/test/loops/TSPExchangerTest.java0000644000000000000000000006062711537741072015721 0ustar /* * Written by Doug Lea and Bill Scherer with assistance from members * of JCP JSR-166 Expert Group and released to the public domain, as * explained at http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.concurrent.locks.*; /** * A parallel Traveling Salesperson Problem (TSP) program based on a * genetic algorithm using an Exchanger. A population of chromosomes is * distributed among "subpops". Each chromosomes represents a tour, * and its fitness is the total tour length. * * A set of worker threads perform updates on subpops. The basic * update step is: *
    *
  1. Select a breeder b from the subpop *
  2. Create a strand of its tour with a random starting point and length *
  3. Offer the strand to the exchanger, receiving a strand from * another subpop *
  4. Combine b and the received strand using crossing function to * create new chromosome c. *
  5. Replace a chromosome in the subpop with c. *
* * This continues for a given number of generations per subpop. * Because there are normally more subpops than threads, each worker * thread performs small (randomly sized) run of updates for one * subpop and then selects another. A run continues until there is at * most one remaining thread performing updates. * * See below for more details. */ public class TSPExchangerTest { static final int NCPUS = Runtime.getRuntime().availableProcessors(); /** Runs start with two threads, increasing by two through max */ static final int DEFAULT_MAX_THREADS = Math.max(4, NCPUS + NCPUS/2); /** The number of replication runs per thread value */ static final int DEFAULT_REPLICATIONS = 3; /** If true, print statistics in SNAPSHOT_RATE intervals */ static boolean verbose = true; static final long SNAPSHOT_RATE = 10000; // in milliseconds /** * The problem size. Each city is a random point. The goal is to * find a tour among them with smallest total Euclidean distance. */ static final int DEFAULT_CITIES = 144; // Tuning parameters. /** * The number of chromosomes per subpop. Must be a power of two. * * Smaller values lead to faster iterations but poorer quality * results */ static final int DEFAULT_SUBPOP_SIZE = 32; /** * The number of iterations per subpop. Convergence appears * to be roughly proportional to #cities-squared */ static final int DEFAULT_GENERATIONS = DEFAULT_CITIES * DEFAULT_CITIES; /** * The number of subpops. The total population is #subpops * subpopSize, * which should be roughly on the order of #cities-squared * * Smaller values lead to faster total runs but poorer quality * results */ static final int DEFAULT_NSUBPOPS = DEFAULT_GENERATIONS / DEFAULT_SUBPOP_SIZE; /** * The minimum length for a random chromosome strand. * Must be at least 1. */ static final int MIN_STRAND_LENGTH = 3; /** * The probability mask value for creating random strands, * that have lengths at least MIN_STRAND_LENGTH, and grow * with exponential decay 2^(-(1/(RANDOM_STRAND_MASK + 1) * Must be 1 less than a power of two. */ static final int RANDOM_STRAND_MASK = 7; /** * Probability control for selecting breeders. * Breeders are selected starting at the best-fitness chromosome, * with exponentially decaying probability * 1 / (subpopSize >>> BREEDER_DECAY). * * Larger values usually cause faster convergence but poorer * quality results */ static final int BREEDER_DECAY = 1; /** * Probability control for selecting dyers. * Dyers are selected starting at the worst-fitness chromosome, * with exponentially decaying probability * 1 / (subpopSize >>> DYER_DECAY) * * Larger values usually cause faster convergence but poorer * quality results */ static final int DYER_DECAY = 1; /** * The set of cities. Created once per program run, to * make it easier to compare solutions across different runs. */ static CitySet cities; public static void main(String[] args) throws Exception { int maxThreads = DEFAULT_MAX_THREADS; int nCities = DEFAULT_CITIES; int subpopSize = DEFAULT_SUBPOP_SIZE; int nGen = nCities * nCities; int nSubpops = nCities * nCities / subpopSize; int nReps = DEFAULT_REPLICATIONS; try { int argc = 0; while (argc < args.length) { String option = args[argc++]; if (option.equals("-c")) { nCities = Integer.parseInt(args[argc]); nGen = nCities * nCities; nSubpops = nCities * nCities / subpopSize; } else if (option.equals("-p")) subpopSize = Integer.parseInt(args[argc]); else if (option.equals("-g")) nGen = Integer.parseInt(args[argc]); else if (option.equals("-n")) nSubpops = Integer.parseInt(args[argc]); else if (option.equals("-q")) { verbose = false; argc--; } else if (option.equals("-r")) nReps = Integer.parseInt(args[argc]); else maxThreads = Integer.parseInt(option); argc++; } } catch (Exception e) { reportUsageErrorAndDie(); } System.out.print("TSPExchangerTest"); System.out.print(" -c " + nCities); System.out.print(" -g " + nGen); System.out.print(" -p " + subpopSize); System.out.print(" -n " + nSubpops); System.out.print(" -r " + nReps); System.out.print(" max threads " + maxThreads); System.out.println(); cities = new CitySet(nCities); if (false && NCPUS > 4) { int h = NCPUS/2; System.out.printf("Threads: %4d Warmup\n", h); oneRun(h, nSubpops, subpopSize, nGen); Thread.sleep(500); } int maxt = (maxThreads < nSubpops) ? maxThreads : nSubpops; for (int j = 0; j < nReps; ++j) { for (int i = 2; i <= maxt; i += 2) { System.out.printf("Threads: %4d Replication: %2d\n", i, j); oneRun(i, nSubpops, subpopSize, nGen); Thread.sleep(500); } } } static void reportUsageErrorAndDie() { System.out.print("usage: TSPExchangerTest"); System.out.print(" [-c #cities]"); System.out.print(" [-p #subpopSize]"); System.out.print(" [-g #generations]"); System.out.print(" [-n #subpops]"); System.out.print(" [-r #replications]"); System.out.print(" [-q ]"); System.out.print(" #threads]"); System.out.println(); System.exit(0); } /** * Perform one run with the given parameters. Each run complete * when there are fewer than 2 active threads. When there is * only one remaining thread, it will have no one to exchange * with, so it is terminated (via interrupt). */ static void oneRun(int nThreads, int nSubpops, int subpopSize, int nGen) throws InterruptedException { Population p = new Population(nThreads, nSubpops, subpopSize, nGen); ProgressMonitor mon = null; if (verbose) { p.printSnapshot(0); mon = new ProgressMonitor(p); mon.start(); } long startTime = System.nanoTime(); p.start(); p.awaitDone(); long stopTime = System.nanoTime(); if (mon != null) mon.interrupt(); p.shutdown(); // Thread.sleep(100); long elapsed = stopTime - startTime; double secs = (double) elapsed / 1000000000.0; p.printSnapshot(secs); } /** * A Population creates the subpops, subpops, and threads for a run * and has control methods to start, stop, and report progress. */ static final class Population { final Worker[] threads; final Subpop[] subpops; final Exchanger exchanger; final CountDownLatch done; final int nGen; final int subpopSize; final int nThreads; Population(int nThreads, int nSubpops, int subpopSize, int nGen) { this.nThreads = nThreads; this.nGen = nGen; this.subpopSize = subpopSize; this.exchanger = new Exchanger(); this.done = new CountDownLatch(nThreads - 1); this.subpops = new Subpop[nSubpops]; for (int i = 0; i < nSubpops; i++) subpops[i] = new Subpop(this); this.threads = new Worker[nThreads]; int maxExchanges = nGen * nSubpops / nThreads; for (int i = 0; i < nThreads; ++i) { threads[i] = new Worker(this, maxExchanges); } } void start() { for (int i = 0; i < nThreads; ++i) { threads[i].start(); } } /** Stop the tasks */ void shutdown() { for (int i = 0; i < threads.length; ++ i) threads[i].interrupt(); } void threadDone() { done.countDown(); } /** Wait for tasks to complete */ void awaitDone() throws InterruptedException { done.await(); } int totalExchanges() { int xs = 0; for (int i = 0; i < threads.length; ++i) xs += threads[i].exchanges; return xs; } /** * Prints statistics, including best and worst tour lengths * for points scaled in [0,1), scaled by the square root of * number of points. This simplifies checking results. The * expected optimal TSP for random points is believed to be * around 0.76 * sqrt(N). For papers discussing this, see * http://www.densis.fee.unicamp.br/~moscato/TSPBIB_home.html */ void printSnapshot(double secs) { int xs = totalExchanges(); long rate = (xs == 0) ? 0L : (long) ((secs * 1000000000.0) / xs); Chromosome bestc = subpops[0].chromosomes[0]; Chromosome worstc = bestc; for (int k = 0; k < subpops.length; ++k) { Chromosome[] cs = subpops[k].chromosomes; if (cs[0].fitness < bestc.fitness) bestc = cs[0]; int w = cs[cs.length-1].fitness; if (cs[cs.length-1].fitness > worstc.fitness) worstc = cs[cs.length-1]; } double sqrtn = Math.sqrt(cities.length); double best = bestc.unitTourLength() / sqrtn; double worst = worstc.unitTourLength() / sqrtn; System.out.printf("N:%4d T:%8.3f B:%6.3f W:%6.3f X:%9d R:%7d\n", nThreads, secs, best, worst, xs, rate); // exchanger.printStats(); // System.out.print(" s: " + exchanger.aveSpins()); // System.out.print(" p: " + exchanger.aveParks()); } } /** * Worker threads perform updates on subpops. */ static final class Worker extends Thread { final Population pop; final int maxExchanges; int exchanges; final RNG rng = new RNG(); Worker(Population pop, int maxExchanges) { this.pop = pop; this.maxExchanges = maxExchanges; } /** * Repeatedly, find a subpop that is not being updated by * another thread, and run a random number of updates on it. */ public void run() { try { int len = pop.subpops.length; int pos = (rng.next() & 0x7FFFFFFF) % len; while (exchanges < maxExchanges) { Subpop s = pop.subpops[pos]; AtomicBoolean busy = s.busy; if (!busy.get() && busy.compareAndSet(false, true)) { exchanges += s.runUpdates(); busy.set(false); pos = (rng.next() & 0x7FFFFFFF) % len; } else if (++pos >= len) pos = 0; } pop.threadDone(); } catch (InterruptedException fallthrough) { } } } /** * A Subpop maintains a set of chromosomes.. */ static final class Subpop { /** The chromosomes, kept in sorted order */ final Chromosome[] chromosomes; /** The parent population */ final Population pop; /** Reservation bit for worker threads */ final AtomicBoolean busy; /** The common exchanger, same for all subpops */ final Exchanger exchanger; /** The current strand being exchanged */ Strand strand; /** Bitset used in cross */ final int[] inTour; final RNG rng; final int subpopSize; Subpop(Population pop) { this.pop = pop; this.subpopSize = pop.subpopSize; this.exchanger = pop.exchanger; this.busy = new AtomicBoolean(false); this.rng = new RNG(); int length = cities.length; this.strand = new Strand(length); this.inTour = new int[(length >>> 5) + 1]; this.chromosomes = new Chromosome[subpopSize]; for (int j = 0; j < subpopSize; ++j) chromosomes[j] = new Chromosome(length, rng); Arrays.sort(chromosomes); } /** * Run a random number of updates. The number of updates is * at least 1 and no more than subpopSize. This * controls the granularity of multiplexing subpop updates on * to threads. It is small enough to balance out updates * across tasks, but large enough to avoid having runs * dominated by subpop selection. It is randomized to avoid * long runs where pairs of subpops exchange only with each * other. It is hardwired because small variations of it * don't matter much. * * @param g the first generation to run. */ int runUpdates() throws InterruptedException { int n = 1 + (rng.next() & ((subpopSize << 1) - 1)); for (int i = 0; i < n; ++i) update(); return n; } /** * Choose a breeder, exchange strand with another subpop, and * cross them to create new chromosome to replace a chosen * dyer. */ void update() throws InterruptedException { int b = chooseBreeder(); int d = chooseDyer(b); Chromosome breeder = chromosomes[b]; Chromosome child = chromosomes[d]; chooseStrand(breeder); strand = exchanger.exchange(strand); cross(breeder, child); fixOrder(child, d); } /** * Choose a breeder, with exponentially decreasing probability * starting at best. * @return index of selected breeder */ int chooseBreeder() { int mask = (subpopSize >>> BREEDER_DECAY) - 1; int b = 0; while ((rng.next() & mask) != mask) { if (++b >= subpopSize) b = 0; } return b; } /** * Choose a chromosome that will be replaced, with * exponentially decreasing probability starting at * worst, ignoring the excluded index * @param exclude index to ignore; use -1 to not exclude any * @return index of selected dyer */ int chooseDyer(int exclude) { int mask = (subpopSize >>> DYER_DECAY) - 1; int d = subpopSize - 1; while (d == exclude || (rng.next() & mask) != mask) { if (--d < 0) d = subpopSize - 1; } return d; } /** * Select a random strand of b's. * @param breeder the breeder */ void chooseStrand(Chromosome breeder) { int[] bs = breeder.alleles; int length = bs.length; int strandLength = MIN_STRAND_LENGTH; while (strandLength < length && (rng.next() & RANDOM_STRAND_MASK) != RANDOM_STRAND_MASK) strandLength++; strand.strandLength = strandLength; int[] ss = strand.alleles; int k = (rng.next() & 0x7FFFFFFF) % length; for (int i = 0; i < strandLength; ++i) { ss[i] = bs[k]; if (++k >= length) k = 0; } } /** * Copy current strand to start of c's, and then append all * remaining b's that aren't in the strand. * @param breeder the breeder * @param child the child */ void cross(Chromosome breeder, Chromosome child) { for (int k = 0; k < inTour.length; ++k) // clear bitset inTour[k] = 0; // Copy current strand to c int[] cs = child.alleles; int ssize = strand.strandLength; int[] ss = strand.alleles; int i; for (i = 0; i < ssize; ++i) { int x = ss[i]; cs[i] = x; inTour[x >>> 5] |= 1 << (x & 31); // record in bit set } // Find index of matching origin in b int first = cs[0]; int j = 0; int[] bs = breeder.alleles; while (bs[j] != first) ++j; // Append remaining b's that aren't already in tour while (i < cs.length) { if (++j >= bs.length) j = 0; int x = bs[j]; if ((inTour[x >>> 5] & (1 << (x & 31))) == 0) cs[i++] = x; } } /** * Fix the sort order of a changed Chromosome c at position k * @param c the chromosome * @param k the index */ void fixOrder(Chromosome c, int k) { Chromosome[] cs = chromosomes; int oldFitness = c.fitness; c.recalcFitness(); int newFitness = c.fitness; if (newFitness < oldFitness) { int j = k; int p = j - 1; while (p >= 0 && cs[p].fitness > newFitness) { cs[j] = cs[p]; j = p--; } cs[j] = c; } else if (newFitness > oldFitness) { int j = k; int n = j + 1; while (n < cs.length && cs[n].fitness < newFitness) { cs[j] = cs[n]; j = n++; } cs[j] = c; } } } /** * A Chromosome is a candidate TSP tour. */ static final class Chromosome implements Comparable { /** Index of cities in tour order */ final int[] alleles; /** Total tour length */ int fitness; /** * Initialize to random tour */ Chromosome(int length, RNG random) { alleles = new int[length]; for (int i = 0; i < length; i++) alleles[i] = i; for (int i = length - 1; i > 0; i--) { int idx = (random.next() & 0x7FFFFFFF) % alleles.length; int tmp = alleles[i]; alleles[i] = alleles[idx]; alleles[idx] = tmp; } recalcFitness(); } public int compareTo(Object x) { // to enable sorting int xf = ((Chromosome) x).fitness; int f = fitness; return ((f == xf) ? 0 :((f < xf) ? -1 : 1)); } void recalcFitness() { int[] a = alleles; int len = a.length; int p = a[0]; long f = cities.distanceBetween(a[len-1], p); for (int i = 1; i < len; i++) { int n = a[i]; f += cities.distanceBetween(p, n); p = n; } fitness = (int) (f / len); } /** * Return tour length for points scaled in [0, 1). */ double unitTourLength() { int[] a = alleles; int len = a.length; int p = a[0]; double f = cities.unitDistanceBetween(a[len-1], p); for (int i = 1; i < len; i++) { int n = a[i]; f += cities.unitDistanceBetween(p, n); p = n; } return f; } /** * Check that this tour visits each city */ void validate() { int len = alleles.length; boolean[] used = new boolean[len]; for (int i = 0; i < len; ++i) used[alleles[i]] = true; for (int i = 0; i < len; ++i) if (!used[i]) throw new Error("Bad tour"); } } /** * A Strand is a random sub-sequence of a Chromosome. Each subpop * creates only one strand, and then trades it with others, * refilling it on each iteration. */ static final class Strand { final int[] alleles; int strandLength; Strand(int length) { alleles = new int[length]; } } /** * A collection of (x,y) points that represent cities. */ static final class CitySet { final int length; final int[] xPts; final int[] yPts; final int[][] distances; CitySet(int n) { this.length = n; this.xPts = new int[n]; this.yPts = new int[n]; this.distances = new int[n][n]; RNG random = new RNG(); for (int i = 0; i < n; i++) { xPts[i] = (random.next() & 0x7FFFFFFF); yPts[i] = (random.next() & 0x7FFFFFFF); } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { double dx = (double) xPts[i] - (double) xPts[j]; double dy = (double) yPts[i] - (double) yPts[j]; double dd = Math.hypot(dx, dy) / 2.0; long ld = Math.round(dd); distances[i][j] = (ld >= Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) ld; } } } /** * Returns the cached distance between a pair of cities. */ int distanceBetween(int i, int j) { return distances[i][j]; } // Scale ints to doubles in [0,1) static final double PSCALE = (double) 0x80000000L; /** * Returns distance for points scaled in [0,1). This simplifies * checking results. The expected optimal TSP for random * points is believed to be around 0.76 * sqrt(N). For papers * discussing this, see * http://www.densis.fee.unicamp.br/~moscato/TSPBIB_home.html */ double unitDistanceBetween(int i, int j) { double dx = ((double) xPts[i] - (double) xPts[j]) / PSCALE; double dy = ((double) yPts[i] - (double) yPts[j]) / PSCALE; return Math.hypot(dx, dy); } } /** * Cheap XorShift random number generator */ static final class RNG { /** Seed generator for XorShift RNGs */ static final Random seedGenerator = new Random(); int seed; RNG(int seed) { this.seed = seed; } RNG() { this.seed = seedGenerator.nextInt() | 1; } int next() { int x = seed; x ^= x << 6; x ^= x >>> 21; x ^= x << 7; seed = x; return x; } } static final class ProgressMonitor extends Thread { final Population pop; ProgressMonitor(Population p) { pop = p; } public void run() { double time = 0; try { while (!Thread.interrupted()) { sleep(SNAPSHOT_RATE); time += SNAPSHOT_RATE; pop.printSnapshot(time / 1000.0); } } catch (InterruptedException ie) {} } } } jsr166/src/test/loops/LeftSpineFib.java0000644000000000000000000000716711475011737015077 0ustar import java.util.*; import java.util.concurrent.*; public final class LeftSpineFib extends RecursiveAction { // Performance-tuning constant: static int sequentialThreshold; static long lastStealCount; public static void main(String[] args) throws Exception { int procs = 0; int num = 45; sequentialThreshold = 2; try { if (args.length > 0) procs = Integer.parseInt(args[0]); if (args.length > 1) num = Integer.parseInt(args[1]); if (args.length > 2) sequentialThreshold = Integer.parseInt(args[2]); } catch (Exception e) { System.out.println("Usage: java LeftSpineFib []"); return; } for (int reps = 0; reps < 2; ++reps) { ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); // g.setMaintainsParallelism(false); lastStealCount = g.getStealCount(); for (int i = 0; i < 20; ++i) { test(g, num); Thread.sleep(50); } System.out.println(g); g.shutdown(); if (!g.awaitTermination(8, TimeUnit.SECONDS)) { System.out.println(g); throw new Error(); } g = null; // System.gc(); Thread.sleep(500); } } static void test(ForkJoinPool g, int num) throws Exception { int ps = g.getParallelism(); long start = System.currentTimeMillis(); LeftSpineFib f = new LeftSpineFib(num, null); g.invoke(f); long time = System.currentTimeMillis() - start; double secs = ((double)time) / 1000.0; long result = f.getAnswer(); System.out.print("JLSFib " + num + " = " + result); System.out.printf("\tTime: %7.3f", secs); long sc = g.getStealCount(); long ns = sc - lastStealCount; lastStealCount = sc; System.out.printf(" Steals/t: %5d", ns/ps); // System.out.printf(" Workers: %8d", g.getRunningThreadCount()); System.out.printf(" Workers: %8d", g.getPoolSize()); System.out.println(); } // Initialized with argument; replaced with result int number; LeftSpineFib next; LeftSpineFib(int n, LeftSpineFib nxt) { number = n; next = nxt; } int getAnswer() { return number; } public final void compute() { int n = number; if (n > 1) { LeftSpineFib rt = null; int r = 0; while (n > sequentialThreshold) { int m = n - 2; if (m <= 1) r += m; else (rt = new LeftSpineFib(m, rt)).fork(); n -= 1; } r += n <= 1 ? n : seqFib(n); if (rt != null) r += collectRights(rt); number = r; } } static final int collectRights(LeftSpineFib rt) { int r = 0; while (rt != null) { LeftSpineFib rn = rt.next; rt.next = null; if (rt.tryUnfork()) rt.compute(); else rt.join(); // rt.join(); r += rt.number; rt = rn; } return r; } // Sequential version for arguments less than threshold static final int seqFib(int n) { // unroll left only int r = 1; do { int m = n - 2; r += m <= 1 ? m : seqFib(m); } while (--n > 1); return r; } } jsr166/src/test/loops/LockOncePerThreadLoops.java0000644000000000000000000000604111537741071017064 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class LockOncePerThreadLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int nlocks = 500000; static int nthreads = 100; static int replications = 20; public static void main(String[] args) throws Exception { if (args.length > 0) replications = Integer.parseInt(args[0]); if (args.length > 1) nlocks = Integer.parseInt(args[1]); print = true; for (int i = 0; i < replications; ++i) { System.out.print("Iteration: " + i); new ReentrantLockLoop().test(); Thread.sleep(100); } pool.shutdown(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; final ReentrantLock[]locks = new ReentrantLock[nlocks]; private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; ReentrantLockLoop() { barrier = new CyclicBarrier(nthreads+1, timer); for (int i = 0; i < nlocks; ++i) locks[i] = new ReentrantLock(); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v; int x = 0; for (int i = 0; i < locks.length; ++i) { locks[i].lock(); try { v = x += ~(v - i); } finally { locks[i].unlock(); } // Once in a while, do something more expensive if ((~i & 255) == 0) { sum += LoopHelpers.compute1(LoopHelpers.compute2(x)); } else sum += sum ^ x; } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/MapLoops.java0000644000000000000000000001362511537741071014313 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; public class MapLoops { static int nkeys = 1000; static int pinsert = 60; static int premove = 2; static int maxThreads = 100; static int nops = 1000000; static int removesPerMaxRandom; static int insertsPerMaxRandom; static final ExecutorService pool = Executors.newCachedThreadPool(); public static void main(String[] args) throws Exception { Class mapClass = null; if (args.length > 0) { try { mapClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } else mapClass = java.util.concurrent.ConcurrentHashMap.class; if (args.length > 1) maxThreads = Integer.parseInt(args[1]); if (args.length > 2) nkeys = Integer.parseInt(args[2]); if (args.length > 3) pinsert = Integer.parseInt(args[3]); if (args.length > 4) premove = Integer.parseInt(args[4]); if (args.length > 5) nops = Integer.parseInt(args[5]); // normalize probabilities wrt random number generator removesPerMaxRandom = (int)(((double)premove/100.0 * 0x7FFFFFFFL)); insertsPerMaxRandom = (int)(((double)pinsert/100.0 * 0x7FFFFFFFL)); System.out.print("Class: " + mapClass.getName()); System.out.print(" threads: " + maxThreads); System.out.print(" size: " + nkeys); System.out.print(" ins: " + pinsert); System.out.print(" rem: " + premove); System.out.print(" ops: " + nops); System.out.println(); int k = 1; int warmups = 2; for (int i = 1; i <= maxThreads;) { Thread.sleep(100); test(i, nkeys, mapClass); if (warmups > 0) --warmups; else if (i == k) { k = i << 1; i = i + (i >>> 1); } else if (i == 1 && k == 2) { i = k; warmups = 1; } else i = k; } pool.shutdown(); } static Integer[] makeKeys(int n) { LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); Integer[] key = new Integer[n]; for (int i = 0; i < key.length; ++i) key[i] = new Integer(rng.next()); return key; } static void shuffleKeys(Integer[] key) { Random rng = new Random(); for (int i = key.length; i > 1; --i) { int j = rng.nextInt(i); Integer tmp = key[j]; key[j] = key[i-1]; key[i-1] = tmp; } } static void test(int i, int nkeys, Class mapClass) throws Exception { System.out.print("Threads: " + i + "\t:"); Map map = (Map)mapClass.newInstance(); Integer[] key = makeKeys(nkeys); // Uncomment to start with a non-empty table // for (int j = 0; j < nkeys; j += 4) // start 1/4 occupied // map.put(key[j], key[j]); shuffleKeys(key); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(i+1, timer); for (int t = 0; t < i; ++t) pool.execute(new Runner(t, map, key, barrier)); barrier.await(); barrier.await(); long time = timer.getTime(); long tpo = time / (i * (long) nops); System.out.print(LoopHelpers.rightJustify(tpo) + " ns per op"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); map.clear(); } static class Runner implements Runnable { final Map map; final Integer[] key; final LoopHelpers.SimpleRandom rng; final CyclicBarrier barrier; int position; int total; Runner(int id, Map map, Integer[] key, CyclicBarrier barrier) { this.map = map; this.key = key; this.barrier = barrier; position = key.length / 2; rng = new LoopHelpers.SimpleRandom((id + 1) * 8862213513L); rng.next(); } int step() { // random-walk around key positions, bunching accesses int r = rng.next(); position += (r & 7) - 3; while (position >= key.length) position -= key.length; while (position < 0) position += key.length; Integer k = key[position]; Integer x = map.get(k); if (x != null) { if (x.intValue() != k.intValue()) throw new Error("bad mapping: " + x + " to " + k); if (r < removesPerMaxRandom) { if (map.remove(k) != null) { position = total % key.length; // move from position return 2; } } } else if (r < insertsPerMaxRandom) { ++position; map.put(k, k); return 2; } // Uncomment to add a little computation between accesses // total += LoopHelpers.compute1(k.intValue()); total += r; return 1; } public void run() { try { barrier.await(); int ops = nops; while (ops > 0) ops -= step(); barrier.await(); } catch (Exception ex) { ex.printStackTrace(); } } } } jsr166/src/test/loops/dir.txt0000644000000000000000000376427310235476645013262 0ustar SCCS SCCS/s.overview-bundled.html SCCS/s.jdi-overview.html SCCS/s.overview-core.html com com/sun com/sun/accessibility com/sun/accessibility/internal com/sun/accessibility/internal/resources com/sun/accessibility/internal/resources/SCCS com/sun/accessibility/internal/resources/SCCS/s.accessibility_de.properties com/sun/accessibility/internal/resources/SCCS/s.accessibility.properties com/sun/accessibility/internal/resources/SCCS/s.accessibility_en.properties com/sun/accessibility/internal/resources/SCCS/s.accessibility_es.properties com/sun/accessibility/internal/resources/SCCS/s.accessibility_fr.properties com/sun/accessibility/internal/resources/SCCS/s.accessibility_it.properties com/sun/accessibility/internal/resources/SCCS/s.accessibility_ja.properties com/sun/accessibility/internal/resources/SCCS/s.accessibility_ko.properties com/sun/accessibility/internal/resources/SCCS/s.accessibility_sv.properties com/sun/accessibility/internal/resources/SCCS/s.accessibility_zh_CN.properties com/sun/accessibility/internal/resources/SCCS/s.accessibility_zh_TW.properties com/sun/accessibility/internal/resources/accessibility_zh_CN.properties com/sun/accessibility/internal/resources/accessibility.properties com/sun/accessibility/internal/resources/accessibility_de.properties com/sun/accessibility/internal/resources/accessibility_en.properties com/sun/accessibility/internal/resources/accessibility_es.properties com/sun/accessibility/internal/resources/accessibility_fr.properties com/sun/accessibility/internal/resources/accessibility_it.properties com/sun/accessibility/internal/resources/accessibility_ja.properties com/sun/accessibility/internal/resources/accessibility_ko.properties com/sun/accessibility/internal/resources/accessibility_sv.properties com/sun/accessibility/internal/resources/accessibility_zh_TW.properties com/sun/beans com/sun/beans/SCCS com/sun/beans/SCCS/s.ObjectHandler.java com/sun/beans/ObjectHandler.java com/sun/corba com/sun/corba/se com/sun/corba/se/ActivationIDL com/sun/corba/se/ActivationIDL/SCCS com/sun/corba/se/GiopIDL com/sun/corba/se/GiopIDL/SCCS com/sun/corba/se/GiopIDL/SCCS/s.messages.idl com/sun/corba/se/GiopIDL/SCCS/s.GIOP.idl com/sun/corba/se/GiopIDL/messages.idl com/sun/corba/se/GiopIDL/GIOP.idl com/sun/corba/se/PortableActivationIDL com/sun/corba/se/PortableActivationIDL/SCCS com/sun/corba/se/PortableActivationIDL/SCCS/s.activation.idl com/sun/corba/se/PortableActivationIDL/activation.idl com/sun/corba/se/connection com/sun/corba/se/connection/SCCS com/sun/corba/se/extension com/sun/corba/se/extension/SCCS com/sun/corba/se/impl com/sun/corba/se/impl/activation com/sun/corba/se/impl/activation/SCCS com/sun/corba/se/impl/activation/SCCS/s.NameServiceStartThread.java com/sun/corba/se/impl/activation/SCCS/s.CommandHandler.java com/sun/corba/se/impl/activation/SCCS/s.ServerMain.java com/sun/corba/se/impl/activation/SCCS/s.ORBD.java com/sun/corba/se/impl/activation/SCCS/s.ProcessMonitorThread.java com/sun/corba/se/impl/activation/SCCS/s.RepositoryImpl.java com/sun/corba/se/impl/activation/SCCS/s.ServerManagerImpl.java com/sun/corba/se/impl/activation/SCCS/s.ServerTableEntry.java com/sun/corba/se/impl/activation/SCCS/s.ServerTool.java com/sun/corba/se/impl/activation/NameServiceStartThread.java com/sun/corba/se/impl/activation/CommandHandler.java com/sun/corba/se/impl/activation/RepositoryImpl.java com/sun/corba/se/impl/activation/ORBD.java com/sun/corba/se/impl/activation/ProcessMonitorThread.java com/sun/corba/se/impl/activation/ServerMain.java com/sun/corba/se/impl/activation/ServerManagerImpl.java com/sun/corba/se/impl/activation/ServerTableEntry.java com/sun/corba/se/impl/activation/ServerTool.java com/sun/corba/se/impl/copyobject com/sun/corba/se/impl/copyobject/SCCS com/sun/corba/se/impl/copyobject/SCCS/s.FallbackObjectCopierImpl.java com/sun/corba/se/impl/copyobject/SCCS/s.CopierManagerImpl.java com/sun/corba/se/impl/copyobject/SCCS/s.JavaStreamObjectCopierImpl.java com/sun/corba/se/impl/copyobject/SCCS/s.JavaInputStream.sjava com/sun/corba/se/impl/copyobject/SCCS/s.JavaOutputStream.sjava com/sun/corba/se/impl/copyobject/SCCS/s.ORBStreamObjectCopierImpl.java com/sun/corba/se/impl/copyobject/SCCS/s.ReferenceObjectCopierImpl.java com/sun/corba/se/impl/copyobject/FallbackObjectCopierImpl.java com/sun/corba/se/impl/copyobject/CopierManagerImpl.java com/sun/corba/se/impl/copyobject/JavaStreamObjectCopierImpl.java com/sun/corba/se/impl/copyobject/JavaInputStream.sjava com/sun/corba/se/impl/copyobject/JavaOutputStream.sjava com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java com/sun/corba/se/impl/copyobject/ReferenceObjectCopierImpl.java com/sun/corba/se/impl/corba com/sun/corba/se/impl/corba/SCCS com/sun/corba/se/impl/corba/SCCS/s.AnyImplHelper.java com/sun/corba/se/impl/corba/SCCS/s.AnyImpl.java com/sun/corba/se/impl/corba/SCCS/s.CORBAObjectImpl.java com/sun/corba/se/impl/corba/SCCS/s.AsynchInvoke.java com/sun/corba/se/impl/corba/SCCS/s.ExceptionListImpl.java com/sun/corba/se/impl/corba/SCCS/s.ContextImpl.java com/sun/corba/se/impl/corba/SCCS/s.ContextListImpl.java com/sun/corba/se/impl/corba/SCCS/s.EnvironmentImpl.java com/sun/corba/se/impl/corba/SCCS/s.ServerRequestImpl.java com/sun/corba/se/impl/corba/SCCS/s.NVListImpl.java com/sun/corba/se/impl/corba/SCCS/s.NamedValueImpl.java com/sun/corba/se/impl/corba/SCCS/s.PrincipalImpl.java com/sun/corba/se/impl/corba/SCCS/s.RequestImpl.java com/sun/corba/se/impl/corba/SCCS/s.TCUtility.java com/sun/corba/se/impl/corba/SCCS/s.TypeCodeFactory.java com/sun/corba/se/impl/corba/SCCS/s.TypeCodeImpl.java com/sun/corba/se/impl/corba/SCCS/s.TypeCodeImplHelper.java com/sun/corba/se/impl/corba/SCCS/s.orb_config_design.txt com/sun/corba/se/impl/corba/AnyImplHelper.java com/sun/corba/se/impl/corba/AnyImpl.java com/sun/corba/se/impl/corba/AsynchInvoke.java com/sun/corba/se/impl/corba/CORBAObjectImpl.java com/sun/corba/se/impl/corba/ContextImpl.java com/sun/corba/se/impl/corba/ContextListImpl.java com/sun/corba/se/impl/corba/EnvironmentImpl.java com/sun/corba/se/impl/corba/ExceptionListImpl.java com/sun/corba/se/impl/corba/NVListImpl.java com/sun/corba/se/impl/corba/NamedValueImpl.java com/sun/corba/se/impl/corba/PrincipalImpl.java com/sun/corba/se/impl/corba/RequestImpl.java com/sun/corba/se/impl/corba/ServerRequestImpl.java com/sun/corba/se/impl/corba/TCUtility.java com/sun/corba/se/impl/corba/TypeCodeFactory.java com/sun/corba/se/impl/corba/TypeCodeImpl.java com/sun/corba/se/impl/corba/TypeCodeImplHelper.java com/sun/corba/se/impl/corba/orb_config_design.txt com/sun/corba/se/impl/core com/sun/corba/se/impl/core/SCCS com/sun/corba/se/impl/dynamicany com/sun/corba/se/impl/dynamicany/SCCS com/sun/corba/se/impl/dynamicany/SCCS/s.DynAnyCollectionImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynAnyBasicImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynAnyComplexImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynAnyConstructedImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynAnyFactoryImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynAnyImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynAnyUtil.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynArrayImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynEnumImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynFixedImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynSequenceImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynStructImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynUnionImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynValueBoxImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynValueCommonImpl.java com/sun/corba/se/impl/dynamicany/SCCS/s.DynValueImpl.java com/sun/corba/se/impl/dynamicany/DynAnyCollectionImpl.java com/sun/corba/se/impl/dynamicany/DynAnyBasicImpl.java com/sun/corba/se/impl/dynamicany/DynAnyComplexImpl.java com/sun/corba/se/impl/dynamicany/DynAnyConstructedImpl.java com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java com/sun/corba/se/impl/dynamicany/DynAnyImpl.java com/sun/corba/se/impl/dynamicany/DynAnyUtil.java com/sun/corba/se/impl/dynamicany/DynArrayImpl.java com/sun/corba/se/impl/dynamicany/DynEnumImpl.java com/sun/corba/se/impl/dynamicany/DynFixedImpl.java com/sun/corba/se/impl/dynamicany/DynSequenceImpl.java com/sun/corba/se/impl/dynamicany/DynStructImpl.java com/sun/corba/se/impl/dynamicany/DynUnionImpl.java com/sun/corba/se/impl/dynamicany/DynValueBoxImpl.java com/sun/corba/se/impl/dynamicany/DynValueCommonImpl.java com/sun/corba/se/impl/dynamicany/DynValueImpl.java com/sun/corba/se/impl/encoding com/sun/corba/se/impl/encoding/SCCS com/sun/corba/se/impl/encoding/SCCS/s.BufferManagerReadGrow.java com/sun/corba/se/impl/encoding/SCCS/s.BufferManagerFactory.java com/sun/corba/se/impl/encoding/SCCS/s.BufferManagerRead.java com/sun/corba/se/impl/encoding/SCCS/s.BufferManagerReadStream.java com/sun/corba/se/impl/encoding/SCCS/s.BufferManagerWrite.java com/sun/corba/se/impl/encoding/SCCS/s.BufferManagerWriteCollect.java com/sun/corba/se/impl/encoding/SCCS/s.BufferManagerWriteGrow.java com/sun/corba/se/impl/encoding/SCCS/s.BufferManagerWriteStream.java com/sun/corba/se/impl/encoding/SCCS/s.BufferQueue.java com/sun/corba/se/impl/encoding/SCCS/s.ByteBufferWithInfo.java com/sun/corba/se/impl/encoding/SCCS/s.CDRInputObject.java com/sun/corba/se/impl/encoding/SCCS/s.CDRInputStream.java com/sun/corba/se/impl/encoding/SCCS/s.IDLJavaSerializationInputStream.java com/sun/corba/se/impl/encoding/SCCS/s.CDRInputStreamBase.java com/sun/corba/se/impl/encoding/SCCS/s.CDRInputStream_1_0.java com/sun/corba/se/impl/encoding/SCCS/s.CDRInputStream_1_1.java com/sun/corba/se/impl/encoding/SCCS/s.CDRInputStream_1_2.java com/sun/corba/se/impl/encoding/SCCS/s.CDROutputObject.java com/sun/corba/se/impl/encoding/SCCS/s.CDROutputStream.java com/sun/corba/se/impl/encoding/SCCS/s.CDROutputStreamBase.java com/sun/corba/se/impl/encoding/SCCS/s.CDROutputStream_1_0.java com/sun/corba/se/impl/encoding/SCCS/s.CDROutputStream_1_1.java com/sun/corba/se/impl/encoding/SCCS/s.CDROutputStream_1_2.java com/sun/corba/se/impl/encoding/SCCS/s.CachedCodeBase.java com/sun/corba/se/impl/encoding/SCCS/s.CodeSetCache.java com/sun/corba/se/impl/encoding/SCCS/s.CodeSetComponentInfo.java com/sun/corba/se/impl/encoding/SCCS/s.CodeSetConversion.java com/sun/corba/se/impl/encoding/SCCS/s.EncapsInputStream.java com/sun/corba/se/impl/encoding/SCCS/s.EncapsOutputStream.java com/sun/corba/se/impl/encoding/SCCS/s.IDLJavaSerializationOutputStream.java com/sun/corba/se/impl/encoding/SCCS/s.MarkAndResetHandler.java com/sun/corba/se/impl/encoding/SCCS/s.MarshalInputStream.java com/sun/corba/se/impl/encoding/SCCS/s.MarshalOutputStream.java com/sun/corba/se/impl/encoding/SCCS/s.OSFCodeSetRegistry.java com/sun/corba/se/impl/encoding/SCCS/s.RestorableInputStream.java com/sun/corba/se/impl/encoding/SCCS/s.TypeCodeInputStream.java com/sun/corba/se/impl/encoding/SCCS/s.TypeCodeOutputStream.java com/sun/corba/se/impl/encoding/SCCS/s.TypeCodeReader.java com/sun/corba/se/impl/encoding/SCCS/s.WrapperInputStream.java com/sun/corba/se/impl/encoding/BufferManagerReadStream.java com/sun/corba/se/impl/encoding/BufferManagerFactory.java com/sun/corba/se/impl/encoding/BufferManagerRead.java com/sun/corba/se/impl/encoding/BufferManagerReadGrow.java com/sun/corba/se/impl/encoding/BufferManagerWriteCollect.java com/sun/corba/se/impl/encoding/BufferManagerWrite.java com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java com/sun/corba/se/impl/encoding/BufferQueue.java com/sun/corba/se/impl/encoding/ByteBufferWithInfo.java com/sun/corba/se/impl/encoding/CDRInputObject.java com/sun/corba/se/impl/encoding/CDRInputStream.java com/sun/corba/se/impl/encoding/WrapperInputStream.java com/sun/corba/se/impl/encoding/TypeCodeReader.java com/sun/corba/se/impl/encoding/CDRInputStreamBase.java com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java com/sun/corba/se/impl/encoding/CDRInputStream_1_1.java com/sun/corba/se/impl/encoding/CDRInputStream_1_2.java com/sun/corba/se/impl/encoding/CDROutputObject.java com/sun/corba/se/impl/encoding/CDROutputStream.java com/sun/corba/se/impl/encoding/CDROutputStreamBase.java com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java com/sun/corba/se/impl/encoding/CDROutputStream_1_1.java com/sun/corba/se/impl/encoding/CDROutputStream_1_2.java com/sun/corba/se/impl/encoding/CachedCodeBase.java com/sun/corba/se/impl/encoding/CodeSetCache.java com/sun/corba/se/impl/encoding/CodeSetComponentInfo.java com/sun/corba/se/impl/encoding/CodeSetConversion.java com/sun/corba/se/impl/encoding/EncapsInputStream.java com/sun/corba/se/impl/encoding/EncapsOutputStream.java com/sun/corba/se/impl/encoding/IDLJavaSerializationInputStream.java com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java com/sun/corba/se/impl/encoding/MarkAndResetHandler.java com/sun/corba/se/impl/encoding/MarshalInputStream.java com/sun/corba/se/impl/encoding/MarshalOutputStream.java com/sun/corba/se/impl/encoding/OSFCodeSetRegistry.java com/sun/corba/se/impl/encoding/RestorableInputStream.java com/sun/corba/se/impl/encoding/TypeCodeInputStream.java com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java com/sun/corba/se/impl/interceptors com/sun/corba/se/impl/interceptors/SCCS com/sun/corba/se/impl/interceptors/SCCS/s.ClientRequestInfoImpl.java com/sun/corba/se/impl/interceptors/SCCS/s.CDREncapsCodec.java com/sun/corba/se/impl/interceptors/SCCS/s.InterceptorInvoker.java com/sun/corba/se/impl/interceptors/SCCS/s.CodecFactoryImpl.java com/sun/corba/se/impl/interceptors/SCCS/s.IORInfoImpl.java com/sun/corba/se/impl/interceptors/SCCS/s.ServerRequestInfoImpl.java com/sun/corba/se/impl/interceptors/SCCS/s.InterceptorList.java com/sun/corba/se/impl/interceptors/SCCS/s.ORBInitInfoImpl.java com/sun/corba/se/impl/interceptors/SCCS/s.PICurrent.java com/sun/corba/se/impl/interceptors/SCCS/s.PIHandlerImpl.java com/sun/corba/se/impl/interceptors/SCCS/s.PINoOpHandlerImpl.java com/sun/corba/se/impl/interceptors/SCCS/s.RequestInfoImpl.java com/sun/corba/se/impl/interceptors/SCCS/s.SlotTable.java com/sun/corba/se/impl/interceptors/SCCS/s.SlotTableStack.java com/sun/corba/se/impl/interceptors/SCCS/s.ThreadCurrentStack.sjava com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java com/sun/corba/se/impl/interceptors/CDREncapsCodec.java com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java com/sun/corba/se/impl/interceptors/CodecFactoryImpl.java com/sun/corba/se/impl/interceptors/IORInfoImpl.java com/sun/corba/se/impl/interceptors/InterceptorInvoker.java com/sun/corba/se/impl/interceptors/InterceptorList.java com/sun/corba/se/impl/interceptors/ORBInitInfoImpl.java com/sun/corba/se/impl/interceptors/PICurrent.java com/sun/corba/se/impl/interceptors/PIHandlerImpl.java com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java com/sun/corba/se/impl/interceptors/RequestInfoImpl.java com/sun/corba/se/impl/interceptors/SlotTable.java com/sun/corba/se/impl/interceptors/SlotTableStack.java com/sun/corba/se/impl/interceptors/ThreadCurrentStack.sjava com/sun/corba/se/impl/io com/sun/corba/se/impl/io/SCCS com/sun/corba/se/impl/io/SCCS/s.ObjectStreamClass.java com/sun/corba/se/impl/io/SCCS/s.FVDCodeBaseImpl.java com/sun/corba/se/impl/io/SCCS/s.IIOPInputStream.java com/sun/corba/se/impl/io/SCCS/s.IIOPOutputStream.java com/sun/corba/se/impl/io/SCCS/s.InputStreamHook.java com/sun/corba/se/impl/io/SCCS/s.ObjectStreamClassCorbaExt.java com/sun/corba/se/impl/io/SCCS/s.ObjectStreamField.java com/sun/corba/se/impl/io/SCCS/s.OptionalDataException.java com/sun/corba/se/impl/io/SCCS/s.OutputStreamHook.java com/sun/corba/se/impl/io/SCCS/s.TypeMismatchException.java com/sun/corba/se/impl/io/SCCS/s.ValueHandlerImpl.java com/sun/corba/se/impl/io/SCCS/s.ValueUtility.java com/sun/corba/se/impl/io/ObjectStreamClassCorbaExt.java com/sun/corba/se/impl/io/FVDCodeBaseImpl.java com/sun/corba/se/impl/io/IIOPInputStream.java com/sun/corba/se/impl/io/IIOPOutputStream.java com/sun/corba/se/impl/io/InputStreamHook.java com/sun/corba/se/impl/io/ObjectStreamClass.java com/sun/corba/se/impl/io/OptionalDataException.java com/sun/corba/se/impl/io/ObjectStreamField.java com/sun/corba/se/impl/io/OutputStreamHook.java com/sun/corba/se/impl/io/TypeMismatchException.java com/sun/corba/se/impl/io/ValueHandlerImpl.java com/sun/corba/se/impl/io/ValueUtility.java com/sun/corba/se/impl/ior com/sun/corba/se/impl/ior/SCCS com/sun/corba/se/impl/ior/SCCS/s.EncapsulationUtility.java com/sun/corba/se/impl/ior/SCCS/s.ByteBuffer.java com/sun/corba/se/impl/ior/SCCS/s.GenericIdentifiable.java com/sun/corba/se/impl/ior/SCCS/s.FreezableList.java com/sun/corba/se/impl/ior/SCCS/s.IdentifiableFactoryFinderBase.java com/sun/corba/se/impl/ior/SCCS/s.GenericTaggedComponent.java com/sun/corba/se/impl/ior/SCCS/s.GenericTaggedProfile.java com/sun/corba/se/impl/ior/SCCS/s.IORImpl.java com/sun/corba/se/impl/ior/SCCS/s.IORTemplateImpl.java com/sun/corba/se/impl/ior/SCCS/s.IORTemplateListImpl.java com/sun/corba/se/impl/ior/SCCS/s.JIDLObjectKeyTemplate.java com/sun/corba/se/impl/ior/SCCS/s.NewObjectKeyTemplateBase.java com/sun/corba/se/impl/ior/SCCS/s.TaggedProfileTemplateFactoryFinderImpl.java com/sun/corba/se/impl/ior/SCCS/s.ObjectAdapterIdArray.java com/sun/corba/se/impl/ior/SCCS/s.ObjectAdapterIdBase.java com/sun/corba/se/impl/ior/SCCS/s.ObjectAdapterIdNumber.java com/sun/corba/se/impl/ior/SCCS/s.ObjectIdImpl.java com/sun/corba/se/impl/ior/SCCS/s.ObjectKeyFactoryImpl.java com/sun/corba/se/impl/ior/SCCS/s.ObjectKeyImpl.java com/sun/corba/se/impl/ior/SCCS/s.ObjectKeyTemplateBase.java com/sun/corba/se/impl/ior/SCCS/s.ObjectReferenceFactoryImpl.java com/sun/corba/se/impl/ior/SCCS/s.ObjectReferenceProducerBase.java com/sun/corba/se/impl/ior/SCCS/s.ObjectReferenceTemplateImpl.java com/sun/corba/se/impl/ior/SCCS/s.OldJIDLObjectKeyTemplate.java com/sun/corba/se/impl/ior/SCCS/s.OldObjectKeyTemplateBase.java com/sun/corba/se/impl/ior/SCCS/s.OldPOAObjectKeyTemplate.java com/sun/corba/se/impl/ior/SCCS/s.POAObjectKeyTemplate.java com/sun/corba/se/impl/ior/SCCS/s.StubIORImpl.java com/sun/corba/se/impl/ior/SCCS/s.TaggedComponentFactoryFinderImpl.java com/sun/corba/se/impl/ior/SCCS/s.TaggedProfileFactoryFinderImpl.java com/sun/corba/se/impl/ior/SCCS/s.TestAssertions com/sun/corba/se/impl/ior/SCCS/s.ior.mdl com/sun/corba/se/impl/ior/SCCS/s.notes com/sun/corba/se/impl/ior/SCCS/s.WireObjectKeyTemplate.java com/sun/corba/se/impl/ior/iiop com/sun/corba/se/impl/ior/iiop/SCCS com/sun/corba/se/impl/ior/iiop/SCCS/s.AlternateIIOPAddressComponentImpl.java com/sun/corba/se/impl/ior/iiop/SCCS/s.CodeSetsComponentImpl.java com/sun/corba/se/impl/ior/iiop/SCCS/s.IIOPAddressBase.java com/sun/corba/se/impl/ior/iiop/SCCS/s.IIOPAddressClosureImpl.java com/sun/corba/se/impl/ior/iiop/SCCS/s.IIOPAddressImpl.java com/sun/corba/se/impl/ior/iiop/SCCS/s.IIOPProfileImpl.java com/sun/corba/se/impl/ior/iiop/SCCS/s.IIOPProfileTemplateImpl.java com/sun/corba/se/impl/ior/iiop/SCCS/s.JavaCodebaseComponentImpl.java com/sun/corba/se/impl/ior/iiop/SCCS/s.JavaSerializationComponent.java com/sun/corba/se/impl/ior/iiop/SCCS/s.MaxStreamFormatVersionComponentImpl.java com/sun/corba/se/impl/ior/iiop/SCCS/s.ORBTypeComponentImpl.java com/sun/corba/se/impl/ior/iiop/SCCS/s.RequestPartitioningComponentImpl.java com/sun/corba/se/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java com/sun/corba/se/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java com/sun/corba/se/impl/ior/iiop/CodeSetsComponentImpl.java com/sun/corba/se/impl/ior/iiop/IIOPAddressBase.java com/sun/corba/se/impl/ior/iiop/IIOPAddressClosureImpl.java com/sun/corba/se/impl/ior/iiop/IIOPAddressImpl.java com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java com/sun/corba/se/impl/ior/iiop/JavaCodebaseComponentImpl.java com/sun/corba/se/impl/ior/iiop/JavaSerializationComponent.java com/sun/corba/se/impl/ior/iiop/ORBTypeComponentImpl.java com/sun/corba/se/impl/ior/iiop/RequestPartitioningComponentImpl.java com/sun/corba/se/impl/ior/FreezableList.java com/sun/corba/se/impl/ior/ByteBuffer.java com/sun/corba/se/impl/ior/IdentifiableFactoryFinderBase.java com/sun/corba/se/impl/ior/EncapsulationUtility.java com/sun/corba/se/impl/ior/GenericIdentifiable.java com/sun/corba/se/impl/ior/GenericTaggedComponent.java com/sun/corba/se/impl/ior/GenericTaggedProfile.java com/sun/corba/se/impl/ior/IORImpl.java com/sun/corba/se/impl/ior/IORTemplateImpl.java com/sun/corba/se/impl/ior/IORTemplateListImpl.java com/sun/corba/se/impl/ior/ObjectReferenceProducerBase.java com/sun/corba/se/impl/ior/JIDLObjectKeyTemplate.java com/sun/corba/se/impl/ior/NewObjectKeyTemplateBase.java com/sun/corba/se/impl/ior/ObjectAdapterIdArray.java com/sun/corba/se/impl/ior/ObjectAdapterIdBase.java com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java com/sun/corba/se/impl/ior/ObjectIdImpl.java com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java com/sun/corba/se/impl/ior/ObjectKeyImpl.java com/sun/corba/se/impl/ior/ObjectKeyTemplateBase.java com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl.java com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl.java com/sun/corba/se/impl/ior/OldJIDLObjectKeyTemplate.java com/sun/corba/se/impl/ior/OldObjectKeyTemplateBase.java com/sun/corba/se/impl/ior/OldPOAObjectKeyTemplate.java com/sun/corba/se/impl/ior/TestAssertions com/sun/corba/se/impl/ior/ior.mdl com/sun/corba/se/impl/ior/StubIORImpl.java com/sun/corba/se/impl/ior/POAObjectKeyTemplate.java com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java com/sun/corba/se/impl/ior/TaggedProfileFactoryFinderImpl.java com/sun/corba/se/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java com/sun/corba/se/impl/ior/WireObjectKeyTemplate.java com/sun/corba/se/impl/ior/notes com/sun/corba/se/impl/javax com/sun/corba/se/impl/javax/rmi com/sun/corba/se/impl/javax/rmi/CORBA com/sun/corba/se/impl/javax/rmi/CORBA/SCCS com/sun/corba/se/impl/javax/rmi/CORBA/SCCS/s.StubDelegateImpl.java com/sun/corba/se/impl/javax/rmi/CORBA/SCCS/s.Util.java com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java com/sun/corba/se/impl/javax/rmi/CORBA/Util.java com/sun/corba/se/impl/javax/rmi/SCCS com/sun/corba/se/impl/javax/rmi/SCCS/s.PortableRemoteObject.java com/sun/corba/se/impl/javax/rmi/PortableRemoteObject.java com/sun/corba/se/impl/legacy com/sun/corba/se/impl/legacy/connection com/sun/corba/se/impl/legacy/connection/SCCS com/sun/corba/se/impl/legacy/connection/SCCS/s.SocketFactoryAcceptorImpl.java com/sun/corba/se/impl/legacy/connection/SCCS/s.DefaultSocketFactory.java com/sun/corba/se/impl/legacy/connection/SCCS/s.EndPointInfoImpl.java com/sun/corba/se/impl/legacy/connection/SCCS/s.SocketFactoryContactInfoListIteratorImpl.java com/sun/corba/se/impl/legacy/connection/SCCS/s.LegacyServerSocketManagerImpl.java com/sun/corba/se/impl/legacy/connection/SCCS/s.SocketFactoryConnectionImpl.java com/sun/corba/se/impl/legacy/connection/SCCS/s.SocketFactoryContactInfoImpl.java com/sun/corba/se/impl/legacy/connection/SCCS/s.SocketFactoryContactInfoListImpl.java com/sun/corba/se/impl/legacy/connection/SCCS/s.USLPort.java com/sun/corba/se/impl/legacy/connection/LegacyServerSocketManagerImpl.java com/sun/corba/se/impl/legacy/connection/DefaultSocketFactory.java com/sun/corba/se/impl/legacy/connection/EndPointInfoImpl.java com/sun/corba/se/impl/legacy/connection/SocketFactoryConnectionImpl.java com/sun/corba/se/impl/legacy/connection/SocketFactoryAcceptorImpl.java com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoImpl.java com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListImpl.java com/sun/corba/se/impl/legacy/connection/USLPort.java com/sun/corba/se/impl/monitoring com/sun/corba/se/impl/monitoring/SCCS com/sun/corba/se/impl/monitoring/SCCS/s.MonitoredAttributeInfoFactoryImpl.java com/sun/corba/se/impl/monitoring/SCCS/s.MonitoredAttributeInfoImpl.java com/sun/corba/se/impl/monitoring/SCCS/s.MonitoredObjectFactoryImpl.java com/sun/corba/se/impl/monitoring/SCCS/s.MonitoredObjectImpl.java com/sun/corba/se/impl/monitoring/SCCS/s.MonitoringManagerFactoryImpl.java com/sun/corba/se/impl/monitoring/SCCS/s.MonitoringManagerImpl.java com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoFactoryImpl.java com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoImpl.java com/sun/corba/se/impl/monitoring/MonitoredObjectFactoryImpl.java com/sun/corba/se/impl/monitoring/MonitoredObjectImpl.java com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java com/sun/corba/se/impl/naming com/sun/corba/se/impl/naming/cosnaming com/sun/corba/se/impl/naming/cosnaming/SCCS com/sun/corba/se/impl/naming/cosnaming/SCCS/s.InterOperableNamingImpl.java com/sun/corba/se/impl/naming/cosnaming/SCCS/s.BindingIteratorImpl.java com/sun/corba/se/impl/naming/cosnaming/SCCS/s.InternalBindingKey.java com/sun/corba/se/impl/naming/cosnaming/SCCS/s.InternalBindingValue.java com/sun/corba/se/impl/naming/cosnaming/SCCS/s.NamingContextDataStore.java com/sun/corba/se/impl/naming/cosnaming/SCCS/s.NamingContextImpl.java com/sun/corba/se/impl/naming/cosnaming/SCCS/s.NamingUtils.java com/sun/corba/se/impl/naming/cosnaming/SCCS/s.TransientBindingIterator.java com/sun/corba/se/impl/naming/cosnaming/SCCS/s.TransientNameServer.java com/sun/corba/se/impl/naming/cosnaming/SCCS/s.TransientNameService.java com/sun/corba/se/impl/naming/cosnaming/SCCS/s.TransientNamingContext.java com/sun/corba/se/impl/naming/cosnaming/InterOperableNamingImpl.java com/sun/corba/se/impl/naming/cosnaming/BindingIteratorImpl.java com/sun/corba/se/impl/naming/cosnaming/TransientBindingIterator.java com/sun/corba/se/impl/naming/cosnaming/InternalBindingKey.java com/sun/corba/se/impl/naming/cosnaming/InternalBindingValue.java com/sun/corba/se/impl/naming/cosnaming/NamingContextDataStore.java com/sun/corba/se/impl/naming/cosnaming/NamingContextImpl.java com/sun/corba/se/impl/naming/cosnaming/NamingUtils.java com/sun/corba/se/impl/naming/cosnaming/TransientNameServer.java com/sun/corba/se/impl/naming/cosnaming/TransientNameService.java com/sun/corba/se/impl/naming/cosnaming/TransientNamingContext.java com/sun/corba/se/impl/naming/namingutil com/sun/corba/se/impl/naming/namingutil/SCCS com/sun/corba/se/impl/naming/namingutil/SCCS/s.IIOPEndpointInfo.java com/sun/corba/se/impl/naming/namingutil/SCCS/s.CorbalocURL.java com/sun/corba/se/impl/naming/namingutil/SCCS/s.CorbanameURL.java com/sun/corba/se/impl/naming/namingutil/SCCS/s.INSURLHandler.java com/sun/corba/se/impl/naming/namingutil/SCCS/s.INSURL.java com/sun/corba/se/impl/naming/namingutil/SCCS/s.INSURLBase.java com/sun/corba/se/impl/naming/namingutil/SCCS/s.NamingConstants.java com/sun/corba/se/impl/naming/namingutil/SCCS/s.Utility.java com/sun/corba/se/impl/naming/namingutil/IIOPEndpointInfo.java com/sun/corba/se/impl/naming/namingutil/CorbalocURL.java com/sun/corba/se/impl/naming/namingutil/CorbanameURL.java com/sun/corba/se/impl/naming/namingutil/INSURLHandler.java com/sun/corba/se/impl/naming/namingutil/INSURL.java com/sun/corba/se/impl/naming/namingutil/INSURLBase.java com/sun/corba/se/impl/naming/namingutil/NamingConstants.java com/sun/corba/se/impl/naming/namingutil/Utility.java com/sun/corba/se/impl/naming/pcosnaming com/sun/corba/se/impl/naming/pcosnaming/SCCS com/sun/corba/se/impl/naming/pcosnaming/SCCS/s.PersistentBindingIterator.java com/sun/corba/se/impl/naming/pcosnaming/SCCS/s.InternalBindingKey.java com/sun/corba/se/impl/naming/pcosnaming/SCCS/s.InternalBindingValue.java com/sun/corba/se/impl/naming/pcosnaming/SCCS/s.NameServer.java com/sun/corba/se/impl/naming/pcosnaming/SCCS/s.NameService.java com/sun/corba/se/impl/naming/pcosnaming/SCCS/s.NamingContextImpl.java com/sun/corba/se/impl/naming/pcosnaming/SCCS/s.ServantManagerImpl.java com/sun/corba/se/impl/naming/pcosnaming/InternalBindingValue.java com/sun/corba/se/impl/naming/pcosnaming/InternalBindingKey.java com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java com/sun/corba/se/impl/naming/pcosnaming/NameServer.java com/sun/corba/se/impl/naming/pcosnaming/NameService.java com/sun/corba/se/impl/naming/pcosnaming/PersistentBindingIterator.java com/sun/corba/se/impl/naming/pcosnaming/ServantManagerImpl.java com/sun/corba/se/impl/oa com/sun/corba/se/impl/oa/SCCS com/sun/corba/se/impl/oa/SCCS/s.NullServantImpl.java com/sun/corba/se/impl/oa/poa com/sun/corba/se/impl/oa/poa/SCCS com/sun/corba/se/impl/oa/poa/SCCS/s.ActiveObjectMap.java com/sun/corba/se/impl/oa/poa/SCCS/s.AOMEntry.java com/sun/corba/se/impl/oa/poa/SCCS/s.IdAssignmentPolicyImpl.java com/sun/corba/se/impl/oa/poa/SCCS/s.BadServerIdHandler.java com/sun/corba/se/impl/oa/poa/SCCS/s.DelegateImpl.java com/sun/corba/se/impl/oa/poa/SCCS/s.IdUniquenessPolicyImpl.java com/sun/corba/se/impl/oa/poa/SCCS/s.ImplicitActivationPolicyImpl.java com/sun/corba/se/impl/oa/poa/SCCS/s.LifespanPolicyImpl.java com/sun/corba/se/impl/oa/poa/SCCS/s.POACurrent.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAFactory.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAImpl.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAManagerImpl.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAPolicyMediator.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAPolicyMediatorBase.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAPolicyMediatorBase_R.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAPolicyMediatorFactory.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAPolicyMediatorImpl_NR_UDS.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAPolicyMediatorImpl_NR_USM.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAPolicyMediatorImpl_R_AOM.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAPolicyMediatorImpl_R_UDS.java com/sun/corba/se/impl/oa/poa/SCCS/s.POAPolicyMediatorImpl_R_USM.java com/sun/corba/se/impl/oa/poa/SCCS/s.Policies.java com/sun/corba/se/impl/oa/poa/SCCS/s.RequestProcessingPolicyImpl.java com/sun/corba/se/impl/oa/poa/SCCS/s.ServantRetentionPolicyImpl.java com/sun/corba/se/impl/oa/poa/SCCS/s.ThreadPolicyImpl.java com/sun/corba/se/impl/oa/poa/SCCS/s.minor_code_example.txt com/sun/corba/se/impl/oa/poa/SCCS/s.standard_minor_codes.txt com/sun/corba/se/impl/oa/poa/ActiveObjectMap.java com/sun/corba/se/impl/oa/poa/AOMEntry.java com/sun/corba/se/impl/oa/poa/IdAssignmentPolicyImpl.java com/sun/corba/se/impl/oa/poa/BadServerIdHandler.java com/sun/corba/se/impl/oa/poa/DelegateImpl.java com/sun/corba/se/impl/oa/poa/ImplicitActivationPolicyImpl.java com/sun/corba/se/impl/oa/poa/IdUniquenessPolicyImpl.java com/sun/corba/se/impl/oa/poa/LifespanPolicyImpl.java com/sun/corba/se/impl/oa/poa/POACurrent.java com/sun/corba/se/impl/oa/poa/POAFactory.java com/sun/corba/se/impl/oa/poa/POAImpl.java com/sun/corba/se/impl/oa/poa/POAManagerImpl.java com/sun/corba/se/impl/oa/poa/POAPolicyMediator.java com/sun/corba/se/impl/oa/poa/Policies.java com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase.java com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java com/sun/corba/se/impl/oa/poa/POAPolicyMediatorFactory.java com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java com/sun/corba/se/impl/oa/poa/RequestProcessingPolicyImpl.java com/sun/corba/se/impl/oa/poa/ServantRetentionPolicyImpl.java com/sun/corba/se/impl/oa/poa/ThreadPolicyImpl.java com/sun/corba/se/impl/oa/poa/minor_code_example.txt com/sun/corba/se/impl/oa/poa/standard_minor_codes.txt com/sun/corba/se/impl/oa/toa com/sun/corba/se/impl/oa/toa/SCCS com/sun/corba/se/impl/oa/toa/SCCS/s.TOAFactory.java com/sun/corba/se/impl/oa/toa/SCCS/s.TOA.java com/sun/corba/se/impl/oa/toa/SCCS/s.TOAImpl.java com/sun/corba/se/impl/oa/toa/SCCS/s.TransientObjectManager.java com/sun/corba/se/impl/oa/toa/TOAFactory.java com/sun/corba/se/impl/oa/toa/TOA.java com/sun/corba/se/impl/oa/toa/TOAImpl.java com/sun/corba/se/impl/oa/toa/TransientObjectManager.java com/sun/corba/se/impl/oa/NullServantImpl.java com/sun/corba/se/impl/orb com/sun/corba/se/impl/orb/SCCS com/sun/corba/se/impl/orb/SCCS/s.AppletDataCollector.java com/sun/corba/se/impl/orb/SCCS/s.DataCollectorBase.java com/sun/corba/se/impl/orb/SCCS/s.DataCollectorFactory.java com/sun/corba/se/impl/orb/SCCS/s.NormalDataCollector.java com/sun/corba/se/impl/orb/SCCS/s.NormalParserAction.java com/sun/corba/se/impl/orb/SCCS/s.NormalParserData.java com/sun/corba/se/impl/orb/SCCS/s.ORBConfiguratorImpl.java com/sun/corba/se/impl/orb/SCCS/s.ORBDataParserImpl.java com/sun/corba/se/impl/orb/SCCS/s.ORBImpl.java com/sun/corba/se/impl/orb/SCCS/s.ORBSingleton.java com/sun/corba/se/impl/orb/SCCS/s.ORBVersionImpl.java com/sun/corba/se/impl/orb/SCCS/s.ParserAction.java com/sun/corba/se/impl/orb/SCCS/s.ParserActionBase.java com/sun/corba/se/impl/orb/SCCS/s.ParserActionFactory.java com/sun/corba/se/impl/orb/SCCS/s.ParserDataBase.java com/sun/corba/se/impl/orb/SCCS/s.ParserTable.java com/sun/corba/se/impl/orb/SCCS/s.PrefixParserAction.java com/sun/corba/se/impl/orb/SCCS/s.PrefixParserData.java com/sun/corba/se/impl/orb/SCCS/s.PropertyOnlyDataCollector.java com/sun/corba/se/impl/orb/SCCS/s.parsing_combinators.txt com/sun/corba/se/impl/orb/AppletDataCollector.java com/sun/corba/se/impl/orb/DataCollectorBase.java com/sun/corba/se/impl/orb/DataCollectorFactory.java com/sun/corba/se/impl/orb/NormalDataCollector.java com/sun/corba/se/impl/orb/NormalParserAction.java com/sun/corba/se/impl/orb/NormalParserData.java com/sun/corba/se/impl/orb/ORBConfiguratorImpl.java com/sun/corba/se/impl/orb/ORBDataParserImpl.java com/sun/corba/se/impl/orb/ORBImpl.java com/sun/corba/se/impl/orb/ORBSingleton.java com/sun/corba/se/impl/orb/ORBVersionImpl.java com/sun/corba/se/impl/orb/ParserAction.java com/sun/corba/se/impl/orb/ParserActionBase.java com/sun/corba/se/impl/orb/ParserActionFactory.java com/sun/corba/se/impl/orb/ParserDataBase.java com/sun/corba/se/impl/orb/ParserTable.java com/sun/corba/se/impl/orb/PrefixParserAction.java com/sun/corba/se/impl/orb/PrefixParserData.java com/sun/corba/se/impl/orb/PropertyOnlyDataCollector.java com/sun/corba/se/impl/orb/parsing_combinators.txt com/sun/corba/se/impl/orbutil com/sun/corba/se/impl/orbutil/SCCS com/sun/corba/se/impl/orbutil/SCCS/s.CorbaResourceUtil.java com/sun/corba/se/impl/orbutil/SCCS/s.CacheTable.java com/sun/corba/se/impl/orbutil/SCCS/s.GetPropertyAction.java com/sun/corba/se/impl/orbutil/SCCS/s.DefineWrapper.sjava com/sun/corba/se/impl/orbutil/SCCS/s.DenseIntMapImpl.java com/sun/corba/se/impl/orbutil/SCCS/s.IIOPInputStream_1_3_1.java com/sun/corba/se/impl/orbutil/SCCS/s.HexOutputStream.java com/sun/corba/se/impl/orbutil/SCCS/s.IIOPInputStream_1_3.java com/sun/corba/se/impl/orbutil/SCCS/s.IIOPOutputStream_1_3.java com/sun/corba/se/impl/orbutil/SCCS/s.IIOPOutputStream_1_3_1.java com/sun/corba/se/impl/orbutil/SCCS/s.LegacyHookGetFields.java com/sun/corba/se/impl/orbutil/SCCS/s.LegacyHookPutFields.java com/sun/corba/se/impl/orbutil/SCCS/s.LogKeywords.java com/sun/corba/se/impl/orbutil/SCCS/s.ObjectStreamClass_1_3_1.java com/sun/corba/se/impl/orbutil/SCCS/s.ORBClassLoader.java com/sun/corba/se/impl/orbutil/SCCS/s.ORBConstants.java com/sun/corba/se/impl/orbutil/SCCS/s.ORBUtility.java com/sun/corba/se/impl/orbutil/SCCS/s.ObjectStreamClassUtil_1_3.java com/sun/corba/se/impl/orbutil/SCCS/s.ObjectStreamField.java com/sun/corba/se/impl/orbutil/SCCS/s.ObjectUtility.java com/sun/corba/se/impl/orbutil/SCCS/s.ObjectWriter.java com/sun/corba/se/impl/orbutil/SCCS/s.RepIdDelegator.java com/sun/corba/se/impl/orbutil/SCCS/s.RepIdDelegator_1_3.java com/sun/corba/se/impl/orbutil/SCCS/s.RepIdDelegator_1_3_1.java com/sun/corba/se/impl/orbutil/SCCS/s.RepositoryIdCache_1_3.java com/sun/corba/se/impl/orbutil/SCCS/s.RepositoryIdCache_1_3_1.java com/sun/corba/se/impl/orbutil/SCCS/s.RepositoryIdFactory.java com/sun/corba/se/impl/orbutil/SCCS/s.RepositoryIdInterface.java com/sun/corba/se/impl/orbutil/SCCS/s.RepositoryIdStrings.java com/sun/corba/se/impl/orbutil/SCCS/s.RepositoryIdUtility.java com/sun/corba/se/impl/orbutil/SCCS/s.RepositoryId_1_3.java com/sun/corba/se/impl/orbutil/SCCS/s.RepositoryId_1_3_1.java com/sun/corba/se/impl/orbutil/SCCS/s.StackImpl.java com/sun/corba/se/impl/orbutil/SCCS/s.ValueHandlerImpl_1_3.java com/sun/corba/se/impl/orbutil/SCCS/s.ValueHandlerImpl_1_3_1.java com/sun/corba/se/impl/orbutil/closure com/sun/corba/se/impl/orbutil/closure/SCCS com/sun/corba/se/impl/orbutil/closure/SCCS/s.Constant.java com/sun/corba/se/impl/orbutil/closure/SCCS/s.Future.java com/sun/corba/se/impl/orbutil/closure/Constant.java com/sun/corba/se/impl/orbutil/closure/Future.java com/sun/corba/se/impl/orbutil/concurrent com/sun/corba/se/impl/orbutil/concurrent/SCCS com/sun/corba/se/impl/orbutil/concurrent/SCCS/s.DebugMutex.java com/sun/corba/se/impl/orbutil/concurrent/SCCS/s.CondVar.java com/sun/corba/se/impl/orbutil/concurrent/SCCS/s.ReentrantMutex.java com/sun/corba/se/impl/orbutil/concurrent/SCCS/s.Mutex.java com/sun/corba/se/impl/orbutil/concurrent/SCCS/s.Sync.java com/sun/corba/se/impl/orbutil/concurrent/SCCS/s.SyncUtil.java com/sun/corba/se/impl/orbutil/concurrent/ReentrantMutex.java com/sun/corba/se/impl/orbutil/concurrent/CondVar.java com/sun/corba/se/impl/orbutil/concurrent/DebugMutex.java com/sun/corba/se/impl/orbutil/concurrent/Mutex.java com/sun/corba/se/impl/orbutil/concurrent/Sync.java com/sun/corba/se/impl/orbutil/concurrent/SyncUtil.java com/sun/corba/se/impl/orbutil/fsm com/sun/corba/se/impl/orbutil/fsm/SCCS com/sun/corba/se/impl/orbutil/fsm/SCCS/s.GuardedAction.java com/sun/corba/se/impl/orbutil/fsm/SCCS/s.NameBase.java com/sun/corba/se/impl/orbutil/fsm/SCCS/s.StateEngineImpl.java com/sun/corba/se/impl/orbutil/fsm/StateEngineImpl.java com/sun/corba/se/impl/orbutil/fsm/GuardedAction.java com/sun/corba/se/impl/orbutil/fsm/NameBase.java com/sun/corba/se/impl/orbutil/graph com/sun/corba/se/impl/orbutil/graph/SCCS com/sun/corba/se/impl/orbutil/graph/SCCS/s.GraphImpl.java com/sun/corba/se/impl/orbutil/graph/SCCS/s.Graph.java com/sun/corba/se/impl/orbutil/graph/SCCS/s.Node.java com/sun/corba/se/impl/orbutil/graph/SCCS/s.NodeData.java com/sun/corba/se/impl/orbutil/graph/GraphImpl.java com/sun/corba/se/impl/orbutil/graph/Graph.java com/sun/corba/se/impl/orbutil/graph/Node.java com/sun/corba/se/impl/orbutil/graph/NodeData.java com/sun/corba/se/impl/orbutil/resources com/sun/corba/se/impl/orbutil/resources/SCCS com/sun/corba/se/impl/orbutil/resources/SCCS/s.sunorb_de.properties com/sun/corba/se/impl/orbutil/resources/SCCS/s.sunorb.properties com/sun/corba/se/impl/orbutil/resources/SCCS/s.sunorb_es.properties com/sun/corba/se/impl/orbutil/resources/SCCS/s.sunorb_fr.properties com/sun/corba/se/impl/orbutil/resources/SCCS/s.sunorb_it.properties com/sun/corba/se/impl/orbutil/resources/SCCS/s.sunorb_ja.properties com/sun/corba/se/impl/orbutil/resources/SCCS/s.sunorb_ko.properties com/sun/corba/se/impl/orbutil/resources/SCCS/s.sunorb_sv.properties com/sun/corba/se/impl/orbutil/resources/SCCS/s.sunorb_zh_CN.properties com/sun/corba/se/impl/orbutil/resources/SCCS/s.sunorb_zh_TW.properties com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties com/sun/corba/se/impl/orbutil/resources/sunorb.properties com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties com/sun/corba/se/impl/orbutil/threadpool com/sun/corba/se/impl/orbutil/threadpool/SCCS com/sun/corba/se/impl/orbutil/threadpool/SCCS/s.ThreadPoolManagerImpl.java com/sun/corba/se/impl/orbutil/threadpool/SCCS/s.ThreadPoolImpl.java com/sun/corba/se/impl/orbutil/threadpool/SCCS/s.TimeoutException.java com/sun/corba/se/impl/orbutil/threadpool/SCCS/s.WorkQueueImpl.java com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolManagerImpl.java com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolImpl.java com/sun/corba/se/impl/orbutil/threadpool/TimeoutException.java com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java com/sun/corba/se/impl/orbutil/CacheTable.java com/sun/corba/se/impl/orbutil/DenseIntMapImpl.java com/sun/corba/se/impl/orbutil/DefineWrapper.sjava com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java com/sun/corba/se/impl/orbutil/GetPropertyAction.java com/sun/corba/se/impl/orbutil/HexOutputStream.java com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3.java com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3_1.java com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3.java com/sun/corba/se/impl/orbutil/IIOPOutputStream_1_3_1.java com/sun/corba/se/impl/orbutil/LegacyHookGetFields.java com/sun/corba/se/impl/orbutil/LegacyHookPutFields.java com/sun/corba/se/impl/orbutil/LogKeywords.java com/sun/corba/se/impl/orbutil/ORBClassLoader.java com/sun/corba/se/impl/orbutil/ORBConstants.java com/sun/corba/se/impl/orbutil/ORBUtility.java com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java com/sun/corba/se/impl/orbutil/ObjectStreamField.java com/sun/corba/se/impl/orbutil/ObjectUtility.java com/sun/corba/se/impl/orbutil/ObjectWriter.java com/sun/corba/se/impl/orbutil/RepIdDelegator.java com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3.java com/sun/corba/se/impl/orbutil/RepIdDelegator_1_3_1.java com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3.java com/sun/corba/se/impl/orbutil/StackImpl.java com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3_1.java com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java com/sun/corba/se/impl/orbutil/RepositoryIdInterface.java com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java com/sun/corba/se/impl/orbutil/RepositoryIdUtility.java com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3.java com/sun/corba/se/impl/orbutil/ValueHandlerImpl_1_3_1.java com/sun/corba/se/impl/presentation com/sun/corba/se/impl/presentation/rmi com/sun/corba/se/impl/presentation/rmi/SCCS com/sun/corba/se/impl/presentation/rmi/SCCS/s.DynamicMethodMarshallerImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.DynamicStubImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.ExceptionHandler.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.ExceptionHandlerImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.IDLNameTranslatorImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.IDLNameTranslatorImpl_save.sjava com/sun/corba/se/impl/presentation/rmi/SCCS/s.IDLType.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.IDLTypeException.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.IDLTypesUtil.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.IDLTypesUtil_save.sjava com/sun/corba/se/impl/presentation/rmi/SCCS/s.InvocationHandlerFactoryImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.JNDIStateFactoryImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.PresentationManagerImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.ReflectiveTie.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.StubConnectImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.StubFactoryBase.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.StubFactoryDynamicBase.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.StubFactoryFactoryBase.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.StubFactoryFactoryDynamicBase.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.StubFactoryFactoryProxyImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.StubFactoryFactoryStaticImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.StubFactoryProxyImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.StubFactoryStaticImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.StubInvocationHandlerImpl.java com/sun/corba/se/impl/presentation/rmi/SCCS/s.jndi.properties com/sun/corba/se/impl/presentation/rmi/DynamicMethodMarshallerImpl.java com/sun/corba/se/impl/presentation/rmi/DynamicStubImpl.java com/sun/corba/se/impl/presentation/rmi/ExceptionHandler.java com/sun/corba/se/impl/presentation/rmi/ExceptionHandlerImpl.java com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl_save.sjava com/sun/corba/se/impl/presentation/rmi/IDLType.java com/sun/corba/se/impl/presentation/rmi/IDLTypeException.java com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil.java com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil_save.sjava com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java com/sun/corba/se/impl/presentation/rmi/PresentationManagerImpl.java com/sun/corba/se/impl/presentation/rmi/ReflectiveTie.java com/sun/corba/se/impl/presentation/rmi/StubConnectImpl.java com/sun/corba/se/impl/presentation/rmi/StubFactoryBase.java com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryBase.java com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryDynamicBase.java com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryProxyImpl.java com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryStaticImpl.java com/sun/corba/se/impl/presentation/rmi/StubFactoryProxyImpl.java com/sun/corba/se/impl/presentation/rmi/StubFactoryStaticImpl.java com/sun/corba/se/impl/presentation/rmi/StubInvocationHandlerImpl.java com/sun/corba/se/impl/presentation/rmi/jndi.properties com/sun/corba/se/impl/protocol com/sun/corba/se/impl/protocol/SCCS com/sun/corba/se/impl/protocol/SCCS/s.AddressingDispositionException.java com/sun/corba/se/impl/protocol/SCCS/s.BootstrapServerRequestDispatcher.java com/sun/corba/se/impl/protocol/SCCS/s.CorbaClientDelegateImpl.java com/sun/corba/se/impl/protocol/SCCS/s.CorbaClientRequestDispatcherImpl.java com/sun/corba/se/impl/protocol/SCCS/s.CorbaInvocationInfo.java com/sun/corba/se/impl/protocol/SCCS/s.CorbaMessageMediatorImpl.java com/sun/corba/se/impl/protocol/SCCS/s.CorbaServerRequestDispatcherImpl.java com/sun/corba/se/impl/protocol/SCCS/s.FullServantCacheLocalCRDImpl.java com/sun/corba/se/impl/protocol/SCCS/s.INSServerRequestDispatcher.java com/sun/corba/se/impl/protocol/SCCS/s.JIDLLocalCRDImpl.java com/sun/corba/se/impl/protocol/SCCS/s.InfoOnlyServantCacheLocalCRDImpl.java com/sun/corba/se/impl/protocol/SCCS/s.LocalClientRequestDispatcherBase.java com/sun/corba/se/impl/protocol/SCCS/s.MinimalServantCacheLocalCRDImpl.java com/sun/corba/se/impl/protocol/SCCS/s.NotLocalLocalCRDImpl.java com/sun/corba/se/impl/protocol/SCCS/s.POALocalCRDImpl.java com/sun/corba/se/impl/protocol/SCCS/s.RequestCanceledException.java com/sun/corba/se/impl/protocol/SCCS/s.RequestDispatcherRegistryImpl.java com/sun/corba/se/impl/protocol/SCCS/s.ServantCacheLocalCRDBase.java com/sun/corba/se/impl/protocol/SCCS/s.SharedCDRClientRequestDispatcherImpl.java com/sun/corba/se/impl/protocol/SCCS/s.SpecialMethod.java com/sun/corba/se/impl/protocol/giopmsgheaders com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.AddressingDispositionHelper.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.CancelRequestMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.CancelRequestMessage_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.CancelRequestMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.CancelRequestMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.FragmentMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.FragmentMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.FragmentMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.IORAddressingInfo.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.IORAddressingInfoHelper.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.KeyAddr.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.LocateReplyMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.LocateReplyOrReplyMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.LocateReplyMessage_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.LocateReplyMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.LocateReplyMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.LocateRequestMessage_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.LocateRequestMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.LocateRequestMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.LocateRequestMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.Message.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.MessageBase.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.MessageHandler.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.Message_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.Message_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.Message_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.ProfileAddr.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.RequestMessage_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.ReferenceAddr.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.ReplyMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.ReplyMessage_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.ReplyMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.ReplyMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.RequestMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.RequestMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.RequestMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.TargetAddress.java com/sun/corba/se/impl/protocol/giopmsgheaders/SCCS/s.TargetAddressHelper.java com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfo.java com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java com/sun/corba/se/impl/protocol/giopmsgheaders/KeyAddr.java com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyOrReplyMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/Message.java com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java com/sun/corba/se/impl/protocol/giopmsgheaders/MessageHandler.java com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/ProfileAddr.java com/sun/corba/se/impl/protocol/giopmsgheaders/ReferenceAddr.java com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage.java com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_0.java com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_1.java com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_2.java com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddress.java com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddressHelper.java com/sun/corba/se/impl/protocol/oldlocal com/sun/corba/se/impl/protocol/oldlocal/SCCS com/sun/corba/se/impl/protocol/oldlocal/SCCS/s.LocalClientRequestImpl.sjava com/sun/corba/se/impl/protocol/oldlocal/SCCS/s.LocalClientResponseImpl.sjava com/sun/corba/se/impl/protocol/oldlocal/SCCS/s.LocalServerRequestImpl.sjava com/sun/corba/se/impl/protocol/oldlocal/SCCS/s.LocalServerResponseImpl.sjava com/sun/corba/se/impl/protocol/oldlocal/LocalClientRequestImpl.sjava com/sun/corba/se/impl/protocol/oldlocal/LocalClientResponseImpl.sjava com/sun/corba/se/impl/protocol/oldlocal/LocalServerRequestImpl.sjava com/sun/corba/se/impl/protocol/oldlocal/LocalServerResponseImpl.sjava com/sun/corba/se/impl/protocol/BootstrapServerRequestDispatcher.java com/sun/corba/se/impl/protocol/AddressingDispositionException.java com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java com/sun/corba/se/impl/protocol/CorbaClientDelegateImpl.java com/sun/corba/se/impl/protocol/CorbaServerRequestDispatcherImpl.java com/sun/corba/se/impl/protocol/CorbaInvocationInfo.java com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java com/sun/corba/se/impl/protocol/FullServantCacheLocalCRDImpl.java com/sun/corba/se/impl/protocol/JIDLLocalCRDImpl.java com/sun/corba/se/impl/protocol/RequestDispatcherRegistryImpl.java com/sun/corba/se/impl/protocol/INSServerRequestDispatcher.java com/sun/corba/se/impl/protocol/InfoOnlyServantCacheLocalCRDImpl.java com/sun/corba/se/impl/protocol/NotLocalLocalCRDImpl.java com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java com/sun/corba/se/impl/protocol/MinimalServantCacheLocalCRDImpl.java com/sun/corba/se/impl/protocol/POALocalCRDImpl.java com/sun/corba/se/impl/protocol/RequestCanceledException.java com/sun/corba/se/impl/protocol/SpecialMethod.java com/sun/corba/se/impl/protocol/ServantCacheLocalCRDBase.java com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java com/sun/corba/se/impl/resolver com/sun/corba/se/impl/resolver/SCCS com/sun/corba/se/impl/resolver/SCCS/s.ORBDefaultInitRefResolverImpl.java com/sun/corba/se/impl/resolver/SCCS/s.BootstrapResolverImpl.java com/sun/corba/se/impl/resolver/SCCS/s.CompositeResolverImpl.java com/sun/corba/se/impl/resolver/SCCS/s.FileResolverImpl.java com/sun/corba/se/impl/resolver/SCCS/s.INSURLOperationImpl.java com/sun/corba/se/impl/resolver/SCCS/s.LocalResolverImpl.java com/sun/corba/se/impl/resolver/SCCS/s.ORBInitRefResolverImpl.java com/sun/corba/se/impl/resolver/SCCS/s.SplitLocalResolverImpl.java com/sun/corba/se/impl/resolver/ORBDefaultInitRefResolverImpl.java com/sun/corba/se/impl/resolver/BootstrapResolverImpl.java com/sun/corba/se/impl/resolver/CompositeResolverImpl.java com/sun/corba/se/impl/resolver/FileResolverImpl.java com/sun/corba/se/impl/resolver/INSURLOperationImpl.java com/sun/corba/se/impl/resolver/LocalResolverImpl.java com/sun/corba/se/impl/resolver/ORBInitRefResolverImpl.java com/sun/corba/se/impl/resolver/SplitLocalResolverImpl.java com/sun/corba/se/impl/transport com/sun/corba/se/impl/transport/SCCS com/sun/corba/se/impl/transport/SCCS/s.CorbaContactInfoListIteratorImpl.java com/sun/corba/se/impl/transport/SCCS/s.BufferConnectionImpl.sjava com/sun/corba/se/impl/transport/SCCS/s.ByteBufferPoolImpl.java com/sun/corba/se/impl/transport/SCCS/s.CorbaConnectionCacheBase.java com/sun/corba/se/impl/transport/SCCS/s.CorbaContactInfoBase.java com/sun/corba/se/impl/transport/SCCS/s.CorbaContactInfoListImpl.java com/sun/corba/se/impl/transport/SCCS/s.CorbaInboundConnectionCacheImpl.java com/sun/corba/se/impl/transport/SCCS/s.CorbaOutboundConnectionCacheImpl.java com/sun/corba/se/impl/transport/SCCS/s.CorbaResponseWaitingRoomImpl.java com/sun/corba/se/impl/transport/SCCS/s.CorbaTransportManagerImpl.java com/sun/corba/se/impl/transport/SCCS/s.DefaultIORToSocketInfoImpl.java com/sun/corba/se/impl/transport/SCCS/s.DefaultSocketFactoryImpl.java com/sun/corba/se/impl/transport/SCCS/s.EventHandlerBase.java com/sun/corba/se/impl/transport/SCCS/s.ListenerThreadImpl.java com/sun/corba/se/impl/transport/SCCS/s.ReadTCPTimeoutsImpl.java com/sun/corba/se/impl/transport/SCCS/s.ReaderThreadImpl.java com/sun/corba/se/impl/transport/SCCS/s.SelectorImpl.java com/sun/corba/se/impl/transport/SCCS/s.SharedCDRContactInfoImpl.java com/sun/corba/se/impl/transport/SCCS/s.SocketOrChannelAcceptorImpl.java com/sun/corba/se/impl/transport/SCCS/s.SocketOrChannelConnectionImpl.java com/sun/corba/se/impl/transport/SCCS/s.SocketOrChannelContactInfoImpl.java com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java com/sun/corba/se/impl/transport/BufferConnectionImpl.sjava com/sun/corba/se/impl/transport/ByteBufferPoolImpl.java com/sun/corba/se/impl/transport/CorbaContactInfoListIteratorImpl.java com/sun/corba/se/impl/transport/CorbaContactInfoBase.java com/sun/corba/se/impl/transport/CorbaContactInfoListImpl.java com/sun/corba/se/impl/transport/CorbaInboundConnectionCacheImpl.java com/sun/corba/se/impl/transport/CorbaOutboundConnectionCacheImpl.java com/sun/corba/se/impl/transport/CorbaResponseWaitingRoomImpl.java com/sun/corba/se/impl/transport/CorbaTransportManagerImpl.java com/sun/corba/se/impl/transport/DefaultIORToSocketInfoImpl.java com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java com/sun/corba/se/impl/transport/EventHandlerBase.java com/sun/corba/se/impl/transport/ListenerThreadImpl.java com/sun/corba/se/impl/transport/ReadTCPTimeoutsImpl.java com/sun/corba/se/impl/transport/ReaderThreadImpl.java com/sun/corba/se/impl/transport/SelectorImpl.java com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java com/sun/corba/se/impl/transport/SocketOrChannelContactInfoImpl.java com/sun/corba/se/impl/util com/sun/corba/se/impl/util/SCCS com/sun/corba/se/impl/util/SCCS/s.IdentityHashtableEnumerator.java com/sun/corba/se/impl/util/SCCS/s.IdentityHashtable.java com/sun/corba/se/impl/util/SCCS/s.JDKClassLoader.java com/sun/corba/se/impl/util/SCCS/s.JDKBridge.java com/sun/corba/se/impl/util/SCCS/s.ORBProperties.java com/sun/corba/se/impl/util/SCCS/s.PackagePrefixChecker.java com/sun/corba/se/impl/util/SCCS/s.RepositoryId.java com/sun/corba/se/impl/util/SCCS/s.RepositoryIdCache.java com/sun/corba/se/impl/util/SCCS/s.SUNVMCID.java com/sun/corba/se/impl/util/SCCS/s.Utility.java com/sun/corba/se/impl/util/SCCS/s.Version.java com/sun/corba/se/impl/util/PackagePrefixChecker.java com/sun/corba/se/impl/util/IdentityHashtable.java com/sun/corba/se/impl/util/JDKBridge.java com/sun/corba/se/impl/util/JDKClassLoader.java com/sun/corba/se/impl/util/IdentityHashtableEnumerator.java com/sun/corba/se/impl/util/ORBProperties.java com/sun/corba/se/impl/util/RepositoryId.java com/sun/corba/se/impl/util/RepositoryIdCache.java com/sun/corba/se/impl/util/SUNVMCID.java com/sun/corba/se/impl/util/Utility.java com/sun/corba/se/impl/util/Version.java com/sun/corba/se/interceptor com/sun/corba/se/interceptor/SCCS com/sun/corba/se/internal com/sun/corba/se/internal/Activation com/sun/corba/se/internal/Activation/SCCS com/sun/corba/se/internal/CosNaming com/sun/corba/se/internal/CosNaming/SCCS com/sun/corba/se/internal/CosNaming/SCCS/s.BootstrapServer.java com/sun/corba/se/internal/CosNaming/BootstrapServer.java com/sun/corba/se/internal/DynamicAny com/sun/corba/se/internal/DynamicAny/SCCS com/sun/corba/se/internal/Interceptors com/sun/corba/se/internal/Interceptors/SCCS com/sun/corba/se/internal/Interceptors/SCCS/s.PIORB.java com/sun/corba/se/internal/Interceptors/PIORB.java com/sun/corba/se/internal/PCosNaming com/sun/corba/se/internal/PCosNaming/SCCS com/sun/corba/se/internal/POA com/sun/corba/se/internal/POA/SCCS com/sun/corba/se/internal/POA/SCCS/s.POAORB.java com/sun/corba/se/internal/POA/POAORB.java com/sun/corba/se/internal/corba com/sun/corba/se/internal/corba/SCCS com/sun/corba/se/internal/corba/SCCS/s.ORBSingleton.java com/sun/corba/se/internal/corba/ORBSingleton.java com/sun/corba/se/internal/core com/sun/corba/se/internal/core/SCCS com/sun/corba/se/internal/iiop com/sun/corba/se/internal/iiop/SCCS com/sun/corba/se/internal/iiop/SCCS/s.ORB.java com/sun/corba/se/internal/iiop/messages com/sun/corba/se/internal/iiop/messages/SCCS com/sun/corba/se/internal/iiop/ORB.java com/sun/corba/se/internal/io com/sun/corba/se/internal/io/SCCS com/sun/corba/se/internal/io/SCCS/s.ObjectStreamClass.java com/sun/corba/se/internal/io/SCCS/s.IIOPInputStream.java com/sun/corba/se/internal/io/SCCS/s.IIOPOutputStream.java com/sun/corba/se/internal/io/SCCS/s.LibraryManager.java com/sun/corba/se/internal/io/IIOPInputStream.java com/sun/corba/se/internal/io/IIOPOutputStream.java com/sun/corba/se/internal/io/LibraryManager.java com/sun/corba/se/internal/io/ObjectStreamClass.java com/sun/corba/se/internal/ior com/sun/corba/se/internal/ior/SCCS com/sun/corba/se/internal/javax com/sun/corba/se/internal/javax/rmi com/sun/corba/se/internal/javax/rmi/CORBA com/sun/corba/se/internal/javax/rmi/CORBA/SCCS com/sun/corba/se/internal/javax/rmi/SCCS com/sun/corba/se/internal/orbutil com/sun/corba/se/internal/orbutil/SCCS com/sun/corba/se/internal/orbutil/resources com/sun/corba/se/internal/orbutil/resources/SCCS com/sun/corba/se/internal/util com/sun/corba/se/internal/util/SCCS com/sun/corba/se/org com/sun/corba/se/org/omg com/sun/corba/se/org/omg/CORBA com/sun/corba/se/org/omg/CORBA/SCCS com/sun/corba/se/org/omg/CORBA/SCCS/s.ORB.java com/sun/corba/se/org/omg/CORBA/ORB.java com/sun/corba/se/pept com/sun/corba/se/pept/SCCS com/sun/corba/se/pept/SCCS/s.package.html com/sun/corba/se/pept/broker com/sun/corba/se/pept/broker/SCCS com/sun/corba/se/pept/broker/SCCS/s.Broker.java com/sun/corba/se/pept/broker/Broker.java com/sun/corba/se/pept/encoding com/sun/corba/se/pept/encoding/SCCS com/sun/corba/se/pept/encoding/SCCS/s.InputObject.java com/sun/corba/se/pept/encoding/SCCS/s.OutputObject.java com/sun/corba/se/pept/encoding/InputObject.java com/sun/corba/se/pept/encoding/OutputObject.java com/sun/corba/se/pept/protocol com/sun/corba/se/pept/protocol/SCCS com/sun/corba/se/pept/protocol/SCCS/s.ClientInvocationInfo.java com/sun/corba/se/pept/protocol/SCCS/s.ClientDelegate.java com/sun/corba/se/pept/protocol/SCCS/s.ClientRequestDispatcher.java com/sun/corba/se/pept/protocol/SCCS/s.MessageMediator.java com/sun/corba/se/pept/protocol/SCCS/s.ProtocolHandler.java com/sun/corba/se/pept/protocol/SCCS/s.ServerRequestDispatcher.java com/sun/corba/se/pept/protocol/ClientInvocationInfo.java com/sun/corba/se/pept/protocol/ClientDelegate.java com/sun/corba/se/pept/protocol/ClientRequestDispatcher.java com/sun/corba/se/pept/protocol/MessageMediator.java com/sun/corba/se/pept/protocol/ProtocolHandler.java com/sun/corba/se/pept/protocol/ServerRequestDispatcher.java com/sun/corba/se/pept/transport com/sun/corba/se/pept/transport/SCCS com/sun/corba/se/pept/transport/SCCS/s.ByteBufferPool.java com/sun/corba/se/pept/transport/SCCS/s.Acceptor.java com/sun/corba/se/pept/transport/SCCS/s.ConnectionCache.java com/sun/corba/se/pept/transport/SCCS/s.Connection.java com/sun/corba/se/pept/transport/SCCS/s.ContactInfoListIterator.java com/sun/corba/se/pept/transport/SCCS/s.ContactInfo.java com/sun/corba/se/pept/transport/SCCS/s.ContactInfoList.java com/sun/corba/se/pept/transport/SCCS/s.ListenerThread.java com/sun/corba/se/pept/transport/SCCS/s.EventHandler.java com/sun/corba/se/pept/transport/SCCS/s.InboundConnectionCache.java com/sun/corba/se/pept/transport/SCCS/s.OutboundConnectionCache.java com/sun/corba/se/pept/transport/SCCS/s.ReaderThread.java com/sun/corba/se/pept/transport/SCCS/s.ResponseWaitingRoom.java com/sun/corba/se/pept/transport/SCCS/s.Selector.java com/sun/corba/se/pept/transport/SCCS/s.TransportManager.java com/sun/corba/se/pept/transport/SCCS/s.transport.zargo com/sun/corba/se/pept/transport/ByteBufferPool.java com/sun/corba/se/pept/transport/Acceptor.java com/sun/corba/se/pept/transport/ConnectionCache.java com/sun/corba/se/pept/transport/Connection.java com/sun/corba/se/pept/transport/ContactInfoListIterator.java com/sun/corba/se/pept/transport/ContactInfo.java com/sun/corba/se/pept/transport/ContactInfoList.java com/sun/corba/se/pept/transport/InboundConnectionCache.java com/sun/corba/se/pept/transport/EventHandler.java com/sun/corba/se/pept/transport/ListenerThread.java com/sun/corba/se/pept/transport/ReaderThread.java com/sun/corba/se/pept/transport/Selector.java com/sun/corba/se/pept/transport/OutboundConnectionCache.java com/sun/corba/se/pept/transport/ResponseWaitingRoom.java com/sun/corba/se/pept/transport/TransportManager.java com/sun/corba/se/pept/transport/transport.zargo com/sun/corba/se/pept/package.html com/sun/corba/se/spi com/sun/corba/se/spi/activation com/sun/corba/se/spi/activation/SCCS com/sun/corba/se/spi/activation/SCCS/s.activation.idl com/sun/corba/se/spi/activation/activation.idl com/sun/corba/se/spi/copyobject com/sun/corba/se/spi/copyobject/SCCS com/sun/corba/se/spi/copyobject/SCCS/s.CopyobjectDefaults.java com/sun/corba/se/spi/copyobject/SCCS/s.CopierManager.java com/sun/corba/se/spi/copyobject/SCCS/s.ObjectCopierFactory.java com/sun/corba/se/spi/copyobject/SCCS/s.ObjectCopier.java com/sun/corba/se/spi/copyobject/SCCS/s.ReflectiveCopyException.java com/sun/corba/se/spi/copyobject/CopyobjectDefaults.java com/sun/corba/se/spi/copyobject/CopierManager.java com/sun/corba/se/spi/copyobject/ObjectCopierFactory.java com/sun/corba/se/spi/copyobject/ObjectCopier.java com/sun/corba/se/spi/copyobject/ReflectiveCopyException.java com/sun/corba/se/spi/costransactions com/sun/corba/se/spi/costransactions/SCCS com/sun/corba/se/spi/costransactions/SCCS/s.TransactionService.java com/sun/corba/se/spi/costransactions/TransactionService.java com/sun/corba/se/spi/encoding com/sun/corba/se/spi/encoding/SCCS com/sun/corba/se/spi/encoding/SCCS/s.CorbaOutputObject.java com/sun/corba/se/spi/encoding/SCCS/s.CorbaInputObject.java com/sun/corba/se/spi/encoding/CorbaInputObject.java com/sun/corba/se/spi/encoding/CorbaOutputObject.java com/sun/corba/se/spi/extension com/sun/corba/se/spi/extension/SCCS com/sun/corba/se/spi/extension/SCCS/s.ServantCachingPolicy.java com/sun/corba/se/spi/extension/SCCS/s.CopyObjectPolicy.java com/sun/corba/se/spi/extension/SCCS/s.RequestPartitioningPolicy.java com/sun/corba/se/spi/extension/SCCS/s.ZeroPortPolicy.java com/sun/corba/se/spi/extension/RequestPartitioningPolicy.java com/sun/corba/se/spi/extension/CopyObjectPolicy.java com/sun/corba/se/spi/extension/ServantCachingPolicy.java com/sun/corba/se/spi/extension/ZeroPortPolicy.java com/sun/corba/se/spi/ior com/sun/corba/se/spi/ior/SCCS com/sun/corba/se/spi/ior/SCCS/s.IORFactories.java com/sun/corba/se/spi/ior/SCCS/s.IOR.java com/sun/corba/se/spi/ior/SCCS/s.EncapsulationFactoryBase.java com/sun/corba/se/spi/ior/SCCS/s.IORTemplateList.java com/sun/corba/se/spi/ior/SCCS/s.IORFactory.java com/sun/corba/se/spi/ior/SCCS/s.IORTemplate.java com/sun/corba/se/spi/ior/SCCS/s.IdentifiableFactory.java com/sun/corba/se/spi/ior/SCCS/s.Identifiable.java com/sun/corba/se/spi/ior/SCCS/s.IdentifiableBase.java com/sun/corba/se/spi/ior/SCCS/s.ObjectId.java com/sun/corba/se/spi/ior/SCCS/s.IdentifiableContainerBase.java com/sun/corba/se/spi/ior/SCCS/s.IdentifiableFactoryFinder.java com/sun/corba/se/spi/ior/SCCS/s.MakeImmutable.java com/sun/corba/se/spi/ior/SCCS/s.ObjectAdapterId.java com/sun/corba/se/spi/ior/SCCS/s.ObjectKeyTemplate.java com/sun/corba/se/spi/ior/SCCS/s.ObjectKey.java com/sun/corba/se/spi/ior/SCCS/s.ObjectKeyFactory.java com/sun/corba/se/spi/ior/SCCS/s.TaggedComponentBase.java com/sun/corba/se/spi/ior/SCCS/s.TaggedComponent.java com/sun/corba/se/spi/ior/SCCS/s.iornotes com/sun/corba/se/spi/ior/SCCS/s.TaggedComponentFactoryFinder.java com/sun/corba/se/spi/ior/SCCS/s.TaggedProfile.java com/sun/corba/se/spi/ior/SCCS/s.TaggedProfileTemplate.java com/sun/corba/se/spi/ior/SCCS/s.TaggedProfileTemplateBase.java com/sun/corba/se/spi/ior/SCCS/s.WriteContents.java com/sun/corba/se/spi/ior/SCCS/s.Writeable.java com/sun/corba/se/spi/ior/SCCS/s.package.html com/sun/corba/se/spi/ior/iiop com/sun/corba/se/spi/ior/iiop/SCCS com/sun/corba/se/spi/ior/iiop/SCCS/s.AlternateIIOPAddressComponent.java com/sun/corba/se/spi/ior/iiop/SCCS/s.CodeSetsComponent.java com/sun/corba/se/spi/ior/iiop/SCCS/s.GIOPVersion.java com/sun/corba/se/spi/ior/iiop/SCCS/s.IIOPAddress.java com/sun/corba/se/spi/ior/iiop/SCCS/s.IIOPFactories.java com/sun/corba/se/spi/ior/iiop/SCCS/s.IIOPProfile.java com/sun/corba/se/spi/ior/iiop/SCCS/s.IIOPProfileTemplate.java com/sun/corba/se/spi/ior/iiop/SCCS/s.JavaCodebaseComponent.java com/sun/corba/se/spi/ior/iiop/SCCS/s.MaxStreamFormatVersionComponent.java com/sun/corba/se/spi/ior/iiop/SCCS/s.ORBTypeComponent.java com/sun/corba/se/spi/ior/iiop/SCCS/s.RequestPartitioningComponent.java com/sun/corba/se/spi/ior/iiop/MaxStreamFormatVersionComponent.java com/sun/corba/se/spi/ior/iiop/AlternateIIOPAddressComponent.java com/sun/corba/se/spi/ior/iiop/CodeSetsComponent.java com/sun/corba/se/spi/ior/iiop/GIOPVersion.java com/sun/corba/se/spi/ior/iiop/IIOPAddress.java com/sun/corba/se/spi/ior/iiop/IIOPFactories.java com/sun/corba/se/spi/ior/iiop/IIOPProfile.java com/sun/corba/se/spi/ior/iiop/IIOPProfileTemplate.java com/sun/corba/se/spi/ior/iiop/JavaCodebaseComponent.java com/sun/corba/se/spi/ior/iiop/RequestPartitioningComponent.java com/sun/corba/se/spi/ior/iiop/ORBTypeComponent.java com/sun/corba/se/spi/ior/IORFactories.java com/sun/corba/se/spi/ior/IOR.java com/sun/corba/se/spi/ior/EncapsulationFactoryBase.java com/sun/corba/se/spi/ior/IORTemplate.java com/sun/corba/se/spi/ior/IORFactory.java com/sun/corba/se/spi/ior/IdentifiableContainerBase.java com/sun/corba/se/spi/ior/IORTemplateList.java com/sun/corba/se/spi/ior/Identifiable.java com/sun/corba/se/spi/ior/IdentifiableBase.java com/sun/corba/se/spi/ior/TaggedComponentFactoryFinder.java com/sun/corba/se/spi/ior/IdentifiableFactory.java com/sun/corba/se/spi/ior/IdentifiableFactoryFinder.java com/sun/corba/se/spi/ior/MakeImmutable.java com/sun/corba/se/spi/ior/ObjectAdapterId.java com/sun/corba/se/spi/ior/ObjectId.java com/sun/corba/se/spi/ior/ObjectKey.java com/sun/corba/se/spi/ior/ObjectKeyFactory.java com/sun/corba/se/spi/ior/ObjectKeyTemplate.java com/sun/corba/se/spi/ior/TaggedComponent.java com/sun/corba/se/spi/ior/TaggedComponentBase.java com/sun/corba/se/spi/ior/TaggedProfileTemplate.java com/sun/corba/se/spi/ior/TaggedProfile.java com/sun/corba/se/spi/ior/package.html com/sun/corba/se/spi/ior/iornotes com/sun/corba/se/spi/ior/TaggedProfileTemplateBase.java com/sun/corba/se/spi/ior/WriteContents.java com/sun/corba/se/spi/ior/Writeable.java com/sun/corba/se/spi/legacy com/sun/corba/se/spi/legacy/connection com/sun/corba/se/spi/legacy/connection/SCCS com/sun/corba/se/spi/legacy/connection/SCCS/s.ORBSocketFactory.java com/sun/corba/se/spi/legacy/connection/SCCS/s.Connection.java com/sun/corba/se/spi/legacy/connection/SCCS/s.README.txt com/sun/corba/se/spi/legacy/connection/SCCS/s.GetEndPointInfoAgainException.java com/sun/corba/se/spi/legacy/connection/SCCS/s.LegacyServerSocketEndPointInfo.java com/sun/corba/se/spi/legacy/connection/SCCS/s.LegacyServerSocketManager.java com/sun/corba/se/spi/legacy/connection/ORBSocketFactory.java com/sun/corba/se/spi/legacy/connection/Connection.java com/sun/corba/se/spi/legacy/connection/README.txt com/sun/corba/se/spi/legacy/connection/GetEndPointInfoAgainException.java com/sun/corba/se/spi/legacy/connection/LegacyServerSocketEndPointInfo.java com/sun/corba/se/spi/legacy/connection/LegacyServerSocketManager.java com/sun/corba/se/spi/legacy/interceptor com/sun/corba/se/spi/legacy/interceptor/SCCS com/sun/corba/se/spi/legacy/interceptor/SCCS/s.ORBInitInfoExt.java com/sun/corba/se/spi/legacy/interceptor/SCCS/s.IORInfoExt.java com/sun/corba/se/spi/legacy/interceptor/SCCS/s.RequestInfoExt.java com/sun/corba/se/spi/legacy/interceptor/SCCS/s.UnknownType.java com/sun/corba/se/spi/legacy/interceptor/ORBInitInfoExt.java com/sun/corba/se/spi/legacy/interceptor/IORInfoExt.java com/sun/corba/se/spi/legacy/interceptor/RequestInfoExt.java com/sun/corba/se/spi/legacy/interceptor/UnknownType.java com/sun/corba/se/spi/logging com/sun/corba/se/spi/logging/SCCS com/sun/corba/se/spi/logging/SCCS/s.LogWrapperFactory.java com/sun/corba/se/spi/logging/SCCS/s.CORBALogDomains.java com/sun/corba/se/spi/logging/SCCS/s.LogWrapperBase.java com/sun/corba/se/spi/logging/data com/sun/corba/se/spi/logging/data/SCCS com/sun/corba/se/spi/logging/data/SCCS/s.Interceptors.mc com/sun/corba/se/spi/logging/data/SCCS/s.Activation.mc com/sun/corba/se/spi/logging/data/SCCS/s.IOR.mc com/sun/corba/se/spi/logging/data/SCCS/s.Naming.mc com/sun/corba/se/spi/logging/data/SCCS/s.OMG.mc com/sun/corba/se/spi/logging/data/SCCS/s.ORBUtil.mc com/sun/corba/se/spi/logging/data/SCCS/s.POA.mc com/sun/corba/se/spi/logging/data/SCCS/s.Util.mc com/sun/corba/se/spi/logging/data/Activation.mc com/sun/corba/se/spi/logging/data/IOR.mc com/sun/corba/se/spi/logging/data/Interceptors.mc com/sun/corba/se/spi/logging/data/Naming.mc com/sun/corba/se/spi/logging/data/OMG.mc com/sun/corba/se/spi/logging/data/ORBUtil.mc com/sun/corba/se/spi/logging/data/POA.mc com/sun/corba/se/spi/logging/data/Util.mc com/sun/corba/se/spi/logging/CORBALogDomains.java com/sun/corba/se/spi/logging/LogWrapperBase.java com/sun/corba/se/spi/logging/LogWrapperFactory.java com/sun/corba/se/spi/monitoring com/sun/corba/se/spi/monitoring/SCCS com/sun/corba/se/spi/monitoring/SCCS/s.MonitoredAttribute.java com/sun/corba/se/spi/monitoring/SCCS/s.CorbaMBean.zargo com/sun/corba/se/spi/monitoring/SCCS/s.MonitoredAttributeInfoFactory.java com/sun/corba/se/spi/monitoring/SCCS/s.LongMonitoredAttributeBase.java com/sun/corba/se/spi/monitoring/SCCS/s.MonitoredAttributeBase.java com/sun/corba/se/spi/monitoring/SCCS/s.MonitoredAttributeInfo.java com/sun/corba/se/spi/monitoring/SCCS/s.MonitoredObjectFactory.java com/sun/corba/se/spi/monitoring/SCCS/s.MonitoredObject.java com/sun/corba/se/spi/monitoring/SCCS/s.MonitoringConstants.java com/sun/corba/se/spi/monitoring/SCCS/s.MonitoringFactories.java com/sun/corba/se/spi/monitoring/SCCS/s.MonitoringManager.java com/sun/corba/se/spi/monitoring/SCCS/s.cut1.zargo com/sun/corba/se/spi/monitoring/SCCS/s.MonitoringManagerFactory.java com/sun/corba/se/spi/monitoring/SCCS/s.StatisticMonitoredAttribute.java com/sun/corba/se/spi/monitoring/SCCS/s.StatisticsAccumulator.java com/sun/corba/se/spi/monitoring/SCCS/s.StringMonitoredAttributeBase.java com/sun/corba/se/spi/monitoring/SCCS/s.package.html com/sun/corba/se/spi/monitoring/MonitoredAttribute.java com/sun/corba/se/spi/monitoring/CorbaMBean.zargo com/sun/corba/se/spi/monitoring/cut1.zargo com/sun/corba/se/spi/monitoring/LongMonitoredAttributeBase.java com/sun/corba/se/spi/monitoring/MonitoredAttributeBase.java com/sun/corba/se/spi/monitoring/MonitoredAttributeInfo.java com/sun/corba/se/spi/monitoring/MonitoredAttributeInfoFactory.java com/sun/corba/se/spi/monitoring/MonitoredObject.java com/sun/corba/se/spi/monitoring/MonitoredObjectFactory.java com/sun/corba/se/spi/monitoring/MonitoringConstants.java com/sun/corba/se/spi/monitoring/MonitoringFactories.java com/sun/corba/se/spi/monitoring/MonitoringManager.java com/sun/corba/se/spi/monitoring/package.html com/sun/corba/se/spi/monitoring/MonitoringManagerFactory.java com/sun/corba/se/spi/monitoring/StatisticMonitoredAttribute.java com/sun/corba/se/spi/monitoring/StatisticsAccumulator.java com/sun/corba/se/spi/monitoring/StringMonitoredAttributeBase.java com/sun/corba/se/spi/oa com/sun/corba/se/spi/oa/SCCS com/sun/corba/se/spi/oa/SCCS/s.OAInvocationInfo.java com/sun/corba/se/spi/oa/SCCS/s.NullServant.java com/sun/corba/se/spi/oa/SCCS/s.OADefault.java com/sun/corba/se/spi/oa/SCCS/s.OADestroyed.java com/sun/corba/se/spi/oa/SCCS/s.ObjectAdapter.java com/sun/corba/se/spi/oa/SCCS/s.ObjectAdapterBase.java com/sun/corba/se/spi/oa/SCCS/s.ObjectAdapterFactory.java com/sun/corba/se/spi/oa/OAInvocationInfo.java com/sun/corba/se/spi/oa/NullServant.java com/sun/corba/se/spi/oa/OADefault.java com/sun/corba/se/spi/oa/OADestroyed.java com/sun/corba/se/spi/oa/ObjectAdapterFactory.java com/sun/corba/se/spi/oa/ObjectAdapter.java com/sun/corba/se/spi/oa/ObjectAdapterBase.java com/sun/corba/se/spi/orb com/sun/corba/se/spi/orb/SCCS com/sun/corba/se/spi/orb/SCCS/s.ORBVersionFactory.java com/sun/corba/se/spi/orb/SCCS/s.DataCollector.java com/sun/corba/se/spi/orb/SCCS/s.ORB.java com/sun/corba/se/spi/orb/SCCS/s.ORBConfigurator.java com/sun/corba/se/spi/orb/SCCS/s.ORBData.java com/sun/corba/se/spi/orb/SCCS/s.ORBVersion.java com/sun/corba/se/spi/orb/SCCS/s.ParserDataFactory.java com/sun/corba/se/spi/orb/SCCS/s.Operation.java com/sun/corba/se/spi/orb/SCCS/s.OperationFactory.java com/sun/corba/se/spi/orb/SCCS/s.ParserData.java com/sun/corba/se/spi/orb/SCCS/s.ParserImplBase.java com/sun/corba/se/spi/orb/SCCS/s.ParserImplTableBase.java com/sun/corba/se/spi/orb/SCCS/s.PropertyParser.java com/sun/corba/se/spi/orb/SCCS/s.StringPair.java com/sun/corba/se/spi/orb/ORBConfigurator.java com/sun/corba/se/spi/orb/DataCollector.java com/sun/corba/se/spi/orb/ORB.java com/sun/corba/se/spi/orb/ORBVersionFactory.java com/sun/corba/se/spi/orb/ORBData.java com/sun/corba/se/spi/orb/ORBVersion.java com/sun/corba/se/spi/orb/OperationFactory.java com/sun/corba/se/spi/orb/Operation.java com/sun/corba/se/spi/orb/ParserDataFactory.java com/sun/corba/se/spi/orb/ParserData.java com/sun/corba/se/spi/orb/ParserImplTableBase.java com/sun/corba/se/spi/orb/ParserImplBase.java com/sun/corba/se/spi/orb/PropertyParser.java com/sun/corba/se/spi/orb/StringPair.java com/sun/corba/se/spi/orbutil com/sun/corba/se/spi/orbutil/closure com/sun/corba/se/spi/orbutil/closure/SCCS com/sun/corba/se/spi/orbutil/closure/SCCS/s.ClosureFactory.java com/sun/corba/se/spi/orbutil/closure/SCCS/s.Closure.java com/sun/corba/se/spi/orbutil/closure/ClosureFactory.java com/sun/corba/se/spi/orbutil/closure/Closure.java com/sun/corba/se/spi/orbutil/fsm com/sun/corba/se/spi/orbutil/fsm/SCCS com/sun/corba/se/spi/orbutil/fsm/SCCS/s.ActionBase.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.Action.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.GuardBase.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.FSM.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.FSMImpl.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.FSMTest.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.Guard.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.StateEngineFactory.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.Input.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.InputImpl.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.State.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.StateEngine.java com/sun/corba/se/spi/orbutil/fsm/SCCS/s.StateImpl.java com/sun/corba/se/spi/orbutil/fsm/ActionBase.java com/sun/corba/se/spi/orbutil/fsm/Action.java com/sun/corba/se/spi/orbutil/fsm/StateEngine.java com/sun/corba/se/spi/orbutil/fsm/FSM.java com/sun/corba/se/spi/orbutil/fsm/FSMImpl.java com/sun/corba/se/spi/orbutil/fsm/FSMTest.java com/sun/corba/se/spi/orbutil/fsm/Guard.java com/sun/corba/se/spi/orbutil/fsm/GuardBase.java com/sun/corba/se/spi/orbutil/fsm/Input.java com/sun/corba/se/spi/orbutil/fsm/InputImpl.java com/sun/corba/se/spi/orbutil/fsm/State.java com/sun/corba/se/spi/orbutil/fsm/StateEngineFactory.java com/sun/corba/se/spi/orbutil/fsm/StateImpl.java com/sun/corba/se/spi/orbutil/proxy com/sun/corba/se/spi/orbutil/proxy/SCCS com/sun/corba/se/spi/orbutil/proxy/SCCS/s.CompositeInvocationHandlerImpl.java com/sun/corba/se/spi/orbutil/proxy/SCCS/s.CompositeInvocationHandler.java com/sun/corba/se/spi/orbutil/proxy/SCCS/s.DelegateInvocationHandlerImpl.java com/sun/corba/se/spi/orbutil/proxy/SCCS/s.InvocationHandlerFactory.java com/sun/corba/se/spi/orbutil/proxy/SCCS/s.LinkedInvocationHandler.java com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandler.java com/sun/corba/se/spi/orbutil/proxy/DelegateInvocationHandlerImpl.java com/sun/corba/se/spi/orbutil/proxy/InvocationHandlerFactory.java com/sun/corba/se/spi/orbutil/proxy/LinkedInvocationHandler.java com/sun/corba/se/spi/orbutil/threadpool com/sun/corba/se/spi/orbutil/threadpool/SCCS com/sun/corba/se/spi/orbutil/threadpool/SCCS/s.WorkQueue.java com/sun/corba/se/spi/orbutil/threadpool/SCCS/s.Work.java com/sun/corba/se/spi/orbutil/threadpool/SCCS/s.NoSuchThreadPoolException.java com/sun/corba/se/spi/orbutil/threadpool/SCCS/s.NoSuchWorkQueueException.java com/sun/corba/se/spi/orbutil/threadpool/SCCS/s.ThreadPool.java com/sun/corba/se/spi/orbutil/threadpool/SCCS/s.ThreadPoolChooser.java com/sun/corba/se/spi/orbutil/threadpool/SCCS/s.ThreadPoolManager.java com/sun/corba/se/spi/orbutil/threadpool/WorkQueue.java com/sun/corba/se/spi/orbutil/threadpool/Work.java com/sun/corba/se/spi/orbutil/threadpool/NoSuchThreadPoolException.java com/sun/corba/se/spi/orbutil/threadpool/NoSuchWorkQueueException.java com/sun/corba/se/spi/orbutil/threadpool/ThreadPool.java com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolChooser.java com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolManager.java com/sun/corba/se/spi/presentation com/sun/corba/se/spi/presentation/rmi com/sun/corba/se/spi/presentation/rmi/SCCS com/sun/corba/se/spi/presentation/rmi/SCCS/s.DynamicMethodMarshaller.java com/sun/corba/se/spi/presentation/rmi/SCCS/s.DynamicStub.java com/sun/corba/se/spi/presentation/rmi/SCCS/s.IDLNameTranslator.java com/sun/corba/se/spi/presentation/rmi/SCCS/s.PresentationDefaults.java com/sun/corba/se/spi/presentation/rmi/SCCS/s.PresentationManager.java com/sun/corba/se/spi/presentation/rmi/SCCS/s.StubAdapter.java com/sun/corba/se/spi/presentation/rmi/SCCS/s.StubWrapper.java com/sun/corba/se/spi/presentation/rmi/DynamicMethodMarshaller.java com/sun/corba/se/spi/presentation/rmi/DynamicStub.java com/sun/corba/se/spi/presentation/rmi/IDLNameTranslator.java com/sun/corba/se/spi/presentation/rmi/PresentationDefaults.java com/sun/corba/se/spi/presentation/rmi/PresentationManager.java com/sun/corba/se/spi/presentation/rmi/StubAdapter.java com/sun/corba/se/spi/presentation/rmi/StubWrapper.java com/sun/corba/se/spi/protocol com/sun/corba/se/spi/protocol/SCCS com/sun/corba/se/spi/protocol/SCCS/s.CorbaServerRequestDispatcher.java com/sun/corba/se/spi/protocol/SCCS/s.ClientDelegateFactory.java com/sun/corba/se/spi/protocol/SCCS/s.CorbaClientDelegate.java com/sun/corba/se/spi/protocol/SCCS/s.CorbaMessageMediator.java com/sun/corba/se/spi/protocol/SCCS/s.CorbaProtocolHandler.java com/sun/corba/se/spi/protocol/SCCS/s.ForwardException.java com/sun/corba/se/spi/protocol/SCCS/s.PIHandler.java com/sun/corba/se/spi/protocol/SCCS/s.InitialServerRequestDispatcher.java com/sun/corba/se/spi/protocol/SCCS/s.LocalClientRequestDispatcher.java com/sun/corba/se/spi/protocol/SCCS/s.LocalClientRequestDispatcherFactory.java com/sun/corba/se/spi/protocol/SCCS/s.RequestDispatcherDefault.java com/sun/corba/se/spi/protocol/SCCS/s.RequestDispatcherRegistry.java com/sun/corba/se/spi/protocol/SCCS/s.protocol.zargo com/sun/corba/se/spi/protocol/CorbaServerRequestDispatcher.java com/sun/corba/se/spi/protocol/ClientDelegateFactory.java com/sun/corba/se/spi/protocol/CorbaClientDelegate.java com/sun/corba/se/spi/protocol/CorbaMessageMediator.java com/sun/corba/se/spi/protocol/CorbaProtocolHandler.java com/sun/corba/se/spi/protocol/ForwardException.java com/sun/corba/se/spi/protocol/PIHandler.java com/sun/corba/se/spi/protocol/InitialServerRequestDispatcher.java com/sun/corba/se/spi/protocol/LocalClientRequestDispatcher.java com/sun/corba/se/spi/protocol/LocalClientRequestDispatcherFactory.java com/sun/corba/se/spi/protocol/RequestDispatcherDefault.java com/sun/corba/se/spi/protocol/RequestDispatcherRegistry.java com/sun/corba/se/spi/protocol/protocol.zargo com/sun/corba/se/spi/resolver com/sun/corba/se/spi/resolver/SCCS com/sun/corba/se/spi/resolver/SCCS/s.LocalResolver.java com/sun/corba/se/spi/resolver/SCCS/s.Resolver.java com/sun/corba/se/spi/resolver/SCCS/s.ResolverDefault.java com/sun/corba/se/spi/resolver/ResolverDefault.java com/sun/corba/se/spi/resolver/LocalResolver.java com/sun/corba/se/spi/resolver/Resolver.java com/sun/corba/se/spi/servicecontext com/sun/corba/se/spi/servicecontext/SCCS com/sun/corba/se/spi/servicecontext/SCCS/s.CodeSetServiceContext.java com/sun/corba/se/spi/servicecontext/SCCS/s.ORBVersionServiceContext.java com/sun/corba/se/spi/servicecontext/SCCS/s.MaxStreamFormatVersionServiceContext.java com/sun/corba/se/spi/servicecontext/SCCS/s.SendingContextServiceContext.java com/sun/corba/se/spi/servicecontext/SCCS/s.ServiceContext.java com/sun/corba/se/spi/servicecontext/SCCS/s.ServiceContextData.java com/sun/corba/se/spi/servicecontext/SCCS/s.ServiceContextRegistry.java com/sun/corba/se/spi/servicecontext/SCCS/s.ServiceContexts.java com/sun/corba/se/spi/servicecontext/SCCS/s.UEInfoServiceContext.java com/sun/corba/se/spi/servicecontext/SCCS/s.UnknownServiceContext.java com/sun/corba/se/spi/servicecontext/ORBVersionServiceContext.java com/sun/corba/se/spi/servicecontext/CodeSetServiceContext.java com/sun/corba/se/spi/servicecontext/MaxStreamFormatVersionServiceContext.java com/sun/corba/se/spi/servicecontext/SendingContextServiceContext.java com/sun/corba/se/spi/servicecontext/ServiceContext.java com/sun/corba/se/spi/servicecontext/ServiceContextData.java com/sun/corba/se/spi/servicecontext/ServiceContextRegistry.java com/sun/corba/se/spi/servicecontext/ServiceContexts.java com/sun/corba/se/spi/servicecontext/UEInfoServiceContext.java com/sun/corba/se/spi/servicecontext/UnknownServiceContext.java com/sun/corba/se/spi/transport com/sun/corba/se/spi/transport/SCCS com/sun/corba/se/spi/transport/SCCS/s.CorbaConnectionCache.java com/sun/corba/se/spi/transport/SCCS/s.CorbaAcceptor.java com/sun/corba/se/spi/transport/SCCS/s.CorbaConnection.java com/sun/corba/se/spi/transport/SCCS/s.CorbaContactInfoListFactory.java com/sun/corba/se/spi/transport/SCCS/s.CorbaContactInfo.java com/sun/corba/se/spi/transport/SCCS/s.CorbaContactInfoList.java com/sun/corba/se/spi/transport/SCCS/s.CorbaContactInfoListIterator.java com/sun/corba/se/spi/transport/SCCS/s.CorbaResponseWaitingRoom.java com/sun/corba/se/spi/transport/SCCS/s.CorbaTransportManager.java com/sun/corba/se/spi/transport/SCCS/s.IIOPPrimaryToContactInfo.java com/sun/corba/se/spi/transport/SCCS/s.IORToSocketInfo.java com/sun/corba/se/spi/transport/SCCS/s.IORTransformer.java com/sun/corba/se/spi/transport/SCCS/s.ORBSocketFactory.java com/sun/corba/se/spi/transport/SCCS/s.ReadTimeouts.java com/sun/corba/se/spi/transport/SCCS/s.ReadTimeoutsFactory.java com/sun/corba/se/spi/transport/SCCS/s.SocketInfo.java com/sun/corba/se/spi/transport/SCCS/s.SocketOrChannelAcceptor.java com/sun/corba/se/spi/transport/SCCS/s.TransportDefault.java com/sun/corba/se/spi/transport/CorbaConnection.java com/sun/corba/se/spi/transport/CorbaAcceptor.java com/sun/corba/se/spi/transport/CorbaContactInfoListFactory.java com/sun/corba/se/spi/transport/CorbaConnectionCache.java com/sun/corba/se/spi/transport/CorbaContactInfo.java com/sun/corba/se/spi/transport/CorbaContactInfoList.java com/sun/corba/se/spi/transport/CorbaContactInfoListIterator.java com/sun/corba/se/spi/transport/CorbaResponseWaitingRoom.java com/sun/corba/se/spi/transport/CorbaTransportManager.java com/sun/corba/se/spi/transport/IIOPPrimaryToContactInfo.java com/sun/corba/se/spi/transport/IORToSocketInfo.java com/sun/corba/se/spi/transport/IORTransformer.java com/sun/corba/se/spi/transport/SocketOrChannelAcceptor.java com/sun/corba/se/spi/transport/ORBSocketFactory.java com/sun/corba/se/spi/transport/ReadTimeouts.java com/sun/corba/se/spi/transport/ReadTimeoutsFactory.java com/sun/corba/se/spi/transport/SocketInfo.java com/sun/corba/se/spi/transport/TransportDefault.java com/sun/image com/sun/image/codec com/sun/image/codec/jpeg com/sun/image/codec/jpeg/SCCS com/sun/image/codec/jpeg/SCCS/s.TruncatedFileException.java com/sun/image/codec/jpeg/SCCS/s.ImageFormatException.java com/sun/image/codec/jpeg/SCCS/s.JPEGCodec.java com/sun/image/codec/jpeg/SCCS/s.JPEGDecodeParam.java com/sun/image/codec/jpeg/SCCS/s.JPEGEncodeParam.java com/sun/image/codec/jpeg/SCCS/s.JPEGHuffmanTable.java com/sun/image/codec/jpeg/SCCS/s.JPEGImageDecoder.java com/sun/image/codec/jpeg/SCCS/s.JPEGImageEncoder.java com/sun/image/codec/jpeg/SCCS/s.JPEGQTable.java com/sun/image/codec/jpeg/SCCS/s.package.html com/sun/image/codec/jpeg/ImageFormatException.java com/sun/image/codec/jpeg/JPEGCodec.java com/sun/image/codec/jpeg/JPEGDecodeParam.java com/sun/image/codec/jpeg/JPEGEncodeParam.java com/sun/image/codec/jpeg/JPEGHuffmanTable.java com/sun/image/codec/jpeg/JPEGImageDecoder.java com/sun/image/codec/jpeg/JPEGImageEncoder.java com/sun/image/codec/jpeg/JPEGQTable.java com/sun/image/codec/jpeg/TruncatedFileException.java com/sun/image/codec/jpeg/package.html com/sun/imageio com/sun/imageio/metadata com/sun/imageio/metadata/SCCS com/sun/imageio/metadata/SCCS/s.XmlChars.java com/sun/imageio/metadata/SCCS/s.XmlNames.java com/sun/imageio/metadata/XmlChars.java com/sun/imageio/metadata/XmlNames.java com/sun/imageio/plugins com/sun/imageio/plugins/bmp com/sun/imageio/plugins/bmp/SCCS com/sun/imageio/plugins/bmp/SCCS/s.BMPImageReader.java com/sun/imageio/plugins/bmp/SCCS/s.BMPConstants.java com/sun/imageio/plugins/bmp/SCCS/s.BMPMetadataFormatResources.java com/sun/imageio/plugins/bmp/SCCS/s.BMPImageReaderSpi.java com/sun/imageio/plugins/bmp/SCCS/s.BMPImageWriter.java com/sun/imageio/plugins/bmp/SCCS/s.BMPImageWriterSpi.java com/sun/imageio/plugins/bmp/SCCS/s.BMPMetadata.java com/sun/imageio/plugins/bmp/SCCS/s.BMPMetadataFormat.java com/sun/imageio/plugins/bmp/BMPImageReaderSpi.java com/sun/imageio/plugins/bmp/BMPConstants.java com/sun/imageio/plugins/bmp/BMPImageReader.java com/sun/imageio/plugins/bmp/BMPMetadataFormatResources.java com/sun/imageio/plugins/bmp/BMPImageWriter.java com/sun/imageio/plugins/bmp/BMPImageWriterSpi.java com/sun/imageio/plugins/bmp/BMPMetadata.java com/sun/imageio/plugins/bmp/BMPMetadataFormat.java com/sun/imageio/plugins/common com/sun/imageio/plugins/common/SCCS com/sun/imageio/plugins/common/SCCS/s.InputStreamAdapter.java com/sun/imageio/plugins/common/SCCS/s.BogusColorSpace.java com/sun/imageio/plugins/common/SCCS/s.I18N.java com/sun/imageio/plugins/common/SCCS/s.I18NImpl.java com/sun/imageio/plugins/common/SCCS/s.ImageUtil.java com/sun/imageio/plugins/common/SCCS/s.StandardMetadataFormatResources.java com/sun/imageio/plugins/common/SCCS/s.StandardMetadataFormat.java com/sun/imageio/plugins/common/SCCS/s.SubImageInputStream.java com/sun/imageio/plugins/common/SCCS/s.iio-plugin.properties com/sun/imageio/plugins/common/StandardMetadataFormat.java com/sun/imageio/plugins/common/BogusColorSpace.java com/sun/imageio/plugins/common/I18N.java com/sun/imageio/plugins/common/I18NImpl.java com/sun/imageio/plugins/common/ImageUtil.java com/sun/imageio/plugins/common/InputStreamAdapter.java com/sun/imageio/plugins/common/StandardMetadataFormatResources.java com/sun/imageio/plugins/common/SubImageInputStream.java com/sun/imageio/plugins/common/iio-plugin.properties com/sun/imageio/plugins/gif com/sun/imageio/plugins/gif/SCCS com/sun/imageio/plugins/gif/SCCS/s.GIFImageMetadataFormat.java com/sun/imageio/plugins/gif/SCCS/s.GIFImageMetadata.java com/sun/imageio/plugins/gif/SCCS/s.GIFImageMetadataFormatResources.java com/sun/imageio/plugins/gif/SCCS/s.GIFImageReader.java com/sun/imageio/plugins/gif/SCCS/s.GIFImageReaderSpi.java com/sun/imageio/plugins/gif/SCCS/s.GIFStreamMetadata.java com/sun/imageio/plugins/gif/SCCS/s.GIFStreamMetadataFormat.java com/sun/imageio/plugins/gif/SCCS/s.GIFStreamMetadataFormatResources.java com/sun/imageio/plugins/gif/GIFImageMetadataFormat.java com/sun/imageio/plugins/gif/GIFImageMetadata.java com/sun/imageio/plugins/gif/GIFImageMetadataFormatResources.java com/sun/imageio/plugins/gif/GIFImageReader.java com/sun/imageio/plugins/gif/GIFImageReaderSpi.java com/sun/imageio/plugins/gif/GIFStreamMetadata.java com/sun/imageio/plugins/gif/GIFStreamMetadataFormat.java com/sun/imageio/plugins/gif/GIFStreamMetadataFormatResources.java com/sun/imageio/plugins/jpeg com/sun/imageio/plugins/jpeg/SCCS com/sun/imageio/plugins/jpeg/SCCS/s.JPEGImageMetadataFormat.java com/sun/imageio/plugins/jpeg/SCCS/s.AdobeMarkerSegment.java com/sun/imageio/plugins/jpeg/SCCS/s.COMMarkerSegment.java com/sun/imageio/plugins/jpeg/SCCS/s.DHTMarkerSegment.java com/sun/imageio/plugins/jpeg/SCCS/s.DQTMarkerSegment.java com/sun/imageio/plugins/jpeg/SCCS/s.DRIMarkerSegment.java com/sun/imageio/plugins/jpeg/SCCS/s.JFIFMarkerSegment.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEG.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGBuffer.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGImageWriterResources.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGImageMetadataFormatResources.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGImageReader.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGImageReaderResources.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGImageReaderSpi.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGImageWriter.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGMetadataFormatResources.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGImageWriterSpi.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGMetadata.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGMetadataFormat.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGStreamMetadataFormat.java com/sun/imageio/plugins/jpeg/SCCS/s.MarkerSegment.java com/sun/imageio/plugins/jpeg/SCCS/s.JPEGStreamMetadataFormatResources.java com/sun/imageio/plugins/jpeg/SCCS/s.SOFMarkerSegment.java com/sun/imageio/plugins/jpeg/SCCS/s.SOSMarkerSegment.java com/sun/imageio/plugins/jpeg/JPEGImageMetadataFormat.java com/sun/imageio/plugins/jpeg/AdobeMarkerSegment.java com/sun/imageio/plugins/jpeg/COMMarkerSegment.java com/sun/imageio/plugins/jpeg/DHTMarkerSegment.java com/sun/imageio/plugins/jpeg/DQTMarkerSegment.java com/sun/imageio/plugins/jpeg/DRIMarkerSegment.java com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java com/sun/imageio/plugins/jpeg/JPEG.java com/sun/imageio/plugins/jpeg/JPEGBuffer.java com/sun/imageio/plugins/jpeg/JPEGImageWriterResources.java com/sun/imageio/plugins/jpeg/JPEGImageMetadataFormatResources.java com/sun/imageio/plugins/jpeg/JPEGImageReader.java com/sun/imageio/plugins/jpeg/JPEGImageReaderResources.java com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java com/sun/imageio/plugins/jpeg/JPEGImageWriter.java com/sun/imageio/plugins/jpeg/JPEGStreamMetadataFormat.java com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java com/sun/imageio/plugins/jpeg/JPEGMetadata.java com/sun/imageio/plugins/jpeg/JPEGMetadataFormat.java com/sun/imageio/plugins/jpeg/JPEGStreamMetadataFormatResources.java com/sun/imageio/plugins/jpeg/JPEGMetadataFormatResources.java com/sun/imageio/plugins/jpeg/MarkerSegment.java com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java com/sun/imageio/plugins/jpeg/SOSMarkerSegment.java com/sun/imageio/plugins/png com/sun/imageio/plugins/png/SCCS com/sun/imageio/plugins/png/SCCS/s.PNGImageReaderSpi.java com/sun/imageio/plugins/png/SCCS/s.PNGImageReader.java com/sun/imageio/plugins/png/SCCS/s.PNGMetadataFormatResources.java com/sun/imageio/plugins/png/SCCS/s.PNGImageWriter.java com/sun/imageio/plugins/png/SCCS/s.PNGImageWriterSpi.java com/sun/imageio/plugins/png/SCCS/s.PNGMetadata.java com/sun/imageio/plugins/png/SCCS/s.PNGMetadataFormat.java com/sun/imageio/plugins/png/SCCS/s.RowFilter.java com/sun/imageio/plugins/png/PNGImageReaderSpi.java com/sun/imageio/plugins/png/PNGImageReader.java com/sun/imageio/plugins/png/PNGMetadataFormatResources.java com/sun/imageio/plugins/png/PNGImageWriter.java com/sun/imageio/plugins/png/PNGImageWriterSpi.java com/sun/imageio/plugins/png/PNGMetadata.java com/sun/imageio/plugins/png/PNGMetadataFormat.java com/sun/imageio/plugins/png/RowFilter.java com/sun/imageio/plugins/wbmp com/sun/imageio/plugins/wbmp/SCCS com/sun/imageio/plugins/wbmp/SCCS/s.WBMPImageReaderSpi.java com/sun/imageio/plugins/wbmp/SCCS/s.WBMPImageReader.java com/sun/imageio/plugins/wbmp/SCCS/s.WBMPImageWriter.java com/sun/imageio/plugins/wbmp/SCCS/s.WBMPImageWriterSpi.java com/sun/imageio/plugins/wbmp/SCCS/s.WBMPMetadata.java com/sun/imageio/plugins/wbmp/SCCS/s.WBMPMetadataFormat.java com/sun/imageio/plugins/wbmp/WBMPImageReader.java com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java com/sun/imageio/plugins/wbmp/WBMPImageWriter.java com/sun/imageio/plugins/wbmp/WBMPImageWriterSpi.java com/sun/imageio/plugins/wbmp/WBMPMetadata.java com/sun/imageio/plugins/wbmp/WBMPMetadataFormat.java com/sun/imageio/spi com/sun/imageio/spi/SCCS com/sun/imageio/spi/SCCS/s.InputStreamImageInputStreamSpi.java com/sun/imageio/spi/SCCS/s.FileImageInputStreamSpi.java com/sun/imageio/spi/SCCS/s.FileImageOutputStreamSpi.java com/sun/imageio/spi/SCCS/s.OutputStreamImageOutputStreamSpi.java com/sun/imageio/spi/SCCS/s.RAFImageInputStreamSpi.java com/sun/imageio/spi/SCCS/s.RAFImageOutputStreamSpi.java com/sun/imageio/spi/InputStreamImageInputStreamSpi.java com/sun/imageio/spi/FileImageInputStreamSpi.java com/sun/imageio/spi/FileImageOutputStreamSpi.java com/sun/imageio/spi/OutputStreamImageOutputStreamSpi.java com/sun/imageio/spi/RAFImageInputStreamSpi.java com/sun/imageio/spi/RAFImageOutputStreamSpi.java com/sun/inputmethods com/sun/inputmethods/internal com/sun/inputmethods/internal/indicim com/sun/inputmethods/internal/indicim/SCCS com/sun/inputmethods/internal/indicim/SCCS/s.DevanagariInputMethodDescriptor.java com/sun/inputmethods/internal/indicim/SCCS/s.DevanagariTables.java com/sun/inputmethods/internal/indicim/SCCS/s.IndicInputMethod.java com/sun/inputmethods/internal/indicim/SCCS/s.IndicInputMethodImpl.java com/sun/inputmethods/internal/indicim/SCCS/s.java.awt.im.spi.InputMethodDescriptor com/sun/inputmethods/internal/indicim/resources com/sun/inputmethods/internal/indicim/resources/SCCS com/sun/inputmethods/internal/indicim/resources/SCCS/s.DisplayNames_de.properties com/sun/inputmethods/internal/indicim/resources/SCCS/s.DisplayNames.properties com/sun/inputmethods/internal/indicim/resources/SCCS/s.DisplayNames_es.properties com/sun/inputmethods/internal/indicim/resources/SCCS/s.DisplayNames_fr.properties com/sun/inputmethods/internal/indicim/resources/SCCS/s.DisplayNames_it.properties com/sun/inputmethods/internal/indicim/resources/SCCS/s.DisplayNames_ja.properties com/sun/inputmethods/internal/indicim/resources/SCCS/s.DisplayNames_ko.properties com/sun/inputmethods/internal/indicim/resources/SCCS/s.DisplayNames_sv.properties com/sun/inputmethods/internal/indicim/resources/SCCS/s.DisplayNames_zh_CN.properties com/sun/inputmethods/internal/indicim/resources/SCCS/s.DisplayNames_zh_TW.properties com/sun/inputmethods/internal/indicim/resources/DisplayNames_de.properties com/sun/inputmethods/internal/indicim/resources/DisplayNames.properties com/sun/inputmethods/internal/indicim/resources/DisplayNames_es.properties com/sun/inputmethods/internal/indicim/resources/DisplayNames_fr.properties com/sun/inputmethods/internal/indicim/resources/DisplayNames_it.properties com/sun/inputmethods/internal/indicim/resources/DisplayNames_ja.properties com/sun/inputmethods/internal/indicim/resources/DisplayNames_ko.properties com/sun/inputmethods/internal/indicim/resources/DisplayNames_sv.properties com/sun/inputmethods/internal/indicim/resources/DisplayNames_zh_CN.properties com/sun/inputmethods/internal/indicim/resources/DisplayNames_zh_TW.properties com/sun/inputmethods/internal/indicim/DevanagariInputMethodDescriptor.java com/sun/inputmethods/internal/indicim/DevanagariTables.java com/sun/inputmethods/internal/indicim/IndicInputMethod.java com/sun/inputmethods/internal/indicim/IndicInputMethodImpl.java com/sun/inputmethods/internal/indicim/java.awt.im.spi.InputMethodDescriptor com/sun/inputmethods/internal/thaiim com/sun/inputmethods/internal/thaiim/SCCS com/sun/inputmethods/internal/thaiim/SCCS/s.ThaiInputMethodImpl.java com/sun/inputmethods/internal/thaiim/SCCS/s.ThaiInputMethod.java com/sun/inputmethods/internal/thaiim/SCCS/s.ThaiInputMethodDescriptor.java com/sun/inputmethods/internal/thaiim/SCCS/s.ThaiRules.java com/sun/inputmethods/internal/thaiim/SCCS/s.java.awt.im.spi.InputMethodDescriptor com/sun/inputmethods/internal/thaiim/resources com/sun/inputmethods/internal/thaiim/resources/SCCS com/sun/inputmethods/internal/thaiim/resources/SCCS/s.DisplayNames.properties com/sun/inputmethods/internal/thaiim/resources/DisplayNames.properties com/sun/inputmethods/internal/thaiim/ThaiInputMethodDescriptor.java com/sun/inputmethods/internal/thaiim/ThaiInputMethod.java com/sun/inputmethods/internal/thaiim/ThaiInputMethodImpl.java com/sun/inputmethods/internal/thaiim/ThaiRules.java com/sun/inputmethods/internal/thaiim/java.awt.im.spi.InputMethodDescriptor com/sun/jarsigner com/sun/jarsigner/SCCS com/sun/jarsigner/SCCS/s.ContentSignerParameters.java com/sun/jarsigner/SCCS/s.ContentSigner.java com/sun/jarsigner/SCCS/s.package.html com/sun/jarsigner/ContentSigner.java com/sun/jarsigner/package.html com/sun/jarsigner/ContentSignerParameters.java com/sun/java com/sun/java/browser com/sun/java/browser/dom com/sun/java/browser/dom/SCCS com/sun/java/browser/dom/SCCS/s.DOMUnsupportedException.java com/sun/java/browser/dom/SCCS/s.DOMAccessException.java com/sun/java/browser/dom/SCCS/s.DOMAccessor.java com/sun/java/browser/dom/SCCS/s.DOMAction.java com/sun/java/browser/dom/SCCS/s.DOMService.java com/sun/java/browser/dom/SCCS/s.DOMServiceProvider.java com/sun/java/browser/dom/DOMUnsupportedException.java com/sun/java/browser/dom/DOMAccessException.java com/sun/java/browser/dom/DOMAccessor.java com/sun/java/browser/dom/DOMAction.java com/sun/java/browser/dom/DOMService.java com/sun/java/browser/dom/DOMServiceProvider.java com/sun/java/browser/net com/sun/java/browser/net/SCCS com/sun/java/browser/net/SCCS/s.ProxyServiceProvider.java com/sun/java/browser/net/SCCS/s.ProxyInfo.java com/sun/java/browser/net/SCCS/s.ProxyService.java com/sun/java/browser/net/ProxyService.java com/sun/java/browser/net/ProxyInfo.java com/sun/java/browser/net/ProxyServiceProvider.java com/sun/java/swing com/sun/java/swing/SCCS com/sun/java/swing/SCCS/s.SwingUtilities2.java com/sun/java/swing/plaf com/sun/java/swing/plaf/gtk com/sun/java/swing/plaf/gtk/SCCS com/sun/java/swing/plaf/gtk/SCCS/s.BluecurveEngineParser.java com/sun/java/swing/plaf/gtk/SCCS/s.BluecurveColorType.java com/sun/java/swing/plaf/gtk/SCCS/s.BluecurveEngine.java com/sun/java/swing/plaf/gtk/SCCS/s.BlueprintEngineParser.java com/sun/java/swing/plaf/gtk/SCCS/s.BluecurveStyle.java com/sun/java/swing/plaf/gtk/SCCS/s.BlueprintEngine.java com/sun/java/swing/plaf/gtk/SCCS/s.BlueprintGraphicsUtils.java com/sun/java/swing/plaf/gtk/SCCS/s.BlueprintStyle.java com/sun/java/swing/plaf/gtk/SCCS/s.CircularIdentityList.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKColorChooserPanel.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKColorType.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKConstants.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKEngine.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKEngineParser.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKFileChooserUI.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKGraphicsUtils.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKIconFactory.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKLookAndFeel.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKPainter.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKParser.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKRegion.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKScanner.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKStyle.java com/sun/java/swing/plaf/gtk/SCCS/s.GTKStyleFactory.java com/sun/java/swing/plaf/gtk/SCCS/s.Metacity.java com/sun/java/swing/plaf/gtk/SCCS/s.PangoFonts.java com/sun/java/swing/plaf/gtk/SCCS/s.PixmapEngine.java com/sun/java/swing/plaf/gtk/SCCS/s.PixmapEngineParser.java com/sun/java/swing/plaf/gtk/SCCS/s.PixmapStyle.java com/sun/java/swing/plaf/gtk/SCCS/s.PropertyParser.java com/sun/java/swing/plaf/gtk/SCCS/s.XColors.java com/sun/java/swing/plaf/gtk/SCCS/s.package.html com/sun/java/swing/plaf/gtk/icons com/sun/java/swing/plaf/gtk/icons/SCCS com/sun/java/swing/plaf/gtk/icons/SCCS/s.Directory.gif com/sun/java/swing/plaf/gtk/icons/SCCS/s.File.gif com/sun/java/swing/plaf/gtk/icons/Directory.gif com/sun/java/swing/plaf/gtk/icons/File.gif com/sun/java/swing/plaf/gtk/resources com/sun/java/swing/plaf/gtk/resources/SCCS com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk-dialog-error-6.png com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk-cancel-4.png com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk-dialog-question-6.png com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk-dialog-info-6.png com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk-dialog-warning-6.png com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk-no-4.png com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk-ok-4.png com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk-yes-4.png com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk.properties com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk_de.properties com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk_es.properties com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk_fr.properties com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk_it.properties com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk_ja.properties com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk_ko.properties com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk_sv.properties com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk_zh_CN.properties com/sun/java/swing/plaf/gtk/resources/SCCS/s.gtk_zh_TW.properties com/sun/java/swing/plaf/gtk/resources/metacity com/sun/java/swing/plaf/gtk/resources/metacity/SwingFallbackTheme com/sun/java/swing/plaf/gtk/resources/metacity/SwingFallbackTheme/metacity-1 com/sun/java/swing/plaf/gtk/resources/metacity/SwingFallbackTheme/metacity-1/SCCS com/sun/java/swing/plaf/gtk/resources/metacity/SwingFallbackTheme/metacity-1/SCCS/s.metacity-theme-1.xml com/sun/java/swing/plaf/gtk/resources/metacity/SwingFallbackTheme/metacity-1/metacity-theme-1.xml com/sun/java/swing/plaf/gtk/resources/gtk-dialog-error-6.png com/sun/java/swing/plaf/gtk/resources/gtk-cancel-4.png com/sun/java/swing/plaf/gtk/resources/gtk-dialog-info-6.png com/sun/java/swing/plaf/gtk/resources/gtk-dialog-question-6.png com/sun/java/swing/plaf/gtk/resources/gtk-dialog-warning-6.png com/sun/java/swing/plaf/gtk/resources/gtk-no-4.png com/sun/java/swing/plaf/gtk/resources/gtk-ok-4.png com/sun/java/swing/plaf/gtk/resources/gtk-yes-4.png com/sun/java/swing/plaf/gtk/resources/gtk.properties com/sun/java/swing/plaf/gtk/resources/gtk_de.properties com/sun/java/swing/plaf/gtk/resources/gtk_es.properties com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties com/sun/java/swing/plaf/gtk/resources/gtk_it.properties com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties com/sun/java/swing/plaf/gtk/BluecurveEngineParser.java com/sun/java/swing/plaf/gtk/BluecurveColorType.java com/sun/java/swing/plaf/gtk/BluecurveEngine.java com/sun/java/swing/plaf/gtk/BlueprintEngineParser.java com/sun/java/swing/plaf/gtk/BluecurveStyle.java com/sun/java/swing/plaf/gtk/BlueprintEngine.java com/sun/java/swing/plaf/gtk/BlueprintGraphicsUtils.java com/sun/java/swing/plaf/gtk/BlueprintStyle.java com/sun/java/swing/plaf/gtk/CircularIdentityList.java com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java com/sun/java/swing/plaf/gtk/GTKColorType.java com/sun/java/swing/plaf/gtk/GTKConstants.java com/sun/java/swing/plaf/gtk/GTKEngine.java com/sun/java/swing/plaf/gtk/GTKPainter.java com/sun/java/swing/plaf/gtk/GTKEngineParser.java com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java com/sun/java/swing/plaf/gtk/GTKIconFactory.java com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java com/sun/java/swing/plaf/gtk/GTKParser.java com/sun/java/swing/plaf/gtk/GTKRegion.java com/sun/java/swing/plaf/gtk/GTKScanner.java com/sun/java/swing/plaf/gtk/GTKStyle.java com/sun/java/swing/plaf/gtk/GTKStyleFactory.java com/sun/java/swing/plaf/gtk/Metacity.java com/sun/java/swing/plaf/gtk/PangoFonts.java com/sun/java/swing/plaf/gtk/PixmapEngine.java com/sun/java/swing/plaf/gtk/PixmapEngineParser.java com/sun/java/swing/plaf/gtk/PixmapStyle.java com/sun/java/swing/plaf/gtk/PropertyParser.java com/sun/java/swing/plaf/gtk/XColors.java com/sun/java/swing/plaf/gtk/package.html com/sun/java/swing/plaf/motif com/sun/java/swing/plaf/motif/SCCS com/sun/java/swing/plaf/motif/SCCS/s.MotifButtonListener.java com/sun/java/swing/plaf/motif/SCCS/s.MotifBorders.java com/sun/java/swing/plaf/motif/SCCS/s.MotifCheckBoxMenuItemUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifButtonUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifComboBoxRenderer.java com/sun/java/swing/plaf/motif/SCCS/s.MotifCheckBoxUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifDesktopIconUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifComboBoxUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifDesktopPaneUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifEditorPaneUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifFileChooserUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifGraphicsUtils.java com/sun/java/swing/plaf/motif/SCCS/s.MotifLabelUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifMenuMouseListener.java com/sun/java/swing/plaf/motif/SCCS/s.MotifIconFactory.java com/sun/java/swing/plaf/motif/SCCS/s.MotifInternalFrameTitlePane.java com/sun/java/swing/plaf/motif/SCCS/s.MotifInternalFrameUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifLookAndFeel.java com/sun/java/swing/plaf/motif/SCCS/s.MotifMenuBarUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifMenuItemUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifRadioButtonMenuItemUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifMenuMouseMotionListener.java com/sun/java/swing/plaf/motif/SCCS/s.MotifMenuUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifOptionPaneUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifPasswordFieldUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifPopupMenuSeparatorUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifPopupMenuUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifProgressBarUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifSplitPaneDivider.java com/sun/java/swing/plaf/motif/SCCS/s.MotifRadioButtonUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifScrollBarButton.java com/sun/java/swing/plaf/motif/SCCS/s.MotifScrollBarUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifScrollPaneUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifSeparatorUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifSliderUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifSplitPaneUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifTabbedPaneUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifTextAreaUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifTextFieldUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifTextPaneUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifTextUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifTreeUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifToggleButtonUI.java com/sun/java/swing/plaf/motif/SCCS/s.MotifTreeCellRenderer.java com/sun/java/swing/plaf/motif/icons com/sun/java/swing/plaf/motif/icons/SCCS com/sun/java/swing/plaf/motif/icons/SCCS/s.ScrollDownArrow.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.DesktopIcon.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.Error.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.Inform.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.Question.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.Warn.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.ScrollDownArrowActive.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.ScrollKnobH.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.ScrollLeftArrow.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.ScrollLeftArrowActive.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.ScrollRightArrow.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.ScrollRightArrowActive.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.ScrollUpArrow.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.ScrollUpArrowActive.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.StandardBackground.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.TrayBottom.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.TrayLeft.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.TrayRight.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.TrayTop.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.TreeClosed.gif com/sun/java/swing/plaf/motif/icons/SCCS/s.TreeOpen.gif com/sun/java/swing/plaf/motif/icons/ScrollDownArrow.gif com/sun/java/swing/plaf/motif/icons/DesktopIcon.gif com/sun/java/swing/plaf/motif/icons/Error.gif com/sun/java/swing/plaf/motif/icons/Inform.gif com/sun/java/swing/plaf/motif/icons/Question.gif com/sun/java/swing/plaf/motif/icons/ScrollDownArrowActive.gif com/sun/java/swing/plaf/motif/icons/ScrollKnobH.gif com/sun/java/swing/plaf/motif/icons/ScrollLeftArrow.gif com/sun/java/swing/plaf/motif/icons/ScrollLeftArrowActive.gif com/sun/java/swing/plaf/motif/icons/ScrollRightArrow.gif com/sun/java/swing/plaf/motif/icons/ScrollRightArrowActive.gif com/sun/java/swing/plaf/motif/icons/ScrollUpArrow.gif com/sun/java/swing/plaf/motif/icons/ScrollUpArrowActive.gif com/sun/java/swing/plaf/motif/icons/StandardBackground.gif com/sun/java/swing/plaf/motif/icons/TrayBottom.gif com/sun/java/swing/plaf/motif/icons/TrayLeft.gif com/sun/java/swing/plaf/motif/icons/TrayRight.gif com/sun/java/swing/plaf/motif/icons/TrayTop.gif com/sun/java/swing/plaf/motif/icons/TreeClosed.gif com/sun/java/swing/plaf/motif/icons/TreeOpen.gif com/sun/java/swing/plaf/motif/icons/Warn.gif com/sun/java/swing/plaf/motif/resources com/sun/java/swing/plaf/motif/resources/SCCS com/sun/java/swing/plaf/motif/resources/SCCS/s.motif_de.properties com/sun/java/swing/plaf/motif/resources/SCCS/s.motif.properties com/sun/java/swing/plaf/motif/resources/SCCS/s.motif_es.properties com/sun/java/swing/plaf/motif/resources/SCCS/s.motif_fr.properties com/sun/java/swing/plaf/motif/resources/SCCS/s.motif_it.properties com/sun/java/swing/plaf/motif/resources/SCCS/s.motif_ja.properties com/sun/java/swing/plaf/motif/resources/SCCS/s.motif_ko.properties com/sun/java/swing/plaf/motif/resources/SCCS/s.motif_sv.properties com/sun/java/swing/plaf/motif/resources/SCCS/s.motif_zh_CN.properties com/sun/java/swing/plaf/motif/resources/SCCS/s.motif_zh_TW.properties com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties com/sun/java/swing/plaf/motif/resources/motif.properties com/sun/java/swing/plaf/motif/resources/motif_de.properties com/sun/java/swing/plaf/motif/resources/motif_es.properties com/sun/java/swing/plaf/motif/resources/motif_fr.properties com/sun/java/swing/plaf/motif/resources/motif_it.properties com/sun/java/swing/plaf/motif/resources/motif_ja.properties com/sun/java/swing/plaf/motif/resources/motif_ko.properties com/sun/java/swing/plaf/motif/resources/motif_sv.properties com/sun/java/swing/plaf/motif/resources/motif_zh_TW.properties com/sun/java/swing/plaf/motif/MotifButtonListener.java com/sun/java/swing/plaf/motif/MotifBorders.java com/sun/java/swing/plaf/motif/MotifCheckBoxUI.java com/sun/java/swing/plaf/motif/MotifButtonUI.java com/sun/java/swing/plaf/motif/MotifCheckBoxMenuItemUI.java com/sun/java/swing/plaf/motif/MotifComboBoxRenderer.java com/sun/java/swing/plaf/motif/MotifComboBoxUI.java com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java com/sun/java/swing/plaf/motif/MotifDesktopPaneUI.java com/sun/java/swing/plaf/motif/MotifEditorPaneUI.java com/sun/java/swing/plaf/motif/MotifFileChooserUI.java com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java com/sun/java/swing/plaf/motif/MotifMenuMouseMotionListener.java com/sun/java/swing/plaf/motif/MotifIconFactory.java com/sun/java/swing/plaf/motif/MotifInternalFrameUI.java com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java com/sun/java/swing/plaf/motif/MotifLabelUI.java com/sun/java/swing/plaf/motif/MotifLookAndFeel.java com/sun/java/swing/plaf/motif/MotifMenuBarUI.java com/sun/java/swing/plaf/motif/MotifMenuItemUI.java com/sun/java/swing/plaf/motif/MotifMenuMouseListener.java com/sun/java/swing/plaf/motif/MotifRadioButtonMenuItemUI.java com/sun/java/swing/plaf/motif/MotifMenuUI.java com/sun/java/swing/plaf/motif/MotifOptionPaneUI.java com/sun/java/swing/plaf/motif/MotifPasswordFieldUI.java com/sun/java/swing/plaf/motif/MotifPopupMenuSeparatorUI.java com/sun/java/swing/plaf/motif/MotifPopupMenuUI.java com/sun/java/swing/plaf/motif/MotifProgressBarUI.java com/sun/java/swing/plaf/motif/MotifScrollBarButton.java com/sun/java/swing/plaf/motif/MotifRadioButtonUI.java com/sun/java/swing/plaf/motif/MotifScrollBarUI.java com/sun/java/swing/plaf/motif/MotifScrollPaneUI.java com/sun/java/swing/plaf/motif/MotifSeparatorUI.java com/sun/java/swing/plaf/motif/MotifSliderUI.java com/sun/java/swing/plaf/motif/MotifSplitPaneDivider.java com/sun/java/swing/plaf/motif/MotifSplitPaneUI.java com/sun/java/swing/plaf/motif/MotifTabbedPaneUI.java com/sun/java/swing/plaf/motif/MotifTextAreaUI.java com/sun/java/swing/plaf/motif/MotifTextFieldUI.java com/sun/java/swing/plaf/motif/MotifTextPaneUI.java com/sun/java/swing/plaf/motif/MotifTextUI.java com/sun/java/swing/plaf/motif/MotifToggleButtonUI.java com/sun/java/swing/plaf/motif/MotifTreeCellRenderer.java com/sun/java/swing/plaf/motif/MotifTreeUI.java com/sun/java/swing/plaf/windows com/sun/java/swing/plaf/windows/SCCS com/sun/java/swing/plaf/windows/SCCS/s.WindowsButtonListener.java com/sun/java/swing/plaf/windows/SCCS/s.DesktopProperty.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsBorders.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsCheckBoxUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsButtonUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsInternalFrameUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsCheckBoxMenuItemUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsClassicLookAndFeel.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsComboBoxUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsDesktopIconUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsDesktopManager.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsDesktopPaneUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsEditorPaneUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsFileChooserUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsGraphicsUtils.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsIconFactory.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsRadioButtonMenuItemUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsInternalFrameTitlePane.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsLabelUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsListUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsLookAndFeel.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsMenuBarUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsMenuItemUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsMenuUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsOptionPaneUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsPasswordFieldUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsPopupMenuUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsPopupWindow.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsProgressBarUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsSplitPaneDivider.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsRadioButtonUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsRootPaneUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsScrollBarUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsScrollPaneUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsSeparatorUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsSliderUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsSpinnerUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsToolBarSeparatorUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsSplitPaneUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsTabbedPaneUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsTableHeaderUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsTableUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsTextAreaUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsTextFieldUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsTextPaneUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsTextUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsToggleButtonUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsToolBarUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsTreeUI.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsUtils.java com/sun/java/swing/plaf/windows/SCCS/s.XPStyle.java com/sun/java/swing/plaf/windows/SCCS/s.WindowsPopupMenuSeparatorUI.java com/sun/java/swing/plaf/windows/icons com/sun/java/swing/plaf/windows/icons/SCCS com/sun/java/swing/plaf/windows/icons/SCCS/s.DetailsView.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.Computer.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.StandardBackground.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.Directory.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.Error.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.File.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.FloppyDrive.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.HardDrive.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.HomeFolder.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.Inform.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.JavaCup32.png com/sun/java/swing/plaf/windows/icons/SCCS/s.ListView.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.NewFolder.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.Question.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.TreeClosed.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.TreeLeaf.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.TreeOpen.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.UpFolder.gif com/sun/java/swing/plaf/windows/icons/SCCS/s.Warn.gif com/sun/java/swing/plaf/windows/icons/StandardBackground.gif com/sun/java/swing/plaf/windows/icons/Computer.gif com/sun/java/swing/plaf/windows/icons/DetailsView.gif com/sun/java/swing/plaf/windows/icons/Directory.gif com/sun/java/swing/plaf/windows/icons/Error.gif com/sun/java/swing/plaf/windows/icons/File.gif com/sun/java/swing/plaf/windows/icons/FloppyDrive.gif com/sun/java/swing/plaf/windows/icons/HardDrive.gif com/sun/java/swing/plaf/windows/icons/HomeFolder.gif com/sun/java/swing/plaf/windows/icons/Inform.gif com/sun/java/swing/plaf/windows/icons/JavaCup32.png com/sun/java/swing/plaf/windows/icons/ListView.gif com/sun/java/swing/plaf/windows/icons/NewFolder.gif com/sun/java/swing/plaf/windows/icons/Question.gif com/sun/java/swing/plaf/windows/icons/TreeClosed.gif com/sun/java/swing/plaf/windows/icons/TreeLeaf.gif com/sun/java/swing/plaf/windows/icons/TreeOpen.gif com/sun/java/swing/plaf/windows/icons/UpFolder.gif com/sun/java/swing/plaf/windows/icons/Warn.gif com/sun/java/swing/plaf/windows/resources com/sun/java/swing/plaf/windows/resources/SCCS com/sun/java/swing/plaf/windows/resources/SCCS/s.windows_zh_CN.properties com/sun/java/swing/plaf/windows/resources/SCCS/s.windows.properties com/sun/java/swing/plaf/windows/resources/SCCS/s.windows_de.properties com/sun/java/swing/plaf/windows/resources/SCCS/s.windows_es.properties com/sun/java/swing/plaf/windows/resources/SCCS/s.windows_fr.properties com/sun/java/swing/plaf/windows/resources/SCCS/s.windows_it.properties com/sun/java/swing/plaf/windows/resources/SCCS/s.windows_ja.properties com/sun/java/swing/plaf/windows/resources/SCCS/s.windows_ko.properties com/sun/java/swing/plaf/windows/resources/SCCS/s.windows_sv.properties com/sun/java/swing/plaf/windows/resources/SCCS/s.windows_zh_TW.properties com/sun/java/swing/plaf/windows/resources/windows_de.properties com/sun/java/swing/plaf/windows/resources/windows.properties com/sun/java/swing/plaf/windows/resources/windows_es.properties com/sun/java/swing/plaf/windows/resources/windows_fr.properties com/sun/java/swing/plaf/windows/resources/windows_it.properties com/sun/java/swing/plaf/windows/resources/windows_ja.properties com/sun/java/swing/plaf/windows/resources/windows_ko.properties com/sun/java/swing/plaf/windows/resources/windows_sv.properties com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties com/sun/java/swing/plaf/windows/resources/windows_zh_TW.properties com/sun/java/swing/plaf/windows/WindowsButtonListener.java com/sun/java/swing/plaf/windows/DesktopProperty.java com/sun/java/swing/plaf/windows/WindowsBorders.java com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java com/sun/java/swing/plaf/windows/WindowsButtonUI.java com/sun/java/swing/plaf/windows/WindowsClassicLookAndFeel.java com/sun/java/swing/plaf/windows/WindowsCheckBoxUI.java com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java com/sun/java/swing/plaf/windows/WindowsDesktopIconUI.java com/sun/java/swing/plaf/windows/WindowsDesktopManager.java com/sun/java/swing/plaf/windows/WindowsDesktopPaneUI.java com/sun/java/swing/plaf/windows/XPStyle.java com/sun/java/swing/plaf/windows/WindowsIconFactory.java com/sun/java/swing/plaf/windows/WindowsEditorPaneUI.java com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java com/sun/java/swing/plaf/windows/WindowsInternalFrameUI.java com/sun/java/swing/plaf/windows/WindowsLabelUI.java com/sun/java/swing/plaf/windows/WindowsListUI.java com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java com/sun/java/swing/plaf/windows/WindowsMenuUI.java com/sun/java/swing/plaf/windows/WindowsOptionPaneUI.java com/sun/java/swing/plaf/windows/WindowsPasswordFieldUI.java com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java com/sun/java/swing/plaf/windows/WindowsPopupWindow.java com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java com/sun/java/swing/plaf/windows/WindowsRadioButtonUI.java com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java com/sun/java/swing/plaf/windows/WindowsScrollPaneUI.java com/sun/java/swing/plaf/windows/WindowsSeparatorUI.java com/sun/java/swing/plaf/windows/WindowsSliderUI.java com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java com/sun/java/swing/plaf/windows/WindowsSplitPaneDivider.java com/sun/java/swing/plaf/windows/WindowsSplitPaneUI.java com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI.java com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java com/sun/java/swing/plaf/windows/WindowsTableUI.java com/sun/java/swing/plaf/windows/WindowsTextUI.java com/sun/java/swing/plaf/windows/WindowsTextAreaUI.java com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java com/sun/java/swing/plaf/windows/WindowsTextPaneUI.java com/sun/java/swing/plaf/windows/WindowsToggleButtonUI.java com/sun/java/swing/plaf/windows/WindowsToolBarSeparatorUI.java com/sun/java/swing/plaf/windows/WindowsToolBarUI.java com/sun/java/swing/plaf/windows/WindowsTreeUI.java com/sun/java/swing/plaf/windows/WindowsUtils.java com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java com/sun/java/swing/SwingUtilities2.java com/sun/java/util com/sun/java/util/jar com/sun/java/util/jar/pack com/sun/java/util/jar/pack/SCCS com/sun/java/util/jar/pack/SCCS/s.AdaptiveCoding.java com/sun/java/util/jar/pack/SCCS/s.Attribute.java com/sun/java/util/jar/pack/SCCS/s.BandStructure.java com/sun/java/util/jar/pack/SCCS/s.ClassReader.java com/sun/java/util/jar/pack/SCCS/s.ClassWriter.java com/sun/java/util/jar/pack/SCCS/s.Code.java com/sun/java/util/jar/pack/SCCS/s.Coding.java com/sun/java/util/jar/pack/SCCS/s.CodingChooser.java com/sun/java/util/jar/pack/SCCS/s.CodingMethod.java com/sun/java/util/jar/pack/SCCS/s.ConstantPool.java com/sun/java/util/jar/pack/SCCS/s.Constants.java com/sun/java/util/jar/pack/SCCS/s.Driver.java com/sun/java/util/jar/pack/SCCS/s.Fixups.java com/sun/java/util/jar/pack/SCCS/s.Histogram.java com/sun/java/util/jar/pack/SCCS/s.Instruction.java com/sun/java/util/jar/pack/SCCS/s.NativeUnpack.java com/sun/java/util/jar/pack/SCCS/s.Package.java com/sun/java/util/jar/pack/SCCS/s.PropMap.java com/sun/java/util/jar/pack/SCCS/s.PackageReader.java com/sun/java/util/jar/pack/SCCS/s.PackageWriter.java com/sun/java/util/jar/pack/SCCS/s.PackerImpl.java com/sun/java/util/jar/pack/SCCS/s.PopulationCoding.java com/sun/java/util/jar/pack/SCCS/s.UnpackerImpl.java com/sun/java/util/jar/pack/SCCS/s.Utils.java com/sun/java/util/jar/pack/SCCS/s.intrinsic.properties com/sun/java/util/jar/pack/SCCS/s.package.html com/sun/java/util/jar/pack/AdaptiveCoding.java com/sun/java/util/jar/pack/Attribute.java com/sun/java/util/jar/pack/BandStructure.java com/sun/java/util/jar/pack/ClassReader.java com/sun/java/util/jar/pack/ClassWriter.java com/sun/java/util/jar/pack/Code.java com/sun/java/util/jar/pack/Coding.java com/sun/java/util/jar/pack/CodingChooser.java com/sun/java/util/jar/pack/CodingMethod.java com/sun/java/util/jar/pack/ConstantPool.java com/sun/java/util/jar/pack/Constants.java com/sun/java/util/jar/pack/Driver.java com/sun/java/util/jar/pack/Fixups.java com/sun/java/util/jar/pack/Histogram.java com/sun/java/util/jar/pack/Instruction.java com/sun/java/util/jar/pack/NativeUnpack.java com/sun/java/util/jar/pack/Package.java com/sun/java/util/jar/pack/PackageReader.java com/sun/java/util/jar/pack/PackageWriter.java com/sun/java/util/jar/pack/PackerImpl.java com/sun/java/util/jar/pack/PopulationCoding.java com/sun/java/util/jar/pack/PropMap.java com/sun/java/util/jar/pack/UnpackerImpl.java com/sun/java/util/jar/pack/Utils.java com/sun/java/util/jar/pack/intrinsic.properties com/sun/java/util/jar/pack/package.html com/sun/java/util/logging com/sun/java/util/logging/ulf com/sun/java/util/logging/ulf/SCCS com/sun/java2d com/sun/java2d/fontchecker com/sun/java2d/fontchecker/SCCS com/sun/java2d/fontchecker/SCCS/s.FontCheckerConstants.java com/sun/java2d/fontchecker/SCCS/s.FontCheckDummy.java com/sun/java2d/fontchecker/SCCS/s.FontChecker.java com/sun/java2d/fontchecker/SCCS/s.FontFileFilter.java com/sun/java2d/fontchecker/SCCS/s.README.txt com/sun/java2d/fontchecker/FontCheckerConstants.java com/sun/java2d/fontchecker/FontCheckDummy.java com/sun/java2d/fontchecker/FontChecker.java com/sun/java2d/fontchecker/FontFileFilter.java com/sun/java2d/fontchecker/README.txt com/sun/java_cup com/sun/java_cup/internal com/sun/java_cup/internal/SCCS com/sun/java_cup/internal/SCCS/s.action_part.java com/sun/java_cup/internal/SCCS/s.Main.java com/sun/java_cup/internal/SCCS/s.action_production.java com/sun/java_cup/internal/SCCS/s.assoc.java com/sun/java_cup/internal/SCCS/s.emit.java com/sun/java_cup/internal/SCCS/s.internal_error.java com/sun/java_cup/internal/SCCS/s.lalr_item.java com/sun/java_cup/internal/SCCS/s.lalr_item_set.java com/sun/java_cup/internal/SCCS/s.lalr_state.java com/sun/java_cup/internal/SCCS/s.lalr_transition.java com/sun/java_cup/internal/SCCS/s.lexer.java com/sun/java_cup/internal/SCCS/s.lr_item_core.java com/sun/java_cup/internal/SCCS/s.non_terminal.java com/sun/java_cup/internal/SCCS/s.nonassoc_action.java com/sun/java_cup/internal/SCCS/s.parse_action.java com/sun/java_cup/internal/SCCS/s.parser.java com/sun/java_cup/internal/SCCS/s.parse_action_row.java com/sun/java_cup/internal/SCCS/s.parse_action_table.java com/sun/java_cup/internal/SCCS/s.parse_reduce_row.java com/sun/java_cup/internal/SCCS/s.parse_reduce_table.java com/sun/java_cup/internal/SCCS/s.production.java com/sun/java_cup/internal/SCCS/s.production_part.java com/sun/java_cup/internal/SCCS/s.reduce_action.java com/sun/java_cup/internal/SCCS/s.shift_action.java com/sun/java_cup/internal/SCCS/s.sym.java com/sun/java_cup/internal/SCCS/s.symbol.java com/sun/java_cup/internal/SCCS/s.symbol_part.java com/sun/java_cup/internal/SCCS/s.symbol_set.java com/sun/java_cup/internal/SCCS/s.terminal.java com/sun/java_cup/internal/SCCS/s.terminal_set.java com/sun/java_cup/internal/SCCS/s.version.java com/sun/java_cup/internal/runtime com/sun/java_cup/internal/runtime/SCCS com/sun/java_cup/internal/runtime/SCCS/s.lr_parser.java com/sun/java_cup/internal/runtime/SCCS/s.Scanner.java com/sun/java_cup/internal/runtime/SCCS/s.Symbol.java com/sun/java_cup/internal/runtime/SCCS/s.virtual_parse_stack.java com/sun/java_cup/internal/runtime/Scanner.java com/sun/java_cup/internal/runtime/Symbol.java com/sun/java_cup/internal/runtime/lr_parser.java com/sun/java_cup/internal/runtime/virtual_parse_stack.java com/sun/java_cup/internal/action_part.java com/sun/java_cup/internal/Main.java com/sun/java_cup/internal/action_production.java com/sun/java_cup/internal/assoc.java com/sun/java_cup/internal/emit.java com/sun/java_cup/internal/internal_error.java com/sun/java_cup/internal/lalr_item.java com/sun/java_cup/internal/lalr_item_set.java com/sun/java_cup/internal/lalr_state.java com/sun/java_cup/internal/lalr_transition.java com/sun/java_cup/internal/lexer.java com/sun/java_cup/internal/lr_item_core.java com/sun/java_cup/internal/non_terminal.java com/sun/java_cup/internal/nonassoc_action.java com/sun/java_cup/internal/parse_action.java com/sun/java_cup/internal/parser.java com/sun/java_cup/internal/parse_action_row.java com/sun/java_cup/internal/parse_action_table.java com/sun/java_cup/internal/parse_reduce_row.java com/sun/java_cup/internal/parse_reduce_table.java com/sun/java_cup/internal/production.java com/sun/java_cup/internal/production_part.java com/sun/java_cup/internal/reduce_action.java com/sun/java_cup/internal/shift_action.java com/sun/java_cup/internal/sym.java com/sun/java_cup/internal/symbol.java com/sun/java_cup/internal/symbol_part.java com/sun/java_cup/internal/symbol_set.java com/sun/java_cup/internal/terminal.java com/sun/java_cup/internal/terminal_set.java com/sun/java_cup/internal/version.java com/sun/javadoc com/sun/javadoc/SCCS com/sun/javadoc/SCCS/s.AnnotationTypeDoc.java com/sun/javadoc/SCCS/s.AnnotationDesc.java com/sun/javadoc/SCCS/s.Doc.java com/sun/javadoc/SCCS/s.AnnotationTypeElementDoc.java com/sun/javadoc/SCCS/s.AnnotationValue.java com/sun/javadoc/SCCS/s.ClassDoc.java com/sun/javadoc/SCCS/s.ConstructorDoc.java com/sun/javadoc/SCCS/s.Doclet.java com/sun/javadoc/SCCS/s.ParameterizedType.java com/sun/javadoc/SCCS/s.DocErrorReporter.java com/sun/javadoc/SCCS/s.ExecutableMemberDoc.java com/sun/javadoc/SCCS/s.FieldDoc.java com/sun/javadoc/SCCS/s.LanguageVersion.java com/sun/javadoc/SCCS/s.MemberDoc.java com/sun/javadoc/SCCS/s.MethodDoc.java com/sun/javadoc/SCCS/s.PackageDoc.java com/sun/javadoc/SCCS/s.ParamTag.java com/sun/javadoc/SCCS/s.Parameter.java com/sun/javadoc/SCCS/s.ProgramElementDoc.java com/sun/javadoc/SCCS/s.RootDoc.java com/sun/javadoc/SCCS/s.SeeTag.java com/sun/javadoc/SCCS/s.SerialFieldTag.java com/sun/javadoc/SCCS/s.SourcePosition.java com/sun/javadoc/SCCS/s.Tag.java com/sun/javadoc/SCCS/s.ThrowsTag.java com/sun/javadoc/SCCS/s.Type.java com/sun/javadoc/SCCS/s.TypeVariable.java com/sun/javadoc/SCCS/s.WildcardType.java com/sun/javadoc/SCCS/s.package.html com/sun/javadoc/AnnotationTypeDoc.java com/sun/javadoc/AnnotationDesc.java com/sun/javadoc/Doc.java com/sun/javadoc/AnnotationTypeElementDoc.java com/sun/javadoc/AnnotationValue.java com/sun/javadoc/ClassDoc.java com/sun/javadoc/ConstructorDoc.java com/sun/javadoc/Doclet.java com/sun/javadoc/SerialFieldTag.java com/sun/javadoc/SeeTag.java com/sun/javadoc/DocErrorReporter.java com/sun/javadoc/ExecutableMemberDoc.java com/sun/javadoc/FieldDoc.java com/sun/javadoc/LanguageVersion.java com/sun/javadoc/MemberDoc.java com/sun/javadoc/MethodDoc.java com/sun/javadoc/PackageDoc.java com/sun/javadoc/ParamTag.java com/sun/javadoc/Parameter.java com/sun/javadoc/ParameterizedType.java com/sun/javadoc/ProgramElementDoc.java com/sun/javadoc/RootDoc.java com/sun/javadoc/SourcePosition.java com/sun/javadoc/Tag.java com/sun/javadoc/ThrowsTag.java com/sun/javadoc/Type.java com/sun/javadoc/TypeVariable.java com/sun/javadoc/WildcardType.java com/sun/javadoc/package.html com/sun/jdi com/sun/jdi/SCCS com/sun/jdi/SCCS/s.AbsentInformationException.java com/sun/jdi/SCCS/s.Accessible.java com/sun/jdi/SCCS/s.ArrayReference.java com/sun/jdi/SCCS/s.ArrayType.java com/sun/jdi/SCCS/s.BooleanType.java com/sun/jdi/SCCS/s.BooleanValue.java com/sun/jdi/SCCS/s.Bootstrap.java com/sun/jdi/SCCS/s.ByteType.java com/sun/jdi/SCCS/s.ByteValue.java com/sun/jdi/SCCS/s.CharType.java com/sun/jdi/SCCS/s.CharValue.java com/sun/jdi/SCCS/s.ClassLoaderReference.java com/sun/jdi/SCCS/s.ClassNotLoadedException.java com/sun/jdi/SCCS/s.ClassObjectReference.java com/sun/jdi/SCCS/s.LongValue.java com/sun/jdi/SCCS/s.Location.java com/sun/jdi/SCCS/s.ClassNotPreparedException.java com/sun/jdi/SCCS/s.ClassType.java com/sun/jdi/SCCS/s.DoubleType.java com/sun/jdi/SCCS/s.DoubleValue.java com/sun/jdi/SCCS/s.Field.java com/sun/jdi/SCCS/s.FloatType.java com/sun/jdi/SCCS/s.FloatValue.java com/sun/jdi/SCCS/s.IncompatibleThreadStateException.java com/sun/jdi/SCCS/s.InconsistentDebugInfoException.java com/sun/jdi/SCCS/s.IntegerType.java com/sun/jdi/SCCS/s.IntegerValue.java com/sun/jdi/SCCS/s.InterfaceType.java com/sun/jdi/SCCS/s.InternalException.java com/sun/jdi/SCCS/s.InvalidCodeIndexException.java com/sun/jdi/SCCS/s.InvalidTypeException.java com/sun/jdi/SCCS/s.InvalidLineNumberException.java com/sun/jdi/SCCS/s.InvalidStackFrameException.java com/sun/jdi/SCCS/s.InvocationException.java com/sun/jdi/SCCS/s.JDIPermission.java com/sun/jdi/SCCS/s.LocalVariable.java com/sun/jdi/SCCS/s.Locatable.java com/sun/jdi/SCCS/s.LongType.java com/sun/jdi/SCCS/s.ObjectReference.java com/sun/jdi/SCCS/s.Method.java com/sun/jdi/SCCS/s.Mirror.java com/sun/jdi/SCCS/s.PathSearchingVirtualMachine.java com/sun/jdi/SCCS/s.NativeMethodException.java com/sun/jdi/SCCS/s.ObjectCollectedException.java com/sun/jdi/SCCS/s.ThreadGroupReference.java com/sun/jdi/SCCS/s.ShortType.java com/sun/jdi/SCCS/s.PrimitiveType.java com/sun/jdi/SCCS/s.PrimitiveValue.java com/sun/jdi/SCCS/s.ReferenceType.java com/sun/jdi/SCCS/s.ShortValue.java com/sun/jdi/SCCS/s.StackFrame.java com/sun/jdi/SCCS/s.StringReference.java com/sun/jdi/SCCS/s.VMDisconnectedException.java com/sun/jdi/SCCS/s.ThreadReference.java com/sun/jdi/SCCS/s.Type.java com/sun/jdi/SCCS/s.TypeComponent.java com/sun/jdi/SCCS/s.VMCannotBeModifiedException.java com/sun/jdi/SCCS/s.VMMismatchException.java com/sun/jdi/SCCS/s.VMOutOfMemoryException.java com/sun/jdi/SCCS/s.Value.java com/sun/jdi/SCCS/s.VirtualMachine.java com/sun/jdi/SCCS/s.VoidType.java com/sun/jdi/SCCS/s.VirtualMachineManager.java com/sun/jdi/SCCS/s.VoidValue.java com/sun/jdi/SCCS/s.package.html com/sun/jdi/connect com/sun/jdi/connect/SCCS com/sun/jdi/connect/SCCS/s.AttachingConnector.java com/sun/jdi/connect/SCCS/s.Connector.java com/sun/jdi/connect/SCCS/s.LaunchingConnector.java com/sun/jdi/connect/SCCS/s.package.html com/sun/jdi/connect/SCCS/s.IllegalConnectorArgumentsException.java com/sun/jdi/connect/SCCS/s.ListeningConnector.java com/sun/jdi/connect/SCCS/s.Transport.java com/sun/jdi/connect/SCCS/s.TransportTimeoutException.java com/sun/jdi/connect/SCCS/s.VMStartException.java com/sun/jdi/connect/spi com/sun/jdi/connect/spi/SCCS com/sun/jdi/connect/spi/SCCS/s.ClosedConnectionException.java com/sun/jdi/connect/spi/SCCS/s.Connection.java com/sun/jdi/connect/spi/SCCS/s.TransportService.java com/sun/jdi/connect/spi/SCCS/s.package.html com/sun/jdi/connect/spi/ClosedConnectionException.java com/sun/jdi/connect/spi/Connection.java com/sun/jdi/connect/spi/TransportService.java com/sun/jdi/connect/spi/package.html com/sun/jdi/connect/TransportTimeoutException.java com/sun/jdi/connect/AttachingConnector.java com/sun/jdi/connect/Connector.java com/sun/jdi/connect/LaunchingConnector.java com/sun/jdi/connect/Transport.java com/sun/jdi/connect/IllegalConnectorArgumentsException.java com/sun/jdi/connect/ListeningConnector.java com/sun/jdi/connect/VMStartException.java com/sun/jdi/connect/package.html com/sun/jdi/doc-files com/sun/jdi/doc-files/SCCS com/sun/jdi/doc-files/SCCS/s.signature.html com/sun/jdi/doc-files/signature.html com/sun/jdi/event com/sun/jdi/event/SCCS com/sun/jdi/event/SCCS/s.ModificationWatchpointEvent.java com/sun/jdi/event/SCCS/s.AccessWatchpointEvent.java com/sun/jdi/event/SCCS/s.BreakpointEvent.java com/sun/jdi/event/SCCS/s.ClassPrepareEvent.java com/sun/jdi/event/SCCS/s.ClassUnloadEvent.java com/sun/jdi/event/SCCS/s.Event.java com/sun/jdi/event/SCCS/s.EventIterator.java com/sun/jdi/event/SCCS/s.EventQueue.java com/sun/jdi/event/SCCS/s.EventSet.java com/sun/jdi/event/SCCS/s.ExceptionEvent.java com/sun/jdi/event/SCCS/s.LocatableEvent.java com/sun/jdi/event/SCCS/s.MethodEntryEvent.java com/sun/jdi/event/SCCS/s.MethodExitEvent.java com/sun/jdi/event/SCCS/s.VMDisconnectEvent.java com/sun/jdi/event/SCCS/s.StepEvent.java com/sun/jdi/event/SCCS/s.ThreadDeathEvent.java com/sun/jdi/event/SCCS/s.ThreadStartEvent.java com/sun/jdi/event/SCCS/s.VMDeathEvent.java com/sun/jdi/event/SCCS/s.WatchpointEvent.java com/sun/jdi/event/SCCS/s.VMStartEvent.java com/sun/jdi/event/SCCS/s.package.html com/sun/jdi/event/ModificationWatchpointEvent.java com/sun/jdi/event/AccessWatchpointEvent.java com/sun/jdi/event/BreakpointEvent.java com/sun/jdi/event/ClassPrepareEvent.java com/sun/jdi/event/ClassUnloadEvent.java com/sun/jdi/event/Event.java com/sun/jdi/event/EventIterator.java com/sun/jdi/event/EventQueue.java com/sun/jdi/event/EventSet.java com/sun/jdi/event/ExceptionEvent.java com/sun/jdi/event/LocatableEvent.java com/sun/jdi/event/MethodEntryEvent.java com/sun/jdi/event/MethodExitEvent.java com/sun/jdi/event/StepEvent.java com/sun/jdi/event/package.html com/sun/jdi/event/ThreadDeathEvent.java com/sun/jdi/event/ThreadStartEvent.java com/sun/jdi/event/VMDeathEvent.java com/sun/jdi/event/VMDisconnectEvent.java com/sun/jdi/event/VMStartEvent.java com/sun/jdi/event/WatchpointEvent.java com/sun/jdi/request com/sun/jdi/request/SCCS com/sun/jdi/request/SCCS/s.DuplicateRequestException.java com/sun/jdi/request/SCCS/s.AccessWatchpointRequest.java com/sun/jdi/request/SCCS/s.BreakpointRequest.java com/sun/jdi/request/SCCS/s.ClassPrepareRequest.java com/sun/jdi/request/SCCS/s.ClassUnloadRequest.java com/sun/jdi/request/SCCS/s.EventRequestManager.java com/sun/jdi/request/SCCS/s.EventRequest.java com/sun/jdi/request/SCCS/s.ExceptionRequest.java com/sun/jdi/request/SCCS/s.MethodEntryRequest.java com/sun/jdi/request/SCCS/s.package.html com/sun/jdi/request/SCCS/s.InvalidRequestStateException.java com/sun/jdi/request/SCCS/s.MethodExitRequest.java com/sun/jdi/request/SCCS/s.ModificationWatchpointRequest.java com/sun/jdi/request/SCCS/s.StepRequest.java com/sun/jdi/request/SCCS/s.ThreadDeathRequest.java com/sun/jdi/request/SCCS/s.ThreadStartRequest.java com/sun/jdi/request/SCCS/s.VMDeathRequest.java com/sun/jdi/request/SCCS/s.WatchpointRequest.java com/sun/jdi/request/InvalidRequestStateException.java com/sun/jdi/request/AccessWatchpointRequest.java com/sun/jdi/request/BreakpointRequest.java com/sun/jdi/request/ClassPrepareRequest.java com/sun/jdi/request/ClassUnloadRequest.java com/sun/jdi/request/DuplicateRequestException.java com/sun/jdi/request/EventRequest.java com/sun/jdi/request/EventRequestManager.java com/sun/jdi/request/ExceptionRequest.java com/sun/jdi/request/MethodEntryRequest.java com/sun/jdi/request/MethodExitRequest.java com/sun/jdi/request/StepRequest.java com/sun/jdi/request/package.html com/sun/jdi/request/ThreadDeathRequest.java com/sun/jdi/request/ModificationWatchpointRequest.java com/sun/jdi/request/ThreadStartRequest.java com/sun/jdi/request/VMDeathRequest.java com/sun/jdi/request/WatchpointRequest.java com/sun/jdi/Field.java com/sun/jdi/AbsentInformationException.java com/sun/jdi/Accessible.java com/sun/jdi/ArrayReference.java com/sun/jdi/ArrayType.java com/sun/jdi/BooleanType.java com/sun/jdi/BooleanValue.java com/sun/jdi/Bootstrap.java com/sun/jdi/ByteType.java com/sun/jdi/ByteValue.java com/sun/jdi/CharType.java com/sun/jdi/CharValue.java com/sun/jdi/ClassLoaderReference.java com/sun/jdi/ClassType.java com/sun/jdi/IntegerType.java com/sun/jdi/ClassNotLoadedException.java com/sun/jdi/ClassNotPreparedException.java com/sun/jdi/ClassObjectReference.java com/sun/jdi/DoubleType.java com/sun/jdi/DoubleValue.java com/sun/jdi/FloatType.java com/sun/jdi/FloatValue.java com/sun/jdi/ObjectReference.java com/sun/jdi/Locatable.java com/sun/jdi/IncompatibleThreadStateException.java com/sun/jdi/InconsistentDebugInfoException.java com/sun/jdi/IntegerValue.java com/sun/jdi/InterfaceType.java com/sun/jdi/InternalException.java com/sun/jdi/InvalidCodeIndexException.java com/sun/jdi/Method.java com/sun/jdi/InvalidLineNumberException.java com/sun/jdi/InvalidStackFrameException.java com/sun/jdi/InvalidTypeException.java com/sun/jdi/InvocationException.java com/sun/jdi/JDIPermission.java com/sun/jdi/LocalVariable.java com/sun/jdi/Location.java com/sun/jdi/LongType.java com/sun/jdi/LongValue.java com/sun/jdi/Mirror.java com/sun/jdi/ObjectCollectedException.java com/sun/jdi/NativeMethodException.java com/sun/jdi/StringReference.java com/sun/jdi/PathSearchingVirtualMachine.java com/sun/jdi/PrimitiveType.java com/sun/jdi/PrimitiveValue.java com/sun/jdi/ReferenceType.java com/sun/jdi/ShortType.java com/sun/jdi/ShortValue.java com/sun/jdi/StackFrame.java com/sun/jdi/VMCannotBeModifiedException.java com/sun/jdi/ThreadGroupReference.java com/sun/jdi/ThreadReference.java com/sun/jdi/Type.java com/sun/jdi/TypeComponent.java com/sun/jdi/VirtualMachine.java com/sun/jdi/Value.java com/sun/jdi/VMDisconnectedException.java com/sun/jdi/VMMismatchException.java com/sun/jdi/VMOutOfMemoryException.java com/sun/jdi/VirtualMachineManager.java com/sun/jdi/VoidType.java com/sun/jdi/VoidValue.java com/sun/jdi/package.html com/sun/jlex com/sun/jlex/internal com/sun/jlex/internal/SCCS com/sun/jlex/internal/SCCS/s.Main.java com/sun/jlex/internal/Main.java com/sun/jmx com/sun/jmx/defaults com/sun/jmx/defaults/SCCS com/sun/jmx/defaults/SCCS/s.JmxProperties.java com/sun/jmx/defaults/SCCS/s.ServiceName.java com/sun/jmx/defaults/SCCS/s.package.html com/sun/jmx/defaults/JmxProperties.java com/sun/jmx/defaults/ServiceName.java com/sun/jmx/defaults/package.html com/sun/jmx/interceptor com/sun/jmx/interceptor/SCCS com/sun/jmx/interceptor/SCCS/s.package.html com/sun/jmx/interceptor/SCCS/s.DefaultMBeanServerInterceptor.java com/sun/jmx/interceptor/SCCS/s.MBeanServerInterceptor.java com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java com/sun/jmx/interceptor/MBeanServerInterceptor.java com/sun/jmx/interceptor/package.html com/sun/jmx/mbeanserver com/sun/jmx/mbeanserver/SCCS com/sun/jmx/mbeanserver/SCCS/s.DynamicMetaDataImpl.java com/sun/jmx/mbeanserver/SCCS/s.BaseMetaDataImpl.java com/sun/jmx/mbeanserver/SCCS/s.package.html com/sun/jmx/mbeanserver/SCCS/s.ClassLoaderRepositorySupport.java com/sun/jmx/mbeanserver/SCCS/s.GetPropertyAction.java com/sun/jmx/mbeanserver/SCCS/s.Introspector.java com/sun/jmx/mbeanserver/SCCS/s.JmxMBeanServer.java com/sun/jmx/mbeanserver/SCCS/s.JmxMBeanServerBuilder.java com/sun/jmx/mbeanserver/SCCS/s.MBeanInstantiator.java com/sun/jmx/mbeanserver/SCCS/s.MBeanInstantiatorImpl.java com/sun/jmx/mbeanserver/SCCS/s.MBeanServerDelegateImpl.java com/sun/jmx/mbeanserver/SCCS/s.MetaData.java com/sun/jmx/mbeanserver/SCCS/s.MetaDataImpl.java com/sun/jmx/mbeanserver/SCCS/s.ModifiableClassLoaderRepository.java com/sun/jmx/mbeanserver/SCCS/s.NamedObject.java com/sun/jmx/mbeanserver/SCCS/s.ObjectInputStreamWithLoader.java com/sun/jmx/mbeanserver/SCCS/s.Repository.java com/sun/jmx/mbeanserver/SCCS/s.RepositorySupport.java com/sun/jmx/mbeanserver/SCCS/s.SecureClassLoaderRepository.java com/sun/jmx/mbeanserver/SCCS/s.StandardMetaDataImpl.java com/sun/jmx/mbeanserver/SCCS/s.SunJmxMBeanServer.java com/sun/jmx/mbeanserver/DynamicMetaDataImpl.java com/sun/jmx/mbeanserver/BaseMetaDataImpl.java com/sun/jmx/mbeanserver/Repository.java com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java com/sun/jmx/mbeanserver/GetPropertyAction.java com/sun/jmx/mbeanserver/Introspector.java com/sun/jmx/mbeanserver/JmxMBeanServer.java com/sun/jmx/mbeanserver/JmxMBeanServerBuilder.java com/sun/jmx/mbeanserver/MBeanInstantiator.java com/sun/jmx/mbeanserver/MBeanInstantiatorImpl.java com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java com/sun/jmx/mbeanserver/MetaData.java com/sun/jmx/mbeanserver/MetaDataImpl.java com/sun/jmx/mbeanserver/ModifiableClassLoaderRepository.java com/sun/jmx/mbeanserver/NamedObject.java com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java com/sun/jmx/mbeanserver/RepositorySupport.java com/sun/jmx/mbeanserver/SecureClassLoaderRepository.java com/sun/jmx/mbeanserver/StandardMetaDataImpl.java com/sun/jmx/mbeanserver/SunJmxMBeanServer.java com/sun/jmx/mbeanserver/package.html com/sun/jmx/remote com/sun/jmx/remote/internal com/sun/jmx/remote/internal/SCCS com/sun/jmx/remote/internal/SCCS/s.ArrayNotificationBuffer.java com/sun/jmx/remote/internal/SCCS/s.ArrayQueue.java com/sun/jmx/remote/internal/SCCS/s.ClientCommunicatorAdmin.java com/sun/jmx/remote/internal/SCCS/s.ClientListenerInfo.java com/sun/jmx/remote/internal/SCCS/s.ClientNotifForwarder.java com/sun/jmx/remote/internal/SCCS/s.ListenerInfo.java com/sun/jmx/remote/internal/SCCS/s.NotificationBuffer.java com/sun/jmx/remote/internal/SCCS/s.ProxyInputStream.java com/sun/jmx/remote/internal/SCCS/s.ProxyRef.java com/sun/jmx/remote/internal/SCCS/s.RMIExporter.java com/sun/jmx/remote/internal/SCCS/s.ServerCommunicatorAdmin.java com/sun/jmx/remote/internal/SCCS/s.ServerNotifForwarder.java com/sun/jmx/remote/internal/SCCS/s.Unmarshal.java com/sun/jmx/remote/internal/SCCS/s.package.html com/sun/jmx/remote/internal/ArrayNotificationBuffer.java com/sun/jmx/remote/internal/ArrayQueue.java com/sun/jmx/remote/internal/ClientCommunicatorAdmin.java com/sun/jmx/remote/internal/ClientListenerInfo.java com/sun/jmx/remote/internal/ClientNotifForwarder.java com/sun/jmx/remote/internal/ListenerInfo.java com/sun/jmx/remote/internal/NotificationBuffer.java com/sun/jmx/remote/internal/ProxyInputStream.java com/sun/jmx/remote/internal/ProxyRef.java com/sun/jmx/remote/internal/RMIExporter.java com/sun/jmx/remote/internal/ServerCommunicatorAdmin.java com/sun/jmx/remote/internal/ServerNotifForwarder.java com/sun/jmx/remote/internal/Unmarshal.java com/sun/jmx/remote/internal/package.html com/sun/jmx/remote/protocol com/sun/jmx/remote/protocol/iiop com/sun/jmx/remote/protocol/iiop/SCCS com/sun/jmx/remote/protocol/iiop/SCCS/s.ClientProvider.java com/sun/jmx/remote/protocol/iiop/SCCS/s.ServerProvider.java com/sun/jmx/remote/protocol/iiop/ClientProvider.java com/sun/jmx/remote/protocol/iiop/ServerProvider.java com/sun/jmx/remote/protocol/rmi com/sun/jmx/remote/protocol/rmi/SCCS com/sun/jmx/remote/protocol/rmi/SCCS/s.ClientProvider.java com/sun/jmx/remote/protocol/rmi/SCCS/s.ServerProvider.java com/sun/jmx/remote/protocol/rmi/ClientProvider.java com/sun/jmx/remote/protocol/rmi/ServerProvider.java com/sun/jmx/remote/security com/sun/jmx/remote/security/SCCS com/sun/jmx/remote/security/SCCS/s.JMXSubjectDomainCombiner.java com/sun/jmx/remote/security/SCCS/s.FileLoginModule.java com/sun/jmx/remote/security/SCCS/s.MBeanServerFileAccessController.java com/sun/jmx/remote/security/SCCS/s.JMXPluggableAuthenticator.java com/sun/jmx/remote/security/SCCS/s.MBeanServerAccessController.java com/sun/jmx/remote/security/SCCS/s.SubjectDelegator.java com/sun/jmx/remote/security/JMXPluggableAuthenticator.java com/sun/jmx/remote/security/FileLoginModule.java com/sun/jmx/remote/security/MBeanServerAccessController.java com/sun/jmx/remote/security/JMXSubjectDomainCombiner.java com/sun/jmx/remote/security/MBeanServerFileAccessController.java com/sun/jmx/remote/security/SubjectDelegator.java com/sun/jmx/remote/util com/sun/jmx/remote/util/SCCS com/sun/jmx/remote/util/SCCS/s.ClassLogger.java com/sun/jmx/remote/util/SCCS/s.CacheMap.java com/sun/jmx/remote/util/SCCS/s.ClassLoaderWithRepository.java com/sun/jmx/remote/util/SCCS/s.EnvHelp.java com/sun/jmx/remote/util/SCCS/s.OrderClassLoaders.java com/sun/jmx/remote/util/SCCS/s.Service.java com/sun/jmx/remote/util/ClassLogger.java com/sun/jmx/remote/util/CacheMap.java com/sun/jmx/remote/util/ClassLoaderWithRepository.java com/sun/jmx/remote/util/EnvHelp.java com/sun/jmx/remote/util/OrderClassLoaders.java com/sun/jmx/remote/util/Service.java com/sun/jmx/snmp com/sun/jmx/snmp/IPAcl com/sun/jmx/snmp/IPAcl/SCCS com/sun/jmx/snmp/IPAcl/SCCS/s.ASCII_CharStream.README com/sun/jmx/snmp/IPAcl/SCCS/s.ASCII_CharStream.java com/sun/jmx/snmp/IPAcl/SCCS/s.AclEntryImpl.java com/sun/jmx/snmp/IPAcl/SCCS/s.AclImpl.java com/sun/jmx/snmp/IPAcl/SCCS/s.GroupImpl.java com/sun/jmx/snmp/IPAcl/SCCS/s.Host.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMAccess.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMAclBlock.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMAclItem.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMCommunities.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMCommunity.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMEnterprise.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMHost.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMHostInform.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMHostName.java com/sun/jmx/snmp/IPAcl/SCCS/s.Node.java com/sun/jmx/snmp/IPAcl/SCCS/s.ParserTokenManager.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMHostTrap.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMInformBlock.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMInformCommunity.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMInformInterestedHost.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMInformItem.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMIpAddress.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMIpMask.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMIpV6Address.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMManagers.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMNetMask.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMNetMaskV6.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMSecurityDefs.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMTrapBlock.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMTrapCommunity.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMTrapInterestedHost.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMTrapItem.java com/sun/jmx/snmp/IPAcl/SCCS/s.JDMTrapNum.java com/sun/jmx/snmp/IPAcl/SCCS/s.JJTParserState.java com/sun/jmx/snmp/IPAcl/SCCS/s.NetMaskImpl.java com/sun/jmx/snmp/IPAcl/SCCS/s.OwnerImpl.java com/sun/jmx/snmp/IPAcl/SCCS/s.ParseError.java com/sun/jmx/snmp/IPAcl/SCCS/s.ParseException.java com/sun/jmx/snmp/IPAcl/SCCS/s.Parser.java com/sun/jmx/snmp/IPAcl/SCCS/s.Parser.jj com/sun/jmx/snmp/IPAcl/SCCS/s.Parser.jjt com/sun/jmx/snmp/IPAcl/SCCS/s.ParserConstants.java com/sun/jmx/snmp/IPAcl/SCCS/s.TokenMgrError.java com/sun/jmx/snmp/IPAcl/SCCS/s.ParserTreeConstants.java com/sun/jmx/snmp/IPAcl/SCCS/s.PermissionImpl.java com/sun/jmx/snmp/IPAcl/SCCS/s.PrincipalImpl.java com/sun/jmx/snmp/IPAcl/SCCS/s.README.update com/sun/jmx/snmp/IPAcl/SCCS/s.SimpleNode.java com/sun/jmx/snmp/IPAcl/SCCS/s.SnmpAcl.java com/sun/jmx/snmp/IPAcl/SCCS/s.Token.java com/sun/jmx/snmp/IPAcl/SCCS/s.package.html com/sun/jmx/snmp/IPAcl/JDMInformInterestedHost.java com/sun/jmx/snmp/IPAcl/ASCII_CharStream.README com/sun/jmx/snmp/IPAcl/ASCII_CharStream.java com/sun/jmx/snmp/IPAcl/AclEntryImpl.java com/sun/jmx/snmp/IPAcl/AclImpl.java com/sun/jmx/snmp/IPAcl/GroupImpl.java com/sun/jmx/snmp/IPAcl/Host.java com/sun/jmx/snmp/IPAcl/JDMAccess.java com/sun/jmx/snmp/IPAcl/JDMAclBlock.java com/sun/jmx/snmp/IPAcl/JDMAclItem.java com/sun/jmx/snmp/IPAcl/JDMCommunities.java com/sun/jmx/snmp/IPAcl/JDMCommunity.java com/sun/jmx/snmp/IPAcl/JDMEnterprise.java com/sun/jmx/snmp/IPAcl/JDMHost.java com/sun/jmx/snmp/IPAcl/JDMHostInform.java com/sun/jmx/snmp/IPAcl/JDMHostName.java com/sun/jmx/snmp/IPAcl/JDMHostTrap.java com/sun/jmx/snmp/IPAcl/JDMInformBlock.java com/sun/jmx/snmp/IPAcl/JDMInformCommunity.java com/sun/jmx/snmp/IPAcl/JDMSecurityDefs.java com/sun/jmx/snmp/IPAcl/JDMInformItem.java com/sun/jmx/snmp/IPAcl/JDMIpAddress.java com/sun/jmx/snmp/IPAcl/JDMIpMask.java com/sun/jmx/snmp/IPAcl/JDMIpV6Address.java com/sun/jmx/snmp/IPAcl/JDMManagers.java com/sun/jmx/snmp/IPAcl/JDMNetMask.java com/sun/jmx/snmp/IPAcl/JDMNetMaskV6.java com/sun/jmx/snmp/IPAcl/JDMTrapInterestedHost.java com/sun/jmx/snmp/IPAcl/JDMTrapBlock.java com/sun/jmx/snmp/IPAcl/JDMTrapCommunity.java com/sun/jmx/snmp/IPAcl/JDMTrapItem.java com/sun/jmx/snmp/IPAcl/JDMTrapNum.java com/sun/jmx/snmp/IPAcl/JJTParserState.java com/sun/jmx/snmp/IPAcl/TokenMgrError.java com/sun/jmx/snmp/IPAcl/README.update com/sun/jmx/snmp/IPAcl/NetMaskImpl.java com/sun/jmx/snmp/IPAcl/Node.java com/sun/jmx/snmp/IPAcl/OwnerImpl.java com/sun/jmx/snmp/IPAcl/ParseError.java com/sun/jmx/snmp/IPAcl/ParseException.java com/sun/jmx/snmp/IPAcl/Parser.java com/sun/jmx/snmp/IPAcl/Parser.jj com/sun/jmx/snmp/IPAcl/Parser.jjt com/sun/jmx/snmp/IPAcl/ParserConstants.java com/sun/jmx/snmp/IPAcl/ParserTokenManager.java com/sun/jmx/snmp/IPAcl/ParserTreeConstants.java com/sun/jmx/snmp/IPAcl/PermissionImpl.java com/sun/jmx/snmp/IPAcl/PrincipalImpl.java com/sun/jmx/snmp/IPAcl/SimpleNode.java com/sun/jmx/snmp/IPAcl/SnmpAcl.java com/sun/jmx/snmp/IPAcl/Token.java com/sun/jmx/snmp/IPAcl/package.html com/sun/jmx/snmp/SCCS com/sun/jmx/snmp/SCCS/s.EnumRowStatus.java com/sun/jmx/snmp/SCCS/s.BerDecoder.java com/sun/jmx/snmp/SCCS/s.BerEncoder.java com/sun/jmx/snmp/SCCS/s.BerException.java com/sun/jmx/snmp/SCCS/s.Enumerated.java com/sun/jmx/snmp/SCCS/s.InetAddressAcl.java com/sun/jmx/snmp/SCCS/s.ServiceName.java com/sun/jmx/snmp/SCCS/s.SnmpAckPdu.java com/sun/jmx/snmp/SCCS/s.SnmpCounter.java com/sun/jmx/snmp/SCCS/s.SnmpEngine.java com/sun/jmx/snmp/SCCS/s.SnmpBadSecurityLevelException.java com/sun/jmx/snmp/SCCS/s.SnmpCounter64.java com/sun/jmx/snmp/SCCS/s.SnmpDataTypeEnums.java com/sun/jmx/snmp/SCCS/s.SnmpDefinitions.java com/sun/jmx/snmp/SCCS/s.SnmpUnknownAccContrModelException.java com/sun/jmx/snmp/SCCS/s.SnmpEngineFactory.java com/sun/jmx/snmp/SCCS/s.SnmpEngineId.java com/sun/jmx/snmp/SCCS/s.SnmpEngineParameters.java com/sun/jmx/snmp/SCCS/s.SnmpGauge.java com/sun/jmx/snmp/SCCS/s.SnmpInt.java com/sun/jmx/snmp/SCCS/s.SnmpIpAddress.java com/sun/jmx/snmp/SCCS/s.SnmpMessage.java com/sun/jmx/snmp/SCCS/s.SnmpMsg.java com/sun/jmx/snmp/SCCS/s.SnmpNull.java com/sun/jmx/snmp/SCCS/s.SnmpOid.java com/sun/jmx/snmp/SCCS/s.SnmpOidDatabase.java com/sun/jmx/snmp/SCCS/s.SnmpOidDatabaseSupport.java com/sun/jmx/snmp/SCCS/s.SnmpOidRecord.java com/sun/jmx/snmp/SCCS/s.SnmpOidTable.java com/sun/jmx/snmp/SCCS/s.SnmpOidTableSupport.java com/sun/jmx/snmp/SCCS/s.SnmpOpaque.java com/sun/jmx/snmp/SCCS/s.SnmpParameters.java com/sun/jmx/snmp/SCCS/s.SnmpParams.java com/sun/jmx/snmp/SCCS/s.SnmpPdu.java com/sun/jmx/snmp/SCCS/s.SnmpPduBulk.java com/sun/jmx/snmp/SCCS/s.SnmpPduBulkType.java com/sun/jmx/snmp/SCCS/s.SnmpPduFactory.java com/sun/jmx/snmp/SCCS/s.SnmpPduFactoryBER.java com/sun/jmx/snmp/SCCS/s.SnmpPduPacket.java com/sun/jmx/snmp/SCCS/s.SnmpPduRequest.java com/sun/jmx/snmp/SCCS/s.SnmpPduRequestType.java com/sun/jmx/snmp/SCCS/s.SnmpPduTrap.java com/sun/jmx/snmp/SCCS/s.SnmpPeer.java com/sun/jmx/snmp/SCCS/s.SnmpScopedPduBulk.java com/sun/jmx/snmp/SCCS/s.SnmpScopedPduPacket.java com/sun/jmx/snmp/SCCS/s.SnmpScopedPduRequest.java com/sun/jmx/snmp/SCCS/s.SnmpSecurityException.java com/sun/jmx/snmp/SCCS/s.SnmpString.java com/sun/jmx/snmp/SCCS/s.SnmpSecurityParameters.java com/sun/jmx/snmp/SCCS/s.SnmpStatusException.java com/sun/jmx/snmp/SCCS/s.SnmpStringFixed.java com/sun/jmx/snmp/SCCS/s.SnmpTimeticks.java com/sun/jmx/snmp/SCCS/s.SnmpTooBigException.java com/sun/jmx/snmp/SCCS/s.SnmpUnknownMsgProcModelException.java com/sun/jmx/snmp/SCCS/s.SnmpUnknownModelException.java com/sun/jmx/snmp/SCCS/s.SnmpUnknownModelLcdException.java com/sun/jmx/snmp/SCCS/s.UserAcl.java com/sun/jmx/snmp/SCCS/s.SnmpUnknownSecModelException.java com/sun/jmx/snmp/SCCS/s.SnmpUnknownSubSystemException.java com/sun/jmx/snmp/SCCS/s.SnmpUnsignedInt.java com/sun/jmx/snmp/SCCS/s.SnmpUsmKeyHandler.java com/sun/jmx/snmp/SCCS/s.SnmpV3Message.java com/sun/jmx/snmp/SCCS/s.SnmpValue.java com/sun/jmx/snmp/SCCS/s.SnmpVarBind.java com/sun/jmx/snmp/SCCS/s.SnmpVarBindList.java com/sun/jmx/snmp/SCCS/s.ThreadContext.java com/sun/jmx/snmp/SCCS/s.Timestamp.java com/sun/jmx/snmp/SCCS/s.package.html com/sun/jmx/snmp/agent com/sun/jmx/snmp/agent/SCCS com/sun/jmx/snmp/agent/SCCS/s.SnmpEntryOid.java com/sun/jmx/snmp/agent/SCCS/s.SnmpIndex.java com/sun/jmx/snmp/agent/SCCS/s.SnmpErrorHandlerAgent.java com/sun/jmx/snmp/agent/SCCS/s.SnmpGenericMetaServer.java com/sun/jmx/snmp/agent/SCCS/s.SnmpGenericObjectServer.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMib.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMibAgent.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMibAgentMBean.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMibEntry.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMibGroup.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMibHandler.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMibNode.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMibOid.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMibRequest.java com/sun/jmx/snmp/agent/SCCS/s.SnmpTableEntryNotification.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMibRequestImpl.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMibSubRequest.java com/sun/jmx/snmp/agent/SCCS/s.SnmpMibTable.java com/sun/jmx/snmp/agent/SCCS/s.SnmpRequestTree.java com/sun/jmx/snmp/agent/SCCS/s.SnmpStandardMetaServer.java com/sun/jmx/snmp/agent/SCCS/s.SnmpStandardObjectServer.java com/sun/jmx/snmp/agent/SCCS/s.SnmpTableCallbackHandler.java com/sun/jmx/snmp/agent/SCCS/s.SnmpTableEntryFactory.java com/sun/jmx/snmp/agent/SCCS/s.SnmpUserDataFactory.java com/sun/jmx/snmp/agent/SCCS/s.SnmpTableSupport.java com/sun/jmx/snmp/agent/SCCS/s.package.html com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java com/sun/jmx/snmp/agent/SnmpEntryOid.java com/sun/jmx/snmp/agent/SnmpGenericObjectServer.java com/sun/jmx/snmp/agent/SnmpGenericMetaServer.java com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java com/sun/jmx/snmp/agent/SnmpIndex.java com/sun/jmx/snmp/agent/SnmpMib.java com/sun/jmx/snmp/agent/SnmpMibAgent.java com/sun/jmx/snmp/agent/SnmpMibEntry.java com/sun/jmx/snmp/agent/SnmpMibGroup.java com/sun/jmx/snmp/agent/SnmpMibHandler.java com/sun/jmx/snmp/agent/SnmpMibNode.java com/sun/jmx/snmp/agent/SnmpMibOid.java com/sun/jmx/snmp/agent/SnmpMibRequest.java com/sun/jmx/snmp/agent/package.html com/sun/jmx/snmp/agent/SnmpMibRequestImpl.java com/sun/jmx/snmp/agent/SnmpMibSubRequest.java com/sun/jmx/snmp/agent/SnmpMibTable.java com/sun/jmx/snmp/agent/SnmpRequestTree.java com/sun/jmx/snmp/agent/SnmpStandardMetaServer.java com/sun/jmx/snmp/agent/SnmpStandardObjectServer.java com/sun/jmx/snmp/agent/SnmpTableCallbackHandler.java com/sun/jmx/snmp/agent/SnmpTableEntryFactory.java com/sun/jmx/snmp/agent/SnmpTableEntryNotification.java com/sun/jmx/snmp/agent/SnmpTableSupport.java com/sun/jmx/snmp/agent/SnmpUserDataFactory.java com/sun/jmx/snmp/daemon com/sun/jmx/snmp/daemon/SCCS com/sun/jmx/snmp/daemon/SCCS/s.CommunicationException.java com/sun/jmx/snmp/daemon/SCCS/s.ClientHandler.java com/sun/jmx/snmp/daemon/SCCS/s.CommunicatorServerMBean.java com/sun/jmx/snmp/daemon/SCCS/s.CommunicatorServer.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpAdaptorServer.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpAdaptorServerMBean.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpInformHandler.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpInformRequest.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpMibTree.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpQManager.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpRequestCounter.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpRequestHandler.java com/sun/jmx/snmp/daemon/SCCS/s.package.html com/sun/jmx/snmp/daemon/SCCS/s.SnmpResponseHandler.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpSendServer.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpSession.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpSocket.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpSubBulkRequestHandler.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpSubNextRequestHandler.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpSubRequestHandler.java com/sun/jmx/snmp/daemon/SCCS/s.SnmpTimerServer.java com/sun/jmx/snmp/daemon/CommunicationException.java com/sun/jmx/snmp/daemon/ClientHandler.java com/sun/jmx/snmp/daemon/CommunicatorServerMBean.java com/sun/jmx/snmp/daemon/CommunicatorServer.java com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java com/sun/jmx/snmp/daemon/SnmpInformHandler.java com/sun/jmx/snmp/daemon/SnmpInformRequest.java com/sun/jmx/snmp/daemon/SnmpMibTree.java com/sun/jmx/snmp/daemon/SnmpQManager.java com/sun/jmx/snmp/daemon/SnmpRequestCounter.java com/sun/jmx/snmp/daemon/SnmpRequestHandler.java com/sun/jmx/snmp/daemon/SnmpResponseHandler.java com/sun/jmx/snmp/daemon/SnmpSendServer.java com/sun/jmx/snmp/daemon/SnmpSession.java com/sun/jmx/snmp/daemon/SnmpSocket.java com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java com/sun/jmx/snmp/daemon/SnmpSubNextRequestHandler.java com/sun/jmx/snmp/daemon/SnmpSubRequestHandler.java com/sun/jmx/snmp/daemon/SnmpTimerServer.java com/sun/jmx/snmp/daemon/package.html com/sun/jmx/snmp/defaults com/sun/jmx/snmp/defaults/SCCS com/sun/jmx/snmp/defaults/SCCS/s.SnmpProperties.java com/sun/jmx/snmp/defaults/SCCS/s.DefaultPaths.java com/sun/jmx/snmp/defaults/SCCS/s.package.html com/sun/jmx/snmp/defaults/DefaultPaths.java com/sun/jmx/snmp/defaults/SnmpProperties.java com/sun/jmx/snmp/defaults/package.html com/sun/jmx/snmp/internal com/sun/jmx/snmp/internal/SCCS com/sun/jmx/snmp/internal/SCCS/s.SnmpAccessControlSubSystem.java com/sun/jmx/snmp/internal/SCCS/s.SnmpAccessControlModel.java com/sun/jmx/snmp/internal/SCCS/s.SnmpMsgProcessingModel.java com/sun/jmx/snmp/internal/SCCS/s.SnmpDecryptedPdu.java com/sun/jmx/snmp/internal/SCCS/s.SnmpEngineImpl.java com/sun/jmx/snmp/internal/SCCS/s.SnmpIncomingRequest.java com/sun/jmx/snmp/internal/SCCS/s.SnmpIncomingResponse.java com/sun/jmx/snmp/internal/SCCS/s.SnmpLcd.java com/sun/jmx/snmp/internal/SCCS/s.SnmpModel.java com/sun/jmx/snmp/internal/SCCS/s.SnmpModelLcd.java com/sun/jmx/snmp/internal/SCCS/s.SnmpMsgProcessingSubSystem.java com/sun/jmx/snmp/internal/SCCS/s.SnmpOutgoingRequest.java com/sun/jmx/snmp/internal/SCCS/s.SnmpSecurityCache.java com/sun/jmx/snmp/internal/SCCS/s.SnmpSubSystem.java com/sun/jmx/snmp/internal/SCCS/s.SnmpSecurityModel.java com/sun/jmx/snmp/internal/SCCS/s.SnmpSecuritySubSystem.java com/sun/jmx/snmp/internal/SCCS/s.SnmpTools.java com/sun/jmx/snmp/internal/SCCS/s.package.html com/sun/jmx/snmp/internal/SnmpAccessControlSubSystem.java com/sun/jmx/snmp/internal/SnmpAccessControlModel.java com/sun/jmx/snmp/internal/SnmpMsgProcessingSubSystem.java com/sun/jmx/snmp/internal/SnmpDecryptedPdu.java com/sun/jmx/snmp/internal/SnmpEngineImpl.java com/sun/jmx/snmp/internal/SnmpIncomingRequest.java com/sun/jmx/snmp/internal/SnmpIncomingResponse.java com/sun/jmx/snmp/internal/SnmpLcd.java com/sun/jmx/snmp/internal/SnmpModel.java com/sun/jmx/snmp/internal/SnmpModelLcd.java com/sun/jmx/snmp/internal/SnmpMsgProcessingModel.java com/sun/jmx/snmp/internal/SnmpOutgoingRequest.java com/sun/jmx/snmp/internal/SnmpSecurityCache.java com/sun/jmx/snmp/internal/SnmpSecurityModel.java com/sun/jmx/snmp/internal/SnmpSecuritySubSystem.java com/sun/jmx/snmp/internal/SnmpSubSystem.java com/sun/jmx/snmp/internal/SnmpTools.java com/sun/jmx/snmp/internal/package.html com/sun/jmx/snmp/mpm com/sun/jmx/snmp/mpm/SCCS com/sun/jmx/snmp/mpm/SCCS/s.SnmpMsgTranslator.java com/sun/jmx/snmp/mpm/SCCS/s.package.html com/sun/jmx/snmp/mpm/SnmpMsgTranslator.java com/sun/jmx/snmp/mpm/package.html com/sun/jmx/snmp/tasks com/sun/jmx/snmp/tasks/SCCS com/sun/jmx/snmp/tasks/SCCS/s.TaskServer.java com/sun/jmx/snmp/tasks/SCCS/s.Task.java com/sun/jmx/snmp/tasks/SCCS/s.ThreadService.java com/sun/jmx/snmp/tasks/SCCS/s.package.html com/sun/jmx/snmp/tasks/TaskServer.java com/sun/jmx/snmp/tasks/Task.java com/sun/jmx/snmp/tasks/ThreadService.java com/sun/jmx/snmp/tasks/package.html com/sun/jmx/snmp/BerException.java com/sun/jmx/snmp/BerDecoder.java com/sun/jmx/snmp/BerEncoder.java com/sun/jmx/snmp/EnumRowStatus.java com/sun/jmx/snmp/Enumerated.java com/sun/jmx/snmp/InetAddressAcl.java com/sun/jmx/snmp/ServiceName.java com/sun/jmx/snmp/SnmpAckPdu.java com/sun/jmx/snmp/SnmpCounter.java com/sun/jmx/snmp/SnmpCounter64.java com/sun/jmx/snmp/SnmpBadSecurityLevelException.java com/sun/jmx/snmp/SnmpUnknownAccContrModelException.java com/sun/jmx/snmp/SnmpDataTypeEnums.java com/sun/jmx/snmp/SnmpDefinitions.java com/sun/jmx/snmp/SnmpEngine.java com/sun/jmx/snmp/SnmpEngineFactory.java com/sun/jmx/snmp/SnmpEngineId.java com/sun/jmx/snmp/SnmpEngineParameters.java com/sun/jmx/snmp/SnmpGauge.java com/sun/jmx/snmp/SnmpInt.java com/sun/jmx/snmp/SnmpIpAddress.java com/sun/jmx/snmp/SnmpMessage.java com/sun/jmx/snmp/SnmpMsg.java com/sun/jmx/snmp/SnmpNull.java com/sun/jmx/snmp/SnmpOid.java com/sun/jmx/snmp/SnmpOidDatabase.java com/sun/jmx/snmp/SnmpOidDatabaseSupport.java com/sun/jmx/snmp/SnmpOidRecord.java com/sun/jmx/snmp/SnmpOidTable.java com/sun/jmx/snmp/SnmpOpaque.java com/sun/jmx/snmp/SnmpOidTableSupport.java com/sun/jmx/snmp/SnmpParameters.java com/sun/jmx/snmp/SnmpParams.java com/sun/jmx/snmp/SnmpPdu.java com/sun/jmx/snmp/SnmpPduBulk.java com/sun/jmx/snmp/SnmpPduBulkType.java com/sun/jmx/snmp/SnmpPduFactory.java com/sun/jmx/snmp/SnmpPduFactoryBER.java com/sun/jmx/snmp/SnmpPduPacket.java com/sun/jmx/snmp/SnmpPduRequest.java com/sun/jmx/snmp/SnmpPduRequestType.java com/sun/jmx/snmp/SnmpPduTrap.java com/sun/jmx/snmp/SnmpPeer.java com/sun/jmx/snmp/SnmpScopedPduBulk.java com/sun/jmx/snmp/SnmpScopedPduPacket.java com/sun/jmx/snmp/SnmpScopedPduRequest.java com/sun/jmx/snmp/SnmpSecurityException.java com/sun/jmx/snmp/SnmpSecurityParameters.java com/sun/jmx/snmp/SnmpStatusException.java com/sun/jmx/snmp/SnmpString.java com/sun/jmx/snmp/SnmpStringFixed.java com/sun/jmx/snmp/SnmpTimeticks.java com/sun/jmx/snmp/SnmpTooBigException.java com/sun/jmx/snmp/SnmpUnknownModelLcdException.java com/sun/jmx/snmp/SnmpUnknownModelException.java com/sun/jmx/snmp/SnmpValue.java com/sun/jmx/snmp/SnmpUnknownMsgProcModelException.java com/sun/jmx/snmp/SnmpUnknownSecModelException.java com/sun/jmx/snmp/SnmpUnknownSubSystemException.java com/sun/jmx/snmp/SnmpUnsignedInt.java com/sun/jmx/snmp/SnmpUsmKeyHandler.java com/sun/jmx/snmp/SnmpV3Message.java com/sun/jmx/snmp/SnmpVarBind.java com/sun/jmx/snmp/SnmpVarBindList.java com/sun/jmx/snmp/ThreadContext.java com/sun/jmx/snmp/Timestamp.java com/sun/jmx/snmp/UserAcl.java com/sun/jmx/snmp/package.html com/sun/jmx/trace com/sun/jmx/trace/SCCS com/sun/jmx/trace/SCCS/s.TraceDestination.java com/sun/jmx/trace/SCCS/s.Trace.java com/sun/jmx/trace/SCCS/s.TraceImplementation.java com/sun/jmx/trace/SCCS/s.TraceManager.java com/sun/jmx/trace/SCCS/s.TraceTags.java com/sun/jmx/trace/SCCS/s.logging.properties com/sun/jmx/trace/SCCS/s.package.html com/sun/jmx/trace/Trace.java com/sun/jmx/trace/TraceManager.java com/sun/jmx/trace/TraceDestination.java com/sun/jmx/trace/TraceImplementation.java com/sun/jmx/trace/TraceTags.java com/sun/jmx/trace/logging.properties com/sun/jmx/trace/package.html com/sun/jndi com/sun/jndi/cosnaming com/sun/jndi/cosnaming/SCCS com/sun/jndi/cosnaming/SCCS/s.CNBindingEnumeration.java com/sun/jndi/cosnaming/SCCS/s.CNCtx.java com/sun/jndi/cosnaming/SCCS/s.CNCtxFactory.java com/sun/jndi/cosnaming/SCCS/s.CNNameParser.java com/sun/jndi/cosnaming/SCCS/s.CorbanameUrl.java com/sun/jndi/cosnaming/SCCS/s.ExceptionMapper.java com/sun/jndi/cosnaming/SCCS/s.IiopUrl.java com/sun/jndi/cosnaming/SCCS/s.RemoteToCorba.java com/sun/jndi/cosnaming/SCCS/s.jndiprovider.properties com/sun/jndi/cosnaming/CNBindingEnumeration.java com/sun/jndi/cosnaming/CNCtx.java com/sun/jndi/cosnaming/CNCtxFactory.java com/sun/jndi/cosnaming/CNNameParser.java com/sun/jndi/cosnaming/CorbanameUrl.java com/sun/jndi/cosnaming/ExceptionMapper.java com/sun/jndi/cosnaming/IiopUrl.java com/sun/jndi/cosnaming/RemoteToCorba.java com/sun/jndi/cosnaming/jndiprovider.properties com/sun/jndi/dns com/sun/jndi/dns/SCCS com/sun/jndi/dns/SCCS/s.DnsContextFactory.java com/sun/jndi/dns/SCCS/s.DnsClient.java com/sun/jndi/dns/SCCS/s.DnsContext.java com/sun/jndi/dns/SCCS/s.DnsNameParser.java com/sun/jndi/dns/SCCS/s.DnsName.java com/sun/jndi/dns/SCCS/s.ResourceRecord.java com/sun/jndi/dns/SCCS/s.DnsUrl.java com/sun/jndi/dns/SCCS/s.Header.java com/sun/jndi/dns/SCCS/s.NameNode.java com/sun/jndi/dns/SCCS/s.Resolver.java com/sun/jndi/dns/SCCS/s.ResourceRecords.java com/sun/jndi/dns/SCCS/s.ZoneNode.java com/sun/jndi/dns/DnsContextFactory.java com/sun/jndi/dns/DnsClient.java com/sun/jndi/dns/DnsContext.java com/sun/jndi/dns/DnsNameParser.java com/sun/jndi/dns/DnsName.java com/sun/jndi/dns/ResourceRecord.java com/sun/jndi/dns/DnsUrl.java com/sun/jndi/dns/Header.java com/sun/jndi/dns/NameNode.java com/sun/jndi/dns/Resolver.java com/sun/jndi/dns/ResourceRecords.java com/sun/jndi/dns/ZoneNode.java com/sun/jndi/ldap com/sun/jndi/ldap/SCCS com/sun/jndi/ldap/SCCS/s.BindingWithControls.java com/sun/jndi/ldap/SCCS/s.BasicControl.java com/sun/jndi/ldap/SCCS/s.Ber.java com/sun/jndi/ldap/SCCS/s.BerDecoder.java com/sun/jndi/ldap/SCCS/s.BerEncoder.java com/sun/jndi/ldap/SCCS/s.Connection.java com/sun/jndi/ldap/SCCS/s.ClientId.java com/sun/jndi/ldap/SCCS/s.LdapAttribute.java com/sun/jndi/ldap/SCCS/s.Filter.java com/sun/jndi/ldap/SCCS/s.DefaultResponseControlFactory.java com/sun/jndi/ldap/SCCS/s.DigestClientId.java com/sun/jndi/ldap/SCCS/s.EntryChangeResponseControl.java com/sun/jndi/ldap/SCCS/s.EventQueue.java com/sun/jndi/ldap/SCCS/s.EventSupport.java com/sun/jndi/ldap/SCCS/s.LdapCtxFactory.java com/sun/jndi/ldap/SCCS/s.LdapCtx.java com/sun/jndi/ldap/SCCS/s.LdapBindingEnumeration.java com/sun/jndi/ldap/SCCS/s.LdapClient.java com/sun/jndi/ldap/SCCS/s.LdapClientFactory.java com/sun/jndi/ldap/SCCS/s.LdapNameParser.java com/sun/jndi/ldap/SCCS/s.LdapEntry.java com/sun/jndi/ldap/SCCS/s.LdapName.java com/sun/jndi/ldap/SCCS/s.Obj.java com/sun/jndi/ldap/SCCS/s.VersionHelper12.java com/sun/jndi/ldap/SCCS/s.LdapNamingEnumeration.java com/sun/jndi/ldap/SCCS/s.LdapPoolManager.java com/sun/jndi/ldap/SCCS/s.LdapReferralContext.java com/sun/jndi/ldap/SCCS/s.LdapReferralException.java com/sun/jndi/ldap/SCCS/s.LdapRequest.java com/sun/jndi/ldap/SCCS/s.LdapResult.java com/sun/jndi/ldap/SCCS/s.LdapSchemaCtx.java com/sun/jndi/ldap/SCCS/s.LdapSchemaParser.java com/sun/jndi/ldap/SCCS/s.LdapSearchEnumeration.java com/sun/jndi/ldap/SCCS/s.LdapURL.java com/sun/jndi/ldap/SCCS/s.ManageReferralControl.java com/sun/jndi/ldap/SCCS/s.NameClassPairWithControls.java com/sun/jndi/ldap/SCCS/s.NamingEventNotifier.java com/sun/jndi/ldap/SCCS/s.NotifierArgs.java com/sun/jndi/ldap/SCCS/s.PersistentSearchControl.java com/sun/jndi/ldap/SCCS/s.ReferralEnumeration.java com/sun/jndi/ldap/SCCS/s.SearchResultWithControls.java com/sun/jndi/ldap/SCCS/s.ServiceLocator.java com/sun/jndi/ldap/SCCS/s.SimpleClientId.java com/sun/jndi/ldap/SCCS/s.UnsolicitedResponseImpl.java com/sun/jndi/ldap/SCCS/s.VersionHelper.java com/sun/jndi/ldap/SCCS/s.jndiprovider.properties com/sun/jndi/ldap/ext com/sun/jndi/ldap/ext/SCCS com/sun/jndi/ldap/ext/SCCS/s.StartTlsResponseImpl.java com/sun/jndi/ldap/ext/StartTlsResponseImpl.java com/sun/jndi/ldap/pool com/sun/jndi/ldap/pool/SCCS com/sun/jndi/ldap/pool/SCCS/s.ConnectionsWeakRef.java com/sun/jndi/ldap/pool/SCCS/s.ConnectionDesc.java com/sun/jndi/ldap/pool/SCCS/s.Connections.java com/sun/jndi/ldap/pool/SCCS/s.ConnectionsRef.java com/sun/jndi/ldap/pool/SCCS/s.PoolCallback.java com/sun/jndi/ldap/pool/SCCS/s.Pool.java com/sun/jndi/ldap/pool/SCCS/s.PooledConnectionFactory.java com/sun/jndi/ldap/pool/SCCS/s.PoolCleaner.java com/sun/jndi/ldap/pool/SCCS/s.PooledConnection.java com/sun/jndi/ldap/pool/ConnectionsWeakRef.java com/sun/jndi/ldap/pool/ConnectionDesc.java com/sun/jndi/ldap/pool/Connections.java com/sun/jndi/ldap/pool/ConnectionsRef.java com/sun/jndi/ldap/pool/PoolCallback.java com/sun/jndi/ldap/pool/Pool.java com/sun/jndi/ldap/pool/PooledConnectionFactory.java com/sun/jndi/ldap/pool/PoolCleaner.java com/sun/jndi/ldap/pool/PooledConnection.java com/sun/jndi/ldap/sasl com/sun/jndi/ldap/sasl/SCCS com/sun/jndi/ldap/sasl/SCCS/s.DefaultCallbackHandler.java com/sun/jndi/ldap/sasl/SCCS/s.LdapSasl.java com/sun/jndi/ldap/sasl/SCCS/s.SaslInputStream.java com/sun/jndi/ldap/sasl/SCCS/s.SaslOutputStream.java com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java com/sun/jndi/ldap/sasl/LdapSasl.java com/sun/jndi/ldap/sasl/SaslInputStream.java com/sun/jndi/ldap/sasl/SaslOutputStream.java com/sun/jndi/ldap/BindingWithControls.java com/sun/jndi/ldap/BasicControl.java com/sun/jndi/ldap/Ber.java com/sun/jndi/ldap/BerDecoder.java com/sun/jndi/ldap/BerEncoder.java com/sun/jndi/ldap/DigestClientId.java com/sun/jndi/ldap/ClientId.java com/sun/jndi/ldap/Connection.java com/sun/jndi/ldap/Filter.java com/sun/jndi/ldap/LdapBindingEnumeration.java com/sun/jndi/ldap/DefaultResponseControlFactory.java com/sun/jndi/ldap/EntryChangeResponseControl.java com/sun/jndi/ldap/EventQueue.java com/sun/jndi/ldap/EventSupport.java com/sun/jndi/ldap/LdapAttribute.java com/sun/jndi/ldap/LdapClientFactory.java com/sun/jndi/ldap/LdapClient.java com/sun/jndi/ldap/LdapCtxFactory.java com/sun/jndi/ldap/LdapCtx.java com/sun/jndi/ldap/LdapNamingEnumeration.java com/sun/jndi/ldap/LdapEntry.java com/sun/jndi/ldap/LdapName.java com/sun/jndi/ldap/LdapNameParser.java com/sun/jndi/ldap/LdapReferralContext.java com/sun/jndi/ldap/LdapPoolManager.java com/sun/jndi/ldap/ServiceLocator.java com/sun/jndi/ldap/Obj.java com/sun/jndi/ldap/LdapReferralException.java com/sun/jndi/ldap/LdapRequest.java com/sun/jndi/ldap/LdapResult.java com/sun/jndi/ldap/LdapSchemaCtx.java com/sun/jndi/ldap/LdapSchemaParser.java com/sun/jndi/ldap/LdapURL.java com/sun/jndi/ldap/LdapSearchEnumeration.java com/sun/jndi/ldap/ManageReferralControl.java com/sun/jndi/ldap/NameClassPairWithControls.java com/sun/jndi/ldap/NamingEventNotifier.java com/sun/jndi/ldap/NotifierArgs.java com/sun/jndi/ldap/PersistentSearchControl.java com/sun/jndi/ldap/ReferralEnumeration.java com/sun/jndi/ldap/SearchResultWithControls.java com/sun/jndi/ldap/SimpleClientId.java com/sun/jndi/ldap/UnsolicitedResponseImpl.java com/sun/jndi/ldap/VersionHelper.java com/sun/jndi/ldap/VersionHelper12.java com/sun/jndi/ldap/jndiprovider.properties com/sun/jndi/rmi com/sun/jndi/rmi/registry com/sun/jndi/rmi/registry/SCCS com/sun/jndi/rmi/registry/SCCS/s.RegistryContextFactory.java com/sun/jndi/rmi/registry/SCCS/s.ReferenceWrapper.java com/sun/jndi/rmi/registry/SCCS/s.RegistryContext.java com/sun/jndi/rmi/registry/SCCS/s.RemoteReference.java com/sun/jndi/rmi/registry/RegistryContextFactory.java com/sun/jndi/rmi/registry/ReferenceWrapper.java com/sun/jndi/rmi/registry/RegistryContext.java com/sun/jndi/rmi/registry/RemoteReference.java com/sun/jndi/toolkit com/sun/jndi/toolkit/corba com/sun/jndi/toolkit/corba/SCCS com/sun/jndi/toolkit/corba/SCCS/s.CorbaUtils.java com/sun/jndi/toolkit/corba/CorbaUtils.java com/sun/jndi/toolkit/ctx com/sun/jndi/toolkit/ctx/SCCS com/sun/jndi/toolkit/ctx/SCCS/s.ComponentDirContext.java com/sun/jndi/toolkit/ctx/SCCS/s.AtomicContext.java com/sun/jndi/toolkit/ctx/SCCS/s.AtomicDirContext.java com/sun/jndi/toolkit/ctx/SCCS/s.ComponentContext.java com/sun/jndi/toolkit/ctx/SCCS/s.Continuation.java com/sun/jndi/toolkit/ctx/SCCS/s.HeadTail.java com/sun/jndi/toolkit/ctx/SCCS/s.StringHeadTail.java com/sun/jndi/toolkit/ctx/SCCS/s.PartialCompositeContext.java com/sun/jndi/toolkit/ctx/SCCS/s.PartialCompositeDirContext.java com/sun/jndi/toolkit/ctx/AtomicDirContext.java com/sun/jndi/toolkit/ctx/AtomicContext.java com/sun/jndi/toolkit/ctx/PartialCompositeContext.java com/sun/jndi/toolkit/ctx/ComponentContext.java com/sun/jndi/toolkit/ctx/ComponentDirContext.java com/sun/jndi/toolkit/ctx/Continuation.java com/sun/jndi/toolkit/ctx/HeadTail.java com/sun/jndi/toolkit/ctx/PartialCompositeDirContext.java com/sun/jndi/toolkit/ctx/StringHeadTail.java com/sun/jndi/toolkit/dir com/sun/jndi/toolkit/dir/SCCS com/sun/jndi/toolkit/dir/SCCS/s.ContainmentFilter.java com/sun/jndi/toolkit/dir/SCCS/s.AttrFilter.java com/sun/jndi/toolkit/dir/SCCS/s.LazySearchEnumerationImpl.java com/sun/jndi/toolkit/dir/SCCS/s.ContextEnumerator.java com/sun/jndi/toolkit/dir/SCCS/s.DirSearch.java com/sun/jndi/toolkit/dir/SCCS/s.HierMemDirCtx.java com/sun/jndi/toolkit/dir/SCCS/s.SearchFilter.java com/sun/jndi/toolkit/dir/ContainmentFilter.java com/sun/jndi/toolkit/dir/AttrFilter.java com/sun/jndi/toolkit/dir/LazySearchEnumerationImpl.java com/sun/jndi/toolkit/dir/ContextEnumerator.java com/sun/jndi/toolkit/dir/DirSearch.java com/sun/jndi/toolkit/dir/HierMemDirCtx.java com/sun/jndi/toolkit/dir/SearchFilter.java com/sun/jndi/toolkit/url com/sun/jndi/toolkit/url/SCCS com/sun/jndi/toolkit/url/SCCS/s.GenericURLContext.java com/sun/jndi/toolkit/url/SCCS/s.GenericURLDirContext.java com/sun/jndi/toolkit/url/SCCS/s.Uri.java com/sun/jndi/toolkit/url/SCCS/s.UrlUtil.java com/sun/jndi/toolkit/url/GenericURLDirContext.java com/sun/jndi/toolkit/url/GenericURLContext.java com/sun/jndi/toolkit/url/Uri.java com/sun/jndi/toolkit/url/UrlUtil.java com/sun/jndi/url com/sun/jndi/url/corbaname com/sun/jndi/url/corbaname/SCCS com/sun/jndi/url/corbaname/SCCS/s.corbanameURLContextFactory.java com/sun/jndi/url/corbaname/corbanameURLContextFactory.java com/sun/jndi/url/dns com/sun/jndi/url/dns/SCCS com/sun/jndi/url/dns/SCCS/s.dnsURLContextFactory.java com/sun/jndi/url/dns/SCCS/s.dnsURLContext.java com/sun/jndi/url/dns/dnsURLContextFactory.java com/sun/jndi/url/dns/dnsURLContext.java com/sun/jndi/url/iiop com/sun/jndi/url/iiop/SCCS com/sun/jndi/url/iiop/SCCS/s.iiopURLContextFactory.java com/sun/jndi/url/iiop/SCCS/s.iiopURLContext.java com/sun/jndi/url/iiop/iiopURLContextFactory.java com/sun/jndi/url/iiop/iiopURLContext.java com/sun/jndi/url/iiopname com/sun/jndi/url/iiopname/SCCS com/sun/jndi/url/iiopname/SCCS/s.iiopnameURLContextFactory.java com/sun/jndi/url/iiopname/iiopnameURLContextFactory.java com/sun/jndi/url/ldap com/sun/jndi/url/ldap/SCCS com/sun/jndi/url/ldap/SCCS/s.ldapURLContextFactory.java com/sun/jndi/url/ldap/SCCS/s.ldapURLContext.java com/sun/jndi/url/ldap/ldapURLContextFactory.java com/sun/jndi/url/ldap/ldapURLContext.java com/sun/jndi/url/ldaps com/sun/jndi/url/ldaps/SCCS com/sun/jndi/url/ldaps/SCCS/s.ldapsURLContextFactory.java com/sun/jndi/url/ldaps/ldapsURLContextFactory.java com/sun/jndi/url/rmi com/sun/jndi/url/rmi/SCCS com/sun/jndi/url/rmi/SCCS/s.rmiURLContextFactory.java com/sun/jndi/url/rmi/SCCS/s.rmiURLContext.java com/sun/jndi/url/rmi/rmiURLContextFactory.java com/sun/jndi/url/rmi/rmiURLContext.java com/sun/management com/sun/management/SCCS com/sun/management/SCCS/s.UnixOperatingSystemMXBean.java com/sun/management/SCCS/s.GarbageCollectorMXBean.java com/sun/management/SCCS/s.GcInfo.java com/sun/management/SCCS/s.OperatingSystemMXBean.java com/sun/management/SCCS/s.mgmt-overview.html com/sun/management/SCCS/s.package.html com/sun/management/jmx com/sun/management/jmx/SCCS com/sun/management/jmx/SCCS/s.MBeanServerImpl.java com/sun/management/jmx/SCCS/s.Introspector.java com/sun/management/jmx/SCCS/s.JMProperties.java com/sun/management/jmx/SCCS/s.TraceNotification.java com/sun/management/jmx/SCCS/s.ServiceName.java com/sun/management/jmx/SCCS/s.Trace.java com/sun/management/jmx/SCCS/s.TraceFilter.java com/sun/management/jmx/SCCS/s.TraceListener.java com/sun/management/jmx/SCCS/s.package.html com/sun/management/jmx/MBeanServerImpl.java com/sun/management/jmx/Introspector.java com/sun/management/jmx/JMProperties.java com/sun/management/jmx/ServiceName.java com/sun/management/jmx/Trace.java com/sun/management/jmx/TraceFilter.java com/sun/management/jmx/TraceListener.java com/sun/management/jmx/TraceNotification.java com/sun/management/jmx/package.html com/sun/management/UnixOperatingSystemMXBean.java com/sun/management/GarbageCollectorMXBean.java com/sun/management/GcInfo.java com/sun/management/OperatingSystemMXBean.java com/sun/management/mgmt-overview.html com/sun/management/package.html com/sun/media com/sun/media/sound com/sun/media/sound/SCCS com/sun/media/sound/SCCS/s.AbstractMidiDevice.java com/sun/media/sound/SCCS/s.AbstractDataLine.java com/sun/media/sound/SCCS/s.AbstractLine.java com/sun/media/sound/SCCS/s.AbstractMidiDeviceProvider.java com/sun/media/sound/SCCS/s.AbstractMixer.java com/sun/media/sound/SCCS/s.AbstractPlayer.java com/sun/media/sound/SCCS/s.AiffFileFormat.java com/sun/media/sound/SCCS/s.AiffFileReader.java com/sun/media/sound/SCCS/s.AiffFileWriter.java com/sun/media/sound/SCCS/s.AlawCodec.java com/sun/media/sound/SCCS/s.AuFileFormat.java com/sun/media/sound/SCCS/s.AuFileReader.java com/sun/media/sound/SCCS/s.AuFileWriter.java com/sun/media/sound/SCCS/s.AutoClosingClip.java com/sun/media/sound/SCCS/s.DirectAudioDeviceProvider.java com/sun/media/sound/SCCS/s.AutoConnectSequencer.java com/sun/media/sound/SCCS/s.CircularBuffer.java com/sun/media/sound/SCCS/s.DataPusher.java com/sun/media/sound/SCCS/s.DirectAudioDevice.java com/sun/media/sound/SCCS/s.HeadspaceInstrument.java com/sun/media/sound/SCCS/s.EventDispatcher.java com/sun/media/sound/SCCS/s.FastShortMessage.java com/sun/media/sound/SCCS/s.FastSysexMessage.java com/sun/media/sound/SCCS/s.HeadspaceMixerProvider.java com/sun/media/sound/SCCS/s.HeadspaceMixer.java com/sun/media/sound/SCCS/s.HeadspaceSample.java com/sun/media/sound/SCCS/s.HeadspaceSoundbank.java com/sun/media/sound/SCCS/s.HsbParser.java com/sun/media/sound/SCCS/s.JDK13Services.java com/sun/media/sound/SCCS/s.RealTimeSequencerProvider.java com/sun/media/sound/SCCS/s.JSSecurityManager.java com/sun/media/sound/SCCS/s.JavaSoundAudioClip.java com/sun/media/sound/SCCS/s.MidiInDevice.java com/sun/media/sound/SCCS/s.MidiInDeviceProvider.java com/sun/media/sound/SCCS/s.MidiOutDevice.java com/sun/media/sound/SCCS/s.MidiOutDeviceProvider.java com/sun/media/sound/SCCS/s.MidiUtils.java com/sun/media/sound/SCCS/s.MixerClip.java com/sun/media/sound/SCCS/s.MixerMidiChannel.java com/sun/media/sound/SCCS/s.MixerSequencer.java com/sun/media/sound/SCCS/s.MixerSequencerProvider.java com/sun/media/sound/SCCS/s.MixerSourceLine.java com/sun/media/sound/SCCS/s.MixerSynth.java com/sun/media/sound/SCCS/s.MixerSynthProvider.java com/sun/media/sound/SCCS/s.MixerThread.java com/sun/media/sound/SCCS/s.PCMtoPCMCodec.java com/sun/media/sound/SCCS/s.Platform.java com/sun/media/sound/SCCS/s.PortMixer.java com/sun/media/sound/SCCS/s.PortMixerProvider.java com/sun/media/sound/SCCS/s.Printer.java com/sun/media/sound/SCCS/s.RealTimeSequencer.java com/sun/media/sound/SCCS/s.SimpleInputDeviceProvider.java com/sun/media/sound/SCCS/s.ReferenceCountingDevice.java com/sun/media/sound/SCCS/s.RmfFileReader.java com/sun/media/sound/SCCS/s.SimpleInputDevice.java com/sun/media/sound/SCCS/s.StandardMidiFileReader.java com/sun/media/sound/SCCS/s.StandardMidiFileWriter.java com/sun/media/sound/SCCS/s.SunCodec.java com/sun/media/sound/SCCS/s.SunFileReader.java com/sun/media/sound/SCCS/s.SunFileWriter.java com/sun/media/sound/SCCS/s.Toolkit.java com/sun/media/sound/SCCS/s.UlawCodec.java com/sun/media/sound/SCCS/s.WaveFileFormat.java com/sun/media/sound/SCCS/s.WaveFileReader.java com/sun/media/sound/SCCS/s.WaveFileWriter.java com/sun/media/sound/services com/sun/media/sound/services/SCCS com/sun/media/sound/services/SCCS/s.javax.sound.sampled.spi.FormatConversionProvider com/sun/media/sound/services/SCCS/s.javax.sound.midi.spi.MidiDeviceProvider com/sun/media/sound/services/SCCS/s.javax.sound.midi.spi.MidiFileReader com/sun/media/sound/services/SCCS/s.javax.sound.midi.spi.MidiFileWriter com/sun/media/sound/services/SCCS/s.javax.sound.midi.spi.SoundbankReader com/sun/media/sound/services/SCCS/s.javax.sound.sampled.spi.AudioFileReader com/sun/media/sound/services/SCCS/s.javax.sound.sampled.spi.AudioFileWriter com/sun/media/sound/services/SCCS/s.javax.sound.sampled.spi.MixerProvider com/sun/media/sound/services/linux-i586 com/sun/media/sound/services/linux-i586/SCCS com/sun/media/sound/services/linux-i586/SCCS/s.javax.sound.sampled.spi.MixerProvider com/sun/media/sound/services/linux-i586/javax.sound.sampled.spi.MixerProvider com/sun/media/sound/services/windows-i586 com/sun/media/sound/services/windows-i586/SCCS com/sun/media/sound/services/windows-i586/SCCS/s.javax.sound.sampled.spi.MixerProvider com/sun/media/sound/services/windows-i586/javax.sound.sampled.spi.MixerProvider com/sun/media/sound/services/windows-ia64 com/sun/media/sound/services/windows-ia64/SCCS com/sun/media/sound/services/windows-ia64/SCCS/s.javax.sound.sampled.spi.MixerProvider com/sun/media/sound/services/windows-ia64/javax.sound.sampled.spi.MixerProvider com/sun/media/sound/services/javax.sound.midi.spi.MidiDeviceProvider com/sun/media/sound/services/javax.sound.midi.spi.MidiFileReader com/sun/media/sound/services/javax.sound.midi.spi.MidiFileWriter com/sun/media/sound/services/javax.sound.midi.spi.SoundbankReader com/sun/media/sound/services/javax.sound.sampled.spi.AudioFileReader com/sun/media/sound/services/javax.sound.sampled.spi.AudioFileWriter com/sun/media/sound/services/javax.sound.sampled.spi.MixerProvider com/sun/media/sound/services/javax.sound.sampled.spi.FormatConversionProvider com/sun/media/sound/AbstractMidiDeviceProvider.java com/sun/media/sound/AbstractDataLine.java com/sun/media/sound/AbstractLine.java com/sun/media/sound/AbstractMidiDevice.java com/sun/media/sound/AbstractMixer.java com/sun/media/sound/AbstractPlayer.java com/sun/media/sound/AiffFileFormat.java com/sun/media/sound/AiffFileReader.java com/sun/media/sound/AiffFileWriter.java com/sun/media/sound/AlawCodec.java com/sun/media/sound/AuFileFormat.java com/sun/media/sound/AuFileReader.java com/sun/media/sound/AuFileWriter.java com/sun/media/sound/AutoConnectSequencer.java com/sun/media/sound/AutoClosingClip.java com/sun/media/sound/DirectAudioDevice.java com/sun/media/sound/CircularBuffer.java com/sun/media/sound/DataPusher.java com/sun/media/sound/DirectAudioDeviceProvider.java com/sun/media/sound/EventDispatcher.java com/sun/media/sound/FastShortMessage.java com/sun/media/sound/FastSysexMessage.java com/sun/media/sound/HeadspaceInstrument.java com/sun/media/sound/HeadspaceMixer.java com/sun/media/sound/HeadspaceMixerProvider.java com/sun/media/sound/HeadspaceSample.java com/sun/media/sound/HeadspaceSoundbank.java com/sun/media/sound/HsbParser.java com/sun/media/sound/JDK13Services.java com/sun/media/sound/JSSecurityManager.java com/sun/media/sound/RealTimeSequencerProvider.java com/sun/media/sound/JavaSoundAudioClip.java com/sun/media/sound/MidiInDevice.java com/sun/media/sound/MidiInDeviceProvider.java com/sun/media/sound/MidiOutDevice.java com/sun/media/sound/MidiOutDeviceProvider.java com/sun/media/sound/MidiUtils.java com/sun/media/sound/MixerClip.java com/sun/media/sound/MixerMidiChannel.java com/sun/media/sound/MixerSequencer.java com/sun/media/sound/MixerSequencerProvider.java com/sun/media/sound/MixerSourceLine.java com/sun/media/sound/MixerSynth.java com/sun/media/sound/MixerSynthProvider.java com/sun/media/sound/MixerThread.java com/sun/media/sound/PCMtoPCMCodec.java com/sun/media/sound/Platform.java com/sun/media/sound/PortMixer.java com/sun/media/sound/PortMixerProvider.java com/sun/media/sound/Printer.java com/sun/media/sound/RealTimeSequencer.java com/sun/media/sound/ReferenceCountingDevice.java com/sun/media/sound/RmfFileReader.java com/sun/media/sound/SimpleInputDevice.java com/sun/media/sound/SimpleInputDeviceProvider.java com/sun/media/sound/StandardMidiFileReader.java com/sun/media/sound/StandardMidiFileWriter.java com/sun/media/sound/SunCodec.java com/sun/media/sound/SunFileReader.java com/sun/media/sound/SunFileWriter.java com/sun/media/sound/Toolkit.java com/sun/media/sound/UlawCodec.java com/sun/media/sound/WaveFileFormat.java com/sun/media/sound/WaveFileReader.java com/sun/media/sound/WaveFileWriter.java com/sun/mirror com/sun/mirror/SCCS com/sun/mirror/SCCS/s.overview.html com/sun/mirror/apt com/sun/mirror/apt/SCCS com/sun/mirror/apt/SCCS/s.AnnotationProcessorFactory.java com/sun/mirror/apt/SCCS/s.AnnotationProcessor.java com/sun/mirror/apt/SCCS/s.Filer.java com/sun/mirror/apt/SCCS/s.AnnotationProcessorEnvironment.java com/sun/mirror/apt/SCCS/s.AnnotationProcessorListener.java com/sun/mirror/apt/SCCS/s.AnnotationProcessors.java com/sun/mirror/apt/SCCS/s.Messager.java com/sun/mirror/apt/SCCS/s.RoundState.java com/sun/mirror/apt/SCCS/s.RoundCompleteEvent.java com/sun/mirror/apt/SCCS/s.RoundCompleteListener.java com/sun/mirror/apt/SCCS/s.package.html com/sun/mirror/apt/AnnotationProcessorEnvironment.java com/sun/mirror/apt/AnnotationProcessor.java com/sun/mirror/apt/AnnotationProcessorListener.java com/sun/mirror/apt/AnnotationProcessorFactory.java com/sun/mirror/apt/AnnotationProcessors.java com/sun/mirror/apt/Filer.java com/sun/mirror/apt/Messager.java com/sun/mirror/apt/RoundCompleteEvent.java com/sun/mirror/apt/RoundCompleteListener.java com/sun/mirror/apt/RoundState.java com/sun/mirror/apt/package.html com/sun/mirror/declaration com/sun/mirror/declaration/SCCS com/sun/mirror/declaration/SCCS/s.AnnotationMirror.java com/sun/mirror/declaration/SCCS/s.AnnotationValue.java com/sun/mirror/declaration/SCCS/s.AnnotationTypeDeclaration.java com/sun/mirror/declaration/SCCS/s.AnnotationTypeElementDeclaration.java com/sun/mirror/declaration/SCCS/s.ClassDeclaration.java com/sun/mirror/declaration/SCCS/s.ConstructorDeclaration.java com/sun/mirror/declaration/SCCS/s.Declaration.java com/sun/mirror/declaration/SCCS/s.EnumConstantDeclaration.java com/sun/mirror/declaration/SCCS/s.EnumDeclaration.java com/sun/mirror/declaration/SCCS/s.ExecutableDeclaration.java com/sun/mirror/declaration/SCCS/s.FieldDeclaration.java com/sun/mirror/declaration/SCCS/s.InterfaceDeclaration.java com/sun/mirror/declaration/SCCS/s.MemberDeclaration.java com/sun/mirror/declaration/SCCS/s.MethodDeclaration.java com/sun/mirror/declaration/SCCS/s.Modifier.java com/sun/mirror/declaration/SCCS/s.PackageDeclaration.java com/sun/mirror/declaration/SCCS/s.ParameterDeclaration.java com/sun/mirror/declaration/SCCS/s.TypeDeclaration.java com/sun/mirror/declaration/SCCS/s.TypeParameterDeclaration.java com/sun/mirror/declaration/SCCS/s.package.html com/sun/mirror/declaration/AnnotationTypeDeclaration.java com/sun/mirror/declaration/AnnotationMirror.java com/sun/mirror/declaration/AnnotationTypeElementDeclaration.java com/sun/mirror/declaration/AnnotationValue.java com/sun/mirror/declaration/ClassDeclaration.java com/sun/mirror/declaration/ConstructorDeclaration.java com/sun/mirror/declaration/Declaration.java com/sun/mirror/declaration/EnumConstantDeclaration.java com/sun/mirror/declaration/EnumDeclaration.java com/sun/mirror/declaration/ExecutableDeclaration.java com/sun/mirror/declaration/FieldDeclaration.java com/sun/mirror/declaration/InterfaceDeclaration.java com/sun/mirror/declaration/MemberDeclaration.java com/sun/mirror/declaration/MethodDeclaration.java com/sun/mirror/declaration/Modifier.java com/sun/mirror/declaration/PackageDeclaration.java com/sun/mirror/declaration/ParameterDeclaration.java com/sun/mirror/declaration/TypeDeclaration.java com/sun/mirror/declaration/TypeParameterDeclaration.java com/sun/mirror/declaration/package.html com/sun/mirror/type com/sun/mirror/type/SCCS com/sun/mirror/type/SCCS/s.MirroredTypeException.java com/sun/mirror/type/SCCS/s.AnnotationType.java com/sun/mirror/type/SCCS/s.ArrayType.java com/sun/mirror/type/SCCS/s.ClassType.java com/sun/mirror/type/SCCS/s.DeclaredType.java com/sun/mirror/type/SCCS/s.EnumType.java com/sun/mirror/type/SCCS/s.InterfaceType.java com/sun/mirror/type/SCCS/s.MirroredTypesException.java com/sun/mirror/type/SCCS/s.PrimitiveType.java com/sun/mirror/type/SCCS/s.ReferenceType.java com/sun/mirror/type/SCCS/s.TypeMirror.java com/sun/mirror/type/SCCS/s.TypeVariable.java com/sun/mirror/type/SCCS/s.VoidType.java com/sun/mirror/type/SCCS/s.WildcardType.java com/sun/mirror/type/SCCS/s.package.html com/sun/mirror/type/MirroredTypeException.java com/sun/mirror/type/AnnotationType.java com/sun/mirror/type/ArrayType.java com/sun/mirror/type/ClassType.java com/sun/mirror/type/DeclaredType.java com/sun/mirror/type/EnumType.java com/sun/mirror/type/InterfaceType.java com/sun/mirror/type/MirroredTypesException.java com/sun/mirror/type/PrimitiveType.java com/sun/mirror/type/ReferenceType.java com/sun/mirror/type/TypeMirror.java com/sun/mirror/type/TypeVariable.java com/sun/mirror/type/VoidType.java com/sun/mirror/type/WildcardType.java com/sun/mirror/type/package.html com/sun/mirror/util com/sun/mirror/util/SCCS com/sun/mirror/util/SCCS/s.SimpleDeclarationVisitor.java com/sun/mirror/util/SCCS/s.DeclarationFilter.java com/sun/mirror/util/SCCS/s.DeclarationScanner.java com/sun/mirror/util/SCCS/s.DeclarationVisitor.java com/sun/mirror/util/SCCS/s.DeclarationVisitors.java com/sun/mirror/util/SCCS/s.Declarations.java com/sun/mirror/util/SCCS/s.SimpleTypeVisitor.java com/sun/mirror/util/SCCS/s.SourceOrderDeclScanner.java com/sun/mirror/util/SCCS/s.SourcePosition.java com/sun/mirror/util/SCCS/s.TypeVisitor.java com/sun/mirror/util/SCCS/s.Types.java com/sun/mirror/util/SCCS/s.package.html com/sun/mirror/util/DeclarationVisitors.java com/sun/mirror/util/DeclarationFilter.java com/sun/mirror/util/DeclarationScanner.java com/sun/mirror/util/DeclarationVisitor.java com/sun/mirror/util/Declarations.java com/sun/mirror/util/SimpleTypeVisitor.java com/sun/mirror/util/Types.java com/sun/mirror/util/SimpleDeclarationVisitor.java com/sun/mirror/util/SourceOrderDeclScanner.java com/sun/mirror/util/SourcePosition.java com/sun/mirror/util/TypeVisitor.java com/sun/mirror/util/package.html com/sun/mirror/overview.html com/sun/naming com/sun/naming/internal com/sun/naming/internal/SCCS com/sun/naming/internal/SCCS/s.FactoryEnumeration.java com/sun/naming/internal/SCCS/s.NamedWeakReference.java com/sun/naming/internal/SCCS/s.ResourceManager.java com/sun/naming/internal/SCCS/s.VersionHelper.java com/sun/naming/internal/SCCS/s.VersionHelper12.java com/sun/naming/internal/FactoryEnumeration.java com/sun/naming/internal/NamedWeakReference.java com/sun/naming/internal/ResourceManager.java com/sun/naming/internal/VersionHelper.java com/sun/naming/internal/VersionHelper12.java com/sun/org com/sun/org/apache com/sun/org/apache/bcel com/sun/org/apache/bcel/internal com/sun/org/apache/bcel/internal/SCCS com/sun/org/apache/bcel/internal/SCCS/s.ExceptionConstants.java com/sun/org/apache/bcel/internal/SCCS/s.Constants.java com/sun/org/apache/bcel/internal/SCCS/s.Repository.java com/sun/org/apache/bcel/internal/SCCS/s.package.html com/sun/org/apache/bcel/internal/classfile com/sun/org/apache/bcel/internal/classfile/SCCS com/sun/org/apache/bcel/internal/classfile/SCCS/s.CodeException.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.AccessFlags.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Attribute.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ClassParser.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Code.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantClass.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Constant.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantCP.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.package.html com/sun/org/apache/bcel/internal/classfile/SCCS/s.lic com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantDouble.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantFieldref.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantFloat.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantInteger.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantLong.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Field.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantInterfaceMethodref.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantMethodref.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantNameAndType.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantObject.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantPool.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantString.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantUtf8.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ConstantValue.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Deprecated.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.DescendingVisitor.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.EmptyVisitor.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.ExceptionTable.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.FieldOrMethod.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.InnerClass.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.InnerClasses.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.JavaClass.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.LineNumber.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Node.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.LineNumberTable.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.LocalVariable.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.LocalVariableTable.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Method.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.PMGClass.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Signature.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.SourceFile.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.StackMap.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.StackMapEntry.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.StackMapType.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Synthetic.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Unknown.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Utility.java com/sun/org/apache/bcel/internal/classfile/SCCS/s.Visitor.java com/sun/org/apache/bcel/internal/classfile/ConstantFieldref.java com/sun/org/apache/bcel/internal/classfile/AccessFlags.java com/sun/org/apache/bcel/internal/classfile/Attribute.java com/sun/org/apache/bcel/internal/classfile/ClassParser.java com/sun/org/apache/bcel/internal/classfile/Code.java com/sun/org/apache/bcel/internal/classfile/CodeException.java com/sun/org/apache/bcel/internal/classfile/Constant.java com/sun/org/apache/bcel/internal/classfile/ConstantCP.java com/sun/org/apache/bcel/internal/classfile/ConstantClass.java com/sun/org/apache/bcel/internal/classfile/ConstantDouble.java com/sun/org/apache/bcel/internal/classfile/ConstantInterfaceMethodref.java com/sun/org/apache/bcel/internal/classfile/ConstantFloat.java com/sun/org/apache/bcel/internal/classfile/ConstantInteger.java com/sun/org/apache/bcel/internal/classfile/ConstantMethodref.java com/sun/org/apache/bcel/internal/classfile/ConstantLong.java com/sun/org/apache/bcel/internal/classfile/lic com/sun/org/apache/bcel/internal/classfile/ConstantNameAndType.java com/sun/org/apache/bcel/internal/classfile/ConstantObject.java com/sun/org/apache/bcel/internal/classfile/ConstantPool.java com/sun/org/apache/bcel/internal/classfile/ConstantString.java com/sun/org/apache/bcel/internal/classfile/ConstantUtf8.java com/sun/org/apache/bcel/internal/classfile/ConstantValue.java com/sun/org/apache/bcel/internal/classfile/Deprecated.java com/sun/org/apache/bcel/internal/classfile/DescendingVisitor.java com/sun/org/apache/bcel/internal/classfile/EmptyVisitor.java com/sun/org/apache/bcel/internal/classfile/ExceptionTable.java com/sun/org/apache/bcel/internal/classfile/Field.java com/sun/org/apache/bcel/internal/classfile/FieldOrMethod.java com/sun/org/apache/bcel/internal/classfile/InnerClass.java com/sun/org/apache/bcel/internal/classfile/InnerClasses.java com/sun/org/apache/bcel/internal/classfile/JavaClass.java com/sun/org/apache/bcel/internal/classfile/LineNumber.java com/sun/org/apache/bcel/internal/classfile/LineNumberTable.java com/sun/org/apache/bcel/internal/classfile/LocalVariable.java com/sun/org/apache/bcel/internal/classfile/LocalVariableTable.java com/sun/org/apache/bcel/internal/classfile/Method.java com/sun/org/apache/bcel/internal/classfile/Node.java com/sun/org/apache/bcel/internal/classfile/PMGClass.java com/sun/org/apache/bcel/internal/classfile/Signature.java com/sun/org/apache/bcel/internal/classfile/SourceFile.java com/sun/org/apache/bcel/internal/classfile/StackMap.java com/sun/org/apache/bcel/internal/classfile/StackMapEntry.java com/sun/org/apache/bcel/internal/classfile/StackMapType.java com/sun/org/apache/bcel/internal/classfile/Synthetic.java com/sun/org/apache/bcel/internal/classfile/Unknown.java com/sun/org/apache/bcel/internal/classfile/Utility.java com/sun/org/apache/bcel/internal/classfile/Visitor.java com/sun/org/apache/bcel/internal/classfile/package.html com/sun/org/apache/bcel/internal/generic com/sun/org/apache/bcel/internal/generic/SCCS com/sun/org/apache/bcel/internal/generic/SCCS/s.ACONST_NULL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.AALOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.AASTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ArrayInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ALOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ANEWARRAY.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ARETURN.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ARRAYLENGTH.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ASTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ATHROW.java com/sun/org/apache/bcel/internal/generic/SCCS/s.AllocationInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ArithmeticInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ArrayType.java com/sun/org/apache/bcel/internal/generic/SCCS/s.BALOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.BASTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.BIPUSH.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DALOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.D2F.java com/sun/org/apache/bcel/internal/generic/SCCS/s.BREAKPOINT.java com/sun/org/apache/bcel/internal/generic/SCCS/s.BasicType.java com/sun/org/apache/bcel/internal/generic/SCCS/s.BranchHandle.java com/sun/org/apache/bcel/internal/generic/SCCS/s.BranchInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.CALOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.CASTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.CHECKCAST.java com/sun/org/apache/bcel/internal/generic/SCCS/s.CPInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ClassGen.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ClassGenException.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ClassObserver.java com/sun/org/apache/bcel/internal/generic/SCCS/s.CodeExceptionGen.java com/sun/org/apache/bcel/internal/generic/SCCS/s.CompoundInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ConstantPoolGen.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ConstantPushInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ConversionInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.D2I.java com/sun/org/apache/bcel/internal/generic/SCCS/s.D2L.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DADD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DASTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DCMPG.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DCMPL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DCONST.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DDIV.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DLOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DMUL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DNEG.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DREM.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DRETURN.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DSTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DSUB.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DUP.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DUP2.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DUP2_X1.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DUP2_X2.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DUP_X1.java com/sun/org/apache/bcel/internal/generic/SCCS/s.DUP_X2.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FALOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.F2D.java com/sun/org/apache/bcel/internal/generic/SCCS/s.EmptyVisitor.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ExceptionThrower.java com/sun/org/apache/bcel/internal/generic/SCCS/s.F2I.java com/sun/org/apache/bcel/internal/generic/SCCS/s.F2L.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FADD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FASTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FCMPG.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FCMPL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FCONST.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FDIV.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FLOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FMUL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FNEG.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FREM.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FRETURN.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FSTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FSUB.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FieldGen.java com/sun/org/apache/bcel/internal/generic/SCCS/s.InstructionListObserver.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FieldGenOrMethodGen.java com/sun/org/apache/bcel/internal/generic/SCCS/s.GOTO.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FieldInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FieldObserver.java com/sun/org/apache/bcel/internal/generic/SCCS/s.FieldOrMethod.java com/sun/org/apache/bcel/internal/generic/SCCS/s.GETFIELD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.GETSTATIC.java com/sun/org/apache/bcel/internal/generic/SCCS/s.GOTO_W.java com/sun/org/apache/bcel/internal/generic/SCCS/s.GotoInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.I2B.java com/sun/org/apache/bcel/internal/generic/SCCS/s.I2C.java com/sun/org/apache/bcel/internal/generic/SCCS/s.I2D.java com/sun/org/apache/bcel/internal/generic/SCCS/s.I2F.java com/sun/org/apache/bcel/internal/generic/SCCS/s.I2L.java com/sun/org/apache/bcel/internal/generic/SCCS/s.I2S.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IADD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IALOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IAND.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IASTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ICONST.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IDIV.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IFEQ.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IFGE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IFGT.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IFLE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IFLT.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IFNE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IFNONNULL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IFNULL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IF_ACMPEQ.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IF_ACMPNE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IF_ICMPEQ.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IF_ICMPGE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IF_ICMPGT.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IF_ICMPLE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IF_ICMPLT.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IF_ICMPNE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IINC.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ILOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IMPDEP1.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IMPDEP2.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IMUL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.INEG.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IOR.java com/sun/org/apache/bcel/internal/generic/SCCS/s.INSTANCEOF.java com/sun/org/apache/bcel/internal/generic/SCCS/s.INVOKEINTERFACE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.INVOKESPECIAL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.INVOKESTATIC.java com/sun/org/apache/bcel/internal/generic/SCCS/s.INVOKEVIRTUAL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IREM.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IRETURN.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ISHL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ISHR.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ISTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ISUB.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IUSHR.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IXOR.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IfInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.IndexedInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.Instruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.InstructionConstants.java com/sun/org/apache/bcel/internal/generic/SCCS/s.InstructionFactory.java com/sun/org/apache/bcel/internal/generic/SCCS/s.JSR.java com/sun/org/apache/bcel/internal/generic/SCCS/s.InstructionHandle.java com/sun/org/apache/bcel/internal/generic/SCCS/s.InstructionList.java com/sun/org/apache/bcel/internal/generic/SCCS/s.InstructionTargeter.java com/sun/org/apache/bcel/internal/generic/SCCS/s.InvokeInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.JSR_W.java com/sun/org/apache/bcel/internal/generic/SCCS/s.JsrInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.L2D.java com/sun/org/apache/bcel/internal/generic/SCCS/s.L2F.java com/sun/org/apache/bcel/internal/generic/SCCS/s.L2I.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LADD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LALOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LAND.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LASTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LCMP.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LCONST.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LDC.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LDC2_W.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LDC_W.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LDIV.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LineNumberGen.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LLOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LMUL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LNEG.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LOOKUPSWITCH.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LOR.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LREM.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LRETURN.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LSHL.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LSHR.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LSTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LSUB.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LUSHR.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LXOR.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LoadInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LoadClass.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LocalVariableInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.LocalVariableGen.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ReturnInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.MONITORENTER.java com/sun/org/apache/bcel/internal/generic/SCCS/s.MONITOREXIT.java com/sun/org/apache/bcel/internal/generic/SCCS/s.MULTIANEWARRAY.java com/sun/org/apache/bcel/internal/generic/SCCS/s.MethodGen.java com/sun/org/apache/bcel/internal/generic/SCCS/s.MethodObserver.java com/sun/org/apache/bcel/internal/generic/SCCS/s.NEW.java com/sun/org/apache/bcel/internal/generic/SCCS/s.NEWARRAY.java com/sun/org/apache/bcel/internal/generic/SCCS/s.NOP.java com/sun/org/apache/bcel/internal/generic/SCCS/s.NamedAndTyped.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ObjectType.java com/sun/org/apache/bcel/internal/generic/SCCS/s.POP.java com/sun/org/apache/bcel/internal/generic/SCCS/s.POP2.java com/sun/org/apache/bcel/internal/generic/SCCS/s.PUSH.java com/sun/org/apache/bcel/internal/generic/SCCS/s.PUTFIELD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.PUTSTATIC.java com/sun/org/apache/bcel/internal/generic/SCCS/s.PopInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.PushInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.RET.java com/sun/org/apache/bcel/internal/generic/SCCS/s.RETURN.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ReferenceType.java com/sun/org/apache/bcel/internal/generic/SCCS/s.VariableLengthInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.ReturnaddressType.java com/sun/org/apache/bcel/internal/generic/SCCS/s.SALOAD.java com/sun/org/apache/bcel/internal/generic/SCCS/s.SASTORE.java com/sun/org/apache/bcel/internal/generic/SCCS/s.SIPUSH.java com/sun/org/apache/bcel/internal/generic/SCCS/s.SWAP.java com/sun/org/apache/bcel/internal/generic/SCCS/s.SWITCH.java com/sun/org/apache/bcel/internal/generic/SCCS/s.Select.java com/sun/org/apache/bcel/internal/generic/SCCS/s.StackConsumer.java com/sun/org/apache/bcel/internal/generic/SCCS/s.StackInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.StackProducer.java com/sun/org/apache/bcel/internal/generic/SCCS/s.StoreInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.TABLESWITCH.java com/sun/org/apache/bcel/internal/generic/SCCS/s.TargetLostException.java com/sun/org/apache/bcel/internal/generic/SCCS/s.Type.java com/sun/org/apache/bcel/internal/generic/SCCS/s.TypedInstruction.java com/sun/org/apache/bcel/internal/generic/SCCS/s.UnconditionalBranch.java com/sun/org/apache/bcel/internal/generic/SCCS/s.Visitor.java com/sun/org/apache/bcel/internal/generic/SCCS/s.package.html com/sun/org/apache/bcel/internal/generic/AASTORE.java com/sun/org/apache/bcel/internal/generic/AALOAD.java com/sun/org/apache/bcel/internal/generic/AllocationInstruction.java com/sun/org/apache/bcel/internal/generic/ACONST_NULL.java com/sun/org/apache/bcel/internal/generic/ALOAD.java com/sun/org/apache/bcel/internal/generic/ANEWARRAY.java com/sun/org/apache/bcel/internal/generic/ARETURN.java com/sun/org/apache/bcel/internal/generic/ARRAYLENGTH.java com/sun/org/apache/bcel/internal/generic/ASTORE.java com/sun/org/apache/bcel/internal/generic/ATHROW.java com/sun/org/apache/bcel/internal/generic/DASTORE.java com/sun/org/apache/bcel/internal/generic/D2F.java com/sun/org/apache/bcel/internal/generic/ArithmeticInstruction.java com/sun/org/apache/bcel/internal/generic/ArrayInstruction.java com/sun/org/apache/bcel/internal/generic/ArrayType.java com/sun/org/apache/bcel/internal/generic/BALOAD.java com/sun/org/apache/bcel/internal/generic/BASTORE.java com/sun/org/apache/bcel/internal/generic/BIPUSH.java com/sun/org/apache/bcel/internal/generic/BREAKPOINT.java com/sun/org/apache/bcel/internal/generic/BasicType.java com/sun/org/apache/bcel/internal/generic/BranchHandle.java com/sun/org/apache/bcel/internal/generic/BranchInstruction.java com/sun/org/apache/bcel/internal/generic/CALOAD.java com/sun/org/apache/bcel/internal/generic/CASTORE.java com/sun/org/apache/bcel/internal/generic/CHECKCAST.java com/sun/org/apache/bcel/internal/generic/CPInstruction.java com/sun/org/apache/bcel/internal/generic/ClassGen.java com/sun/org/apache/bcel/internal/generic/ClassGenException.java com/sun/org/apache/bcel/internal/generic/ClassObserver.java com/sun/org/apache/bcel/internal/generic/CodeExceptionGen.java com/sun/org/apache/bcel/internal/generic/CompoundInstruction.java com/sun/org/apache/bcel/internal/generic/ConstantPoolGen.java com/sun/org/apache/bcel/internal/generic/ConstantPushInstruction.java com/sun/org/apache/bcel/internal/generic/ConversionInstruction.java com/sun/org/apache/bcel/internal/generic/D2I.java com/sun/org/apache/bcel/internal/generic/D2L.java com/sun/org/apache/bcel/internal/generic/DADD.java com/sun/org/apache/bcel/internal/generic/DALOAD.java com/sun/org/apache/bcel/internal/generic/DRETURN.java com/sun/org/apache/bcel/internal/generic/DCMPG.java com/sun/org/apache/bcel/internal/generic/DCMPL.java com/sun/org/apache/bcel/internal/generic/DCONST.java com/sun/org/apache/bcel/internal/generic/DDIV.java com/sun/org/apache/bcel/internal/generic/DLOAD.java com/sun/org/apache/bcel/internal/generic/DMUL.java com/sun/org/apache/bcel/internal/generic/DNEG.java com/sun/org/apache/bcel/internal/generic/DREM.java com/sun/org/apache/bcel/internal/generic/EmptyVisitor.java com/sun/org/apache/bcel/internal/generic/DSTORE.java com/sun/org/apache/bcel/internal/generic/DSUB.java com/sun/org/apache/bcel/internal/generic/DUP.java com/sun/org/apache/bcel/internal/generic/DUP2.java com/sun/org/apache/bcel/internal/generic/DUP2_X1.java com/sun/org/apache/bcel/internal/generic/DUP2_X2.java com/sun/org/apache/bcel/internal/generic/DUP_X1.java com/sun/org/apache/bcel/internal/generic/DUP_X2.java com/sun/org/apache/bcel/internal/generic/ExceptionThrower.java com/sun/org/apache/bcel/internal/generic/F2D.java com/sun/org/apache/bcel/internal/generic/F2I.java com/sun/org/apache/bcel/internal/generic/FieldGenOrMethodGen.java com/sun/org/apache/bcel/internal/generic/F2L.java com/sun/org/apache/bcel/internal/generic/FADD.java com/sun/org/apache/bcel/internal/generic/FALOAD.java com/sun/org/apache/bcel/internal/generic/FASTORE.java com/sun/org/apache/bcel/internal/generic/FCMPG.java com/sun/org/apache/bcel/internal/generic/FCMPL.java com/sun/org/apache/bcel/internal/generic/FCONST.java com/sun/org/apache/bcel/internal/generic/FDIV.java com/sun/org/apache/bcel/internal/generic/FLOAD.java com/sun/org/apache/bcel/internal/generic/FMUL.java com/sun/org/apache/bcel/internal/generic/FNEG.java com/sun/org/apache/bcel/internal/generic/FREM.java com/sun/org/apache/bcel/internal/generic/FRETURN.java com/sun/org/apache/bcel/internal/generic/FSTORE.java com/sun/org/apache/bcel/internal/generic/FSUB.java com/sun/org/apache/bcel/internal/generic/FieldGen.java com/sun/org/apache/bcel/internal/generic/FieldInstruction.java com/sun/org/apache/bcel/internal/generic/FieldObserver.java com/sun/org/apache/bcel/internal/generic/FieldOrMethod.java com/sun/org/apache/bcel/internal/generic/GETFIELD.java com/sun/org/apache/bcel/internal/generic/GETSTATIC.java com/sun/org/apache/bcel/internal/generic/InstructionListObserver.java com/sun/org/apache/bcel/internal/generic/GOTO.java com/sun/org/apache/bcel/internal/generic/GOTO_W.java com/sun/org/apache/bcel/internal/generic/GotoInstruction.java com/sun/org/apache/bcel/internal/generic/I2B.java com/sun/org/apache/bcel/internal/generic/I2C.java com/sun/org/apache/bcel/internal/generic/I2D.java com/sun/org/apache/bcel/internal/generic/I2F.java com/sun/org/apache/bcel/internal/generic/I2L.java com/sun/org/apache/bcel/internal/generic/I2S.java com/sun/org/apache/bcel/internal/generic/IADD.java com/sun/org/apache/bcel/internal/generic/IALOAD.java com/sun/org/apache/bcel/internal/generic/IAND.java com/sun/org/apache/bcel/internal/generic/IASTORE.java com/sun/org/apache/bcel/internal/generic/ICONST.java com/sun/org/apache/bcel/internal/generic/IDIV.java com/sun/org/apache/bcel/internal/generic/IFEQ.java com/sun/org/apache/bcel/internal/generic/IFGE.java com/sun/org/apache/bcel/internal/generic/IFGT.java com/sun/org/apache/bcel/internal/generic/IFLE.java com/sun/org/apache/bcel/internal/generic/IFLT.java com/sun/org/apache/bcel/internal/generic/IFNE.java com/sun/org/apache/bcel/internal/generic/IFNONNULL.java com/sun/org/apache/bcel/internal/generic/IFNULL.java com/sun/org/apache/bcel/internal/generic/IF_ACMPEQ.java com/sun/org/apache/bcel/internal/generic/IF_ACMPNE.java com/sun/org/apache/bcel/internal/generic/IF_ICMPEQ.java com/sun/org/apache/bcel/internal/generic/IF_ICMPGE.java com/sun/org/apache/bcel/internal/generic/IF_ICMPGT.java com/sun/org/apache/bcel/internal/generic/IF_ICMPLE.java com/sun/org/apache/bcel/internal/generic/IF_ICMPLT.java com/sun/org/apache/bcel/internal/generic/IF_ICMPNE.java com/sun/org/apache/bcel/internal/generic/IINC.java com/sun/org/apache/bcel/internal/generic/ILOAD.java com/sun/org/apache/bcel/internal/generic/IMPDEP1.java com/sun/org/apache/bcel/internal/generic/IMPDEP2.java com/sun/org/apache/bcel/internal/generic/IMUL.java com/sun/org/apache/bcel/internal/generic/INEG.java com/sun/org/apache/bcel/internal/generic/INSTANCEOF.java com/sun/org/apache/bcel/internal/generic/INVOKEINTERFACE.java com/sun/org/apache/bcel/internal/generic/INVOKESPECIAL.java com/sun/org/apache/bcel/internal/generic/INVOKESTATIC.java com/sun/org/apache/bcel/internal/generic/INVOKEVIRTUAL.java com/sun/org/apache/bcel/internal/generic/IOR.java com/sun/org/apache/bcel/internal/generic/IREM.java com/sun/org/apache/bcel/internal/generic/IRETURN.java com/sun/org/apache/bcel/internal/generic/ISHL.java com/sun/org/apache/bcel/internal/generic/ISHR.java com/sun/org/apache/bcel/internal/generic/ISTORE.java com/sun/org/apache/bcel/internal/generic/ISUB.java com/sun/org/apache/bcel/internal/generic/IUSHR.java com/sun/org/apache/bcel/internal/generic/IXOR.java com/sun/org/apache/bcel/internal/generic/IfInstruction.java com/sun/org/apache/bcel/internal/generic/IndexedInstruction.java com/sun/org/apache/bcel/internal/generic/Instruction.java com/sun/org/apache/bcel/internal/generic/InstructionConstants.java com/sun/org/apache/bcel/internal/generic/InstructionFactory.java com/sun/org/apache/bcel/internal/generic/InstructionHandle.java com/sun/org/apache/bcel/internal/generic/InstructionList.java com/sun/org/apache/bcel/internal/generic/LoadInstruction.java com/sun/org/apache/bcel/internal/generic/InstructionTargeter.java com/sun/org/apache/bcel/internal/generic/InvokeInstruction.java com/sun/org/apache/bcel/internal/generic/JSR.java com/sun/org/apache/bcel/internal/generic/JSR_W.java com/sun/org/apache/bcel/internal/generic/JsrInstruction.java com/sun/org/apache/bcel/internal/generic/L2D.java com/sun/org/apache/bcel/internal/generic/L2F.java com/sun/org/apache/bcel/internal/generic/L2I.java com/sun/org/apache/bcel/internal/generic/LADD.java com/sun/org/apache/bcel/internal/generic/LALOAD.java com/sun/org/apache/bcel/internal/generic/LAND.java com/sun/org/apache/bcel/internal/generic/LASTORE.java com/sun/org/apache/bcel/internal/generic/LCMP.java com/sun/org/apache/bcel/internal/generic/LCONST.java com/sun/org/apache/bcel/internal/generic/LDC.java com/sun/org/apache/bcel/internal/generic/LDC2_W.java com/sun/org/apache/bcel/internal/generic/LDC_W.java com/sun/org/apache/bcel/internal/generic/LDIV.java com/sun/org/apache/bcel/internal/generic/LLOAD.java com/sun/org/apache/bcel/internal/generic/LMUL.java com/sun/org/apache/bcel/internal/generic/LNEG.java com/sun/org/apache/bcel/internal/generic/LOOKUPSWITCH.java com/sun/org/apache/bcel/internal/generic/LOR.java com/sun/org/apache/bcel/internal/generic/LREM.java com/sun/org/apache/bcel/internal/generic/LRETURN.java com/sun/org/apache/bcel/internal/generic/LSHL.java com/sun/org/apache/bcel/internal/generic/LSHR.java com/sun/org/apache/bcel/internal/generic/LSTORE.java com/sun/org/apache/bcel/internal/generic/LSUB.java com/sun/org/apache/bcel/internal/generic/LUSHR.java com/sun/org/apache/bcel/internal/generic/LXOR.java com/sun/org/apache/bcel/internal/generic/LineNumberGen.java com/sun/org/apache/bcel/internal/generic/LoadClass.java com/sun/org/apache/bcel/internal/generic/LocalVariableInstruction.java com/sun/org/apache/bcel/internal/generic/LocalVariableGen.java com/sun/org/apache/bcel/internal/generic/PushInstruction.java com/sun/org/apache/bcel/internal/generic/MONITORENTER.java com/sun/org/apache/bcel/internal/generic/MONITOREXIT.java com/sun/org/apache/bcel/internal/generic/MULTIANEWARRAY.java com/sun/org/apache/bcel/internal/generic/MethodGen.java com/sun/org/apache/bcel/internal/generic/MethodObserver.java com/sun/org/apache/bcel/internal/generic/NEW.java com/sun/org/apache/bcel/internal/generic/NEWARRAY.java com/sun/org/apache/bcel/internal/generic/NOP.java com/sun/org/apache/bcel/internal/generic/NamedAndTyped.java com/sun/org/apache/bcel/internal/generic/ObjectType.java com/sun/org/apache/bcel/internal/generic/POP.java com/sun/org/apache/bcel/internal/generic/POP2.java com/sun/org/apache/bcel/internal/generic/PUSH.java com/sun/org/apache/bcel/internal/generic/PUTFIELD.java com/sun/org/apache/bcel/internal/generic/PUTSTATIC.java com/sun/org/apache/bcel/internal/generic/PopInstruction.java com/sun/org/apache/bcel/internal/generic/ReferenceType.java com/sun/org/apache/bcel/internal/generic/RET.java com/sun/org/apache/bcel/internal/generic/RETURN.java com/sun/org/apache/bcel/internal/generic/ReturnInstruction.java com/sun/org/apache/bcel/internal/generic/ReturnaddressType.java com/sun/org/apache/bcel/internal/generic/SALOAD.java com/sun/org/apache/bcel/internal/generic/SASTORE.java com/sun/org/apache/bcel/internal/generic/SIPUSH.java com/sun/org/apache/bcel/internal/generic/SWAP.java com/sun/org/apache/bcel/internal/generic/SWITCH.java com/sun/org/apache/bcel/internal/generic/Select.java com/sun/org/apache/bcel/internal/generic/StackConsumer.java com/sun/org/apache/bcel/internal/generic/StackInstruction.java com/sun/org/apache/bcel/internal/generic/StackProducer.java com/sun/org/apache/bcel/internal/generic/StoreInstruction.java com/sun/org/apache/bcel/internal/generic/Type.java com/sun/org/apache/bcel/internal/generic/UnconditionalBranch.java com/sun/org/apache/bcel/internal/generic/TABLESWITCH.java com/sun/org/apache/bcel/internal/generic/TargetLostException.java com/sun/org/apache/bcel/internal/generic/TypedInstruction.java com/sun/org/apache/bcel/internal/generic/VariableLengthInstruction.java com/sun/org/apache/bcel/internal/generic/Visitor.java com/sun/org/apache/bcel/internal/generic/package.html com/sun/org/apache/bcel/internal/util com/sun/org/apache/bcel/internal/util/SCCS com/sun/org/apache/bcel/internal/util/SCCS/s.InstructionFinder.java com/sun/org/apache/bcel/internal/util/SCCS/s.AttributeHTML.java com/sun/org/apache/bcel/internal/util/SCCS/s.ByteSequence.java com/sun/org/apache/bcel/internal/util/SCCS/s.Class2HTML.java com/sun/org/apache/bcel/internal/util/SCCS/s.ClassLoader.java com/sun/org/apache/bcel/internal/util/SCCS/s.ClassPath.java com/sun/org/apache/bcel/internal/util/SCCS/s.ClassQueue.java com/sun/org/apache/bcel/internal/util/SCCS/s.ClassStack.java com/sun/org/apache/bcel/internal/util/SCCS/s.ClassVector.java com/sun/org/apache/bcel/internal/util/SCCS/s.CodeHTML.java com/sun/org/apache/bcel/internal/util/SCCS/s.ConstantHTML.java com/sun/org/apache/bcel/internal/util/SCCS/s.MethodHTML.java com/sun/org/apache/bcel/internal/util/SCCS/s.package.html com/sun/org/apache/bcel/internal/util/InstructionFinder.java com/sun/org/apache/bcel/internal/util/AttributeHTML.java com/sun/org/apache/bcel/internal/util/ByteSequence.java com/sun/org/apache/bcel/internal/util/Class2HTML.java com/sun/org/apache/bcel/internal/util/ClassLoader.java com/sun/org/apache/bcel/internal/util/ClassPath.java com/sun/org/apache/bcel/internal/util/ClassQueue.java com/sun/org/apache/bcel/internal/util/ClassStack.java com/sun/org/apache/bcel/internal/util/ClassVector.java com/sun/org/apache/bcel/internal/util/CodeHTML.java com/sun/org/apache/bcel/internal/util/ConstantHTML.java com/sun/org/apache/bcel/internal/util/MethodHTML.java com/sun/org/apache/bcel/internal/util/package.html com/sun/org/apache/bcel/internal/verifier com/sun/org/apache/bcel/internal/verifier/SCCS com/sun/org/apache/bcel/internal/verifier/SCCS/s.VerifierFactoryListModel.java com/sun/org/apache/bcel/internal/verifier/SCCS/s.GraphicalVerifier.java com/sun/org/apache/bcel/internal/verifier/SCCS/s.NativeVerifier.java com/sun/org/apache/bcel/internal/verifier/SCCS/s.PassVerifier.java com/sun/org/apache/bcel/internal/verifier/SCCS/s.TransitiveHull.java com/sun/org/apache/bcel/internal/verifier/SCCS/s.VerificationResult.java com/sun/org/apache/bcel/internal/verifier/SCCS/s.Verifier.java com/sun/org/apache/bcel/internal/verifier/SCCS/s.VerifierAppFrame.java com/sun/org/apache/bcel/internal/verifier/SCCS/s.VerifierFactory.java com/sun/org/apache/bcel/internal/verifier/SCCS/s.VerifierFactoryObserver.java com/sun/org/apache/bcel/internal/verifier/SCCS/s.VerifyDialog.java com/sun/org/apache/bcel/internal/verifier/SCCS/s.package.html com/sun/org/apache/bcel/internal/verifier/exc com/sun/org/apache/bcel/internal/verifier/exc/SCCS com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.StaticCodeConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.AssertionViolatedException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.ClassConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.CodeConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.InvalidMethodException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.LinkingConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.LoadingException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.LocalVariableInfoInconsistentException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.StaticCodeInstructionConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.Utility.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.package.html com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.VerificationException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.StaticCodeInstructionOperandConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.StructuralCodeConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/SCCS/s.VerifierConstraintViolatedException.java com/sun/org/apache/bcel/internal/verifier/exc/StaticCodeConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/AssertionViolatedException.java com/sun/org/apache/bcel/internal/verifier/exc/ClassConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/CodeConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/InvalidMethodException.java com/sun/org/apache/bcel/internal/verifier/exc/LinkingConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/LoadingException.java com/sun/org/apache/bcel/internal/verifier/exc/LocalVariableInfoInconsistentException.java com/sun/org/apache/bcel/internal/verifier/exc/StaticCodeInstructionConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/Utility.java com/sun/org/apache/bcel/internal/verifier/exc/package.html com/sun/org/apache/bcel/internal/verifier/exc/VerificationException.java com/sun/org/apache/bcel/internal/verifier/exc/StaticCodeInstructionOperandConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/StructuralCodeConstraintException.java com/sun/org/apache/bcel/internal/verifier/exc/VerifierConstraintViolatedException.java com/sun/org/apache/bcel/internal/verifier/statics com/sun/org/apache/bcel/internal/verifier/statics/SCCS com/sun/org/apache/bcel/internal/verifier/statics/SCCS/s.LocalVariableInfo.java com/sun/org/apache/bcel/internal/verifier/statics/SCCS/s.DOUBLE_Upper.java com/sun/org/apache/bcel/internal/verifier/statics/SCCS/s.IntList.java com/sun/org/apache/bcel/internal/verifier/statics/SCCS/s.LONG_Upper.java com/sun/org/apache/bcel/internal/verifier/statics/SCCS/s.LocalVariablesInfo.java com/sun/org/apache/bcel/internal/verifier/statics/SCCS/s.Pass1Verifier.java com/sun/org/apache/bcel/internal/verifier/statics/SCCS/s.Pass2Verifier.java com/sun/org/apache/bcel/internal/verifier/statics/SCCS/s.Pass3aVerifier.java com/sun/org/apache/bcel/internal/verifier/statics/SCCS/s.StringRepresentation.java com/sun/org/apache/bcel/internal/verifier/statics/SCCS/s.package.html com/sun/org/apache/bcel/internal/verifier/statics/LocalVariableInfo.java com/sun/org/apache/bcel/internal/verifier/statics/DOUBLE_Upper.java com/sun/org/apache/bcel/internal/verifier/statics/IntList.java com/sun/org/apache/bcel/internal/verifier/statics/LONG_Upper.java com/sun/org/apache/bcel/internal/verifier/statics/LocalVariablesInfo.java com/sun/org/apache/bcel/internal/verifier/statics/Pass1Verifier.java com/sun/org/apache/bcel/internal/verifier/statics/Pass2Verifier.java com/sun/org/apache/bcel/internal/verifier/statics/Pass3aVerifier.java com/sun/org/apache/bcel/internal/verifier/statics/StringRepresentation.java com/sun/org/apache/bcel/internal/verifier/statics/package.html com/sun/org/apache/bcel/internal/verifier/structurals com/sun/org/apache/bcel/internal/verifier/structurals/SCCS com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.ExceptionHandlers.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.ControlFlowGraph.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.ExceptionHandler.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.InstConstraintVisitor.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.ExecutionVisitor.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.Frame.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.GenericArray.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.InstructionContext.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.LocalVariables.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.OperandStack.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.Pass3bVerifier.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.Subroutine.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.Subroutines.java com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.package.html com/sun/org/apache/bcel/internal/verifier/structurals/SCCS/s.UninitializedObjectType.java com/sun/org/apache/bcel/internal/verifier/structurals/InstConstraintVisitor.java com/sun/org/apache/bcel/internal/verifier/structurals/ControlFlowGraph.java com/sun/org/apache/bcel/internal/verifier/structurals/ExceptionHandler.java com/sun/org/apache/bcel/internal/verifier/structurals/ExceptionHandlers.java com/sun/org/apache/bcel/internal/verifier/structurals/ExecutionVisitor.java com/sun/org/apache/bcel/internal/verifier/structurals/Frame.java com/sun/org/apache/bcel/internal/verifier/structurals/GenericArray.java com/sun/org/apache/bcel/internal/verifier/structurals/UninitializedObjectType.java com/sun/org/apache/bcel/internal/verifier/structurals/InstructionContext.java com/sun/org/apache/bcel/internal/verifier/structurals/LocalVariables.java com/sun/org/apache/bcel/internal/verifier/structurals/OperandStack.java com/sun/org/apache/bcel/internal/verifier/structurals/Pass3bVerifier.java com/sun/org/apache/bcel/internal/verifier/structurals/Subroutine.java com/sun/org/apache/bcel/internal/verifier/structurals/Subroutines.java com/sun/org/apache/bcel/internal/verifier/structurals/package.html com/sun/org/apache/bcel/internal/verifier/VerifierFactoryListModel.java com/sun/org/apache/bcel/internal/verifier/GraphicalVerifier.java com/sun/org/apache/bcel/internal/verifier/NativeVerifier.java com/sun/org/apache/bcel/internal/verifier/PassVerifier.java com/sun/org/apache/bcel/internal/verifier/TransitiveHull.java com/sun/org/apache/bcel/internal/verifier/VerificationResult.java com/sun/org/apache/bcel/internal/verifier/Verifier.java com/sun/org/apache/bcel/internal/verifier/VerifierAppFrame.java com/sun/org/apache/bcel/internal/verifier/VerifierFactory.java com/sun/org/apache/bcel/internal/verifier/VerifierFactoryObserver.java com/sun/org/apache/bcel/internal/verifier/VerifyDialog.java com/sun/org/apache/bcel/internal/verifier/package.html com/sun/org/apache/bcel/internal/ExceptionConstants.java com/sun/org/apache/bcel/internal/Constants.java com/sun/org/apache/bcel/internal/Repository.java com/sun/org/apache/bcel/internal/package.html com/sun/org/apache/html com/sun/org/apache/html/internal com/sun/org/apache/html/internal/dom com/sun/org/apache/html/internal/dom/SCCS com/sun/org/apache/html/internal/dom/SCCS/s.HTMLAnchorElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLAppletElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLAreaElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLBRElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLBaseElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLBaseFontElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLBodyElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLBuilder.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLButtonElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLCollectionImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLDListElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLDivElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLTableCaptionElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLDOMImplementationImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLDirectoryElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLDocumentImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLFieldSetElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLFontElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLFormControl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLFormElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLFrameElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLFrameSetElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLHRElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLHeadElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLHeadingElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.NameNodeListImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLHtmlElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLIFrameElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLImageElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLInputElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLIsIndexElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLLIElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLLabelElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLLegendElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLLinkElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLMapElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLMenuElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLMetaElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLModElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.ObjectFactory.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLOListElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLObjectElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLOptGroupElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLOptionElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLParagraphElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLParamElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLPreElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLQuoteElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLScriptElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLSelectElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLStyleElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLTableCellElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLTableColElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLTableElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLTableRowElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLTableSectionElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLTextAreaElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLTitleElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.HTMLUListElementImpl.java com/sun/org/apache/html/internal/dom/SCCS/s.SecuritySupport.java com/sun/org/apache/html/internal/dom/SCCS/s.SecuritySupport12.java com/sun/org/apache/html/internal/dom/HTMLBaseFontElementImpl.java com/sun/org/apache/html/internal/dom/HTMLAnchorElementImpl.java com/sun/org/apache/html/internal/dom/HTMLAppletElementImpl.java com/sun/org/apache/html/internal/dom/HTMLAreaElementImpl.java com/sun/org/apache/html/internal/dom/HTMLBRElementImpl.java com/sun/org/apache/html/internal/dom/HTMLBaseElementImpl.java com/sun/org/apache/html/internal/dom/HTMLTableCaptionElementImpl.java com/sun/org/apache/html/internal/dom/HTMLBodyElementImpl.java com/sun/org/apache/html/internal/dom/HTMLBuilder.java com/sun/org/apache/html/internal/dom/HTMLButtonElementImpl.java com/sun/org/apache/html/internal/dom/HTMLCollectionImpl.java com/sun/org/apache/html/internal/dom/HTMLDListElementImpl.java com/sun/org/apache/html/internal/dom/HTMLDOMImplementationImpl.java com/sun/org/apache/html/internal/dom/HTMLDirectoryElementImpl.java com/sun/org/apache/html/internal/dom/HTMLDivElementImpl.java com/sun/org/apache/html/internal/dom/HTMLDocumentImpl.java com/sun/org/apache/html/internal/dom/HTMLElementImpl.java com/sun/org/apache/html/internal/dom/HTMLFieldSetElementImpl.java com/sun/org/apache/html/internal/dom/HTMLFontElementImpl.java com/sun/org/apache/html/internal/dom/HTMLFormControl.java com/sun/org/apache/html/internal/dom/HTMLFormElementImpl.java com/sun/org/apache/html/internal/dom/HTMLFrameElementImpl.java com/sun/org/apache/html/internal/dom/HTMLFrameSetElementImpl.java com/sun/org/apache/html/internal/dom/HTMLHRElementImpl.java com/sun/org/apache/html/internal/dom/HTMLHeadElementImpl.java com/sun/org/apache/html/internal/dom/HTMLHeadingElementImpl.java com/sun/org/apache/html/internal/dom/HTMLHtmlElementImpl.java com/sun/org/apache/html/internal/dom/HTMLIFrameElementImpl.java com/sun/org/apache/html/internal/dom/HTMLImageElementImpl.java com/sun/org/apache/html/internal/dom/HTMLInputElementImpl.java com/sun/org/apache/html/internal/dom/HTMLIsIndexElementImpl.java com/sun/org/apache/html/internal/dom/HTMLLIElementImpl.java com/sun/org/apache/html/internal/dom/HTMLLabelElementImpl.java com/sun/org/apache/html/internal/dom/HTMLLegendElementImpl.java com/sun/org/apache/html/internal/dom/HTMLLinkElementImpl.java com/sun/org/apache/html/internal/dom/HTMLMapElementImpl.java com/sun/org/apache/html/internal/dom/HTMLMenuElementImpl.java com/sun/org/apache/html/internal/dom/HTMLMetaElementImpl.java com/sun/org/apache/html/internal/dom/HTMLModElementImpl.java com/sun/org/apache/html/internal/dom/HTMLOListElementImpl.java com/sun/org/apache/html/internal/dom/HTMLObjectElementImpl.java com/sun/org/apache/html/internal/dom/HTMLOptGroupElementImpl.java com/sun/org/apache/html/internal/dom/HTMLOptionElementImpl.java com/sun/org/apache/html/internal/dom/HTMLParagraphElementImpl.java com/sun/org/apache/html/internal/dom/HTMLParamElementImpl.java com/sun/org/apache/html/internal/dom/HTMLPreElementImpl.java com/sun/org/apache/html/internal/dom/HTMLQuoteElementImpl.java com/sun/org/apache/html/internal/dom/HTMLScriptElementImpl.java com/sun/org/apache/html/internal/dom/HTMLSelectElementImpl.java com/sun/org/apache/html/internal/dom/HTMLStyleElementImpl.java com/sun/org/apache/html/internal/dom/HTMLTableCellElementImpl.java com/sun/org/apache/html/internal/dom/HTMLTableColElementImpl.java com/sun/org/apache/html/internal/dom/HTMLTableElementImpl.java com/sun/org/apache/html/internal/dom/ObjectFactory.java com/sun/org/apache/html/internal/dom/HTMLTableRowElementImpl.java com/sun/org/apache/html/internal/dom/HTMLTableSectionElementImpl.java com/sun/org/apache/html/internal/dom/HTMLTextAreaElementImpl.java com/sun/org/apache/html/internal/dom/HTMLTitleElementImpl.java com/sun/org/apache/html/internal/dom/HTMLUListElementImpl.java com/sun/org/apache/html/internal/dom/NameNodeListImpl.java com/sun/org/apache/html/internal/dom/SecuritySupport.java com/sun/org/apache/html/internal/dom/SecuritySupport12.java com/sun/org/apache/regexp com/sun/org/apache/regexp/internal com/sun/org/apache/regexp/internal/SCCS com/sun/org/apache/regexp/internal/SCCS/s.RE.java com/sun/org/apache/regexp/internal/SCCS/s.REDebugCompiler.java com/sun/org/apache/regexp/internal/SCCS/s.CharacterArrayCharacterIterator.java com/sun/org/apache/regexp/internal/SCCS/s.CharacterIterator.java com/sun/org/apache/regexp/internal/SCCS/s.RECompiler.java com/sun/org/apache/regexp/internal/SCCS/s.RESyntaxException.java com/sun/org/apache/regexp/internal/SCCS/s.REDemo.java com/sun/org/apache/regexp/internal/SCCS/s.REProgram.java com/sun/org/apache/regexp/internal/SCCS/s.RETest.java com/sun/org/apache/regexp/internal/SCCS/s.REUtil.java com/sun/org/apache/regexp/internal/SCCS/s.ReaderCharacterIterator.java com/sun/org/apache/regexp/internal/SCCS/s.StreamCharacterIterator.java com/sun/org/apache/regexp/internal/SCCS/s.StringCharacterIterator.java com/sun/org/apache/regexp/internal/SCCS/s.recompile.java com/sun/org/apache/regexp/internal/RE.java com/sun/org/apache/regexp/internal/ReaderCharacterIterator.java com/sun/org/apache/regexp/internal/CharacterArrayCharacterIterator.java com/sun/org/apache/regexp/internal/CharacterIterator.java com/sun/org/apache/regexp/internal/RECompiler.java com/sun/org/apache/regexp/internal/REDebugCompiler.java com/sun/org/apache/regexp/internal/REDemo.java com/sun/org/apache/regexp/internal/REProgram.java com/sun/org/apache/regexp/internal/RESyntaxException.java com/sun/org/apache/regexp/internal/RETest.java com/sun/org/apache/regexp/internal/REUtil.java com/sun/org/apache/regexp/internal/StreamCharacterIterator.java com/sun/org/apache/regexp/internal/StringCharacterIterator.java com/sun/org/apache/regexp/internal/recompile.java com/sun/org/apache/wml com/sun/org/apache/wml/internal com/sun/org/apache/wml/internal/SCCS com/sun/org/apache/wml/internal/SCCS/s.WMLAccessElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLAElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLAnchorElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLBElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLBigElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLBrElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLCardElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLDOMImplementation.java com/sun/org/apache/wml/internal/SCCS/s.WMLDoElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLDocument.java com/sun/org/apache/wml/internal/SCCS/s.WMLElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLEmElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLFieldsetElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLGoElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLHeadElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLIElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLImgElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLInputElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLMetaElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLNoopElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLOneventElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLOptgroupElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLOptionElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLPElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLPostfieldElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLPrevElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLRefreshElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLSelectElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLSetvarElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLSmallElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLStrongElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLTableElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLTdElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLTemplateElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLTimerElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLTrElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLUElement.java com/sun/org/apache/wml/internal/SCCS/s.WMLWmlElement.java com/sun/org/apache/wml/internal/dom com/sun/org/apache/wml/internal/dom/SCCS com/sun/org/apache/wml/internal/dom/SCCS/s.WMLAccessElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLAElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLAnchorElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLBElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLBigElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLBrElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLCardElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLDOMImplementationImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLDoElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLDocumentImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLEmElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLGoElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLFieldsetElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLHeadElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLIElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLImgElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLInputElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLMetaElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLNoopElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLOneventElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLOptgroupElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLOptionElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLPElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLPostfieldElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLPrevElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLSelectElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLRefreshElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLSetvarElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLSmallElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLStrongElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLTableElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLTdElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLTemplateElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLTimerElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLTrElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLUElementImpl.java com/sun/org/apache/wml/internal/dom/SCCS/s.WMLWmlElementImpl.java com/sun/org/apache/wml/internal/dom/WMLAccessElementImpl.java com/sun/org/apache/wml/internal/dom/WMLAElementImpl.java com/sun/org/apache/wml/internal/dom/WMLAnchorElementImpl.java com/sun/org/apache/wml/internal/dom/WMLBElementImpl.java com/sun/org/apache/wml/internal/dom/WMLBigElementImpl.java com/sun/org/apache/wml/internal/dom/WMLBrElementImpl.java com/sun/org/apache/wml/internal/dom/WMLCardElementImpl.java com/sun/org/apache/wml/internal/dom/WMLDOMImplementationImpl.java com/sun/org/apache/wml/internal/dom/WMLDoElementImpl.java com/sun/org/apache/wml/internal/dom/WMLDocumentImpl.java com/sun/org/apache/wml/internal/dom/WMLElementImpl.java com/sun/org/apache/wml/internal/dom/WMLEmElementImpl.java com/sun/org/apache/wml/internal/dom/WMLFieldsetElementImpl.java com/sun/org/apache/wml/internal/dom/WMLGoElementImpl.java com/sun/org/apache/wml/internal/dom/WMLHeadElementImpl.java com/sun/org/apache/wml/internal/dom/WMLIElementImpl.java com/sun/org/apache/wml/internal/dom/WMLImgElementImpl.java com/sun/org/apache/wml/internal/dom/WMLInputElementImpl.java com/sun/org/apache/wml/internal/dom/WMLMetaElementImpl.java com/sun/org/apache/wml/internal/dom/WMLNoopElementImpl.java com/sun/org/apache/wml/internal/dom/WMLOneventElementImpl.java com/sun/org/apache/wml/internal/dom/WMLOptgroupElementImpl.java com/sun/org/apache/wml/internal/dom/WMLOptionElementImpl.java com/sun/org/apache/wml/internal/dom/WMLPElementImpl.java com/sun/org/apache/wml/internal/dom/WMLPostfieldElementImpl.java com/sun/org/apache/wml/internal/dom/WMLPrevElementImpl.java com/sun/org/apache/wml/internal/dom/WMLRefreshElementImpl.java com/sun/org/apache/wml/internal/dom/WMLSelectElementImpl.java com/sun/org/apache/wml/internal/dom/WMLTdElementImpl.java com/sun/org/apache/wml/internal/dom/WMLSetvarElementImpl.java com/sun/org/apache/wml/internal/dom/WMLSmallElementImpl.java com/sun/org/apache/wml/internal/dom/WMLStrongElementImpl.java com/sun/org/apache/wml/internal/dom/WMLTableElementImpl.java com/sun/org/apache/wml/internal/dom/WMLTemplateElementImpl.java com/sun/org/apache/wml/internal/dom/WMLTimerElementImpl.java com/sun/org/apache/wml/internal/dom/WMLTrElementImpl.java com/sun/org/apache/wml/internal/dom/WMLUElementImpl.java com/sun/org/apache/wml/internal/dom/WMLWmlElementImpl.java com/sun/org/apache/wml/internal/WMLAccessElement.java com/sun/org/apache/wml/internal/WMLAElement.java com/sun/org/apache/wml/internal/WMLAnchorElement.java com/sun/org/apache/wml/internal/WMLBElement.java com/sun/org/apache/wml/internal/WMLBigElement.java com/sun/org/apache/wml/internal/WMLBrElement.java com/sun/org/apache/wml/internal/WMLCardElement.java com/sun/org/apache/wml/internal/WMLDOMImplementation.java com/sun/org/apache/wml/internal/WMLDoElement.java com/sun/org/apache/wml/internal/WMLDocument.java com/sun/org/apache/wml/internal/WMLElement.java com/sun/org/apache/wml/internal/WMLEmElement.java com/sun/org/apache/wml/internal/WMLFieldsetElement.java com/sun/org/apache/wml/internal/WMLGoElement.java com/sun/org/apache/wml/internal/WMLHeadElement.java com/sun/org/apache/wml/internal/WMLIElement.java com/sun/org/apache/wml/internal/WMLImgElement.java com/sun/org/apache/wml/internal/WMLInputElement.java com/sun/org/apache/wml/internal/WMLMetaElement.java com/sun/org/apache/wml/internal/WMLNoopElement.java com/sun/org/apache/wml/internal/WMLOneventElement.java com/sun/org/apache/wml/internal/WMLOptgroupElement.java com/sun/org/apache/wml/internal/WMLOptionElement.java com/sun/org/apache/wml/internal/WMLPElement.java com/sun/org/apache/wml/internal/WMLPostfieldElement.java com/sun/org/apache/wml/internal/WMLPrevElement.java com/sun/org/apache/wml/internal/WMLRefreshElement.java com/sun/org/apache/wml/internal/WMLSelectElement.java com/sun/org/apache/wml/internal/WMLSetvarElement.java com/sun/org/apache/wml/internal/WMLSmallElement.java com/sun/org/apache/wml/internal/WMLStrongElement.java com/sun/org/apache/wml/internal/WMLTableElement.java com/sun/org/apache/wml/internal/WMLTdElement.java com/sun/org/apache/wml/internal/WMLTemplateElement.java com/sun/org/apache/wml/internal/WMLTimerElement.java com/sun/org/apache/wml/internal/WMLTrElement.java com/sun/org/apache/wml/internal/WMLUElement.java com/sun/org/apache/wml/internal/WMLWmlElement.java com/sun/org/apache/xalan com/sun/org/apache/xalan/internal com/sun/org/apache/xalan/internal/SCCS com/sun/org/apache/xalan/internal/SCCS/s.Version.java com/sun/org/apache/xalan/internal/client com/sun/org/apache/xalan/internal/client/SCCS com/sun/org/apache/xalan/internal/client/SCCS/s.XSLTProcessorApplet.java com/sun/org/apache/xalan/internal/client/SCCS/s.package.html com/sun/org/apache/xalan/internal/client/XSLTProcessorApplet.java com/sun/org/apache/xalan/internal/client/package.html com/sun/org/apache/xalan/internal/extensions com/sun/org/apache/xalan/internal/extensions/SCCS com/sun/org/apache/xalan/internal/extensions/SCCS/s.ExpressionContext.java com/sun/org/apache/xalan/internal/extensions/SCCS/s.package.html com/sun/org/apache/xalan/internal/extensions/ExpressionContext.java com/sun/org/apache/xalan/internal/extensions/package.html com/sun/org/apache/xalan/internal/lib com/sun/org/apache/xalan/internal/lib/SCCS com/sun/org/apache/xalan/internal/lib/SCCS/s.ExsltDatetime.java com/sun/org/apache/xalan/internal/lib/SCCS/s.ExsltBase.java com/sun/org/apache/xalan/internal/lib/SCCS/s.ExsltCommon.java com/sun/org/apache/xalan/internal/lib/SCCS/s.SecuritySupport12.java com/sun/org/apache/xalan/internal/lib/SCCS/s.ExsltDynamic.java com/sun/org/apache/xalan/internal/lib/SCCS/s.ExsltMath.java com/sun/org/apache/xalan/internal/lib/SCCS/s.ExsltSets.java com/sun/org/apache/xalan/internal/lib/SCCS/s.ExsltStrings.java com/sun/org/apache/xalan/internal/lib/SCCS/s.Extensions.java com/sun/org/apache/xalan/internal/lib/SCCS/s.ObjectFactory.java com/sun/org/apache/xalan/internal/lib/SCCS/s.SecuritySupport.java com/sun/org/apache/xalan/internal/lib/sql com/sun/org/apache/xalan/internal/lib/sql/SCCS com/sun/org/apache/xalan/internal/lib/ExsltCommon.java com/sun/org/apache/xalan/internal/lib/ExsltBase.java com/sun/org/apache/xalan/internal/lib/ExsltDatetime.java com/sun/org/apache/xalan/internal/lib/ExsltDynamic.java com/sun/org/apache/xalan/internal/lib/ExsltMath.java com/sun/org/apache/xalan/internal/lib/ExsltSets.java com/sun/org/apache/xalan/internal/lib/ExsltStrings.java com/sun/org/apache/xalan/internal/lib/Extensions.java com/sun/org/apache/xalan/internal/lib/ObjectFactory.java com/sun/org/apache/xalan/internal/lib/SecuritySupport.java com/sun/org/apache/xalan/internal/lib/SecuritySupport12.java com/sun/org/apache/xalan/internal/processor com/sun/org/apache/xalan/internal/processor/SCCS com/sun/org/apache/xalan/internal/res com/sun/org/apache/xalan/internal/res/SCCS com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLMessages.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources_de.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources_en.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources_es.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources_fr.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources_it.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources_ja.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources_ko.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources_sv.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources_zh_CN.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources_zh_HK.java com/sun/org/apache/xalan/internal/res/SCCS/s.package.html com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTErrorResources_zh_TW.java com/sun/org/apache/xalan/internal/res/SCCS/s.XSLTInfo.properties com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java com/sun/org/apache/xalan/internal/res/XSLMessages.java com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java com/sun/org/apache/xalan/internal/res/XSLTErrorResources_en.java com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java com/sun/org/apache/xalan/internal/res/XSLTInfo.properties com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_HK.java com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java com/sun/org/apache/xalan/internal/res/package.html com/sun/org/apache/xalan/internal/serialize com/sun/org/apache/xalan/internal/serialize/SCCS com/sun/org/apache/xalan/internal/templates com/sun/org/apache/xalan/internal/templates/SCCS com/sun/org/apache/xalan/internal/templates/SCCS/s.Constants.java com/sun/org/apache/xalan/internal/templates/SCCS/s.package.html com/sun/org/apache/xalan/internal/templates/Constants.java com/sun/org/apache/xalan/internal/templates/package.html com/sun/org/apache/xalan/internal/trace com/sun/org/apache/xalan/internal/trace/SCCS com/sun/org/apache/xalan/internal/transformer com/sun/org/apache/xalan/internal/transformer/SCCS com/sun/org/apache/xalan/internal/xslt com/sun/org/apache/xalan/internal/xslt/SCCS com/sun/org/apache/xalan/internal/xslt/SCCS/s.SecuritySupport12.java com/sun/org/apache/xalan/internal/xslt/SCCS/s.EnvironmentCheck.java com/sun/org/apache/xalan/internal/xslt/SCCS/s.ObjectFactory.java com/sun/org/apache/xalan/internal/xslt/SCCS/s.Process.java com/sun/org/apache/xalan/internal/xslt/SCCS/s.SecuritySupport.java com/sun/org/apache/xalan/internal/xslt/SCCS/s.package.html com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java com/sun/org/apache/xalan/internal/xslt/ObjectFactory.java com/sun/org/apache/xalan/internal/xslt/Process.java com/sun/org/apache/xalan/internal/xslt/SecuritySupport.java com/sun/org/apache/xalan/internal/xslt/SecuritySupport12.java com/sun/org/apache/xalan/internal/xslt/package.html com/sun/org/apache/xalan/internal/xsltc com/sun/org/apache/xalan/internal/xsltc/SCCS com/sun/org/apache/xalan/internal/xsltc/SCCS/s.DOMEnhancedForDTM.java com/sun/org/apache/xalan/internal/xsltc/SCCS/s.CollatorFactory.java com/sun/org/apache/xalan/internal/xsltc/SCCS/s.DOM.java com/sun/org/apache/xalan/internal/xsltc/SCCS/s.DOMCache.java com/sun/org/apache/xalan/internal/xsltc/SCCS/s.TransletException.java com/sun/org/apache/xalan/internal/xsltc/SCCS/s.NodeIterator.java com/sun/org/apache/xalan/internal/xsltc/SCCS/s.ProcessorVersion.java com/sun/org/apache/xalan/internal/xsltc/SCCS/s.StripFilter.java com/sun/org/apache/xalan/internal/xsltc/SCCS/s.Translet.java com/sun/org/apache/xalan/internal/xsltc/SCCS/s.javax.xml.transform.TransformerFactory com/sun/org/apache/xalan/internal/xsltc/cmdline com/sun/org/apache/xalan/internal/xsltc/cmdline/SCCS com/sun/org/apache/xalan/internal/xsltc/cmdline/SCCS/s.ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/cmdline/SCCS/s.Compile.java com/sun/org/apache/xalan/internal/xsltc/cmdline/SCCS/s.SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/cmdline/SCCS/s.SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/cmdline/SCCS/s.Transform.java com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt/SCCS com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt/SCCS/s.GetOptsException.java com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt/SCCS/s.GetOpt.java com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt/SCCS/s.IllegalArgumentException.java com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt/SCCS/s.MissingOptArgException.java com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt/GetOpt.java com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt/GetOptsException.java com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt/IllegalArgumentException.java com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt/MissingOptArgException.java com/sun/org/apache/xalan/internal/xsltc/cmdline/ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java com/sun/org/apache/xalan/internal/xsltc/cmdline/SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/cmdline/SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/cmdline/Transform.java com/sun/org/apache/xalan/internal/xsltc/compiler com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.AttributeValueTemplate.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.AbsoluteLocationPath.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.AbsolutePathPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.AlternativePattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.AncestorPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ApplyImports.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ApplyTemplates.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ArgumentList.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Attribute.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.AttributeSet.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.AttributeValue.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.BinOpExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.BooleanCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.BooleanExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.CopyOf.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Copy.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.CallTemplate.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.CastCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.CastExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.CeilingCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Choose.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Closure.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Comment.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.CompilerException.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ConcatCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Constants.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ContainsCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.DecimalFormatting.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.CurrentCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ElementAvailableCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.DocumentCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.FilterParentPath.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.EqualityExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Fallback.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Expression.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.FilterExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.If.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.FilteredAbsoluteLocationPath.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.FloorCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.FlowList.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ForEach.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.FormatNumberCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.FunctionAvailableCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.FunctionCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.GenerateIdCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.IdKeyPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.IdPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Import.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.IllegalCharException.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Include.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ProcessingInstruction.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Instruction.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.IntExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Key.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.KeyCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.KeyPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.LangCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.LastCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.LiteralAttribute.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.LiteralElement.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.LiteralExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.LocalNameCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.LocationPathPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.LogicalExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Makefile.inc com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Message.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Mode.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.NameBase.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.NameCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.NamespaceAlias.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.NamespaceUriCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.NodeTest.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.NotCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Number.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.NumberCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Otherwise.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Output.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Param.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ParameterRef.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ParentLocationPath.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ParentPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Parser.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Pattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.PositionCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.PositionCall.java.inuse com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Predicate.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.RelationalExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.QName.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.RealExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ProcessingInstructionPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.When.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.RelativeLocationPath.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.RelativePathPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.RoundCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.SimpleAttributeValue.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Sort.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.SourceLoader.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.StartsWithCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Step.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.StepPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.StringCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.StringLengthCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Stylesheet.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.SymbolTable.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.SyntaxTreeNode.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Template.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.TestSeq.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Text.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.TopLevelElement.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.TransletOutput.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.UnaryOpExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.UnionPathExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.UnparsedEntityUriCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.UnresolvedRef.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.UnsupportedElement.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.UseAttributeSets.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.ValueOf.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Variable.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.VariableBase.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.VariableRef.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.VariableRefBase.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.Whitespace.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.WithParam.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.XPathLexer.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.XPathParser.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.XSLTC.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.XslAttribute.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.XslElement.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.sym.java com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.xpath.cup com/sun/org/apache/xalan/internal/xsltc/compiler/SCCS/s.xpath.lex com/sun/org/apache/xalan/internal/xsltc/compiler/util com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.AttributeSetMethodGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.BooleanType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ClassGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.CompareGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages_ca.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages_cs.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages_de.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages_es.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages_fr.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages_it.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages_ja.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages_ko.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.NodeType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.RtMethodGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages_sk.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages_zh_CN.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMessages_zh_TW.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ErrorMsg.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.FilterGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.IntType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.MatchGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.MethodGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.MethodType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.MultiHashtable.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.NamedMethodGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.NodeCounterGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.NodeSetType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.NodeSortRecordFactGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.NodeSortRecordGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.Type.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.NumberType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ObjectType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.RealType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ReferenceType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.ResultTreeType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.SlotAllocator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.StringStack.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.StringType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.TestGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.TypeCheckError.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.Util.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SCCS/s.VoidType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/AttributeSetMethodGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/BooleanType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ClassGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/CompareGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ca.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_cs.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/NumberType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sk.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/FilterGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/IntType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/MatchGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/MethodGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/MethodType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/MultiHashtable.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/NamedMethodGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/NodeCounterGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/NodeSetType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/NodeSortRecordFactGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/NodeSortRecordGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/NodeType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ReferenceType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ObjectType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/RealType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/ResultTreeType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/RtMethodGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/SlotAllocator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/StringStack.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/StringType.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/TestGenerator.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/Type.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/TypeCheckError.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java com/sun/org/apache/xalan/internal/xsltc/compiler/util/VoidType.java com/sun/org/apache/xalan/internal/xsltc/compiler/AbsoluteLocationPath.java com/sun/org/apache/xalan/internal/xsltc/compiler/AbsolutePathPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/AlternativePattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/AncestorPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/ApplyImports.java com/sun/org/apache/xalan/internal/xsltc/compiler/ApplyTemplates.java com/sun/org/apache/xalan/internal/xsltc/compiler/ArgumentList.java com/sun/org/apache/xalan/internal/xsltc/compiler/Attribute.java com/sun/org/apache/xalan/internal/xsltc/compiler/AttributeSet.java com/sun/org/apache/xalan/internal/xsltc/compiler/AttributeValue.java com/sun/org/apache/xalan/internal/xsltc/compiler/AttributeValueTemplate.java com/sun/org/apache/xalan/internal/xsltc/compiler/BinOpExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/BooleanCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/BooleanExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/ElementAvailableCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/CallTemplate.java com/sun/org/apache/xalan/internal/xsltc/compiler/CastCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/CastExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/CeilingCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/Choose.java com/sun/org/apache/xalan/internal/xsltc/compiler/Closure.java com/sun/org/apache/xalan/internal/xsltc/compiler/Comment.java com/sun/org/apache/xalan/internal/xsltc/compiler/CompilerException.java com/sun/org/apache/xalan/internal/xsltc/compiler/ConcatCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/Constants.java com/sun/org/apache/xalan/internal/xsltc/compiler/ContainsCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/Copy.java com/sun/org/apache/xalan/internal/xsltc/compiler/CopyOf.java com/sun/org/apache/xalan/internal/xsltc/compiler/CurrentCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/DecimalFormatting.java com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/EqualityExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/Expression.java com/sun/org/apache/xalan/internal/xsltc/compiler/If.java com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralAttribute.java com/sun/org/apache/xalan/internal/xsltc/compiler/Fallback.java com/sun/org/apache/xalan/internal/xsltc/compiler/FilterExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/FilterParentPath.java com/sun/org/apache/xalan/internal/xsltc/compiler/FilteredAbsoluteLocationPath.java com/sun/org/apache/xalan/internal/xsltc/compiler/FloorCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/FlowList.java com/sun/org/apache/xalan/internal/xsltc/compiler/ForEach.java com/sun/org/apache/xalan/internal/xsltc/compiler/FormatNumberCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionAvailableCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/GenerateIdCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/IdKeyPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/IdPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java com/sun/org/apache/xalan/internal/xsltc/compiler/IllegalCharException.java com/sun/org/apache/xalan/internal/xsltc/compiler/Instruction.java com/sun/org/apache/xalan/internal/xsltc/compiler/IntExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/Key.java com/sun/org/apache/xalan/internal/xsltc/compiler/KeyCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/KeyPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/LangCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/LastCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/LocationPathPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/LocalNameCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/NamespaceUriCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/LogicalExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/Makefile.inc com/sun/org/apache/xalan/internal/xsltc/compiler/Message.java com/sun/org/apache/xalan/internal/xsltc/compiler/Mode.java com/sun/org/apache/xalan/internal/xsltc/compiler/NameBase.java com/sun/org/apache/xalan/internal/xsltc/compiler/NameCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/NamespaceAlias.java com/sun/org/apache/xalan/internal/xsltc/compiler/NodeTest.java com/sun/org/apache/xalan/internal/xsltc/compiler/Pattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java com/sun/org/apache/xalan/internal/xsltc/compiler/NotCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/Number.java com/sun/org/apache/xalan/internal/xsltc/compiler/NumberCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/compiler/Otherwise.java com/sun/org/apache/xalan/internal/xsltc/compiler/Output.java com/sun/org/apache/xalan/internal/xsltc/compiler/Param.java com/sun/org/apache/xalan/internal/xsltc/compiler/ParameterRef.java com/sun/org/apache/xalan/internal/xsltc/compiler/ParentLocationPath.java com/sun/org/apache/xalan/internal/xsltc/compiler/ParentPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/PositionCall.java.inuse com/sun/org/apache/xalan/internal/xsltc/compiler/PositionCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/Predicate.java com/sun/org/apache/xalan/internal/xsltc/compiler/RealExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/QName.java com/sun/org/apache/xalan/internal/xsltc/compiler/ProcessingInstruction.java com/sun/org/apache/xalan/internal/xsltc/compiler/ProcessingInstructionPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/compiler/RoundCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/RelationalExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/RelativeLocationPath.java com/sun/org/apache/xalan/internal/xsltc/compiler/RelativePathPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/SimpleAttributeValue.java com/sun/org/apache/xalan/internal/xsltc/compiler/SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/compiler/SourceLoader.java com/sun/org/apache/xalan/internal/xsltc/compiler/Sort.java com/sun/org/apache/xalan/internal/xsltc/compiler/TopLevelElement.java com/sun/org/apache/xalan/internal/xsltc/compiler/StartsWithCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/Step.java com/sun/org/apache/xalan/internal/xsltc/compiler/StepPattern.java com/sun/org/apache/xalan/internal/xsltc/compiler/StringCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/StringLengthCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/Stylesheet.java com/sun/org/apache/xalan/internal/xsltc/compiler/SymbolTable.java com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java com/sun/org/apache/xalan/internal/xsltc/compiler/Template.java com/sun/org/apache/xalan/internal/xsltc/compiler/TestSeq.java com/sun/org/apache/xalan/internal/xsltc/compiler/Text.java com/sun/org/apache/xalan/internal/xsltc/compiler/UnparsedEntityUriCall.java com/sun/org/apache/xalan/internal/xsltc/compiler/TransletOutput.java com/sun/org/apache/xalan/internal/xsltc/compiler/UnaryOpExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/UnionPathExpr.java com/sun/org/apache/xalan/internal/xsltc/compiler/UnsupportedElement.java com/sun/org/apache/xalan/internal/xsltc/compiler/UnresolvedRef.java com/sun/org/apache/xalan/internal/xsltc/compiler/UseAttributeSets.java com/sun/org/apache/xalan/internal/xsltc/compiler/ValueOf.java com/sun/org/apache/xalan/internal/xsltc/compiler/Variable.java com/sun/org/apache/xalan/internal/xsltc/compiler/VariableBase.java com/sun/org/apache/xalan/internal/xsltc/compiler/VariableRef.java com/sun/org/apache/xalan/internal/xsltc/compiler/VariableRefBase.java com/sun/org/apache/xalan/internal/xsltc/compiler/When.java com/sun/org/apache/xalan/internal/xsltc/compiler/Whitespace.java com/sun/org/apache/xalan/internal/xsltc/compiler/WithParam.java com/sun/org/apache/xalan/internal/xsltc/compiler/XPathLexer.java com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java com/sun/org/apache/xalan/internal/xsltc/compiler/XslAttribute.java com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java com/sun/org/apache/xalan/internal/xsltc/compiler/sym.java com/sun/org/apache/xalan/internal/xsltc/compiler/xpath.cup com/sun/org/apache/xalan/internal/xsltc/compiler/xpath.lex com/sun/org/apache/xalan/internal/xsltc/dom com/sun/org/apache/xalan/internal/xsltc/dom/SCCS com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.AdaptiveResultTreeImpl.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.AbsoluteIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.CachedNodeListIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.AnyNodeCounter.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.Axis.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.BitArray.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.DocumentCache.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.ClonedNodeListIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.CollatorFactoryBase.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.CurrentNodeListFilter.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.CurrentNodeListIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.DOM.java.Palm com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.DOMAdapter.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.DOMBuilder.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.DOMWSFilter.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.ForwardPositionIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.DupFilterIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.EmptyFilter.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.ExtendedSAX.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.Filter.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.FilterIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.FilteredStepIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.MatchingIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.KeyIndex.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.LoadDocument.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.MultiDOM.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.NodeCounter.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.MultipleNodeCounter.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.NodeIteratorBase.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.NodeSortRecord.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.NodeSortRecordFactory.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.NthIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.SAXImpl.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.SimpleResultTreeImpl.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.SingleNodeCounter.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.SingletonIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.SortSettings.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.SortingIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.StepIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.StripWhitespaceFilter.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.UnionIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SCCS/s.XSLTCDTMManager.java com/sun/org/apache/xalan/internal/xsltc/dom/AdaptiveResultTreeImpl.java com/sun/org/apache/xalan/internal/xsltc/dom/AbsoluteIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/CachedNodeListIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/AnyNodeCounter.java com/sun/org/apache/xalan/internal/xsltc/dom/Axis.java com/sun/org/apache/xalan/internal/xsltc/dom/BitArray.java com/sun/org/apache/xalan/internal/xsltc/dom/FilterIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/Filter.java com/sun/org/apache/xalan/internal/xsltc/dom/ClonedNodeListIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/CollatorFactoryBase.java com/sun/org/apache/xalan/internal/xsltc/dom/CurrentNodeListFilter.java com/sun/org/apache/xalan/internal/xsltc/dom/CurrentNodeListIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/DOM.java.Palm com/sun/org/apache/xalan/internal/xsltc/dom/DOMAdapter.java com/sun/org/apache/xalan/internal/xsltc/dom/DOMBuilder.java com/sun/org/apache/xalan/internal/xsltc/dom/DOMWSFilter.java com/sun/org/apache/xalan/internal/xsltc/dom/DocumentCache.java com/sun/org/apache/xalan/internal/xsltc/dom/DupFilterIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/EmptyFilter.java com/sun/org/apache/xalan/internal/xsltc/dom/ExtendedSAX.java com/sun/org/apache/xalan/internal/xsltc/dom/ForwardPositionIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/FilteredStepIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/MatchingIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/KeyIndex.java com/sun/org/apache/xalan/internal/xsltc/dom/LoadDocument.java com/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM.java com/sun/org/apache/xalan/internal/xsltc/dom/NodeCounter.java com/sun/org/apache/xalan/internal/xsltc/dom/MultipleNodeCounter.java com/sun/org/apache/xalan/internal/xsltc/dom/NodeIteratorBase.java com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.java com/sun/org/apache/xalan/internal/xsltc/dom/NthIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java com/sun/org/apache/xalan/internal/xsltc/dom/ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/dom/SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/dom/SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/dom/SimpleResultTreeImpl.java com/sun/org/apache/xalan/internal/xsltc/dom/SingleNodeCounter.java com/sun/org/apache/xalan/internal/xsltc/dom/SingletonIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/SortSettings.java com/sun/org/apache/xalan/internal/xsltc/dom/SortingIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/StepIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/StripWhitespaceFilter.java com/sun/org/apache/xalan/internal/xsltc/dom/UnionIterator.java com/sun/org/apache/xalan/internal/xsltc/dom/XSLTCDTMManager.java com/sun/org/apache/xalan/internal/xsltc/runtime com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.AbstractTranslet.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.AttributeList.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.Attributes.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.BasisLibrary.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.CallFunction.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.Constants.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages_ca.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages_cs.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages_de.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages_es.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages_fr.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages_it.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages_ja.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.Node.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages_ko.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages_sk.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages_zh_CN.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ErrorMessages_zh_TW.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.Hashtable.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.MessageHandler.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.Operators.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.Parameter.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/runtime/SCCS/s.StringValueHandler.java com/sun/org/apache/xalan/internal/xsltc/runtime/output com/sun/org/apache/xalan/internal/xsltc/runtime/output/SCCS com/sun/org/apache/xalan/internal/xsltc/runtime/output/SCCS/s.StringOutputBuffer.java com/sun/org/apache/xalan/internal/xsltc/runtime/output/SCCS/s.OutputBuffer.java com/sun/org/apache/xalan/internal/xsltc/runtime/output/SCCS/s.TransletOutputHandlerFactory.java com/sun/org/apache/xalan/internal/xsltc/runtime/output/SCCS/s.WriterOutputBuffer.java com/sun/org/apache/xalan/internal/xsltc/runtime/output/StringOutputBuffer.java com/sun/org/apache/xalan/internal/xsltc/runtime/output/OutputBuffer.java com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java com/sun/org/apache/xalan/internal/xsltc/runtime/AbstractTranslet.java com/sun/org/apache/xalan/internal/xsltc/runtime/AttributeList.java com/sun/org/apache/xalan/internal/xsltc/runtime/Attributes.java com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java com/sun/org/apache/xalan/internal/xsltc/runtime/CallFunction.java com/sun/org/apache/xalan/internal/xsltc/runtime/Constants.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ca.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_cs.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_de.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_es.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_fr.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_it.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ja.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ko.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_sk.java com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_TW.java com/sun/org/apache/xalan/internal/xsltc/runtime/Hashtable.java com/sun/org/apache/xalan/internal/xsltc/runtime/MessageHandler.java com/sun/org/apache/xalan/internal/xsltc/runtime/Node.java com/sun/org/apache/xalan/internal/xsltc/runtime/ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/runtime/Operators.java com/sun/org/apache/xalan/internal/xsltc/runtime/Parameter.java com/sun/org/apache/xalan/internal/xsltc/runtime/SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/runtime/SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/runtime/StringValueHandler.java com/sun/org/apache/xalan/internal/xsltc/trax com/sun/org/apache/xalan/internal/xsltc/trax/SCCS com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.DOM2SAX.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.DOM2TO.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.OutputSettings.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.SAX2DOM.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.Util.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.SmartTransformerFactoryImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.TemplatesHandlerImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.TemplatesImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.TrAXFilter.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.TransformerFactoryImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.TransformerHandlerImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.TransformerImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/SCCS/s.XSLTCSource.java com/sun/org/apache/xalan/internal/xsltc/trax/ObjectFactory.java com/sun/org/apache/xalan/internal/xsltc/trax/DOM2SAX.java com/sun/org/apache/xalan/internal/xsltc/trax/DOM2TO.java com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/OutputSettings.java com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java com/sun/org/apache/xalan/internal/xsltc/trax/SecuritySupport.java com/sun/org/apache/xalan/internal/xsltc/trax/SecuritySupport12.java com/sun/org/apache/xalan/internal/xsltc/trax/XSLTCSource.java com/sun/org/apache/xalan/internal/xsltc/trax/SmartTransformerFactoryImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/TrAXFilter.java com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/TransformerHandlerImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java com/sun/org/apache/xalan/internal/xsltc/trax/Util.java com/sun/org/apache/xalan/internal/xsltc/util com/sun/org/apache/xalan/internal/xsltc/util/SCCS com/sun/org/apache/xalan/internal/xsltc/util/SCCS/s.JavaCupRedirect.java com/sun/org/apache/xalan/internal/xsltc/util/SCCS/s.IntegerArray.java com/sun/org/apache/xalan/internal/xsltc/util/JavaCupRedirect.java com/sun/org/apache/xalan/internal/xsltc/util/IntegerArray.java com/sun/org/apache/xalan/internal/xsltc/CollatorFactory.java com/sun/org/apache/xalan/internal/xsltc/DOM.java com/sun/org/apache/xalan/internal/xsltc/DOMCache.java com/sun/org/apache/xalan/internal/xsltc/DOMEnhancedForDTM.java com/sun/org/apache/xalan/internal/xsltc/NodeIterator.java com/sun/org/apache/xalan/internal/xsltc/ProcessorVersion.java com/sun/org/apache/xalan/internal/xsltc/StripFilter.java com/sun/org/apache/xalan/internal/xsltc/Translet.java com/sun/org/apache/xalan/internal/xsltc/TransletException.java com/sun/org/apache/xalan/internal/xsltc/javax.xml.transform.TransformerFactory com/sun/org/apache/xalan/internal/Version.java com/sun/org/apache/xerces com/sun/org/apache/xerces/internal com/sun/org/apache/xerces/internal/dom com/sun/org/apache/xerces/internal/dom/SCCS com/sun/org/apache/xerces/internal/dom/SCCS/s.CoreDOMImplementationImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.ASDOMImplementationImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.ASModelImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.AttrImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.AttrNSImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.AttributeMap.java com/sun/org/apache/xerces/internal/dom/SCCS/s.CDATASectionImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.CharacterDataImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.ChildNode.java com/sun/org/apache/xerces/internal/dom/SCCS/s.CommentImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.CoreDocumentImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMConfigurationImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMErrorImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMInputImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMXSImplementationSourceImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMImplementationImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMImplementationListImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMImplementationSourceImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMLocatorImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMMessageFormatter.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMNormalizer.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMOutputImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DOMStringListImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredAttrNSImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeepNodeListImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredAttrImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredCDATASectionImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredNode.java com/sun/org/apache/xerces/internal/dom/SCCS/s.PSVIDOMImplementationImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredCommentImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredDocumentImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredDocumentTypeImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredElementDefinitionImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredElementImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredElementNSImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredEntityImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredEntityReferenceImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredNotationImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredTextImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DocumentImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DeferredProcessingInstructionImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DocumentFragmentImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.DocumentTypeImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.ElementDefinitionImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.ElementImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.ElementNSImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.EntityImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.EntityReferenceImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.LCount.java com/sun/org/apache/xerces/internal/dom/SCCS/s.NamedNodeMapImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.NodeImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.NodeIteratorImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.NodeListCache.java com/sun/org/apache/xerces/internal/dom/SCCS/s.NotationImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.ObjectFactory.java com/sun/org/apache/xerces/internal/dom/SCCS/s.PSVIAttrNSImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.PSVIDocumentImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.ProcessingInstructionImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.PSVIElementNSImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.ParentNode.java com/sun/org/apache/xerces/internal/dom/SCCS/s.RangeExceptionImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.RangeImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.SecuritySupport.java com/sun/org/apache/xerces/internal/dom/SCCS/s.SecuritySupport12.java com/sun/org/apache/xerces/internal/dom/SCCS/s.TextImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.TreeWalkerImpl.java com/sun/org/apache/xerces/internal/dom/SCCS/s.org.apache.xerces.dom.DOMImplementationSourceImpl com/sun/org/apache/xerces/internal/dom/SCCS/s.org.w3c.dom.DOMImplementationSourceList com/sun/org/apache/xerces/internal/dom/events com/sun/org/apache/xerces/internal/dom/events/SCCS com/sun/org/apache/xerces/internal/dom/events/SCCS/s.MutationEventImpl.java com/sun/org/apache/xerces/internal/dom/events/SCCS/s.EventImpl.java com/sun/org/apache/xerces/internal/dom/events/MutationEventImpl.java com/sun/org/apache/xerces/internal/dom/events/EventImpl.java com/sun/org/apache/xerces/internal/dom/ASDOMImplementationImpl.java com/sun/org/apache/xerces/internal/dom/ASModelImpl.java com/sun/org/apache/xerces/internal/dom/AttrImpl.java com/sun/org/apache/xerces/internal/dom/AttrNSImpl.java com/sun/org/apache/xerces/internal/dom/AttributeMap.java com/sun/org/apache/xerces/internal/dom/CDATASectionImpl.java com/sun/org/apache/xerces/internal/dom/CharacterDataImpl.java com/sun/org/apache/xerces/internal/dom/ChildNode.java com/sun/org/apache/xerces/internal/dom/CommentImpl.java com/sun/org/apache/xerces/internal/dom/CoreDOMImplementationImpl.java com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java com/sun/org/apache/xerces/internal/dom/DOMErrorImpl.java com/sun/org/apache/xerces/internal/dom/NamedNodeMapImpl.java com/sun/org/apache/xerces/internal/dom/EntityImpl.java com/sun/org/apache/xerces/internal/dom/DOMImplementationImpl.java com/sun/org/apache/xerces/internal/dom/DOMImplementationListImpl.java com/sun/org/apache/xerces/internal/dom/DOMImplementationSourceImpl.java com/sun/org/apache/xerces/internal/dom/DOMInputImpl.java com/sun/org/apache/xerces/internal/dom/DOMLocatorImpl.java com/sun/org/apache/xerces/internal/dom/DOMMessageFormatter.java com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java com/sun/org/apache/xerces/internal/dom/DOMOutputImpl.java com/sun/org/apache/xerces/internal/dom/DOMStringListImpl.java com/sun/org/apache/xerces/internal/dom/DOMXSImplementationSourceImpl.java com/sun/org/apache/xerces/internal/dom/DeepNodeListImpl.java com/sun/org/apache/xerces/internal/dom/DeferredAttrImpl.java com/sun/org/apache/xerces/internal/dom/DeferredAttrNSImpl.java com/sun/org/apache/xerces/internal/dom/DeferredCDATASectionImpl.java com/sun/org/apache/xerces/internal/dom/DeferredEntityImpl.java com/sun/org/apache/xerces/internal/dom/DeferredCommentImpl.java com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java com/sun/org/apache/xerces/internal/dom/DeferredDocumentTypeImpl.java com/sun/org/apache/xerces/internal/dom/DeferredElementDefinitionImpl.java com/sun/org/apache/xerces/internal/dom/DeferredElementImpl.java com/sun/org/apache/xerces/internal/dom/DeferredElementNSImpl.java com/sun/org/apache/xerces/internal/dom/DeferredEntityReferenceImpl.java com/sun/org/apache/xerces/internal/dom/DeferredNode.java com/sun/org/apache/xerces/internal/dom/DeferredNotationImpl.java com/sun/org/apache/xerces/internal/dom/DeferredProcessingInstructionImpl.java com/sun/org/apache/xerces/internal/dom/DeferredTextImpl.java com/sun/org/apache/xerces/internal/dom/DocumentFragmentImpl.java com/sun/org/apache/xerces/internal/dom/DocumentImpl.java com/sun/org/apache/xerces/internal/dom/DocumentTypeImpl.java com/sun/org/apache/xerces/internal/dom/ElementDefinitionImpl.java com/sun/org/apache/xerces/internal/dom/ElementImpl.java com/sun/org/apache/xerces/internal/dom/ElementNSImpl.java com/sun/org/apache/xerces/internal/dom/LCount.java com/sun/org/apache/xerces/internal/dom/NodeImpl.java com/sun/org/apache/xerces/internal/dom/EntityReferenceImpl.java com/sun/org/apache/xerces/internal/dom/PSVIDOMImplementationImpl.java com/sun/org/apache/xerces/internal/dom/NodeIteratorImpl.java com/sun/org/apache/xerces/internal/dom/NodeListCache.java com/sun/org/apache/xerces/internal/dom/NotationImpl.java com/sun/org/apache/xerces/internal/dom/ObjectFactory.java com/sun/org/apache/xerces/internal/dom/PSVIAttrNSImpl.java com/sun/org/apache/xerces/internal/dom/PSVIDocumentImpl.java com/sun/org/apache/xerces/internal/dom/PSVIElementNSImpl.java com/sun/org/apache/xerces/internal/dom/ParentNode.java com/sun/org/apache/xerces/internal/dom/RangeImpl.java com/sun/org/apache/xerces/internal/dom/ProcessingInstructionImpl.java com/sun/org/apache/xerces/internal/dom/RangeExceptionImpl.java com/sun/org/apache/xerces/internal/dom/SecuritySupport.java com/sun/org/apache/xerces/internal/dom/SecuritySupport12.java com/sun/org/apache/xerces/internal/dom/TextImpl.java com/sun/org/apache/xerces/internal/dom/TreeWalkerImpl.java com/sun/org/apache/xerces/internal/dom/org.apache.xerces.dom.DOMImplementationSourceImpl com/sun/org/apache/xerces/internal/dom/org.w3c.dom.DOMImplementationSourceList com/sun/org/apache/xerces/internal/dom3 com/sun/org/apache/xerces/internal/dom3/as com/sun/org/apache/xerces/internal/dom3/as/SCCS com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.ASAttributeDeclaration.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.ASContentModel.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.ASDataType.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.ASElementDeclaration.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.ASEntityDeclaration.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.ASModel.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.ASNamedObjectMap.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.ASNotationDeclaration.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.ASObject.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.ASObjectList.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.CharacterDataEditAS.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.DOMASBuilder.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.DOMASException.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.DOMASWriter.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.DOMImplementationAS.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.DocumentAS.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.DocumentEditAS.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.ElementEditAS.java com/sun/org/apache/xerces/internal/dom3/as/SCCS/s.NodeEditAS.java com/sun/org/apache/xerces/internal/dom3/as/ASAttributeDeclaration.java com/sun/org/apache/xerces/internal/dom3/as/ASContentModel.java com/sun/org/apache/xerces/internal/dom3/as/ASDataType.java com/sun/org/apache/xerces/internal/dom3/as/ASElementDeclaration.java com/sun/org/apache/xerces/internal/dom3/as/ASEntityDeclaration.java com/sun/org/apache/xerces/internal/dom3/as/ASModel.java com/sun/org/apache/xerces/internal/dom3/as/ASNamedObjectMap.java com/sun/org/apache/xerces/internal/dom3/as/ASNotationDeclaration.java com/sun/org/apache/xerces/internal/dom3/as/ASObject.java com/sun/org/apache/xerces/internal/dom3/as/ASObjectList.java com/sun/org/apache/xerces/internal/dom3/as/CharacterDataEditAS.java com/sun/org/apache/xerces/internal/dom3/as/DOMASBuilder.java com/sun/org/apache/xerces/internal/dom3/as/DOMASException.java com/sun/org/apache/xerces/internal/dom3/as/DOMASWriter.java com/sun/org/apache/xerces/internal/dom3/as/DOMImplementationAS.java com/sun/org/apache/xerces/internal/dom3/as/DocumentAS.java com/sun/org/apache/xerces/internal/dom3/as/DocumentEditAS.java com/sun/org/apache/xerces/internal/dom3/as/ElementEditAS.java com/sun/org/apache/xerces/internal/dom3/as/NodeEditAS.java com/sun/org/apache/xerces/internal/impl com/sun/org/apache/xerces/internal/impl/SCCS com/sun/org/apache/xerces/internal/impl/SCCS/s.RevalidationHandler.java com/sun/org/apache/xerces/internal/impl/SCCS/s.Constants.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XML11NSDocumentScannerImpl.java com/sun/org/apache/xerces/internal/impl/SCCS/s.ExternalSubsetResolver.java com/sun/org/apache/xerces/internal/impl/SCCS/s.Version.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XML11DTDScannerImpl.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XML11DocumentScannerImpl.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XML11EntityScanner.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLDocumentFragmentScannerImpl.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XML11NamespaceBinder.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLDTDScannerImpl.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLEntityDescription.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLDocumentScannerImpl.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLEntityHandler.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLEntityManager.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLEntityScanner.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLErrorReporter.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLNSDocumentScannerImpl.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLNamespaceBinder.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLScanner.java com/sun/org/apache/xerces/internal/impl/SCCS/s.XMLVersionDetector.java com/sun/org/apache/xerces/internal/impl/dtd com/sun/org/apache/xerces/internal/impl/dtd/SCCS com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.DTDGrammarBucket.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.DTDGrammar.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XML11DTDProcessor.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XML11DTDValidator.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XML11NSDTDValidator.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLAttributeDecl.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLContentSpec.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLDTDDescription.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLDTDLoader.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLDTDProcessor.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLDTDValidator.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLDTDValidatorFilter.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLElementDecl.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLEntityDecl.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLNSDTDValidator.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLNotationDecl.java com/sun/org/apache/xerces/internal/impl/dtd/SCCS/s.XMLSimpleType.java com/sun/org/apache/xerces/internal/impl/dtd/models com/sun/org/apache/xerces/internal/impl/dtd/models/SCCS com/sun/org/apache/xerces/internal/impl/dtd/models/SCCS/s.CMStateSet.java com/sun/org/apache/xerces/internal/impl/dtd/models/SCCS/s.CMAny.java com/sun/org/apache/xerces/internal/impl/dtd/models/SCCS/s.CMBinOp.java com/sun/org/apache/xerces/internal/impl/dtd/models/SCCS/s.CMLeaf.java com/sun/org/apache/xerces/internal/impl/dtd/models/SCCS/s.CMNode.java com/sun/org/apache/xerces/internal/impl/dtd/models/SCCS/s.DFAContentModel.java com/sun/org/apache/xerces/internal/impl/dtd/models/SCCS/s.CMUniOp.java com/sun/org/apache/xerces/internal/impl/dtd/models/SCCS/s.ContentModelValidator.java com/sun/org/apache/xerces/internal/impl/dtd/models/SCCS/s.MixedContentModel.java com/sun/org/apache/xerces/internal/impl/dtd/models/SCCS/s.SimpleContentModel.java com/sun/org/apache/xerces/internal/impl/dtd/models/CMBinOp.java com/sun/org/apache/xerces/internal/impl/dtd/models/CMAny.java com/sun/org/apache/xerces/internal/impl/dtd/models/DFAContentModel.java com/sun/org/apache/xerces/internal/impl/dtd/models/CMLeaf.java com/sun/org/apache/xerces/internal/impl/dtd/models/CMNode.java com/sun/org/apache/xerces/internal/impl/dtd/models/CMStateSet.java com/sun/org/apache/xerces/internal/impl/dtd/models/CMUniOp.java com/sun/org/apache/xerces/internal/impl/dtd/models/ContentModelValidator.java com/sun/org/apache/xerces/internal/impl/dtd/models/MixedContentModel.java com/sun/org/apache/xerces/internal/impl/dtd/models/SimpleContentModel.java com/sun/org/apache/xerces/internal/impl/dtd/DTDGrammarBucket.java com/sun/org/apache/xerces/internal/impl/dtd/DTDGrammar.java com/sun/org/apache/xerces/internal/impl/dtd/XML11NSDTDValidator.java com/sun/org/apache/xerces/internal/impl/dtd/XML11DTDProcessor.java com/sun/org/apache/xerces/internal/impl/dtd/XML11DTDValidator.java com/sun/org/apache/xerces/internal/impl/dtd/XMLAttributeDecl.java com/sun/org/apache/xerces/internal/impl/dtd/XMLContentSpec.java com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDDescription.java com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDLoader.java com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDProcessor.java com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDValidator.java com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDValidatorFilter.java com/sun/org/apache/xerces/internal/impl/dtd/XMLElementDecl.java com/sun/org/apache/xerces/internal/impl/dtd/XMLEntityDecl.java com/sun/org/apache/xerces/internal/impl/dtd/XMLNSDTDValidator.java com/sun/org/apache/xerces/internal/impl/dtd/XMLNotationDecl.java com/sun/org/apache/xerces/internal/impl/dtd/XMLSimpleType.java com/sun/org/apache/xerces/internal/impl/dv com/sun/org/apache/xerces/internal/impl/dv/SCCS com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.DVFactoryException.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.DTDDVFactory.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.XSSimpleType.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.DatatypeException.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.DatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.ObjectFactory.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.InvalidDatatypeFacetException.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.InvalidDatatypeValueException.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.SchemaDVFactory.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.SecuritySupport.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.SecuritySupport12.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.ValidatedInfo.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.ValidationContext.java com/sun/org/apache/xerces/internal/impl/dv/SCCS/s.XSFacets.java com/sun/org/apache/xerces/internal/impl/dv/dtd com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.ENTITYDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.DTDDVFactoryImpl.java com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.IDREFDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.IDDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.XML11NMTOKENDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.ListDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.NMTOKENDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.NOTATIONDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.StringDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.XML11DTDDVFactoryImpl.java com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.XML11IDDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/SCCS/s.XML11IDREFDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/ENTITYDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/DTDDVFactoryImpl.java com/sun/org/apache/xerces/internal/impl/dv/dtd/NMTOKENDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/IDDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/IDREFDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/ListDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/NOTATIONDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/StringDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/XML11DTDDVFactoryImpl.java com/sun/org/apache/xerces/internal/impl/dv/dtd/XML11IDDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/XML11IDREFDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/dtd/XML11NMTOKENDatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/util com/sun/org/apache/xerces/internal/impl/dv/util/SCCS com/sun/org/apache/xerces/internal/impl/dv/util/SCCS/s.Base64.java com/sun/org/apache/xerces/internal/impl/dv/util/SCCS/s.HexBin.java com/sun/org/apache/xerces/internal/impl/dv/util/Base64.java com/sun/org/apache/xerces/internal/impl/dv/util/HexBin.java com/sun/org/apache/xerces/internal/impl/dv/xs com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.SchemaDateTimeException.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.AbstractDateTimeDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.AnySimpleDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.AnyURIDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.Base64BinaryDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.BaseDVFactory.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.BooleanDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.DateDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.DateTimeDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.DayDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.DecimalDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.DoubleDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.DurationDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.EntityDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.FloatDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.FullDVFactory.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.HexBinaryDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.IDDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.IDREFDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.IntegerDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.ListDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.MonthDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.MonthDayDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.QNameDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.SchemaDVFactoryImpl.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.TypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.StringDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.TimeDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.XSSimpleTypeDecl.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.UnionDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.YearMonthDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SCCS/s.YearDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/AbstractDateTimeDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/AnySimpleDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/AnyURIDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/Base64BinaryDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/BaseDVFactory.java com/sun/org/apache/xerces/internal/impl/dv/xs/BooleanDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/DateDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/DateTimeDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/DayDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/DecimalDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/DoubleDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/DurationDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/EntityDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/FloatDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/FullDVFactory.java com/sun/org/apache/xerces/internal/impl/dv/xs/HexBinaryDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/IDDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/TypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/xs/TimeDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/IDREFDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/IntegerDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/ListDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/MonthDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/MonthDayDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/QNameDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/SchemaDVFactoryImpl.java com/sun/org/apache/xerces/internal/impl/dv/xs/SchemaDateTimeException.java com/sun/org/apache/xerces/internal/impl/dv/xs/StringDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/XSSimpleTypeDecl.java com/sun/org/apache/xerces/internal/impl/dv/xs/UnionDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/YearMonthDV.java com/sun/org/apache/xerces/internal/impl/dv/xs/YearDV.java com/sun/org/apache/xerces/internal/impl/dv/DVFactoryException.java com/sun/org/apache/xerces/internal/impl/dv/DTDDVFactory.java com/sun/org/apache/xerces/internal/impl/dv/DatatypeException.java com/sun/org/apache/xerces/internal/impl/dv/DatatypeValidator.java com/sun/org/apache/xerces/internal/impl/dv/ObjectFactory.java com/sun/org/apache/xerces/internal/impl/dv/XSFacets.java com/sun/org/apache/xerces/internal/impl/dv/InvalidDatatypeFacetException.java com/sun/org/apache/xerces/internal/impl/dv/InvalidDatatypeValueException.java com/sun/org/apache/xerces/internal/impl/dv/SchemaDVFactory.java com/sun/org/apache/xerces/internal/impl/dv/SecuritySupport.java com/sun/org/apache/xerces/internal/impl/dv/SecuritySupport12.java com/sun/org/apache/xerces/internal/impl/dv/ValidatedInfo.java com/sun/org/apache/xerces/internal/impl/dv/ValidationContext.java com/sun/org/apache/xerces/internal/impl/dv/XSSimpleType.java com/sun/org/apache/xerces/internal/impl/io com/sun/org/apache/xerces/internal/impl/io/SCCS com/sun/org/apache/xerces/internal/impl/io/SCCS/s.ASCIIReader.java com/sun/org/apache/xerces/internal/impl/io/SCCS/s.UCSReader.java com/sun/org/apache/xerces/internal/impl/io/SCCS/s.UTF8Reader.java com/sun/org/apache/xerces/internal/impl/io/SCCS/s.MalformedByteSequenceException.java com/sun/org/apache/xerces/internal/impl/io/ASCIIReader.java com/sun/org/apache/xerces/internal/impl/io/UCSReader.java com/sun/org/apache/xerces/internal/impl/io/UTF8Reader.java com/sun/org/apache/xerces/internal/impl/io/MalformedByteSequenceException.java com/sun/org/apache/xerces/internal/impl/msg com/sun/org/apache/xerces/internal/impl/msg/SCCS com/sun/org/apache/xerces/internal/impl/msg/SCCS/s.DatatypeMessages.properties com/sun/org/apache/xerces/internal/impl/msg/SCCS/s.DOMMessages.properties com/sun/org/apache/xerces/internal/impl/msg/SCCS/s.XMLSerializerMessages.properties com/sun/org/apache/xerces/internal/impl/msg/SCCS/s.SAXMessages.properties com/sun/org/apache/xerces/internal/impl/msg/SCCS/s.XIncludeMessages.properties com/sun/org/apache/xerces/internal/impl/msg/SCCS/s.XMLMessageFormatter.java com/sun/org/apache/xerces/internal/impl/msg/SCCS/s.XMLMessages.properties com/sun/org/apache/xerces/internal/impl/msg/SCCS/s.XMLSchemaMessages.properties com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages.properties com/sun/org/apache/xerces/internal/impl/msg/DOMMessages.properties com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages.properties com/sun/org/apache/xerces/internal/impl/msg/SAXMessages.properties com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages.properties com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter.java com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages.properties com/sun/org/apache/xerces/internal/impl/validation com/sun/org/apache/xerces/internal/impl/validation/SCCS com/sun/org/apache/xerces/internal/impl/validation/SCCS/s.ValidationManager.java com/sun/org/apache/xerces/internal/impl/validation/SCCS/s.EntityState.java com/sun/org/apache/xerces/internal/impl/validation/SCCS/s.ValidationState.java com/sun/org/apache/xerces/internal/impl/validation/ValidationManager.java com/sun/org/apache/xerces/internal/impl/validation/EntityState.java com/sun/org/apache/xerces/internal/impl/validation/ValidationState.java com/sun/org/apache/xerces/internal/impl/xpath com/sun/org/apache/xerces/internal/impl/xpath/SCCS com/sun/org/apache/xerces/internal/impl/xpath/SCCS/s.XPathException.java com/sun/org/apache/xerces/internal/impl/xpath/SCCS/s.XPath.java com/sun/org/apache/xerces/internal/impl/xpath/regex com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.ParseException.java com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.BMPattern.java com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.Match.java com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.Op.java com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.ParserForXMLSchema.java com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.REUtil.java com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.RangeToken.java com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.RegexParser.java com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.RegularExpression.java com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.RegularExpression.orig com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.Token.java com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.message.properties com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.message_fr.properties com/sun/org/apache/xerces/internal/impl/xpath/regex/SCCS/s.message_ja.properties com/sun/org/apache/xerces/internal/impl/xpath/regex/ParseException.java com/sun/org/apache/xerces/internal/impl/xpath/regex/BMPattern.java com/sun/org/apache/xerces/internal/impl/xpath/regex/Match.java com/sun/org/apache/xerces/internal/impl/xpath/regex/Op.java com/sun/org/apache/xerces/internal/impl/xpath/regex/ParserForXMLSchema.java com/sun/org/apache/xerces/internal/impl/xpath/regex/REUtil.java com/sun/org/apache/xerces/internal/impl/xpath/regex/RangeToken.java com/sun/org/apache/xerces/internal/impl/xpath/regex/RegexParser.java com/sun/org/apache/xerces/internal/impl/xpath/regex/RegularExpression.java com/sun/org/apache/xerces/internal/impl/xpath/regex/RegularExpression.orig com/sun/org/apache/xerces/internal/impl/xpath/regex/Token.java com/sun/org/apache/xerces/internal/impl/xpath/regex/message.properties com/sun/org/apache/xerces/internal/impl/xpath/regex/message_fr.properties com/sun/org/apache/xerces/internal/impl/xpath/regex/message_ja.properties com/sun/org/apache/xerces/internal/impl/xpath/XPathException.java com/sun/org/apache/xerces/internal/impl/xpath/XPath.java com/sun/org/apache/xerces/internal/impl/xs com/sun/org/apache/xerces/internal/impl/xs/SCCS com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.SchemaNamespaceSupport.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.AttributePSVImpl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.ElementPSVImpl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.SchemaGrammar.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.SubstitutionGroupHandler.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.SchemaSymbols.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XMLSchemaException.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XMLSchemaLoader.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XMLSchemaValidator.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSAnnotationImpl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSAttributeDecl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSAttributeGroupDecl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSConstraints.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSAttributeUseImpl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSComplexTypeDecl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSDDescription.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSDeclarationPool.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSElementDecl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSGrammarBucket.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSGroupDecl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSImplementationImpl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSMessageFormatter.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSModelGroupImpl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSModelImpl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSNotationDecl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSParticleDecl.java com/sun/org/apache/xerces/internal/impl/xs/SCCS/s.XSWildcardDecl.java com/sun/org/apache/xerces/internal/impl/xs/dom com/sun/org/apache/xerces/internal/impl/xs/dom/SCCS com/sun/org/apache/xerces/internal/impl/xs/dom/SCCS/s.ElementNSImpl.java com/sun/org/apache/xerces/internal/impl/xs/dom/SCCS/s.DOMNodePool.java com/sun/org/apache/xerces/internal/impl/xs/dom/SCCS/s.DOMParser.java com/sun/org/apache/xerces/internal/impl/xs/dom/SCCS/s.DocumentImpl.java com/sun/org/apache/xerces/internal/impl/xs/dom/DOMNodePool.java com/sun/org/apache/xerces/internal/impl/xs/dom/DOMParser.java com/sun/org/apache/xerces/internal/impl/xs/dom/DocumentImpl.java com/sun/org/apache/xerces/internal/impl/xs/dom/ElementNSImpl.java com/sun/org/apache/xerces/internal/impl/xs/identity com/sun/org/apache/xerces/internal/impl/xs/identity/SCCS com/sun/org/apache/xerces/internal/impl/xs/identity/SCCS/s.FieldActivator.java com/sun/org/apache/xerces/internal/impl/xs/identity/SCCS/s.Field.java com/sun/org/apache/xerces/internal/impl/xs/identity/SCCS/s.IDValue.java com/sun/org/apache/xerces/internal/impl/xs/identity/SCCS/s.KeyRef.java com/sun/org/apache/xerces/internal/impl/xs/identity/SCCS/s.IdentityConstraint.java com/sun/org/apache/xerces/internal/impl/xs/identity/SCCS/s.Selector.java com/sun/org/apache/xerces/internal/impl/xs/identity/SCCS/s.UniqueOrKey.java com/sun/org/apache/xerces/internal/impl/xs/identity/SCCS/s.ValueStore.java com/sun/org/apache/xerces/internal/impl/xs/identity/SCCS/s.XPathMatcher.java com/sun/org/apache/xerces/internal/impl/xs/identity/FieldActivator.java com/sun/org/apache/xerces/internal/impl/xs/identity/Field.java com/sun/org/apache/xerces/internal/impl/xs/identity/IdentityConstraint.java com/sun/org/apache/xerces/internal/impl/xs/identity/IDValue.java com/sun/org/apache/xerces/internal/impl/xs/identity/Selector.java com/sun/org/apache/xerces/internal/impl/xs/identity/KeyRef.java com/sun/org/apache/xerces/internal/impl/xs/identity/UniqueOrKey.java com/sun/org/apache/xerces/internal/impl/xs/identity/ValueStore.java com/sun/org/apache/xerces/internal/impl/xs/identity/XPathMatcher.java com/sun/org/apache/xerces/internal/impl/xs/models com/sun/org/apache/xerces/internal/impl/xs/models/SCCS com/sun/org/apache/xerces/internal/impl/xs/models/SCCS/s.CMNodeFactory.java com/sun/org/apache/xerces/internal/impl/xs/models/SCCS/s.CMBuilder.java com/sun/org/apache/xerces/internal/impl/xs/models/SCCS/s.XSCMValidator.java com/sun/org/apache/xerces/internal/impl/xs/models/SCCS/s.XSAllCM.java com/sun/org/apache/xerces/internal/impl/xs/models/SCCS/s.XSCMBinOp.java com/sun/org/apache/xerces/internal/impl/xs/models/SCCS/s.XSCMLeaf.java com/sun/org/apache/xerces/internal/impl/xs/models/SCCS/s.XSCMUniOp.java com/sun/org/apache/xerces/internal/impl/xs/models/SCCS/s.XSDFACM.java com/sun/org/apache/xerces/internal/impl/xs/models/SCCS/s.XSEmptyCM.java com/sun/org/apache/xerces/internal/impl/xs/models/CMNodeFactory.java com/sun/org/apache/xerces/internal/impl/xs/models/CMBuilder.java com/sun/org/apache/xerces/internal/impl/xs/models/XSAllCM.java com/sun/org/apache/xerces/internal/impl/xs/models/XSCMBinOp.java com/sun/org/apache/xerces/internal/impl/xs/models/XSCMLeaf.java com/sun/org/apache/xerces/internal/impl/xs/models/XSCMUniOp.java com/sun/org/apache/xerces/internal/impl/xs/models/XSCMValidator.java com/sun/org/apache/xerces/internal/impl/xs/models/XSDFACM.java com/sun/org/apache/xerces/internal/impl/xs/models/XSEmptyCM.java com/sun/org/apache/xerces/internal/impl/xs/opti com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.DefaultDocument.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.AttrImpl.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.SchemaParsingConfig.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.DefaultElement.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.DefaultNode.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.DefaultText.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.ElementImpl.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.NodeImpl.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.DefaultXMLDocumentHandler.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.NamedNodeMapImpl.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.SchemaDOM.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.SchemaDOMParser.java com/sun/org/apache/xerces/internal/impl/xs/opti/SCCS/s.TextImpl.java com/sun/org/apache/xerces/internal/impl/xs/opti/DefaultDocument.java com/sun/org/apache/xerces/internal/impl/xs/opti/AttrImpl.java com/sun/org/apache/xerces/internal/impl/xs/opti/DefaultElement.java com/sun/org/apache/xerces/internal/impl/xs/opti/DefaultNode.java com/sun/org/apache/xerces/internal/impl/xs/opti/DefaultText.java com/sun/org/apache/xerces/internal/impl/xs/opti/ElementImpl.java com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaDOMParser.java com/sun/org/apache/xerces/internal/impl/xs/opti/NodeImpl.java com/sun/org/apache/xerces/internal/impl/xs/opti/DefaultXMLDocumentHandler.java com/sun/org/apache/xerces/internal/impl/xs/opti/NamedNodeMapImpl.java com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaDOM.java com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java com/sun/org/apache/xerces/internal/impl/xs/opti/TextImpl.java com/sun/org/apache/xerces/internal/impl/xs/psvi com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.PSVIProvider.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.StringList.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSAnnotation.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSAttributeUse.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSAttributeDeclaration.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSAttributeGroupDefinition.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSComplexTypeDefinition.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSConstants.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSElementDeclaration.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSFacet.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSIDCDefinition.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSModel.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSModelGroup.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSObject.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSModelGroupDefinition.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSMultiValueFacet.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSNamedMap.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSNamespaceItem.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSNamespaceItemList.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSNotationDeclaration.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSObjectList.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSParticle.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSSimpleTypeDefinition.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSTerm.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSTypeDefinition.java com/sun/org/apache/xerces/internal/impl/xs/psvi/SCCS/s.XSWildcard.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSAttributeDeclaration.java com/sun/org/apache/xerces/internal/impl/xs/psvi/PSVIProvider.java com/sun/org/apache/xerces/internal/impl/xs/psvi/StringList.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSAnnotation.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSTerm.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSAttributeGroupDefinition.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSAttributeUse.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSComplexTypeDefinition.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSConstants.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSElementDeclaration.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSFacet.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSIDCDefinition.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSModel.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSModelGroup.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSNamedMap.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSMultiValueFacet.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSModelGroupDefinition.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSNamespaceItem.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSNamespaceItemList.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSNotationDeclaration.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSObject.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSObjectList.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSParticle.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSSimpleTypeDefinition.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSWildcard.java com/sun/org/apache/xerces/internal/impl/xs/psvi/XSTypeDefinition.java com/sun/org/apache/xerces/internal/impl/xs/traversers com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDAbstractParticleTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSAttributeChecker.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDAbstractIDConstraintTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDAbstractTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDAttributeGroupTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDAttributeTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDComplexTypeTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDElementTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDGroupTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDHandler.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDKeyrefTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDNotationTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDSimpleTypeTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDUniqueOrKeyTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDWildcardTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/SCCS/s.XSDocumentInfo.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDAbstractTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDKeyrefTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDAbstractIDConstraintTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDAbstractParticleTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDAttributeGroupTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDAttributeTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDComplexTypeTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDElementTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDGroupTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDocumentInfo.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDNotationTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDSimpleTypeTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDUniqueOrKeyTraverser.java com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDWildcardTraverser.java com/sun/org/apache/xerces/internal/impl/xs/util com/sun/org/apache/xerces/internal/impl/xs/util/SCCS com/sun/org/apache/xerces/internal/impl/xs/util/SCCS/s.NSItemListImpl.java com/sun/org/apache/xerces/internal/impl/xs/util/SCCS/s.ShortListImpl.java com/sun/org/apache/xerces/internal/impl/xs/util/SCCS/s.SimpleLocator.java com/sun/org/apache/xerces/internal/impl/xs/util/SCCS/s.StringListImpl.java com/sun/org/apache/xerces/internal/impl/xs/util/SCCS/s.XInt.java com/sun/org/apache/xerces/internal/impl/xs/util/SCCS/s.XIntPool.java com/sun/org/apache/xerces/internal/impl/xs/util/SCCS/s.XSGrammarPool.java com/sun/org/apache/xerces/internal/impl/xs/util/SCCS/s.XSNamedMap4Types.java com/sun/org/apache/xerces/internal/impl/xs/util/SCCS/s.XSNamedMapImpl.java com/sun/org/apache/xerces/internal/impl/xs/util/SCCS/s.XSObjectListImpl.java com/sun/org/apache/xerces/internal/impl/xs/util/XSNamedMap4Types.java com/sun/org/apache/xerces/internal/impl/xs/util/NSItemListImpl.java com/sun/org/apache/xerces/internal/impl/xs/util/ShortListImpl.java com/sun/org/apache/xerces/internal/impl/xs/util/SimpleLocator.java com/sun/org/apache/xerces/internal/impl/xs/util/StringListImpl.java com/sun/org/apache/xerces/internal/impl/xs/util/XInt.java com/sun/org/apache/xerces/internal/impl/xs/util/XIntPool.java com/sun/org/apache/xerces/internal/impl/xs/util/XSGrammarPool.java com/sun/org/apache/xerces/internal/impl/xs/util/XSNamedMapImpl.java com/sun/org/apache/xerces/internal/impl/xs/util/XSObjectListImpl.java com/sun/org/apache/xerces/internal/impl/xs/SchemaNamespaceSupport.java com/sun/org/apache/xerces/internal/impl/xs/AttributePSVImpl.java com/sun/org/apache/xerces/internal/impl/xs/ElementPSVImpl.java com/sun/org/apache/xerces/internal/impl/xs/SchemaGrammar.java com/sun/org/apache/xerces/internal/impl/xs/SchemaSymbols.java com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaException.java com/sun/org/apache/xerces/internal/impl/xs/SubstitutionGroupHandler.java com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java com/sun/org/apache/xerces/internal/impl/xs/XSParticleDecl.java com/sun/org/apache/xerces/internal/impl/xs/XSAnnotationImpl.java com/sun/org/apache/xerces/internal/impl/xs/XSAttributeDecl.java com/sun/org/apache/xerces/internal/impl/xs/XSAttributeGroupDecl.java com/sun/org/apache/xerces/internal/impl/xs/XSAttributeUseImpl.java com/sun/org/apache/xerces/internal/impl/xs/XSComplexTypeDecl.java com/sun/org/apache/xerces/internal/impl/xs/XSConstraints.java com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java com/sun/org/apache/xerces/internal/impl/xs/XSDeclarationPool.java com/sun/org/apache/xerces/internal/impl/xs/XSElementDecl.java com/sun/org/apache/xerces/internal/impl/xs/XSGrammarBucket.java com/sun/org/apache/xerces/internal/impl/xs/XSGroupDecl.java com/sun/org/apache/xerces/internal/impl/xs/XSImplementationImpl.java com/sun/org/apache/xerces/internal/impl/xs/XSMessageFormatter.java com/sun/org/apache/xerces/internal/impl/xs/XSModelGroupImpl.java com/sun/org/apache/xerces/internal/impl/xs/XSModelImpl.java com/sun/org/apache/xerces/internal/impl/xs/XSNotationDecl.java com/sun/org/apache/xerces/internal/impl/xs/XSWildcardDecl.java com/sun/org/apache/xerces/internal/impl/Constants.java com/sun/org/apache/xerces/internal/impl/Version.java com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java com/sun/org/apache/xerces/internal/impl/ExternalSubsetResolver.java com/sun/org/apache/xerces/internal/impl/RevalidationHandler.java com/sun/org/apache/xerces/internal/impl/XML11DTDScannerImpl.java com/sun/org/apache/xerces/internal/impl/XML11DocumentScannerImpl.java com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java com/sun/org/apache/xerces/internal/impl/XML11NamespaceBinder.java com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java com/sun/org/apache/xerces/internal/impl/XMLEntityDescription.java com/sun/org/apache/xerces/internal/impl/XMLEntityHandler.java com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java com/sun/org/apache/xerces/internal/impl/XMLErrorReporter.java com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java com/sun/org/apache/xerces/internal/impl/XMLNamespaceBinder.java com/sun/org/apache/xerces/internal/impl/XMLScanner.java com/sun/org/apache/xerces/internal/impl/XMLVersionDetector.java com/sun/org/apache/xerces/internal/jaxp com/sun/org/apache/xerces/internal/jaxp/SCCS com/sun/org/apache/xerces/internal/jaxp/SCCS/s.XNI2SAX.java com/sun/org/apache/xerces/internal/jaxp/SCCS/s.DefaultValidationErrorHandler.java com/sun/org/apache/xerces/internal/jaxp/SCCS/s.DocumentBuilderFactoryImpl.java com/sun/org/apache/xerces/internal/jaxp/SCCS/s.DocumentBuilderImpl.java com/sun/org/apache/xerces/internal/jaxp/SCCS/s.JAXPConstants.java com/sun/org/apache/xerces/internal/jaxp/SCCS/s.JAXPValidatorComponent.java com/sun/org/apache/xerces/internal/jaxp/SCCS/s.SAXParserFactoryImpl.java com/sun/org/apache/xerces/internal/jaxp/SCCS/s.SAXParserImpl.java com/sun/org/apache/xerces/internal/jaxp/SCCS/s.javax.xml.parsers.DocumentBuilderFactory com/sun/org/apache/xerces/internal/jaxp/SCCS/s.javax.xml.parsers.SAXParserFactory com/sun/org/apache/xerces/internal/jaxp/datatype com/sun/org/apache/xerces/internal/jaxp/datatype/SCCS com/sun/org/apache/xerces/internal/jaxp/datatype/SCCS/s.XMLGregorianCalendarImpl.java com/sun/org/apache/xerces/internal/jaxp/datatype/SCCS/s.DatatypeFactoryImpl.java com/sun/org/apache/xerces/internal/jaxp/datatype/SCCS/s.DurationImpl.java com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java com/sun/org/apache/xerces/internal/jaxp/datatype/DurationImpl.java com/sun/org/apache/xerces/internal/jaxp/validation com/sun/org/apache/xerces/internal/jaxp/validation/SCCS com/sun/org/apache/xerces/internal/jaxp/validation/SCCS/s.InsulatedValidatorComponent.java com/sun/org/apache/xerces/internal/jaxp/validation/SCCS/s.ErrorHandlerAdaptor.java com/sun/org/apache/xerces/internal/jaxp/validation/SCCS/s.ReadonlyGrammarPool.java com/sun/org/apache/xerces/internal/jaxp/validation/SCCS/s.Util.java com/sun/org/apache/xerces/internal/jaxp/validation/SCCS/s.ValidatorHandlerImpl.java com/sun/org/apache/xerces/internal/jaxp/validation/SCCS/s.ValidatorImpl.java com/sun/org/apache/xerces/internal/jaxp/validation/SCCS/s.WrappedSAXException.java com/sun/org/apache/xerces/internal/jaxp/validation/SCCS/s.XNI2SAXEx.java com/sun/org/apache/xerces/internal/jaxp/validation/SCCS/s.XercesConstants.java com/sun/org/apache/xerces/internal/jaxp/validation/SCCS/s.XercesSchema.java com/sun/org/apache/xerces/internal/jaxp/validation/SCCS/s.javax.xml.validation.SchemaFactory com/sun/org/apache/xerces/internal/jaxp/validation/xs com/sun/org/apache/xerces/internal/jaxp/validation/xs/SCCS com/sun/org/apache/xerces/internal/jaxp/validation/xs/SCCS/s.InsulatedSchemaValidator.java com/sun/org/apache/xerces/internal/jaxp/validation/xs/SCCS/s.SchemaFactoryImpl.java com/sun/org/apache/xerces/internal/jaxp/validation/xs/SCCS/s.SchemaImpl.java com/sun/org/apache/xerces/internal/jaxp/validation/xs/InsulatedSchemaValidator.java com/sun/org/apache/xerces/internal/jaxp/validation/xs/SchemaFactoryImpl.java com/sun/org/apache/xerces/internal/jaxp/validation/xs/SchemaImpl.java com/sun/org/apache/xerces/internal/jaxp/validation/InsulatedValidatorComponent.java com/sun/org/apache/xerces/internal/jaxp/validation/ErrorHandlerAdaptor.java com/sun/org/apache/xerces/internal/jaxp/validation/javax.xml.validation.SchemaFactory com/sun/org/apache/xerces/internal/jaxp/validation/ReadonlyGrammarPool.java com/sun/org/apache/xerces/internal/jaxp/validation/Util.java com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorImpl.java com/sun/org/apache/xerces/internal/jaxp/validation/WrappedSAXException.java com/sun/org/apache/xerces/internal/jaxp/validation/XNI2SAXEx.java com/sun/org/apache/xerces/internal/jaxp/validation/XercesConstants.java com/sun/org/apache/xerces/internal/jaxp/validation/XercesSchema.java com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.DocumentBuilderFactory com/sun/org/apache/xerces/internal/jaxp/DefaultValidationErrorHandler.java com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java com/sun/org/apache/xerces/internal/jaxp/JAXPConstants.java com/sun/org/apache/xerces/internal/jaxp/JAXPValidatorComponent.java com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java com/sun/org/apache/xerces/internal/jaxp/XNI2SAX.java com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.SAXParserFactory com/sun/org/apache/xerces/internal/parsers com/sun/org/apache/xerces/internal/parsers/SCCS com/sun/org/apache/xerces/internal/parsers/SCCS/s.AbstractXMLDocumentParser.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.AbstractDOMParser.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.AbstractSAXParser.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.IntegratedParserConfiguration.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.BasicParserConfiguration.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.CachingParserPool.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.DOMASBuilderImpl.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.DOMParser.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.DOMParserImpl.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.DTDConfiguration.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.DTDParser.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.JAXPConfiguration.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.org.apache.xerces.xni.parser.DTDConfiguration com/sun/org/apache/xerces/internal/parsers/SCCS/s.NonValidatingConfiguration.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.ObjectFactory.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.SAXParser.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.SecurityConfiguration.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.SecuritySupport.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.SecuritySupport12.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.StandardParserConfiguration.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.XIncludeParserConfiguration.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.XML11Configuration.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.XMLDocumentParser.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.XMLGrammarCachingConfiguration.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.XMLGrammarParser.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.XMLGrammarPreparser.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.XMLParser.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.XPointerParserConfiguration.java com/sun/org/apache/xerces/internal/parsers/SCCS/s.org.apache.xerces.xni.parser.XMLParserConfiguration com/sun/org/apache/xerces/internal/parsers/SCCS/s.org.apache.xerces.xni.parser.XML11Configuration com/sun/org/apache/xerces/internal/parsers/SCCS/s.org.xml.sax.driver com/sun/org/apache/xerces/internal/parsers/AbstractXMLDocumentParser.java com/sun/org/apache/xerces/internal/parsers/AbstractDOMParser.java com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java com/sun/org/apache/xerces/internal/parsers/IntegratedParserConfiguration.java com/sun/org/apache/xerces/internal/parsers/BasicParserConfiguration.java com/sun/org/apache/xerces/internal/parsers/CachingParserPool.java com/sun/org/apache/xerces/internal/parsers/DOMASBuilderImpl.java com/sun/org/apache/xerces/internal/parsers/DOMParser.java com/sun/org/apache/xerces/internal/parsers/DOMParserImpl.java com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java com/sun/org/apache/xerces/internal/parsers/DTDParser.java com/sun/org/apache/xerces/internal/parsers/JAXPConfiguration.java com/sun/org/apache/xerces/internal/parsers/ObjectFactory.java com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java com/sun/org/apache/xerces/internal/parsers/SAXParser.java com/sun/org/apache/xerces/internal/parsers/SecurityConfiguration.java com/sun/org/apache/xerces/internal/parsers/SecuritySupport.java com/sun/org/apache/xerces/internal/parsers/SecuritySupport12.java com/sun/org/apache/xerces/internal/parsers/StandardParserConfiguration.java com/sun/org/apache/xerces/internal/parsers/XIncludeParserConfiguration.java com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java com/sun/org/apache/xerces/internal/parsers/XMLDocumentParser.java com/sun/org/apache/xerces/internal/parsers/XMLGrammarCachingConfiguration.java com/sun/org/apache/xerces/internal/parsers/XMLGrammarParser.java com/sun/org/apache/xerces/internal/parsers/XMLGrammarPreparser.java com/sun/org/apache/xerces/internal/parsers/XMLParser.java com/sun/org/apache/xerces/internal/parsers/XPointerParserConfiguration.java com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.DTDConfiguration com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XMLParserConfiguration com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XML11Configuration com/sun/org/apache/xerces/internal/parsers/org.xml.sax.driver com/sun/org/apache/xerces/internal/util com/sun/org/apache/xerces/internal/util/SCCS com/sun/org/apache/xerces/internal/util/SCCS/s.AugmentationsImpl.java com/sun/org/apache/xerces/internal/util/SCCS/s.AttributesProxy.java com/sun/org/apache/xerces/internal/util/SCCS/s.URI.java com/sun/org/apache/xerces/internal/util/SCCS/s.DOMEntityResolverWrapper.java com/sun/org/apache/xerces/internal/util/SCCS/s.DOMErrorHandlerWrapper.java com/sun/org/apache/xerces/internal/util/SCCS/s.DOMUtil.java com/sun/org/apache/xerces/internal/util/SCCS/s.DatatypeMessageFormatter.java com/sun/org/apache/xerces/internal/util/SCCS/s.DefaultErrorHandler.java com/sun/org/apache/xerces/internal/util/SCCS/s.DraconianErrorHandler.java com/sun/org/apache/xerces/internal/util/SCCS/s.EncodingMap.java com/sun/org/apache/xerces/internal/util/SCCS/s.EntityResolver2Wrapper.java com/sun/org/apache/xerces/internal/util/SCCS/s.EntityResolverWrapper.java com/sun/org/apache/xerces/internal/util/SCCS/s.ErrorHandlerProxy.java com/sun/org/apache/xerces/internal/util/SCCS/s.XMLAttributesImpl.java com/sun/org/apache/xerces/internal/util/SCCS/s.ErrorHandlerWrapper.java com/sun/org/apache/xerces/internal/util/SCCS/s.IntStack.java com/sun/org/apache/xerces/internal/util/SCCS/s.LocatorProxy.java com/sun/org/apache/xerces/internal/util/SCCS/s.LocatorWrapper.java com/sun/org/apache/xerces/internal/util/SCCS/s.MessageFormatter.java com/sun/org/apache/xerces/internal/util/SCCS/s.NamespaceSupport.java com/sun/org/apache/xerces/internal/util/SCCS/s.ParserConfigurationSettings.java com/sun/org/apache/xerces/internal/util/SCCS/s.SAX2XNI.java com/sun/org/apache/xerces/internal/util/SCCS/s.SAXMessageFormatter.java com/sun/org/apache/xerces/internal/util/SCCS/s.SecurityManager.java com/sun/org/apache/xerces/internal/util/SCCS/s.ShadowedSymbolTable.java com/sun/org/apache/xerces/internal/util/SCCS/s.SymbolHash.java com/sun/org/apache/xerces/internal/util/SCCS/s.SymbolTable.java com/sun/org/apache/xerces/internal/util/SCCS/s.SynchronizedSymbolTable.java com/sun/org/apache/xerces/internal/util/SCCS/s.TeeXMLDocumentFilterImpl.java com/sun/org/apache/xerces/internal/util/SCCS/s.TypeInfoImpl.java com/sun/org/apache/xerces/internal/util/SCCS/s.XML11Char.java com/sun/org/apache/xerces/internal/util/SCCS/s.XMLErrorCode.java com/sun/org/apache/xerces/internal/util/SCCS/s.XMLChar.java com/sun/org/apache/xerces/internal/util/SCCS/s.XMLDocumentFilterImpl.java com/sun/org/apache/xerces/internal/util/SCCS/s.XMLEntityDescriptionImpl.java com/sun/org/apache/xerces/internal/util/SCCS/s.XMLGrammarPoolImpl.java com/sun/org/apache/xerces/internal/util/SCCS/s.XMLInputSourceAdaptor.java com/sun/org/apache/xerces/internal/util/SCCS/s.XMLResourceIdentifierImpl.java com/sun/org/apache/xerces/internal/util/SCCS/s.XMLStringBuffer.java com/sun/org/apache/xerces/internal/util/SCCS/s.XMLSymbols.java com/sun/org/apache/xerces/internal/util/DOMEntityResolverWrapper.java com/sun/org/apache/xerces/internal/util/AttributesProxy.java com/sun/org/apache/xerces/internal/util/AugmentationsImpl.java com/sun/org/apache/xerces/internal/util/DatatypeMessageFormatter.java com/sun/org/apache/xerces/internal/util/DOMErrorHandlerWrapper.java com/sun/org/apache/xerces/internal/util/DOMUtil.java com/sun/org/apache/xerces/internal/util/DefaultErrorHandler.java com/sun/org/apache/xerces/internal/util/DraconianErrorHandler.java com/sun/org/apache/xerces/internal/util/EncodingMap.java com/sun/org/apache/xerces/internal/util/EntityResolver2Wrapper.java com/sun/org/apache/xerces/internal/util/EntityResolverWrapper.java com/sun/org/apache/xerces/internal/util/ErrorHandlerProxy.java com/sun/org/apache/xerces/internal/util/SAX2XNI.java com/sun/org/apache/xerces/internal/util/ShadowedSymbolTable.java com/sun/org/apache/xerces/internal/util/ErrorHandlerWrapper.java com/sun/org/apache/xerces/internal/util/IntStack.java com/sun/org/apache/xerces/internal/util/LocatorProxy.java com/sun/org/apache/xerces/internal/util/LocatorWrapper.java com/sun/org/apache/xerces/internal/util/MessageFormatter.java com/sun/org/apache/xerces/internal/util/NamespaceSupport.java com/sun/org/apache/xerces/internal/util/ParserConfigurationSettings.java com/sun/org/apache/xerces/internal/util/SecurityManager.java com/sun/org/apache/xerces/internal/util/SAXMessageFormatter.java com/sun/org/apache/xerces/internal/util/SynchronizedSymbolTable.java com/sun/org/apache/xerces/internal/util/SymbolHash.java com/sun/org/apache/xerces/internal/util/SymbolTable.java com/sun/org/apache/xerces/internal/util/URI.java com/sun/org/apache/xerces/internal/util/TeeXMLDocumentFilterImpl.java com/sun/org/apache/xerces/internal/util/TypeInfoImpl.java com/sun/org/apache/xerces/internal/util/XMLDocumentFilterImpl.java com/sun/org/apache/xerces/internal/util/XML11Char.java com/sun/org/apache/xerces/internal/util/XMLAttributesImpl.java com/sun/org/apache/xerces/internal/util/XMLChar.java com/sun/org/apache/xerces/internal/util/XMLEntityDescriptionImpl.java com/sun/org/apache/xerces/internal/util/XMLErrorCode.java com/sun/org/apache/xerces/internal/util/XMLGrammarPoolImpl.java com/sun/org/apache/xerces/internal/util/XMLInputSourceAdaptor.java com/sun/org/apache/xerces/internal/util/XMLResourceIdentifierImpl.java com/sun/org/apache/xerces/internal/util/XMLStringBuffer.java com/sun/org/apache/xerces/internal/util/XMLSymbols.java com/sun/org/apache/xerces/internal/xinclude com/sun/org/apache/xerces/internal/xinclude/SCCS com/sun/org/apache/xerces/internal/xinclude/SCCS/s.XPointerElementHandler.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.MultipleScopeNamespaceSupport.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.ObjectFactory.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.SecuritySupport.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.SecuritySupport12.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.XInclude11TextReader.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.XIncludeFatalError.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.XIncludeHandler.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.XIncludeInputSource.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.XIncludeMessageFormatter.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.XIncludeNamespaceSupport.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.XIncludeResourceError.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.XIncludeTextReader.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.XPointerFramework.java com/sun/org/apache/xerces/internal/xinclude/SCCS/s.XPointerSchema.java com/sun/org/apache/xerces/internal/xinclude/MultipleScopeNamespaceSupport.java com/sun/org/apache/xerces/internal/xinclude/ObjectFactory.java com/sun/org/apache/xerces/internal/xinclude/SecuritySupport.java com/sun/org/apache/xerces/internal/xinclude/SecuritySupport12.java com/sun/org/apache/xerces/internal/xinclude/XInclude11TextReader.java com/sun/org/apache/xerces/internal/xinclude/XIncludeFatalError.java com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java com/sun/org/apache/xerces/internal/xinclude/XIncludeInputSource.java com/sun/org/apache/xerces/internal/xinclude/XIncludeMessageFormatter.java com/sun/org/apache/xerces/internal/xinclude/XIncludeNamespaceSupport.java com/sun/org/apache/xerces/internal/xinclude/XIncludeResourceError.java com/sun/org/apache/xerces/internal/xinclude/XIncludeTextReader.java com/sun/org/apache/xerces/internal/xinclude/XPointerElementHandler.java com/sun/org/apache/xerces/internal/xinclude/XPointerFramework.java com/sun/org/apache/xerces/internal/xinclude/XPointerSchema.java com/sun/org/apache/xerces/internal/xni com/sun/org/apache/xerces/internal/xni/SCCS com/sun/org/apache/xerces/internal/xni/SCCS/s.Augmentations.java com/sun/org/apache/xerces/internal/xni/SCCS/s.NamespaceContext.java com/sun/org/apache/xerces/internal/xni/SCCS/s.QName.java com/sun/org/apache/xerces/internal/xni/SCCS/s.XMLAttributes.java com/sun/org/apache/xerces/internal/xni/SCCS/s.XMLDTDHandler.java com/sun/org/apache/xerces/internal/xni/SCCS/s.XMLDTDContentModelHandler.java com/sun/org/apache/xerces/internal/xni/SCCS/s.XMLDocumentFragmentHandler.java com/sun/org/apache/xerces/internal/xni/SCCS/s.XMLDocumentHandler.java com/sun/org/apache/xerces/internal/xni/SCCS/s.XMLLocator.java com/sun/org/apache/xerces/internal/xni/SCCS/s.XMLResourceIdentifier.java com/sun/org/apache/xerces/internal/xni/SCCS/s.XMLString.java com/sun/org/apache/xerces/internal/xni/SCCS/s.XNIException.java com/sun/org/apache/xerces/internal/xni/grammars com/sun/org/apache/xerces/internal/xni/grammars/SCCS com/sun/org/apache/xerces/internal/xni/grammars/SCCS/s.Grammar.java com/sun/org/apache/xerces/internal/xni/grammars/SCCS/s.XMLGrammarLoader.java com/sun/org/apache/xerces/internal/xni/grammars/SCCS/s.XMLDTDDescription.java com/sun/org/apache/xerces/internal/xni/grammars/SCCS/s.XMLGrammarDescription.java com/sun/org/apache/xerces/internal/xni/grammars/SCCS/s.XMLGrammarPool.java com/sun/org/apache/xerces/internal/xni/grammars/SCCS/s.XMLSchemaDescription.java com/sun/org/apache/xerces/internal/xni/grammars/SCCS/s.XSGrammar.java com/sun/org/apache/xerces/internal/xni/grammars/XMLDTDDescription.java com/sun/org/apache/xerces/internal/xni/grammars/Grammar.java com/sun/org/apache/xerces/internal/xni/grammars/XMLGrammarDescription.java com/sun/org/apache/xerces/internal/xni/grammars/XMLGrammarLoader.java com/sun/org/apache/xerces/internal/xni/grammars/XMLGrammarPool.java com/sun/org/apache/xerces/internal/xni/grammars/XMLSchemaDescription.java com/sun/org/apache/xerces/internal/xni/grammars/XSGrammar.java com/sun/org/apache/xerces/internal/xni/parser com/sun/org/apache/xerces/internal/xni/parser/SCCS com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLComponentManager.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLComponent.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLConfigurationException.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLDTDContentModelFilter.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLDTDContentModelSource.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLDTDFilter.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLDTDScanner.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLDTDSource.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLDocumentFilter.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLDocumentScanner.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLDocumentSource.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLEntityResolver.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLErrorHandler.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLInputSource.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLParseException.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLParserConfiguration.java com/sun/org/apache/xerces/internal/xni/parser/SCCS/s.XMLPullParserConfiguration.java com/sun/org/apache/xerces/internal/xni/parser/XMLComponentManager.java com/sun/org/apache/xerces/internal/xni/parser/XMLComponent.java com/sun/org/apache/xerces/internal/xni/parser/XMLConfigurationException.java com/sun/org/apache/xerces/internal/xni/parser/XMLDTDContentModelFilter.java com/sun/org/apache/xerces/internal/xni/parser/XMLDTDContentModelSource.java com/sun/org/apache/xerces/internal/xni/parser/XMLDTDFilter.java com/sun/org/apache/xerces/internal/xni/parser/XMLDTDScanner.java com/sun/org/apache/xerces/internal/xni/parser/XMLDTDSource.java com/sun/org/apache/xerces/internal/xni/parser/XMLDocumentFilter.java com/sun/org/apache/xerces/internal/xni/parser/XMLDocumentScanner.java com/sun/org/apache/xerces/internal/xni/parser/XMLDocumentSource.java com/sun/org/apache/xerces/internal/xni/parser/XMLEntityResolver.java com/sun/org/apache/xerces/internal/xni/parser/XMLErrorHandler.java com/sun/org/apache/xerces/internal/xni/parser/XMLPullParserConfiguration.java com/sun/org/apache/xerces/internal/xni/parser/XMLInputSource.java com/sun/org/apache/xerces/internal/xni/parser/XMLParseException.java com/sun/org/apache/xerces/internal/xni/parser/XMLParserConfiguration.java com/sun/org/apache/xerces/internal/xni/NamespaceContext.java com/sun/org/apache/xerces/internal/xni/Augmentations.java com/sun/org/apache/xerces/internal/xni/XMLAttributes.java com/sun/org/apache/xerces/internal/xni/QName.java com/sun/org/apache/xerces/internal/xni/XMLDTDContentModelHandler.java com/sun/org/apache/xerces/internal/xni/XMLDTDHandler.java com/sun/org/apache/xerces/internal/xni/XMLDocumentFragmentHandler.java com/sun/org/apache/xerces/internal/xni/XMLDocumentHandler.java com/sun/org/apache/xerces/internal/xni/XMLLocator.java com/sun/org/apache/xerces/internal/xni/XMLResourceIdentifier.java com/sun/org/apache/xerces/internal/xni/XMLString.java com/sun/org/apache/xerces/internal/xni/XNIException.java com/sun/org/apache/xerces/internal/xs com/sun/org/apache/xerces/internal/xs/SCCS com/sun/org/apache/xerces/internal/xs/SCCS/s.XSAttributeDeclaration.java com/sun/org/apache/xerces/internal/xs/SCCS/s.AttributePSVI.java com/sun/org/apache/xerces/internal/xs/SCCS/s.ElementPSVI.java com/sun/org/apache/xerces/internal/xs/SCCS/s.ItemPSVI.java com/sun/org/apache/xerces/internal/xs/SCCS/s.LSInputList.java com/sun/org/apache/xerces/internal/xs/SCCS/s.PSVIProvider.java com/sun/org/apache/xerces/internal/xs/SCCS/s.ShortList.java com/sun/org/apache/xerces/internal/xs/SCCS/s.StringList.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSAnnotation.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSModelGroupDefinition.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSAttributeGroupDefinition.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSAttributeUse.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSComplexTypeDefinition.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSConstants.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSElementDeclaration.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSException.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSFacet.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSIDCDefinition.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSImplementation.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSLoader.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSModel.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSModelGroup.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSNotationDeclaration.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSMultiValueFacet.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSNamedMap.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSNamespaceItem.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSNamespaceItemList.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSObject.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSObjectList.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSParticle.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSTerm.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSSimpleTypeDefinition.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSTypeDefinition.java com/sun/org/apache/xerces/internal/xs/SCCS/s.XSWildcard.java com/sun/org/apache/xerces/internal/xs/XSAttributeDeclaration.java com/sun/org/apache/xerces/internal/xs/AttributePSVI.java com/sun/org/apache/xerces/internal/xs/ElementPSVI.java com/sun/org/apache/xerces/internal/xs/ItemPSVI.java com/sun/org/apache/xerces/internal/xs/LSInputList.java com/sun/org/apache/xerces/internal/xs/PSVIProvider.java com/sun/org/apache/xerces/internal/xs/ShortList.java com/sun/org/apache/xerces/internal/xs/StringList.java com/sun/org/apache/xerces/internal/xs/XSAnnotation.java com/sun/org/apache/xerces/internal/xs/XSTerm.java com/sun/org/apache/xerces/internal/xs/XSAttributeGroupDefinition.java com/sun/org/apache/xerces/internal/xs/XSAttributeUse.java com/sun/org/apache/xerces/internal/xs/XSComplexTypeDefinition.java com/sun/org/apache/xerces/internal/xs/XSConstants.java com/sun/org/apache/xerces/internal/xs/XSElementDeclaration.java com/sun/org/apache/xerces/internal/xs/XSException.java com/sun/org/apache/xerces/internal/xs/XSFacet.java com/sun/org/apache/xerces/internal/xs/XSIDCDefinition.java com/sun/org/apache/xerces/internal/xs/XSImplementation.java com/sun/org/apache/xerces/internal/xs/XSLoader.java com/sun/org/apache/xerces/internal/xs/XSModel.java com/sun/org/apache/xerces/internal/xs/XSModelGroup.java com/sun/org/apache/xerces/internal/xs/XSModelGroupDefinition.java com/sun/org/apache/xerces/internal/xs/XSMultiValueFacet.java com/sun/org/apache/xerces/internal/xs/XSNamedMap.java com/sun/org/apache/xerces/internal/xs/XSNamespaceItem.java com/sun/org/apache/xerces/internal/xs/XSNamespaceItemList.java com/sun/org/apache/xerces/internal/xs/XSNotationDeclaration.java com/sun/org/apache/xerces/internal/xs/XSObject.java com/sun/org/apache/xerces/internal/xs/XSObjectList.java com/sun/org/apache/xerces/internal/xs/XSParticle.java com/sun/org/apache/xerces/internal/xs/XSSimpleTypeDefinition.java com/sun/org/apache/xerces/internal/xs/XSWildcard.java com/sun/org/apache/xerces/internal/xs/XSTypeDefinition.java com/sun/org/apache/xml com/sun/org/apache/xml/internal com/sun/org/apache/xml/internal/dtm com/sun/org/apache/xml/internal/dtm/SCCS com/sun/org/apache/xml/internal/dtm/SCCS/s.Axis.java com/sun/org/apache/xml/internal/dtm/SCCS/s.DTM.java com/sun/org/apache/xml/internal/dtm/SCCS/s.DTMException.java com/sun/org/apache/xml/internal/dtm/SCCS/s.DTMAxisIterator.java com/sun/org/apache/xml/internal/dtm/SCCS/s.DTMAxisTraverser.java com/sun/org/apache/xml/internal/dtm/SCCS/s.DTMConfigurationException.java com/sun/org/apache/xml/internal/dtm/SCCS/s.DTMDOMException.java com/sun/org/apache/xml/internal/dtm/SCCS/s.DTMFilter.java com/sun/org/apache/xml/internal/dtm/SCCS/s.DTMIterator.java com/sun/org/apache/xml/internal/dtm/SCCS/s.DTMManager.java com/sun/org/apache/xml/internal/dtm/SCCS/s.DTMWSFilter.java com/sun/org/apache/xml/internal/dtm/SCCS/s.FactoryFinder.java com/sun/org/apache/xml/internal/dtm/SCCS/s.ObjectFactory.java com/sun/org/apache/xml/internal/dtm/SCCS/s.SecuritySupport.java com/sun/org/apache/xml/internal/dtm/SCCS/s.SecuritySupport12.java com/sun/org/apache/xml/internal/dtm/ref com/sun/org/apache/xml/internal/dtm/ref/SCCS com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMAxisIterNodeList.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.ChunkedIntArray.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.CoroutineManager.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.CoroutineParser.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.CustomStringPool.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMSafeStringPool.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMAxisIteratorBase.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMChildIterNodeList.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMDefaultBase.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMDefaultBaseIterators.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMDefaultBaseTraversers.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMDocumentImpl.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMManagerDefault.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMNamedNodeMap.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMNodeIterator.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMNodeList.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMNodeListBase.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMNodeProxy.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.ExpandedNameTable.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMStringPool.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.DTMTreeWalker.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.EmptyIterator.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.IncrementalSAXSource.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.ExtendedType.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.IncrementalSAXSource_Filter.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.IncrementalSAXSource_Xerces.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.NodeLocator.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.ObjectFactory.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.SecuritySupport.java com/sun/org/apache/xml/internal/dtm/ref/SCCS/s.SecuritySupport12.java com/sun/org/apache/xml/internal/dtm/ref/dom2dtm com/sun/org/apache/xml/internal/dtm/ref/dom2dtm/SCCS com/sun/org/apache/xml/internal/dtm/ref/dom2dtm/SCCS/s.DOM2DTM.java com/sun/org/apache/xml/internal/dtm/ref/dom2dtm/SCCS/s.DOM2DTMdefaultNamespaceDeclarationNode.java com/sun/org/apache/xml/internal/dtm/ref/dom2dtm/DOM2DTM.java com/sun/org/apache/xml/internal/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java com/sun/org/apache/xml/internal/dtm/ref/sax2dtm com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SCCS com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SCCS/s.SAX2RTFDTM.java com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SCCS/s.SAX2DTM.java com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SCCS/s.SAX2DTM2.java com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2DTM.java com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2DTM2.java com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2RTFDTM.java com/sun/org/apache/xml/internal/dtm/ref/DTMAxisIterNodeList.java com/sun/org/apache/xml/internal/dtm/ref/ChunkedIntArray.java com/sun/org/apache/xml/internal/dtm/ref/CoroutineManager.java com/sun/org/apache/xml/internal/dtm/ref/CoroutineParser.java com/sun/org/apache/xml/internal/dtm/ref/CustomStringPool.java com/sun/org/apache/xml/internal/dtm/ref/DTMAxisIteratorBase.java com/sun/org/apache/xml/internal/dtm/ref/DTMChildIterNodeList.java com/sun/org/apache/xml/internal/dtm/ref/DTMDefaultBase.java com/sun/org/apache/xml/internal/dtm/ref/DTMDefaultBaseIterators.java com/sun/org/apache/xml/internal/dtm/ref/DTMDefaultBaseTraversers.java com/sun/org/apache/xml/internal/dtm/ref/DTMDocumentImpl.java com/sun/org/apache/xml/internal/dtm/ref/SecuritySupport.java com/sun/org/apache/xml/internal/dtm/ref/NodeLocator.java com/sun/org/apache/xml/internal/dtm/ref/DTMManagerDefault.java com/sun/org/apache/xml/internal/dtm/ref/DTMNamedNodeMap.java com/sun/org/apache/xml/internal/dtm/ref/DTMNodeIterator.java com/sun/org/apache/xml/internal/dtm/ref/DTMNodeList.java com/sun/org/apache/xml/internal/dtm/ref/DTMNodeListBase.java com/sun/org/apache/xml/internal/dtm/ref/DTMNodeProxy.java com/sun/org/apache/xml/internal/dtm/ref/DTMSafeStringPool.java com/sun/org/apache/xml/internal/dtm/ref/DTMStringPool.java com/sun/org/apache/xml/internal/dtm/ref/DTMTreeWalker.java com/sun/org/apache/xml/internal/dtm/ref/EmptyIterator.java com/sun/org/apache/xml/internal/dtm/ref/ExpandedNameTable.java com/sun/org/apache/xml/internal/dtm/ref/ExtendedType.java com/sun/org/apache/xml/internal/dtm/ref/IncrementalSAXSource.java com/sun/org/apache/xml/internal/dtm/ref/IncrementalSAXSource_Filter.java com/sun/org/apache/xml/internal/dtm/ref/IncrementalSAXSource_Xerces.java com/sun/org/apache/xml/internal/dtm/ref/ObjectFactory.java com/sun/org/apache/xml/internal/dtm/ref/SecuritySupport12.java com/sun/org/apache/xml/internal/dtm/Axis.java com/sun/org/apache/xml/internal/dtm/DTM.java com/sun/org/apache/xml/internal/dtm/DTMException.java com/sun/org/apache/xml/internal/dtm/DTMAxisIterator.java com/sun/org/apache/xml/internal/dtm/DTMAxisTraverser.java com/sun/org/apache/xml/internal/dtm/DTMConfigurationException.java com/sun/org/apache/xml/internal/dtm/DTMDOMException.java com/sun/org/apache/xml/internal/dtm/DTMFilter.java com/sun/org/apache/xml/internal/dtm/DTMIterator.java com/sun/org/apache/xml/internal/dtm/DTMManager.java com/sun/org/apache/xml/internal/dtm/DTMWSFilter.java com/sun/org/apache/xml/internal/dtm/FactoryFinder.java com/sun/org/apache/xml/internal/dtm/ObjectFactory.java com/sun/org/apache/xml/internal/dtm/SecuritySupport.java com/sun/org/apache/xml/internal/dtm/SecuritySupport12.java com/sun/org/apache/xml/internal/res com/sun/org/apache/xml/internal/res/SCCS com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_ca.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_cs.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_de.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_en.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_es.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_fr.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_it.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_ja.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_ko.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_sk.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_sv.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_tr.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_zh_CN.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_zh_HK.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLErrorResources_zh_TW.java com/sun/org/apache/xml/internal/res/SCCS/s.XMLMessages.java com/sun/org/apache/xml/internal/res/XMLErrorResources_ca.java com/sun/org/apache/xml/internal/res/XMLErrorResources.java com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_CN.java com/sun/org/apache/xml/internal/res/XMLErrorResources_cs.java com/sun/org/apache/xml/internal/res/XMLErrorResources_de.java com/sun/org/apache/xml/internal/res/XMLErrorResources_en.java com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java com/sun/org/apache/xml/internal/res/XMLErrorResources_fr.java com/sun/org/apache/xml/internal/res/XMLErrorResources_it.java com/sun/org/apache/xml/internal/res/XMLErrorResources_ja.java com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java com/sun/org/apache/xml/internal/res/XMLErrorResources_sk.java com/sun/org/apache/xml/internal/res/XMLErrorResources_sv.java com/sun/org/apache/xml/internal/res/XMLErrorResources_tr.java com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_HK.java com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_TW.java com/sun/org/apache/xml/internal/res/XMLMessages.java com/sun/org/apache/xml/internal/serialize com/sun/org/apache/xml/internal/serialize/SCCS com/sun/org/apache/xml/internal/serialize/SCCS/s.SerializerFactoryImpl.java com/sun/org/apache/xml/internal/serialize/SCCS/s.BaseMarkupSerializer.java com/sun/org/apache/xml/internal/serialize/SCCS/s.DOMSerializer.java com/sun/org/apache/xml/internal/serialize/SCCS/s.DOMSerializerImpl.java com/sun/org/apache/xml/internal/serialize/SCCS/s.ElementState.java com/sun/org/apache/xml/internal/serialize/SCCS/s.EncodingInfo.java com/sun/org/apache/xml/internal/serialize/SCCS/s.Encodings.java com/sun/org/apache/xml/internal/serialize/SCCS/s.HTMLEntities.res com/sun/org/apache/xml/internal/serialize/SCCS/s.HTMLSerializer.java com/sun/org/apache/xml/internal/serialize/SCCS/s.HTMLdtd.java com/sun/org/apache/xml/internal/serialize/SCCS/s.IndentPrinter.java com/sun/org/apache/xml/internal/serialize/SCCS/s.LineSeparator.java com/sun/org/apache/xml/internal/serialize/SCCS/s.Method.java com/sun/org/apache/xml/internal/serialize/SCCS/s.ObjectFactory.java com/sun/org/apache/xml/internal/serialize/SCCS/s.OutputFormat.java com/sun/org/apache/xml/internal/serialize/SCCS/s.Printer.java com/sun/org/apache/xml/internal/serialize/SCCS/s.SecuritySupport.java com/sun/org/apache/xml/internal/serialize/SCCS/s.SecuritySupport12.java com/sun/org/apache/xml/internal/serialize/SCCS/s.Serializer.java com/sun/org/apache/xml/internal/serialize/SCCS/s.SerializerFactory.java com/sun/org/apache/xml/internal/serialize/SCCS/s.TextSerializer.java com/sun/org/apache/xml/internal/serialize/SCCS/s.XHTMLSerializer.java com/sun/org/apache/xml/internal/serialize/SCCS/s.XML11Serializer.java com/sun/org/apache/xml/internal/serialize/SCCS/s.XMLSerializer.java com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java com/sun/org/apache/xml/internal/serialize/DOMSerializer.java com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java com/sun/org/apache/xml/internal/serialize/ElementState.java com/sun/org/apache/xml/internal/serialize/EncodingInfo.java com/sun/org/apache/xml/internal/serialize/Encodings.java com/sun/org/apache/xml/internal/serialize/HTMLEntities.res com/sun/org/apache/xml/internal/serialize/HTMLSerializer.java com/sun/org/apache/xml/internal/serialize/HTMLdtd.java com/sun/org/apache/xml/internal/serialize/IndentPrinter.java com/sun/org/apache/xml/internal/serialize/LineSeparator.java com/sun/org/apache/xml/internal/serialize/Method.java com/sun/org/apache/xml/internal/serialize/ObjectFactory.java com/sun/org/apache/xml/internal/serialize/OutputFormat.java com/sun/org/apache/xml/internal/serialize/Printer.java com/sun/org/apache/xml/internal/serialize/SecuritySupport.java com/sun/org/apache/xml/internal/serialize/Serializer.java com/sun/org/apache/xml/internal/serialize/SecuritySupport12.java com/sun/org/apache/xml/internal/serialize/SerializerFactory.java com/sun/org/apache/xml/internal/serialize/SerializerFactoryImpl.java com/sun/org/apache/xml/internal/serialize/TextSerializer.java com/sun/org/apache/xml/internal/serialize/XHTMLSerializer.java com/sun/org/apache/xml/internal/serialize/XML11Serializer.java com/sun/org/apache/xml/internal/serialize/XMLSerializer.java com/sun/org/apache/xml/internal/serializer com/sun/org/apache/xml/internal/serializer/SCCS com/sun/org/apache/xml/internal/serializer/SCCS/s.OutputPropertiesFactory.java com/sun/org/apache/xml/internal/serializer/SCCS/s.AttributesImplSerializer.java com/sun/org/apache/xml/internal/serializer/SCCS/s.CharInfo.java com/sun/org/apache/xml/internal/serializer/SCCS/s.DOMSerializer.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ElemContext.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ElemDesc.java com/sun/org/apache/xml/internal/serializer/SCCS/s.EmptySerializer.java com/sun/org/apache/xml/internal/serializer/SCCS/s.EncodingInfo.java com/sun/org/apache/xml/internal/serializer/SCCS/s.Encodings.java com/sun/org/apache/xml/internal/serializer/SCCS/s.Encodings.properties com/sun/org/apache/xml/internal/serializer/SCCS/s.ExtendedContentHandler.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ExtendedLexicalHandler.java com/sun/org/apache/xml/internal/serializer/SCCS/s.HTMLEntities.properties com/sun/org/apache/xml/internal/serializer/SCCS/s.Method.java com/sun/org/apache/xml/internal/serializer/SCCS/s.NamespaceMappings.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ObjectFactory.java com/sun/org/apache/xml/internal/serializer/SCCS/s.SerializerTraceWriter.java com/sun/org/apache/xml/internal/serializer/SCCS/s.OutputPropertyUtils.java com/sun/org/apache/xml/internal/serializer/SCCS/s.SecuritySupport.java com/sun/org/apache/xml/internal/serializer/SCCS/s.SecuritySupport12.java com/sun/org/apache/xml/internal/serializer/SCCS/s.SerializationHandler.java com/sun/org/apache/xml/internal/serializer/SCCS/s.Serializer.java com/sun/org/apache/xml/internal/serializer/SCCS/s.SerializerBase.java com/sun/org/apache/xml/internal/serializer/SCCS/s.SerializerConstants.java com/sun/org/apache/xml/internal/serializer/SCCS/s.SerializerFactory.java com/sun/org/apache/xml/internal/serializer/SCCS/s.SerializerTrace.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ToHTMLSAXHandler.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ToHTMLStream.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ToSAXHandler.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ToStream.java com/sun/org/apache/xml/internal/serializer/SCCS/s.Utils.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ToTextSAXHandler.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ToTextStream.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ToUnknownStream.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ToXMLSAXHandler.java com/sun/org/apache/xml/internal/serializer/SCCS/s.ToXMLStream.java com/sun/org/apache/xml/internal/serializer/SCCS/s.TransformStateSetter.java com/sun/org/apache/xml/internal/serializer/SCCS/s.WriterToASCI.java com/sun/org/apache/xml/internal/serializer/SCCS/s.WriterToUTF8.java com/sun/org/apache/xml/internal/serializer/SCCS/s.WriterToUTF8Buffered.java com/sun/org/apache/xml/internal/serializer/SCCS/s.XMLEntities.properties com/sun/org/apache/xml/internal/serializer/SCCS/s.XSLOutputAttributes.java com/sun/org/apache/xml/internal/serializer/SCCS/s.output_html.properties com/sun/org/apache/xml/internal/serializer/SCCS/s.output_text.properties com/sun/org/apache/xml/internal/serializer/SCCS/s.output_unknown.properties com/sun/org/apache/xml/internal/serializer/SCCS/s.output_xml.properties com/sun/org/apache/xml/internal/serializer/SCCS/s.package.html com/sun/org/apache/xml/internal/serializer/Method.java com/sun/org/apache/xml/internal/serializer/AttributesImplSerializer.java com/sun/org/apache/xml/internal/serializer/CharInfo.java com/sun/org/apache/xml/internal/serializer/DOMSerializer.java com/sun/org/apache/xml/internal/serializer/ElemContext.java com/sun/org/apache/xml/internal/serializer/ElemDesc.java com/sun/org/apache/xml/internal/serializer/EmptySerializer.java com/sun/org/apache/xml/internal/serializer/EncodingInfo.java com/sun/org/apache/xml/internal/serializer/Encodings.java com/sun/org/apache/xml/internal/serializer/Encodings.properties com/sun/org/apache/xml/internal/serializer/ExtendedContentHandler.java com/sun/org/apache/xml/internal/serializer/ExtendedLexicalHandler.java com/sun/org/apache/xml/internal/serializer/HTMLEntities.properties com/sun/org/apache/xml/internal/serializer/NamespaceMappings.java com/sun/org/apache/xml/internal/serializer/SerializerBase.java com/sun/org/apache/xml/internal/serializer/Serializer.java com/sun/org/apache/xml/internal/serializer/ObjectFactory.java com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java com/sun/org/apache/xml/internal/serializer/OutputPropertyUtils.java com/sun/org/apache/xml/internal/serializer/SecuritySupport.java com/sun/org/apache/xml/internal/serializer/SecuritySupport12.java com/sun/org/apache/xml/internal/serializer/SerializationHandler.java com/sun/org/apache/xml/internal/serializer/SerializerConstants.java com/sun/org/apache/xml/internal/serializer/SerializerFactory.java com/sun/org/apache/xml/internal/serializer/SerializerTrace.java com/sun/org/apache/xml/internal/serializer/SerializerTraceWriter.java com/sun/org/apache/xml/internal/serializer/ToHTMLSAXHandler.java com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java com/sun/org/apache/xml/internal/serializer/ToSAXHandler.java com/sun/org/apache/xml/internal/serializer/ToStream.java com/sun/org/apache/xml/internal/serializer/package.html com/sun/org/apache/xml/internal/serializer/ToTextSAXHandler.java com/sun/org/apache/xml/internal/serializer/ToTextStream.java com/sun/org/apache/xml/internal/serializer/ToUnknownStream.java com/sun/org/apache/xml/internal/serializer/ToXMLSAXHandler.java com/sun/org/apache/xml/internal/serializer/ToXMLStream.java com/sun/org/apache/xml/internal/serializer/TransformStateSetter.java com/sun/org/apache/xml/internal/serializer/Utils.java com/sun/org/apache/xml/internal/serializer/WriterToASCI.java com/sun/org/apache/xml/internal/serializer/WriterToUTF8.java com/sun/org/apache/xml/internal/serializer/WriterToUTF8Buffered.java com/sun/org/apache/xml/internal/serializer/XMLEntities.properties com/sun/org/apache/xml/internal/serializer/XSLOutputAttributes.java com/sun/org/apache/xml/internal/serializer/output_html.properties com/sun/org/apache/xml/internal/serializer/output_text.properties com/sun/org/apache/xml/internal/serializer/output_unknown.properties com/sun/org/apache/xml/internal/serializer/output_xml.properties com/sun/org/apache/xml/internal/utils com/sun/org/apache/xml/internal/utils/SCCS com/sun/org/apache/xml/internal/utils/SCCS/s.BoolStack.java com/sun/org/apache/xml/internal/utils/SCCS/s.AttList.java com/sun/org/apache/xml/internal/utils/SCCS/s.DefaultErrorHandler.java com/sun/org/apache/xml/internal/utils/SCCS/s.CharKey.java com/sun/org/apache/xml/internal/utils/SCCS/s.Constants.java com/sun/org/apache/xml/internal/utils/SCCS/s.DOM2Helper.java com/sun/org/apache/xml/internal/utils/SCCS/s.DOMBuilder.java com/sun/org/apache/xml/internal/utils/SCCS/s.DOMHelper.java com/sun/org/apache/xml/internal/utils/SCCS/s.DOMOrder.java com/sun/org/apache/xml/internal/utils/SCCS/s.FastStringBuffer.java com/sun/org/apache/xml/internal/utils/SCCS/s.ElemDesc.java com/sun/org/apache/xml/internal/utils/SCCS/s.ListingErrorHandler.java com/sun/org/apache/xml/internal/utils/SCCS/s.Hashtree2Node.java com/sun/org/apache/xml/internal/utils/SCCS/s.IntStack.java com/sun/org/apache/xml/internal/utils/SCCS/s.IntVector.java com/sun/org/apache/xml/internal/utils/SCCS/s.NamespaceSupport2.java com/sun/org/apache/xml/internal/utils/SCCS/s.NSInfo.java com/sun/org/apache/xml/internal/utils/SCCS/s.LocaleUtility.java com/sun/org/apache/xml/internal/utils/SCCS/s.MutableAttrListImpl.java com/sun/org/apache/xml/internal/utils/SCCS/s.NameSpace.java com/sun/org/apache/xml/internal/utils/SCCS/s.ObjectFactory.java com/sun/org/apache/xml/internal/utils/SCCS/s.NodeConsumer.java com/sun/org/apache/xml/internal/utils/SCCS/s.NodeVector.java com/sun/org/apache/xml/internal/utils/SCCS/s.PrefixResolverDefault.java com/sun/org/apache/xml/internal/utils/SCCS/s.ObjectPool.java com/sun/org/apache/xml/internal/utils/SCCS/s.ObjectStack.java com/sun/org/apache/xml/internal/utils/SCCS/s.ObjectVector.java com/sun/org/apache/xml/internal/utils/SCCS/s.PrefixResolver.java com/sun/org/apache/xml/internal/utils/SCCS/s.SAXSourceLocator.java com/sun/org/apache/xml/internal/utils/SCCS/s.QName.java com/sun/org/apache/xml/internal/utils/SCCS/s.RawCharacterHandler.java com/sun/org/apache/xml/internal/utils/SCCS/s.SecuritySupport.java com/sun/org/apache/xml/internal/utils/SCCS/s.StringToStringTableVector.java com/sun/org/apache/xml/internal/utils/SCCS/s.SecuritySupport12.java com/sun/org/apache/xml/internal/utils/SCCS/s.SerializableLocatorImpl.java com/sun/org/apache/xml/internal/utils/SCCS/s.StopParseException.java com/sun/org/apache/xml/internal/utils/SCCS/s.StringBufferPool.java com/sun/org/apache/xml/internal/utils/SCCS/s.StringComparable.java com/sun/org/apache/xml/internal/utils/SCCS/s.StringToIntTable.java com/sun/org/apache/xml/internal/utils/SCCS/s.StringToStringTable.java com/sun/org/apache/xml/internal/utils/SCCS/s.StylesheetPIHandler.java com/sun/org/apache/xml/internal/utils/SCCS/s.StringVector.java com/sun/org/apache/xml/internal/utils/SCCS/s.UnImplNode.java com/sun/org/apache/xml/internal/utils/SCCS/s.Trie.java com/sun/org/apache/xml/internal/utils/SCCS/s.SuballocatedByteVector.java com/sun/org/apache/xml/internal/utils/SCCS/s.SuballocatedIntVector.java com/sun/org/apache/xml/internal/utils/SCCS/s.SystemIDResolver.java com/sun/org/apache/xml/internal/utils/SCCS/s.ThreadControllerWrapper.java com/sun/org/apache/xml/internal/utils/SCCS/s.TreeWalker.java com/sun/org/apache/xml/internal/utils/SCCS/s.URI.java com/sun/org/apache/xml/internal/utils/SCCS/s.WrappedRuntimeException.java com/sun/org/apache/xml/internal/utils/SCCS/s.WrongParserException.java com/sun/org/apache/xml/internal/utils/SCCS/s.XMLChar.java com/sun/org/apache/xml/internal/utils/SCCS/s.XMLCharacterRecognizer.java com/sun/org/apache/xml/internal/utils/SCCS/s.XMLReaderManager.java com/sun/org/apache/xml/internal/utils/SCCS/s.XMLString.java com/sun/org/apache/xml/internal/utils/SCCS/s.XMLStringDefault.java com/sun/org/apache/xml/internal/utils/SCCS/s.XMLStringFactory.java com/sun/org/apache/xml/internal/utils/SCCS/s.XMLStringFactoryDefault.java com/sun/org/apache/xml/internal/utils/SCCS/s.package.html com/sun/org/apache/xml/internal/utils/res com/sun/org/apache/xml/internal/utils/res/SCCS com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResourceBundleBase.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResourceBundle.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_de.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_en.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_es.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_fr.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_it.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_ja_JP_A.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_ja_JP_HA.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_ja_JP_HI.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_ja_JP_I.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_ko.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_sv.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_zh_CN.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_zh_HK.java com/sun/org/apache/xml/internal/utils/res/SCCS/s.XResources_zh_TW.java com/sun/org/apache/xml/internal/utils/res/XResourceBundleBase.java com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java com/sun/org/apache/xml/internal/utils/res/XResources_ja_JP_HA.java com/sun/org/apache/xml/internal/utils/res/XResources_de.java com/sun/org/apache/xml/internal/utils/res/XResources_en.java com/sun/org/apache/xml/internal/utils/res/XResources_es.java com/sun/org/apache/xml/internal/utils/res/XResources_fr.java com/sun/org/apache/xml/internal/utils/res/XResources_it.java com/sun/org/apache/xml/internal/utils/res/XResources_ja_JP_A.java com/sun/org/apache/xml/internal/utils/res/XResources_ja_JP_HI.java com/sun/org/apache/xml/internal/utils/res/XResources_ja_JP_I.java com/sun/org/apache/xml/internal/utils/res/XResources_ko.java com/sun/org/apache/xml/internal/utils/res/XResources_sv.java com/sun/org/apache/xml/internal/utils/res/XResources_zh_CN.java com/sun/org/apache/xml/internal/utils/res/XResources_zh_HK.java com/sun/org/apache/xml/internal/utils/res/XResources_zh_TW.java com/sun/org/apache/xml/internal/utils/synthetic com/sun/org/apache/xml/internal/utils/synthetic/SCCS com/sun/org/apache/xml/internal/utils/synthetic/SCCS/s.JavaUtils.java com/sun/org/apache/xml/internal/utils/synthetic/SCCS/s.Class.java com/sun/org/apache/xml/internal/utils/synthetic/SCCS/s.SynthesisException.java com/sun/org/apache/xml/internal/utils/synthetic/SCCS/s.TestDriver.java com/sun/org/apache/xml/internal/utils/synthetic/reflection com/sun/org/apache/xml/internal/utils/synthetic/reflection/SCCS com/sun/org/apache/xml/internal/utils/synthetic/reflection/SCCS/s.Constructor.java com/sun/org/apache/xml/internal/utils/synthetic/reflection/SCCS/s.EntryPoint.java com/sun/org/apache/xml/internal/utils/synthetic/reflection/SCCS/s.Field.java com/sun/org/apache/xml/internal/utils/synthetic/reflection/SCCS/s.Member.java com/sun/org/apache/xml/internal/utils/synthetic/reflection/SCCS/s.Method.java com/sun/org/apache/xml/internal/utils/synthetic/reflection/Constructor.java com/sun/org/apache/xml/internal/utils/synthetic/reflection/EntryPoint.java com/sun/org/apache/xml/internal/utils/synthetic/reflection/Field.java com/sun/org/apache/xml/internal/utils/synthetic/reflection/Member.java com/sun/org/apache/xml/internal/utils/synthetic/reflection/Method.java com/sun/org/apache/xml/internal/utils/synthetic/JavaUtils.java com/sun/org/apache/xml/internal/utils/synthetic/Class.java com/sun/org/apache/xml/internal/utils/synthetic/SynthesisException.java com/sun/org/apache/xml/internal/utils/synthetic/TestDriver.java com/sun/org/apache/xml/internal/utils/AttList.java com/sun/org/apache/xml/internal/utils/BoolStack.java com/sun/org/apache/xml/internal/utils/CharKey.java com/sun/org/apache/xml/internal/utils/Constants.java com/sun/org/apache/xml/internal/utils/DOM2Helper.java com/sun/org/apache/xml/internal/utils/DOMBuilder.java com/sun/org/apache/xml/internal/utils/DOMHelper.java com/sun/org/apache/xml/internal/utils/DOMOrder.java com/sun/org/apache/xml/internal/utils/ElemDesc.java com/sun/org/apache/xml/internal/utils/SerializableLocatorImpl.java com/sun/org/apache/xml/internal/utils/DefaultErrorHandler.java com/sun/org/apache/xml/internal/utils/FastStringBuffer.java com/sun/org/apache/xml/internal/utils/Hashtree2Node.java com/sun/org/apache/xml/internal/utils/IntStack.java com/sun/org/apache/xml/internal/utils/IntVector.java com/sun/org/apache/xml/internal/utils/ListingErrorHandler.java com/sun/org/apache/xml/internal/utils/LocaleUtility.java com/sun/org/apache/xml/internal/utils/MutableAttrListImpl.java com/sun/org/apache/xml/internal/utils/NSInfo.java com/sun/org/apache/xml/internal/utils/NameSpace.java com/sun/org/apache/xml/internal/utils/NamespaceSupport2.java com/sun/org/apache/xml/internal/utils/NodeConsumer.java com/sun/org/apache/xml/internal/utils/NodeVector.java com/sun/org/apache/xml/internal/utils/ObjectFactory.java com/sun/org/apache/xml/internal/utils/ObjectPool.java com/sun/org/apache/xml/internal/utils/ObjectStack.java com/sun/org/apache/xml/internal/utils/ObjectVector.java com/sun/org/apache/xml/internal/utils/PrefixResolver.java com/sun/org/apache/xml/internal/utils/PrefixResolverDefault.java com/sun/org/apache/xml/internal/utils/QName.java com/sun/org/apache/xml/internal/utils/RawCharacterHandler.java com/sun/org/apache/xml/internal/utils/SAXSourceLocator.java com/sun/org/apache/xml/internal/utils/SecuritySupport.java com/sun/org/apache/xml/internal/utils/StringVector.java com/sun/org/apache/xml/internal/utils/SecuritySupport12.java com/sun/org/apache/xml/internal/utils/StringToStringTable.java com/sun/org/apache/xml/internal/utils/StopParseException.java com/sun/org/apache/xml/internal/utils/StringBufferPool.java com/sun/org/apache/xml/internal/utils/StringComparable.java com/sun/org/apache/xml/internal/utils/StringToIntTable.java com/sun/org/apache/xml/internal/utils/XMLReaderManager.java com/sun/org/apache/xml/internal/utils/Trie.java com/sun/org/apache/xml/internal/utils/StringToStringTableVector.java com/sun/org/apache/xml/internal/utils/StylesheetPIHandler.java com/sun/org/apache/xml/internal/utils/SuballocatedByteVector.java com/sun/org/apache/xml/internal/utils/SuballocatedIntVector.java com/sun/org/apache/xml/internal/utils/SystemIDResolver.java com/sun/org/apache/xml/internal/utils/ThreadControllerWrapper.java com/sun/org/apache/xml/internal/utils/TreeWalker.java com/sun/org/apache/xml/internal/utils/URI.java com/sun/org/apache/xml/internal/utils/UnImplNode.java com/sun/org/apache/xml/internal/utils/XMLChar.java com/sun/org/apache/xml/internal/utils/XMLString.java com/sun/org/apache/xml/internal/utils/WrappedRuntimeException.java com/sun/org/apache/xml/internal/utils/WrongParserException.java com/sun/org/apache/xml/internal/utils/XMLStringFactoryDefault.java com/sun/org/apache/xml/internal/utils/XMLCharacterRecognizer.java com/sun/org/apache/xml/internal/utils/XMLStringDefault.java com/sun/org/apache/xml/internal/utils/XMLStringFactory.java com/sun/org/apache/xml/internal/utils/package.html com/sun/org/apache/xpath com/sun/org/apache/xpath/internal com/sun/org/apache/xpath/internal/SCCS com/sun/org/apache/xpath/internal/SCCS/s.Expression.java com/sun/org/apache/xpath/internal/SCCS/s.Arg.java com/sun/org/apache/xpath/internal/SCCS/s.ExtensionsProvider.java com/sun/org/apache/xpath/internal/SCCS/s.CachedXPathAPI.java com/sun/org/apache/xpath/internal/SCCS/s.ExpressionNode.java com/sun/org/apache/xpath/internal/SCCS/s.ExpressionOwner.java com/sun/org/apache/xpath/internal/SCCS/s.SourceTreeManager.java com/sun/org/apache/xpath/internal/SCCS/s.FoundIndex.java com/sun/org/apache/xpath/internal/SCCS/s.NodeSet.java com/sun/org/apache/xpath/internal/SCCS/s.NodeSetDTM.java com/sun/org/apache/xpath/internal/SCCS/s.SourceTree.java com/sun/org/apache/xpath/internal/SCCS/s.VariableStack.java com/sun/org/apache/xpath/internal/SCCS/s.XPathContext.java com/sun/org/apache/xpath/internal/SCCS/s.XPath.java com/sun/org/apache/xpath/internal/SCCS/s.WhitespaceStrippingElementMatcher.java com/sun/org/apache/xpath/internal/SCCS/s.XPathAPI.java com/sun/org/apache/xpath/internal/SCCS/s.XPathProcessorException.java com/sun/org/apache/xpath/internal/SCCS/s.XPathException.java com/sun/org/apache/xpath/internal/SCCS/s.XPathFactory.java com/sun/org/apache/xpath/internal/SCCS/s.XPathVisitable.java com/sun/org/apache/xpath/internal/SCCS/s.XPathVisitor.java com/sun/org/apache/xpath/internal/SCCS/s.package.html com/sun/org/apache/xpath/internal/axes com/sun/org/apache/xpath/internal/axes/SCCS com/sun/org/apache/xpath/internal/axes/SCCS/s.FilterExprIteratorSimple.java com/sun/org/apache/xpath/internal/axes/SCCS/s.AttributeIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.AxesWalker.java com/sun/org/apache/xpath/internal/axes/SCCS/s.BasicTestIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.ChildIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.ChildTestIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.ContextNodeList.java com/sun/org/apache/xpath/internal/axes/SCCS/s.DescendantIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.FilterExprIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.HasPositionalPredChecker.java com/sun/org/apache/xpath/internal/axes/SCCS/s.FilterExprWalker.java com/sun/org/apache/xpath/internal/axes/SCCS/s.IteratorPool.java com/sun/org/apache/xpath/internal/axes/SCCS/s.LocPathIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.OneStepIteratorForward.java com/sun/org/apache/xpath/internal/axes/SCCS/s.MatchPatternIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.NodeSequence.java com/sun/org/apache/xpath/internal/axes/SCCS/s.OneStepIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.PredicatedNodeTest.java com/sun/org/apache/xpath/internal/axes/SCCS/s.PathComponent.java com/sun/org/apache/xpath/internal/axes/SCCS/s.ReverseAxesWalker.java com/sun/org/apache/xpath/internal/axes/SCCS/s.RTFIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.SelfIteratorNoPredicate.java com/sun/org/apache/xpath/internal/axes/SCCS/s.SubContextList.java com/sun/org/apache/xpath/internal/axes/SCCS/s.UnionChildIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.UnionPathIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.WalkerFactory.java com/sun/org/apache/xpath/internal/axes/SCCS/s.WalkingIterator.java com/sun/org/apache/xpath/internal/axes/SCCS/s.package.html com/sun/org/apache/xpath/internal/axes/SCCS/s.WalkingIteratorSorted.java com/sun/org/apache/xpath/internal/axes/FilterExprIteratorSimple.java com/sun/org/apache/xpath/internal/axes/AttributeIterator.java com/sun/org/apache/xpath/internal/axes/AxesWalker.java com/sun/org/apache/xpath/internal/axes/BasicTestIterator.java com/sun/org/apache/xpath/internal/axes/ChildIterator.java com/sun/org/apache/xpath/internal/axes/ChildTestIterator.java com/sun/org/apache/xpath/internal/axes/ContextNodeList.java com/sun/org/apache/xpath/internal/axes/DescendantIterator.java com/sun/org/apache/xpath/internal/axes/FilterExprIterator.java com/sun/org/apache/xpath/internal/axes/HasPositionalPredChecker.java com/sun/org/apache/xpath/internal/axes/FilterExprWalker.java com/sun/org/apache/xpath/internal/axes/LocPathIterator.java com/sun/org/apache/xpath/internal/axes/IteratorPool.java com/sun/org/apache/xpath/internal/axes/MatchPatternIterator.java com/sun/org/apache/xpath/internal/axes/NodeSequence.java com/sun/org/apache/xpath/internal/axes/OneStepIterator.java com/sun/org/apache/xpath/internal/axes/OneStepIteratorForward.java com/sun/org/apache/xpath/internal/axes/PathComponent.java com/sun/org/apache/xpath/internal/axes/PredicatedNodeTest.java com/sun/org/apache/xpath/internal/axes/RTFIterator.java com/sun/org/apache/xpath/internal/axes/ReverseAxesWalker.java com/sun/org/apache/xpath/internal/axes/SelfIteratorNoPredicate.java com/sun/org/apache/xpath/internal/axes/SubContextList.java com/sun/org/apache/xpath/internal/axes/UnionChildIterator.java com/sun/org/apache/xpath/internal/axes/UnionPathIterator.java com/sun/org/apache/xpath/internal/axes/WalkerFactory.java com/sun/org/apache/xpath/internal/axes/WalkingIterator.java com/sun/org/apache/xpath/internal/axes/WalkingIteratorSorted.java com/sun/org/apache/xpath/internal/axes/package.html com/sun/org/apache/xpath/internal/compiler com/sun/org/apache/xpath/internal/compiler/SCCS com/sun/org/apache/xpath/internal/compiler/SCCS/s.FuncLoader.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.Compiler.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.FunctionTable.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.Keywords.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.Lexer.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.ObjectFactory.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.OpCodes.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.OpMap.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.OpMapVector.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.PsuedoNames.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.SecuritySupport.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.SecuritySupport12.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.XPathDumper.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.XPathParser.java com/sun/org/apache/xpath/internal/compiler/SCCS/s.package.html com/sun/org/apache/xpath/internal/compiler/FunctionTable.java com/sun/org/apache/xpath/internal/compiler/Compiler.java com/sun/org/apache/xpath/internal/compiler/FuncLoader.java com/sun/org/apache/xpath/internal/compiler/SecuritySupport.java com/sun/org/apache/xpath/internal/compiler/Keywords.java com/sun/org/apache/xpath/internal/compiler/Lexer.java com/sun/org/apache/xpath/internal/compiler/ObjectFactory.java com/sun/org/apache/xpath/internal/compiler/OpCodes.java com/sun/org/apache/xpath/internal/compiler/OpMap.java com/sun/org/apache/xpath/internal/compiler/OpMapVector.java com/sun/org/apache/xpath/internal/compiler/PsuedoNames.java com/sun/org/apache/xpath/internal/compiler/SecuritySupport12.java com/sun/org/apache/xpath/internal/compiler/XPathDumper.java com/sun/org/apache/xpath/internal/compiler/XPathParser.java com/sun/org/apache/xpath/internal/compiler/package.html com/sun/org/apache/xpath/internal/functions com/sun/org/apache/xpath/internal/functions/SCCS com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncDoclocation.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncBoolean.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncCeiling.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncConcat.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncContains.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncCount.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncCurrent.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncExtElementAvailable.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncExtFunction.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncExtFunctionAvailable.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncFalse.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncFloor.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncGenerateId.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncId.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncLang.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncNormalizeSpace.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncLast.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncLocalPart.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncNamespace.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncNumber.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncNot.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncSubstringAfter.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncPosition.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncQname.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncRound.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncStartsWith.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncString.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncStringLength.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncSubstring.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncSubstringBefore.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncSum.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncSystemProperty.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncTranslate.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncTrue.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FuncUnparsedEntityURI.java com/sun/org/apache/xpath/internal/functions/SCCS/s.Function.java com/sun/org/apache/xpath/internal/functions/SCCS/s.Function2Args.java com/sun/org/apache/xpath/internal/functions/SCCS/s.Function3Args.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FunctionDef1Arg.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FunctionMultiArgs.java com/sun/org/apache/xpath/internal/functions/SCCS/s.FunctionOneArg.java com/sun/org/apache/xpath/internal/functions/SCCS/s.ObjectFactory.java com/sun/org/apache/xpath/internal/functions/SCCS/s.SecuritySupport.java com/sun/org/apache/xpath/internal/functions/SCCS/s.SecuritySupport12.java com/sun/org/apache/xpath/internal/functions/SCCS/s.WrongNumberArgsException.java com/sun/org/apache/xpath/internal/functions/SCCS/s.package.html com/sun/org/apache/xpath/internal/functions/FuncDoclocation.java com/sun/org/apache/xpath/internal/functions/FuncBoolean.java com/sun/org/apache/xpath/internal/functions/FuncCeiling.java com/sun/org/apache/xpath/internal/functions/FuncConcat.java com/sun/org/apache/xpath/internal/functions/FuncContains.java com/sun/org/apache/xpath/internal/functions/FuncCount.java com/sun/org/apache/xpath/internal/functions/FuncCurrent.java com/sun/org/apache/xpath/internal/functions/FuncId.java com/sun/org/apache/xpath/internal/functions/FuncExtElementAvailable.java com/sun/org/apache/xpath/internal/functions/FuncExtFunction.java com/sun/org/apache/xpath/internal/functions/FuncExtFunctionAvailable.java com/sun/org/apache/xpath/internal/functions/FuncFalse.java com/sun/org/apache/xpath/internal/functions/FuncFloor.java com/sun/org/apache/xpath/internal/functions/FuncGenerateId.java com/sun/org/apache/xpath/internal/functions/FuncLang.java com/sun/org/apache/xpath/internal/functions/FuncLast.java com/sun/org/apache/xpath/internal/functions/FuncNot.java com/sun/org/apache/xpath/internal/functions/FuncLocalPart.java com/sun/org/apache/xpath/internal/functions/FuncNamespace.java com/sun/org/apache/xpath/internal/functions/FuncNormalizeSpace.java com/sun/org/apache/xpath/internal/functions/FuncNumber.java com/sun/org/apache/xpath/internal/functions/FuncPosition.java com/sun/org/apache/xpath/internal/functions/FuncQname.java com/sun/org/apache/xpath/internal/functions/FuncRound.java com/sun/org/apache/xpath/internal/functions/FuncStartsWith.java com/sun/org/apache/xpath/internal/functions/FuncString.java com/sun/org/apache/xpath/internal/functions/FuncStringLength.java com/sun/org/apache/xpath/internal/functions/FuncSubstring.java com/sun/org/apache/xpath/internal/functions/FuncSubstringAfter.java com/sun/org/apache/xpath/internal/functions/FuncSubstringBefore.java com/sun/org/apache/xpath/internal/functions/FuncSum.java com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java com/sun/org/apache/xpath/internal/functions/FuncTranslate.java com/sun/org/apache/xpath/internal/functions/FuncTrue.java com/sun/org/apache/xpath/internal/functions/FuncUnparsedEntityURI.java com/sun/org/apache/xpath/internal/functions/Function.java com/sun/org/apache/xpath/internal/functions/Function2Args.java com/sun/org/apache/xpath/internal/functions/Function3Args.java com/sun/org/apache/xpath/internal/functions/FunctionDef1Arg.java com/sun/org/apache/xpath/internal/functions/FunctionMultiArgs.java com/sun/org/apache/xpath/internal/functions/FunctionOneArg.java com/sun/org/apache/xpath/internal/functions/ObjectFactory.java com/sun/org/apache/xpath/internal/functions/SecuritySupport.java com/sun/org/apache/xpath/internal/functions/SecuritySupport12.java com/sun/org/apache/xpath/internal/functions/WrongNumberArgsException.java com/sun/org/apache/xpath/internal/functions/package.html com/sun/org/apache/xpath/internal/jaxp com/sun/org/apache/xpath/internal/jaxp/SCCS com/sun/org/apache/xpath/internal/jaxp/SCCS/s.JAXPExtensionsProvider.java com/sun/org/apache/xpath/internal/jaxp/SCCS/s.JAXPPrefixResolver.java com/sun/org/apache/xpath/internal/jaxp/SCCS/s.JAXPVariableStack.java com/sun/org/apache/xpath/internal/jaxp/SCCS/s.XPathExpressionImpl.java com/sun/org/apache/xpath/internal/jaxp/SCCS/s.XPathFactoryImpl.java com/sun/org/apache/xpath/internal/jaxp/SCCS/s.XPathImpl.java com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java com/sun/org/apache/xpath/internal/jaxp/JAXPPrefixResolver.java com/sun/org/apache/xpath/internal/jaxp/JAXPVariableStack.java com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java com/sun/org/apache/xpath/internal/objects com/sun/org/apache/xpath/internal/objects/SCCS com/sun/org/apache/xpath/internal/objects/SCCS/s.XBooleanStatic.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XBoolean.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XRTreeFragSelectWrapper.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XMLStringFactoryImpl.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XNodeSet.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XNodeSetForDOM.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XNull.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XNumber.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XObject.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XObjectFactory.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XRTreeFrag.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XStringForChars.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XString.java com/sun/org/apache/xpath/internal/objects/SCCS/s.XStringForFSB.java com/sun/org/apache/xpath/internal/objects/SCCS/s.package.html com/sun/org/apache/xpath/internal/objects/XBooleanStatic.java com/sun/org/apache/xpath/internal/objects/XBoolean.java com/sun/org/apache/xpath/internal/objects/XMLStringFactoryImpl.java com/sun/org/apache/xpath/internal/objects/XNodeSet.java com/sun/org/apache/xpath/internal/objects/XNodeSetForDOM.java com/sun/org/apache/xpath/internal/objects/XNull.java com/sun/org/apache/xpath/internal/objects/XNumber.java com/sun/org/apache/xpath/internal/objects/XObject.java com/sun/org/apache/xpath/internal/objects/XObjectFactory.java com/sun/org/apache/xpath/internal/objects/XRTreeFrag.java com/sun/org/apache/xpath/internal/objects/XRTreeFragSelectWrapper.java com/sun/org/apache/xpath/internal/objects/XString.java com/sun/org/apache/xpath/internal/objects/XStringForChars.java com/sun/org/apache/xpath/internal/objects/XStringForFSB.java com/sun/org/apache/xpath/internal/objects/package.html com/sun/org/apache/xpath/internal/operations com/sun/org/apache/xpath/internal/operations/SCCS com/sun/org/apache/xpath/internal/operations/SCCS/s.Equals.java com/sun/org/apache/xpath/internal/operations/SCCS/s.And.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Bool.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Div.java com/sun/org/apache/xpath/internal/operations/SCCS/s.NotEquals.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Gt.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Gte.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Lt.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Lte.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Minus.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Mod.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Mult.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Neg.java com/sun/org/apache/xpath/internal/operations/SCCS/s.UnaryOperation.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Number.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Operation.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Or.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Plus.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Quo.java com/sun/org/apache/xpath/internal/operations/SCCS/s.String.java com/sun/org/apache/xpath/internal/operations/SCCS/s.Variable.java com/sun/org/apache/xpath/internal/operations/SCCS/s.VariableSafeAbsRef.java com/sun/org/apache/xpath/internal/operations/SCCS/s.package.html com/sun/org/apache/xpath/internal/operations/NotEquals.java com/sun/org/apache/xpath/internal/operations/And.java com/sun/org/apache/xpath/internal/operations/Bool.java com/sun/org/apache/xpath/internal/operations/Div.java com/sun/org/apache/xpath/internal/operations/Equals.java com/sun/org/apache/xpath/internal/operations/Gt.java com/sun/org/apache/xpath/internal/operations/Gte.java com/sun/org/apache/xpath/internal/operations/Lt.java com/sun/org/apache/xpath/internal/operations/Lte.java com/sun/org/apache/xpath/internal/operations/Minus.java com/sun/org/apache/xpath/internal/operations/Mod.java com/sun/org/apache/xpath/internal/operations/Mult.java com/sun/org/apache/xpath/internal/operations/Neg.java com/sun/org/apache/xpath/internal/operations/UnaryOperation.java com/sun/org/apache/xpath/internal/operations/Number.java com/sun/org/apache/xpath/internal/operations/Operation.java com/sun/org/apache/xpath/internal/operations/Or.java com/sun/org/apache/xpath/internal/operations/Plus.java com/sun/org/apache/xpath/internal/operations/Quo.java com/sun/org/apache/xpath/internal/operations/String.java com/sun/org/apache/xpath/internal/operations/Variable.java com/sun/org/apache/xpath/internal/operations/VariableSafeAbsRef.java com/sun/org/apache/xpath/internal/operations/package.html com/sun/org/apache/xpath/internal/patterns com/sun/org/apache/xpath/internal/patterns/SCCS com/sun/org/apache/xpath/internal/patterns/SCCS/s.ContextMatchStepPattern.java com/sun/org/apache/xpath/internal/patterns/SCCS/s.FunctionPattern.java com/sun/org/apache/xpath/internal/patterns/SCCS/s.NodeTest.java com/sun/org/apache/xpath/internal/patterns/SCCS/s.NodeTestFilter.java com/sun/org/apache/xpath/internal/patterns/SCCS/s.StepPattern.java com/sun/org/apache/xpath/internal/patterns/SCCS/s.UnionPattern.java com/sun/org/apache/xpath/internal/patterns/SCCS/s.package.html com/sun/org/apache/xpath/internal/patterns/ContextMatchStepPattern.java com/sun/org/apache/xpath/internal/patterns/FunctionPattern.java com/sun/org/apache/xpath/internal/patterns/NodeTest.java com/sun/org/apache/xpath/internal/patterns/NodeTestFilter.java com/sun/org/apache/xpath/internal/patterns/StepPattern.java com/sun/org/apache/xpath/internal/patterns/UnionPattern.java com/sun/org/apache/xpath/internal/patterns/package.html com/sun/org/apache/xpath/internal/res com/sun/org/apache/xpath/internal/res/SCCS com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources_de.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources_en.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources_es.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources_fr.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources_it.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources_ja.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources_ko.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources_sv.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources_zh_CN.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHMessages.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources_zh_HK.java com/sun/org/apache/xpath/internal/res/SCCS/s.XPATHErrorResources_zh_TW.java com/sun/org/apache/xpath/internal/res/SCCS/s.package.html com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java com/sun/org/apache/xpath/internal/res/XPATHErrorResources_en.java com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_HK.java com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java com/sun/org/apache/xpath/internal/res/XPATHMessages.java com/sun/org/apache/xpath/internal/res/package.html com/sun/org/apache/xpath/internal/CachedXPathAPI.java com/sun/org/apache/xpath/internal/Arg.java com/sun/org/apache/xpath/internal/ExpressionNode.java com/sun/org/apache/xpath/internal/Expression.java com/sun/org/apache/xpath/internal/XPathProcessorException.java com/sun/org/apache/xpath/internal/ExpressionOwner.java com/sun/org/apache/xpath/internal/ExtensionsProvider.java com/sun/org/apache/xpath/internal/FoundIndex.java com/sun/org/apache/xpath/internal/NodeSet.java com/sun/org/apache/xpath/internal/NodeSetDTM.java com/sun/org/apache/xpath/internal/SourceTree.java com/sun/org/apache/xpath/internal/SourceTreeManager.java com/sun/org/apache/xpath/internal/VariableStack.java com/sun/org/apache/xpath/internal/XPath.java com/sun/org/apache/xpath/internal/XPathAPI.java com/sun/org/apache/xpath/internal/WhitespaceStrippingElementMatcher.java com/sun/org/apache/xpath/internal/XPathContext.java com/sun/org/apache/xpath/internal/XPathException.java com/sun/org/apache/xpath/internal/XPathFactory.java com/sun/org/apache/xpath/internal/XPathVisitable.java com/sun/org/apache/xpath/internal/XPathVisitor.java com/sun/org/apache/xpath/internal/package.html com/sun/org/omg com/sun/org/omg/CORBA com/sun/org/omg/CORBA/SCCS com/sun/org/omg/CORBA/SCCS/s.AttributeDescriptionHelper.java com/sun/org/omg/CORBA/SCCS/s.AttrDescriptionSeqHelper.java com/sun/org/omg/CORBA/SCCS/s.AttributeDescription.java com/sun/org/omg/CORBA/SCCS/s.ContextIdentifierHelper.java com/sun/org/omg/CORBA/SCCS/s.AttributeMode.java com/sun/org/omg/CORBA/SCCS/s.AttributeModeHelper.java com/sun/org/omg/CORBA/SCCS/s.ContextIdSeqHelper.java com/sun/org/omg/CORBA/SCCS/s.ExceptionDescriptionHelper.java com/sun/org/omg/CORBA/SCCS/s.DefinitionKindHelper.java com/sun/org/omg/CORBA/SCCS/s.ExcDescriptionSeqHelper.java com/sun/org/omg/CORBA/SCCS/s.ExceptionDescription.java com/sun/org/omg/CORBA/SCCS/s.InitializerHelper.java com/sun/org/omg/CORBA/SCCS/s.Initializer.java com/sun/org/omg/CORBA/SCCS/s.IDLTypeHelper.java com/sun/org/omg/CORBA/SCCS/s.IDLTypeOperations.java com/sun/org/omg/CORBA/SCCS/s.IRObjectOperations.java com/sun/org/omg/CORBA/SCCS/s.IdentifierHelper.java com/sun/org/omg/CORBA/SCCS/s.OpDescriptionSeqHelper.java com/sun/org/omg/CORBA/SCCS/s.InitializerSeqHelper.java com/sun/org/omg/CORBA/SCCS/s.OperationDescriptionHelper.java com/sun/org/omg/CORBA/SCCS/s.OperationDescription.java com/sun/org/omg/CORBA/SCCS/s.ParDescriptionSeqHelper.java com/sun/org/omg/CORBA/SCCS/s.OperationMode.java com/sun/org/omg/CORBA/SCCS/s.OperationModeHelper.java com/sun/org/omg/CORBA/SCCS/s.ParameterDescription.java com/sun/org/omg/CORBA/SCCS/s.ParameterMode.java com/sun/org/omg/CORBA/SCCS/s.RepositoryIdSeqHelper.java com/sun/org/omg/CORBA/SCCS/s.ParameterDescriptionHelper.java com/sun/org/omg/CORBA/SCCS/s.ParameterModeHelper.java com/sun/org/omg/CORBA/SCCS/s.Repository.java com/sun/org/omg/CORBA/SCCS/s.RepositoryHelper.java com/sun/org/omg/CORBA/SCCS/s.RepositoryIdHelper.java com/sun/org/omg/CORBA/SCCS/s.StructMemberSeqHelper.java com/sun/org/omg/CORBA/SCCS/s.StructMemberHelper.java com/sun/org/omg/CORBA/SCCS/s.ValueMemberHelper.java com/sun/org/omg/CORBA/SCCS/s.ValueMemberSeqHelper.java com/sun/org/omg/CORBA/SCCS/s.VersionSpecHelper.java com/sun/org/omg/CORBA/SCCS/s.VisibilityHelper.java com/sun/org/omg/CORBA/SCCS/s._IDLTypeStub.java com/sun/org/omg/CORBA/ValueDefPackage com/sun/org/omg/CORBA/ValueDefPackage/SCCS com/sun/org/omg/CORBA/ValueDefPackage/SCCS/s.FullValueDescriptionHelper.java com/sun/org/omg/CORBA/ValueDefPackage/SCCS/s.FullValueDescription.java com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java com/sun/org/omg/CORBA/portable com/sun/org/omg/CORBA/portable/SCCS com/sun/org/omg/CORBA/portable/SCCS/s.ValueHelper.java com/sun/org/omg/CORBA/portable/ValueHelper.java com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java com/sun/org/omg/CORBA/AttributeDescription.java com/sun/org/omg/CORBA/AttributeDescriptionHelper.java com/sun/org/omg/CORBA/AttributeMode.java com/sun/org/omg/CORBA/AttributeModeHelper.java com/sun/org/omg/CORBA/ContextIdSeqHelper.java com/sun/org/omg/CORBA/ContextIdentifierHelper.java com/sun/org/omg/CORBA/DefinitionKindHelper.java com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java com/sun/org/omg/CORBA/ExceptionDescription.java com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java com/sun/org/omg/CORBA/Repository.java com/sun/org/omg/CORBA/IDLTypeHelper.java com/sun/org/omg/CORBA/IDLTypeOperations.java com/sun/org/omg/CORBA/IRObjectOperations.java com/sun/org/omg/CORBA/IdentifierHelper.java com/sun/org/omg/CORBA/Initializer.java com/sun/org/omg/CORBA/InitializerHelper.java com/sun/org/omg/CORBA/InitializerSeqHelper.java com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java com/sun/org/omg/CORBA/OperationDescription.java com/sun/org/omg/CORBA/OperationDescriptionHelper.java com/sun/org/omg/CORBA/OperationMode.java com/sun/org/omg/CORBA/OperationModeHelper.java com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java com/sun/org/omg/CORBA/ParameterDescription.java com/sun/org/omg/CORBA/ParameterDescriptionHelper.java com/sun/org/omg/CORBA/ParameterMode.java com/sun/org/omg/CORBA/ParameterModeHelper.java com/sun/org/omg/CORBA/RepositoryHelper.java com/sun/org/omg/CORBA/RepositoryIdHelper.java com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java com/sun/org/omg/CORBA/StructMemberHelper.java com/sun/org/omg/CORBA/StructMemberSeqHelper.java com/sun/org/omg/CORBA/ValueMemberHelper.java com/sun/org/omg/CORBA/ValueMemberSeqHelper.java com/sun/org/omg/CORBA/VersionSpecHelper.java com/sun/org/omg/CORBA/VisibilityHelper.java com/sun/org/omg/CORBA/_IDLTypeStub.java com/sun/org/omg/SendingContext com/sun/org/omg/SendingContext/CodeBasePackage com/sun/org/omg/SendingContext/CodeBasePackage/SCCS com/sun/org/omg/SendingContext/CodeBasePackage/SCCS/s.ValueDescSeqHelper.java com/sun/org/omg/SendingContext/CodeBasePackage/SCCS/s.URLHelper.java com/sun/org/omg/SendingContext/CodeBasePackage/SCCS/s.URLSeqHelper.java com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java com/sun/org/omg/SendingContext/SCCS com/sun/org/omg/SendingContext/SCCS/s.CodeBaseHelper.java com/sun/org/omg/SendingContext/SCCS/s.CodeBase.java com/sun/org/omg/SendingContext/SCCS/s.CodeBaseOperations.java com/sun/org/omg/SendingContext/SCCS/s._CodeBaseImplBase.java com/sun/org/omg/SendingContext/SCCS/s._CodeBaseStub.java com/sun/org/omg/SendingContext/CodeBaseHelper.java com/sun/org/omg/SendingContext/CodeBase.java com/sun/org/omg/SendingContext/CodeBaseOperations.java com/sun/org/omg/SendingContext/_CodeBaseImplBase.java com/sun/org/omg/SendingContext/_CodeBaseStub.java com/sun/rmi com/sun/rmi/rmid com/sun/rmi/rmid/SCCS com/sun/rmi/rmid/SCCS/s.ExecOptionPermission.java com/sun/rmi/rmid/SCCS/s.ExecPermission.java com/sun/rmi/rmid/ExecOptionPermission.java com/sun/rmi/rmid/ExecPermission.java com/sun/rmi/ssl com/sun/rmi/ssl/SCCS com/sun/rowset com/sun/rowset/SCCS com/sun/rowset/SCCS/s.FilteredRowSetImpl.java com/sun/rowset/SCCS/s.CachedRowSetImpl.java com/sun/rowset/SCCS/s.JdbcRowSetImpl.java com/sun/rowset/SCCS/s.JoinRowSetImpl.java com/sun/rowset/SCCS/s.WebRowSetImpl.java com/sun/rowset/SCCS/s.package.html com/sun/rowset/internal com/sun/rowset/internal/SCCS com/sun/rowset/internal/SCCS/s.InsertRow.java com/sun/rowset/internal/SCCS/s.BaseRow.java com/sun/rowset/internal/SCCS/s.CachedRowSetReader.java com/sun/rowset/internal/SCCS/s.CachedRowSetWriter.java com/sun/rowset/internal/SCCS/s.Row.java com/sun/rowset/internal/SCCS/s.SyncResolverImpl.java com/sun/rowset/internal/SCCS/s.WebRowSetXmlReader.java com/sun/rowset/internal/SCCS/s.WebRowSetXmlWriter.java com/sun/rowset/internal/SCCS/s.XmlErrorHandler.java com/sun/rowset/internal/SCCS/s.XmlReaderContentHandler.java com/sun/rowset/internal/SCCS/s.XmlResolver.java com/sun/rowset/internal/CachedRowSetReader.java com/sun/rowset/internal/BaseRow.java com/sun/rowset/internal/XmlReaderContentHandler.java com/sun/rowset/internal/CachedRowSetWriter.java com/sun/rowset/internal/InsertRow.java com/sun/rowset/internal/Row.java com/sun/rowset/internal/SyncResolverImpl.java com/sun/rowset/internal/WebRowSetXmlReader.java com/sun/rowset/internal/WebRowSetXmlWriter.java com/sun/rowset/internal/XmlErrorHandler.java com/sun/rowset/internal/XmlResolver.java com/sun/rowset/providers com/sun/rowset/providers/SCCS com/sun/rowset/providers/SCCS/s.RIOptimisticProvider.java com/sun/rowset/providers/SCCS/s.RIXMLProvider.java com/sun/rowset/providers/SCCS/s.package.html com/sun/rowset/providers/RIOptimisticProvider.java com/sun/rowset/providers/RIXMLProvider.java com/sun/rowset/providers/package.html com/sun/rowset/CachedRowSetImpl.java com/sun/rowset/FilteredRowSetImpl.java com/sun/rowset/JdbcRowSetImpl.java com/sun/rowset/JoinRowSetImpl.java com/sun/rowset/WebRowSetImpl.java com/sun/rowset/package.html com/sun/security com/sun/security/auth com/sun/security/auth/SCCS com/sun/security/auth/SCCS/s.NTSidPrimaryGroupPrincipal.java com/sun/security/auth/SCCS/s.NTDomainPrincipal.java com/sun/security/auth/SCCS/s.NTNumericCredential.java com/sun/security/auth/SCCS/s.NTSid.java com/sun/security/auth/SCCS/s.NTSidDomainPrincipal.java com/sun/security/auth/SCCS/s.NTSidGroupPrincipal.java com/sun/security/auth/SCCS/s.SolarisNumericGroupPrincipal.java com/sun/security/auth/SCCS/s.NTSidUserPrincipal.java com/sun/security/auth/SCCS/s.NTUserPrincipal.java com/sun/security/auth/SCCS/s.PolicyFile.java com/sun/security/auth/SCCS/s.PolicyParser.java com/sun/security/auth/SCCS/s.PrincipalComparator.java com/sun/security/auth/SCCS/s.SubjectCodeSource.java com/sun/security/auth/SCCS/s.SolarisPrincipal.java com/sun/security/auth/SCCS/s.SolarisNumericUserPrincipal.java com/sun/security/auth/SCCS/s.UnixNumericGroupPrincipal.java com/sun/security/auth/SCCS/s.UnixNumericUserPrincipal.java com/sun/security/auth/SCCS/s.UnixPrincipal.java com/sun/security/auth/SCCS/s.X500Principal.java com/sun/security/auth/SCCS/s.jaas-overview.html com/sun/security/auth/callback com/sun/security/auth/callback/SCCS com/sun/security/auth/callback/SCCS/s.DialogCallbackHandler.java com/sun/security/auth/callback/SCCS/s.TextCallbackHandler.java com/sun/security/auth/callback/DialogCallbackHandler.java com/sun/security/auth/callback/TextCallbackHandler.java com/sun/security/auth/login com/sun/security/auth/login/SCCS com/sun/security/auth/login/SCCS/s.ConfigFile.java com/sun/security/auth/login/ConfigFile.java com/sun/security/auth/module com/sun/security/auth/module/SCCS com/sun/security/auth/module/SCCS/s.JndiLoginModule.java com/sun/security/auth/module/SCCS/s.Crypt.java com/sun/security/auth/module/SCCS/s.KeyStoreLoginModule.java com/sun/security/auth/module/SCCS/s.Krb5LoginModule.java com/sun/security/auth/module/SCCS/s.NTLoginModule.java com/sun/security/auth/module/SCCS/s.NTSystem.java com/sun/security/auth/module/SCCS/s.SolarisLoginModule.java com/sun/security/auth/module/SCCS/s.SolarisSystem.java com/sun/security/auth/module/SCCS/s.UnixLoginModule.java com/sun/security/auth/module/SCCS/s.UnixSystem.java com/sun/security/auth/module/Crypt.java com/sun/security/auth/module/NTLoginModule.java com/sun/security/auth/module/JndiLoginModule.java com/sun/security/auth/module/KeyStoreLoginModule.java com/sun/security/auth/module/Krb5LoginModule.java com/sun/security/auth/module/NTSystem.java com/sun/security/auth/module/SolarisLoginModule.java com/sun/security/auth/module/SolarisSystem.java com/sun/security/auth/module/UnixLoginModule.java com/sun/security/auth/module/UnixSystem.java com/sun/security/auth/NTNumericCredential.java com/sun/security/auth/NTDomainPrincipal.java com/sun/security/auth/NTSid.java com/sun/security/auth/NTSidUserPrincipal.java com/sun/security/auth/NTSidDomainPrincipal.java com/sun/security/auth/NTSidGroupPrincipal.java com/sun/security/auth/NTSidPrimaryGroupPrincipal.java com/sun/security/auth/NTUserPrincipal.java com/sun/security/auth/PolicyFile.java com/sun/security/auth/PolicyParser.java com/sun/security/auth/PrincipalComparator.java com/sun/security/auth/UnixPrincipal.java com/sun/security/auth/SolarisPrincipal.java com/sun/security/auth/SolarisNumericGroupPrincipal.java com/sun/security/auth/SolarisNumericUserPrincipal.java com/sun/security/auth/SubjectCodeSource.java com/sun/security/auth/UnixNumericGroupPrincipal.java com/sun/security/auth/UnixNumericUserPrincipal.java com/sun/security/auth/X500Principal.java com/sun/security/auth/jaas-overview.html com/sun/security/jgss com/sun/security/jgss/SCCS com/sun/security/jgss/SCCS/s.jgss-overview.html com/sun/security/jgss/SCCS/s.GSSUtil.java com/sun/security/jgss/jgss-overview.html com/sun/security/jgss/GSSUtil.java com/sun/security/sasl com/sun/security/sasl/SCCS com/sun/security/sasl/SCCS/s.ClientFactoryImpl.java com/sun/security/sasl/SCCS/s.CramMD5Base.java com/sun/security/sasl/SCCS/s.CramMD5Client.java com/sun/security/sasl/SCCS/s.CramMD5Server.java com/sun/security/sasl/SCCS/s.ExternalClient.java com/sun/security/sasl/SCCS/s.PlainClient.java com/sun/security/sasl/SCCS/s.Provider.java com/sun/security/sasl/SCCS/s.ServerFactoryImpl.java com/sun/security/sasl/digest com/sun/security/sasl/digest/SCCS com/sun/security/sasl/digest/SCCS/s.DigestMD5Base.java com/sun/security/sasl/digest/SCCS/s.DigestMD5Client.java com/sun/security/sasl/digest/SCCS/s.DigestMD5Server.java com/sun/security/sasl/digest/SCCS/s.FactoryImpl.java com/sun/security/sasl/digest/SCCS/s.SecurityCtx.java com/sun/security/sasl/digest/DigestMD5Client.java com/sun/security/sasl/digest/DigestMD5Base.java com/sun/security/sasl/digest/DigestMD5Server.java com/sun/security/sasl/digest/FactoryImpl.java com/sun/security/sasl/digest/SecurityCtx.java com/sun/security/sasl/gsskerb com/sun/security/sasl/gsskerb/SCCS com/sun/security/sasl/gsskerb/SCCS/s.GssKrb5Client.java com/sun/security/sasl/gsskerb/SCCS/s.FactoryImpl.java com/sun/security/sasl/gsskerb/SCCS/s.GssKrb5Base.java com/sun/security/sasl/gsskerb/SCCS/s.GssKrb5Server.java com/sun/security/sasl/gsskerb/FactoryImpl.java com/sun/security/sasl/gsskerb/GssKrb5Base.java com/sun/security/sasl/gsskerb/GssKrb5Client.java com/sun/security/sasl/gsskerb/GssKrb5Server.java com/sun/security/sasl/util com/sun/security/sasl/util/SCCS com/sun/security/sasl/util/SCCS/s.AbstractSaslImpl.java com/sun/security/sasl/util/SCCS/s.PolicyUtils.java com/sun/security/sasl/util/AbstractSaslImpl.java com/sun/security/sasl/util/PolicyUtils.java com/sun/security/sasl/ClientFactoryImpl.java com/sun/security/sasl/CramMD5Base.java com/sun/security/sasl/CramMD5Client.java com/sun/security/sasl/CramMD5Server.java com/sun/security/sasl/ExternalClient.java com/sun/security/sasl/PlainClient.java com/sun/security/sasl/Provider.java com/sun/security/sasl/ServerFactoryImpl.java com/sun/swing com/sun/swing/internal com/sun/swing/internal/plaf com/sun/swing/internal/plaf/basic com/sun/swing/internal/plaf/basic/resources com/sun/swing/internal/plaf/basic/resources/SCCS com/sun/swing/internal/plaf/basic/resources/SCCS/s.basic_de.properties com/sun/swing/internal/plaf/basic/resources/SCCS/s.basic.properties com/sun/swing/internal/plaf/basic/resources/SCCS/s.basic_es.properties com/sun/swing/internal/plaf/basic/resources/SCCS/s.basic_fr.properties com/sun/swing/internal/plaf/basic/resources/SCCS/s.basic_it.properties com/sun/swing/internal/plaf/basic/resources/SCCS/s.basic_ja.properties com/sun/swing/internal/plaf/basic/resources/SCCS/s.basic_ko.properties com/sun/swing/internal/plaf/basic/resources/SCCS/s.basic_sv.properties com/sun/swing/internal/plaf/basic/resources/SCCS/s.basic_zh_CN.properties com/sun/swing/internal/plaf/basic/resources/SCCS/s.basic_zh_TW.properties com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties com/sun/swing/internal/plaf/basic/resources/basic.properties com/sun/swing/internal/plaf/basic/resources/basic_de.properties com/sun/swing/internal/plaf/basic/resources/basic_es.properties com/sun/swing/internal/plaf/basic/resources/basic_fr.properties com/sun/swing/internal/plaf/basic/resources/basic_it.properties com/sun/swing/internal/plaf/basic/resources/basic_ja.properties com/sun/swing/internal/plaf/basic/resources/basic_ko.properties com/sun/swing/internal/plaf/basic/resources/basic_sv.properties com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties com/sun/swing/internal/plaf/metal com/sun/swing/internal/plaf/metal/resources com/sun/swing/internal/plaf/metal/resources/SCCS com/sun/swing/internal/plaf/metal/resources/SCCS/s.metal_de.properties com/sun/swing/internal/plaf/metal/resources/SCCS/s.metal.properties com/sun/swing/internal/plaf/metal/resources/SCCS/s.metal_es.properties com/sun/swing/internal/plaf/metal/resources/SCCS/s.metal_fr.properties com/sun/swing/internal/plaf/metal/resources/SCCS/s.metal_it.properties com/sun/swing/internal/plaf/metal/resources/SCCS/s.metal_ja.properties com/sun/swing/internal/plaf/metal/resources/SCCS/s.metal_ko.properties com/sun/swing/internal/plaf/metal/resources/SCCS/s.metal_sv.properties com/sun/swing/internal/plaf/metal/resources/SCCS/s.metal_zh_CN.properties com/sun/swing/internal/plaf/metal/resources/SCCS/s.metal_zh_TW.properties com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties com/sun/swing/internal/plaf/metal/resources/metal.properties com/sun/swing/internal/plaf/metal/resources/metal_de.properties com/sun/swing/internal/plaf/metal/resources/metal_es.properties com/sun/swing/internal/plaf/metal/resources/metal_fr.properties com/sun/swing/internal/plaf/metal/resources/metal_it.properties com/sun/swing/internal/plaf/metal/resources/metal_ja.properties com/sun/swing/internal/plaf/metal/resources/metal_ko.properties com/sun/swing/internal/plaf/metal/resources/metal_sv.properties com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties com/sun/swing/internal/plaf/synth com/sun/swing/internal/plaf/synth/resources com/sun/swing/internal/plaf/synth/resources/SCCS com/sun/swing/internal/plaf/synth/resources/SCCS/s.synth_de.properties com/sun/swing/internal/plaf/synth/resources/SCCS/s.synth.properties com/sun/swing/internal/plaf/synth/resources/SCCS/s.synth_es.properties com/sun/swing/internal/plaf/synth/resources/SCCS/s.synth_fr.properties com/sun/swing/internal/plaf/synth/resources/SCCS/s.synth_it.properties com/sun/swing/internal/plaf/synth/resources/SCCS/s.synth_ja.properties com/sun/swing/internal/plaf/synth/resources/SCCS/s.synth_ko.properties com/sun/swing/internal/plaf/synth/resources/SCCS/s.synth_sv.properties com/sun/swing/internal/plaf/synth/resources/SCCS/s.synth_zh_CN.properties com/sun/swing/internal/plaf/synth/resources/SCCS/s.synth_zh_TW.properties com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties com/sun/swing/internal/plaf/synth/resources/synth.properties com/sun/swing/internal/plaf/synth/resources/synth_de.properties com/sun/swing/internal/plaf/synth/resources/synth_es.properties com/sun/swing/internal/plaf/synth/resources/synth_fr.properties com/sun/swing/internal/plaf/synth/resources/synth_it.properties com/sun/swing/internal/plaf/synth/resources/synth_ja.properties com/sun/swing/internal/plaf/synth/resources/synth_ko.properties com/sun/swing/internal/plaf/synth/resources/synth_sv.properties com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties com/sun/tools com/sun/tools/apt com/sun/tools/apt/SCCS com/sun/tools/apt/SCCS/s.Main.java com/sun/tools/apt/comp com/sun/tools/apt/comp/SCCS com/sun/tools/apt/comp/SCCS/s.BootstrapAPF.java com/sun/tools/apt/comp/SCCS/s.Apt.java com/sun/tools/apt/comp/SCCS/s.AnnotationProcessingError.java com/sun/tools/apt/comp/SCCS/s.PrintAP.java com/sun/tools/apt/comp/SCCS/s.UsageMessageNeededException.java com/sun/tools/apt/comp/BootstrapAPF.java com/sun/tools/apt/comp/Apt.java com/sun/tools/apt/comp/AnnotationProcessingError.java com/sun/tools/apt/comp/PrintAP.java com/sun/tools/apt/comp/UsageMessageNeededException.java com/sun/tools/apt/main com/sun/tools/apt/main/SCCS com/sun/tools/apt/main/SCCS/s.CommandLine.java com/sun/tools/apt/main/SCCS/s.JavaCompiler.java com/sun/tools/apt/main/SCCS/s.Main.java com/sun/tools/apt/main/CommandLine.java com/sun/tools/apt/main/JavaCompiler.java com/sun/tools/apt/main/Main.java com/sun/tools/apt/mirror com/sun/tools/apt/mirror/SCCS com/sun/tools/apt/mirror/SCCS/s.AptEnv.java com/sun/tools/apt/mirror/apt com/sun/tools/apt/mirror/apt/SCCS com/sun/tools/apt/mirror/apt/SCCS/s.AnnotationProcessorEnvironmentImpl.java com/sun/tools/apt/mirror/apt/SCCS/s.FilerImpl.java com/sun/tools/apt/mirror/apt/SCCS/s.MessagerImpl.java com/sun/tools/apt/mirror/apt/SCCS/s.RoundCompleteEventImpl.java com/sun/tools/apt/mirror/apt/SCCS/s.RoundStateImpl.java com/sun/tools/apt/mirror/apt/MessagerImpl.java com/sun/tools/apt/mirror/apt/FilerImpl.java com/sun/tools/apt/mirror/apt/AnnotationProcessorEnvironmentImpl.java com/sun/tools/apt/mirror/apt/RoundCompleteEventImpl.java com/sun/tools/apt/mirror/apt/RoundStateImpl.java com/sun/tools/apt/mirror/declaration com/sun/tools/apt/mirror/declaration/SCCS com/sun/tools/apt/mirror/declaration/SCCS/s.AnnotationMirrorImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.AnnotationProxyMaker.java com/sun/tools/apt/mirror/declaration/SCCS/s.AnnotationValueImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.AnnotationTypeDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.AnnotationTypeElementDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.ClassDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.Constants.java com/sun/tools/apt/mirror/declaration/SCCS/s.ConstructorDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.DeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.DeclarationMaker.java com/sun/tools/apt/mirror/declaration/SCCS/s.EnumConstantDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.EnumDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.ExecutableDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.FieldDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.InterfaceDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.MemberDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.MethodDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.PackageDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.ParameterDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.TypeDeclarationImpl.java com/sun/tools/apt/mirror/declaration/SCCS/s.TypeParameterDeclarationImpl.java com/sun/tools/apt/mirror/declaration/AnnotationTypeDeclarationImpl.java com/sun/tools/apt/mirror/declaration/AnnotationMirrorImpl.java com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java com/sun/tools/apt/mirror/declaration/DeclarationImpl.java com/sun/tools/apt/mirror/declaration/Constants.java com/sun/tools/apt/mirror/declaration/AnnotationTypeElementDeclarationImpl.java com/sun/tools/apt/mirror/declaration/AnnotationValueImpl.java com/sun/tools/apt/mirror/declaration/ClassDeclarationImpl.java com/sun/tools/apt/mirror/declaration/ConstructorDeclarationImpl.java com/sun/tools/apt/mirror/declaration/DeclarationMaker.java com/sun/tools/apt/mirror/declaration/EnumConstantDeclarationImpl.java com/sun/tools/apt/mirror/declaration/EnumDeclarationImpl.java com/sun/tools/apt/mirror/declaration/ExecutableDeclarationImpl.java com/sun/tools/apt/mirror/declaration/FieldDeclarationImpl.java com/sun/tools/apt/mirror/declaration/InterfaceDeclarationImpl.java com/sun/tools/apt/mirror/declaration/MemberDeclarationImpl.java com/sun/tools/apt/mirror/declaration/MethodDeclarationImpl.java com/sun/tools/apt/mirror/declaration/PackageDeclarationImpl.java com/sun/tools/apt/mirror/declaration/ParameterDeclarationImpl.java com/sun/tools/apt/mirror/declaration/TypeDeclarationImpl.java com/sun/tools/apt/mirror/declaration/TypeParameterDeclarationImpl.java com/sun/tools/apt/mirror/type com/sun/tools/apt/mirror/type/SCCS com/sun/tools/apt/mirror/type/SCCS/s.AnnotationTypeImpl.java com/sun/tools/apt/mirror/type/SCCS/s.ArrayTypeImpl.java com/sun/tools/apt/mirror/type/SCCS/s.ClassTypeImpl.java com/sun/tools/apt/mirror/type/SCCS/s.DeclaredTypeImpl.java com/sun/tools/apt/mirror/type/SCCS/s.EnumTypeImpl.java com/sun/tools/apt/mirror/type/SCCS/s.InterfaceTypeImpl.java com/sun/tools/apt/mirror/type/SCCS/s.PrimitiveTypeImpl.java com/sun/tools/apt/mirror/type/SCCS/s.TypeMaker.java com/sun/tools/apt/mirror/type/SCCS/s.TypeMirrorImpl.java com/sun/tools/apt/mirror/type/SCCS/s.TypeVariableImpl.java com/sun/tools/apt/mirror/type/SCCS/s.VoidTypeImpl.java com/sun/tools/apt/mirror/type/SCCS/s.WildcardTypeImpl.java com/sun/tools/apt/mirror/type/AnnotationTypeImpl.java com/sun/tools/apt/mirror/type/ArrayTypeImpl.java com/sun/tools/apt/mirror/type/ClassTypeImpl.java com/sun/tools/apt/mirror/type/DeclaredTypeImpl.java com/sun/tools/apt/mirror/type/EnumTypeImpl.java com/sun/tools/apt/mirror/type/InterfaceTypeImpl.java com/sun/tools/apt/mirror/type/PrimitiveTypeImpl.java com/sun/tools/apt/mirror/type/TypeMaker.java com/sun/tools/apt/mirror/type/TypeMirrorImpl.java com/sun/tools/apt/mirror/type/TypeVariableImpl.java com/sun/tools/apt/mirror/type/VoidTypeImpl.java com/sun/tools/apt/mirror/type/WildcardTypeImpl.java com/sun/tools/apt/mirror/util com/sun/tools/apt/mirror/util/SCCS com/sun/tools/apt/mirror/util/SCCS/s.SourcePositionImpl.java com/sun/tools/apt/mirror/util/SCCS/s.DeclarationsImpl.java com/sun/tools/apt/mirror/util/SCCS/s.TypesImpl.java com/sun/tools/apt/mirror/util/DeclarationsImpl.java com/sun/tools/apt/mirror/util/SourcePositionImpl.java com/sun/tools/apt/mirror/util/TypesImpl.java com/sun/tools/apt/mirror/AptEnv.java com/sun/tools/apt/resources com/sun/tools/apt/resources/SCCS com/sun/tools/apt/resources/SCCS/s.apt.properties com/sun/tools/apt/resources/SCCS/s.apt_ja.properties com/sun/tools/apt/resources/apt_ja.properties com/sun/tools/apt/resources/apt.properties com/sun/tools/apt/util com/sun/tools/apt/util/SCCS com/sun/tools/apt/util/SCCS/s.Bark.java com/sun/tools/apt/util/Bark.java com/sun/tools/apt/Main.java com/sun/tools/corba com/sun/tools/corba/se com/sun/tools/corba/se/idl com/sun/tools/corba/se/idl/SCCS com/sun/tools/corba/se/idl/SCCS/s.AttributeEntry.java com/sun/tools/corba/se/idl/SCCS/s.Arguments.java com/sun/tools/corba/se/idl/SCCS/s.DefaultSymtabFactory.java com/sun/tools/corba/se/idl/SCCS/s.AttributeGen.java com/sun/tools/corba/se/idl/SCCS/s.Comment.java com/sun/tools/corba/se/idl/SCCS/s.Compile.java com/sun/tools/corba/se/idl/SCCS/s.ConstEntry.java com/sun/tools/corba/se/idl/SCCS/s.ConstGen.java com/sun/tools/corba/se/idl/SCCS/s.EnumEntry.java com/sun/tools/corba/se/idl/SCCS/s.EnumGen.java com/sun/tools/corba/se/idl/SCCS/s.ExceptionEntry.java com/sun/tools/corba/se/idl/SCCS/s.ExceptionGen.java com/sun/tools/corba/se/idl/SCCS/s.Factories.java com/sun/tools/corba/se/idl/SCCS/s.ForwardEntry.java com/sun/tools/corba/se/idl/SCCS/s.ForwardGen.java com/sun/tools/corba/se/idl/SCCS/s.GenFactory.java com/sun/tools/corba/se/idl/SCCS/s.ResourceBundleUtil.java com/sun/tools/corba/se/idl/SCCS/s.ForwardValueEntry.java com/sun/tools/corba/se/idl/SCCS/s.ForwardValueGen.java com/sun/tools/corba/se/idl/SCCS/s.GenFileStream.java com/sun/tools/corba/se/idl/SCCS/s.Generator.java com/sun/tools/corba/se/idl/SCCS/s.IDLID.java com/sun/tools/corba/se/idl/SCCS/s.IncludeEntry.java com/sun/tools/corba/se/idl/SCCS/s.IncludeGen.java com/sun/tools/corba/se/idl/SCCS/s.InterfaceEntry.java com/sun/tools/corba/se/idl/SCCS/s.InterfaceGen.java com/sun/tools/corba/se/idl/SCCS/s.InterfaceState.java com/sun/tools/corba/se/idl/SCCS/s.InterfaceType.java com/sun/tools/corba/se/idl/SCCS/s.InvalidArgument.java com/sun/tools/corba/se/idl/SCCS/s.InvalidCharacter.java com/sun/tools/corba/se/idl/SCCS/s.MethodEntry.java com/sun/tools/corba/se/idl/SCCS/s.MethodGen.java com/sun/tools/corba/se/idl/SCCS/s.ModuleEntry.java com/sun/tools/corba/se/idl/SCCS/s.ModuleGen.java com/sun/tools/corba/se/idl/SCCS/s.NativeEntry.java com/sun/tools/corba/se/idl/SCCS/s.NativeGen.java com/sun/tools/corba/se/idl/SCCS/s.NoPragma.java com/sun/tools/corba/se/idl/SCCS/s.Noop.java com/sun/tools/corba/se/idl/SCCS/s.ParameterEntry.java com/sun/tools/corba/se/idl/SCCS/s.ParameterGen.java com/sun/tools/corba/se/idl/SCCS/s.ParseException.java com/sun/tools/corba/se/idl/SCCS/s.Parser.java com/sun/tools/corba/se/idl/SCCS/s.PragmaEntry.java com/sun/tools/corba/se/idl/SCCS/s.PragmaGen.java com/sun/tools/corba/se/idl/SCCS/s.PragmaHandler.java com/sun/tools/corba/se/idl/SCCS/s.Preprocessor.java com/sun/tools/corba/se/idl/SCCS/s.PrimitiveEntry.java com/sun/tools/corba/se/idl/SCCS/s.PrimitiveGen.java com/sun/tools/corba/se/idl/SCCS/s.RepositoryID.java com/sun/tools/corba/se/idl/SCCS/s.Scanner.java com/sun/tools/corba/se/idl/SCCS/s.SequenceGen.java com/sun/tools/corba/se/idl/SCCS/s.ValueRepositoryId.java com/sun/tools/corba/se/idl/SCCS/s.SequenceEntry.java com/sun/tools/corba/se/idl/SCCS/s.StringEntry.java com/sun/tools/corba/se/idl/SCCS/s.StringGen.java com/sun/tools/corba/se/idl/SCCS/s.StructEntry.java com/sun/tools/corba/se/idl/SCCS/s.StructGen.java com/sun/tools/corba/se/idl/SCCS/s.SymtabEntry.java com/sun/tools/corba/se/idl/SCCS/s.SymtabFactory.java com/sun/tools/corba/se/idl/SCCS/s.Token.java com/sun/tools/corba/se/idl/SCCS/s.TokenBuffer.java com/sun/tools/corba/se/idl/SCCS/s.TypedefEntry.java com/sun/tools/corba/se/idl/SCCS/s.TypedefGen.java com/sun/tools/corba/se/idl/SCCS/s.UnionBranch.java com/sun/tools/corba/se/idl/SCCS/s.UnionEntry.java com/sun/tools/corba/se/idl/SCCS/s.UnionGen.java com/sun/tools/corba/se/idl/SCCS/s.Util.java com/sun/tools/corba/se/idl/SCCS/s.ValueBoxEntry.java com/sun/tools/corba/se/idl/SCCS/s.ValueBoxGen.java com/sun/tools/corba/se/idl/SCCS/s.ValueEntry.java com/sun/tools/corba/se/idl/SCCS/s.ValueGen.java com/sun/tools/corba/se/idl/SCCS/s.follow.set com/sun/tools/corba/se/idl/SCCS/s.first.set com/sun/tools/corba/se/idl/SCCS/s.grammar.idl com/sun/tools/corba/se/idl/SCCS/s.grammar3.idl com/sun/tools/corba/se/idl/SCCS/s.idl.prp com/sun/tools/corba/se/idl/SCCS/s.idl_ja.prp com/sun/tools/corba/se/idl/SCCS/s.ir.idl com/sun/tools/corba/se/idl/SCCS/s.keywords com/sun/tools/corba/se/idl/SCCS/s.orb.idl com/sun/tools/corba/se/idl/constExpr com/sun/tools/corba/se/idl/constExpr/SCCS com/sun/tools/corba/se/idl/constExpr/SCCS/s.BinaryExpr.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.And.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.DefaultExprFactory.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.BooleanAnd.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.BooleanNot.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.BooleanOr.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.ExprFactory.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Divide.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Equal.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.EvaluationException.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Expression.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.GreaterEqual.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.GreaterThan.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.LessEqual.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.LessThan.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Minus.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Modulo.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Negative.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Not.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.NotEqual.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Or.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Plus.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Positive.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.ShiftLeft.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.ShiftRight.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Terminal.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Times.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.UnaryExpr.java com/sun/tools/corba/se/idl/constExpr/SCCS/s.Xor.java com/sun/tools/corba/se/idl/constExpr/BinaryExpr.java com/sun/tools/corba/se/idl/constExpr/And.java com/sun/tools/corba/se/idl/constExpr/DefaultExprFactory.java com/sun/tools/corba/se/idl/constExpr/BooleanAnd.java com/sun/tools/corba/se/idl/constExpr/BooleanNot.java com/sun/tools/corba/se/idl/constExpr/BooleanOr.java com/sun/tools/corba/se/idl/constExpr/ExprFactory.java com/sun/tools/corba/se/idl/constExpr/Divide.java com/sun/tools/corba/se/idl/constExpr/Equal.java com/sun/tools/corba/se/idl/constExpr/Or.java com/sun/tools/corba/se/idl/constExpr/EvaluationException.java com/sun/tools/corba/se/idl/constExpr/Expression.java com/sun/tools/corba/se/idl/constExpr/GreaterEqual.java com/sun/tools/corba/se/idl/constExpr/GreaterThan.java com/sun/tools/corba/se/idl/constExpr/LessEqual.java com/sun/tools/corba/se/idl/constExpr/LessThan.java com/sun/tools/corba/se/idl/constExpr/Minus.java com/sun/tools/corba/se/idl/constExpr/Modulo.java com/sun/tools/corba/se/idl/constExpr/Negative.java com/sun/tools/corba/se/idl/constExpr/Not.java com/sun/tools/corba/se/idl/constExpr/NotEqual.java com/sun/tools/corba/se/idl/constExpr/Plus.java com/sun/tools/corba/se/idl/constExpr/Positive.java com/sun/tools/corba/se/idl/constExpr/ShiftLeft.java com/sun/tools/corba/se/idl/constExpr/ShiftRight.java com/sun/tools/corba/se/idl/constExpr/Terminal.java com/sun/tools/corba/se/idl/constExpr/Times.java com/sun/tools/corba/se/idl/constExpr/UnaryExpr.java com/sun/tools/corba/se/idl/constExpr/Xor.java com/sun/tools/corba/se/idl/som com/sun/tools/corba/se/idl/som/cff com/sun/tools/corba/se/idl/som/cff/SCCS com/sun/tools/corba/se/idl/som/cff/SCCS/s.FileLocator.java com/sun/tools/corba/se/idl/som/cff/SCCS/s.Messages.java com/sun/tools/corba/se/idl/som/cff/FileLocator.java com/sun/tools/corba/se/idl/som/cff/Messages.java com/sun/tools/corba/se/idl/som/idlemit com/sun/tools/corba/se/idl/som/idlemit/SCCS com/sun/tools/corba/se/idl/som/idlemit/SCCS/s.MetaPragma.java com/sun/tools/corba/se/idl/som/idlemit/MetaPragma.java com/sun/tools/corba/se/idl/toJavaPortable com/sun/tools/corba/se/idl/toJavaPortable/SCCS com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.AttributeGen24.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.Arguments.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.AttributeGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.DefaultFactory.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.AuxGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.Compile.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.ConstGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.ForwardValueGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.EnumGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.ExceptionGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.Factories.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.GenFactory.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.Helper.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.Helper24.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.Holder.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.InterfaceGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.JavaGenerator.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.Skeleton.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.MethodGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.MethodGen24.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.MethodGenClone24.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.ModuleGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.NameModifier.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.NameModifierImpl.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.NativeGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.PrimitiveGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.SequenceGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.StringGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.StructGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.Stub.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.TCOffsets.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.TypedefGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.UnionGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.Util.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.ValueBoxGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.ValueBoxGen24.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.ValueFactory.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.ValueGen.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.ValueGen24.java com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.toJavaPortable.prp com/sun/tools/corba/se/idl/toJavaPortable/SCCS/s.toJavaPortable_ja.prp com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen.java com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen24.java com/sun/tools/corba/se/idl/toJavaPortable/AuxGen.java com/sun/tools/corba/se/idl/toJavaPortable/Compile.java com/sun/tools/corba/se/idl/toJavaPortable/ConstGen.java com/sun/tools/corba/se/idl/toJavaPortable/DefaultFactory.java com/sun/tools/corba/se/idl/toJavaPortable/EnumGen.java com/sun/tools/corba/se/idl/toJavaPortable/ExceptionGen.java com/sun/tools/corba/se/idl/toJavaPortable/Factories.java com/sun/tools/corba/se/idl/toJavaPortable/ForwardValueGen.java com/sun/tools/corba/se/idl/toJavaPortable/GenFactory.java com/sun/tools/corba/se/idl/toJavaPortable/Helper.java com/sun/tools/corba/se/idl/toJavaPortable/Helper24.java com/sun/tools/corba/se/idl/toJavaPortable/Holder.java com/sun/tools/corba/se/idl/toJavaPortable/InterfaceGen.java com/sun/tools/corba/se/idl/toJavaPortable/JavaGenerator.java com/sun/tools/corba/se/idl/toJavaPortable/MethodGen.java com/sun/tools/corba/se/idl/toJavaPortable/Stub.java com/sun/tools/corba/se/idl/toJavaPortable/MethodGen24.java com/sun/tools/corba/se/idl/toJavaPortable/MethodGenClone24.java com/sun/tools/corba/se/idl/toJavaPortable/ModuleGen.java com/sun/tools/corba/se/idl/toJavaPortable/NameModifier.java com/sun/tools/corba/se/idl/toJavaPortable/NameModifierImpl.java com/sun/tools/corba/se/idl/toJavaPortable/NativeGen.java com/sun/tools/corba/se/idl/toJavaPortable/PrimitiveGen.java com/sun/tools/corba/se/idl/toJavaPortable/SequenceGen.java com/sun/tools/corba/se/idl/toJavaPortable/Skeleton.java com/sun/tools/corba/se/idl/toJavaPortable/StringGen.java com/sun/tools/corba/se/idl/toJavaPortable/StructGen.java com/sun/tools/corba/se/idl/toJavaPortable/TCOffsets.java com/sun/tools/corba/se/idl/toJavaPortable/TypedefGen.java com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java com/sun/tools/corba/se/idl/toJavaPortable/Util.java com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen.java com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen24.java com/sun/tools/corba/se/idl/toJavaPortable/ValueGen.java com/sun/tools/corba/se/idl/toJavaPortable/ValueFactory.java com/sun/tools/corba/se/idl/toJavaPortable/ValueGen24.java com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp com/sun/tools/corba/se/idl/AttributeEntry.java com/sun/tools/corba/se/idl/Arguments.java com/sun/tools/corba/se/idl/DefaultSymtabFactory.java com/sun/tools/corba/se/idl/AttributeGen.java com/sun/tools/corba/se/idl/Comment.java com/sun/tools/corba/se/idl/Compile.java com/sun/tools/corba/se/idl/ConstEntry.java com/sun/tools/corba/se/idl/ConstGen.java com/sun/tools/corba/se/idl/EnumEntry.java com/sun/tools/corba/se/idl/EnumGen.java com/sun/tools/corba/se/idl/ExceptionEntry.java com/sun/tools/corba/se/idl/ExceptionGen.java com/sun/tools/corba/se/idl/Factories.java com/sun/tools/corba/se/idl/ForwardEntry.java com/sun/tools/corba/se/idl/IncludeEntry.java com/sun/tools/corba/se/idl/IDLID.java com/sun/tools/corba/se/idl/ForwardGen.java com/sun/tools/corba/se/idl/ForwardValueEntry.java com/sun/tools/corba/se/idl/ForwardValueGen.java com/sun/tools/corba/se/idl/GenFactory.java com/sun/tools/corba/se/idl/GenFileStream.java com/sun/tools/corba/se/idl/Generator.java com/sun/tools/corba/se/idl/InterfaceEntry.java com/sun/tools/corba/se/idl/IncludeGen.java com/sun/tools/corba/se/idl/idl.prp com/sun/tools/corba/se/idl/InterfaceGen.java com/sun/tools/corba/se/idl/InterfaceState.java com/sun/tools/corba/se/idl/InterfaceType.java com/sun/tools/corba/se/idl/InvalidArgument.java com/sun/tools/corba/se/idl/InvalidCharacter.java com/sun/tools/corba/se/idl/MethodEntry.java com/sun/tools/corba/se/idl/MethodGen.java com/sun/tools/corba/se/idl/ModuleEntry.java com/sun/tools/corba/se/idl/ModuleGen.java com/sun/tools/corba/se/idl/NativeEntry.java com/sun/tools/corba/se/idl/NativeGen.java com/sun/tools/corba/se/idl/NoPragma.java com/sun/tools/corba/se/idl/Noop.java com/sun/tools/corba/se/idl/ParameterEntry.java com/sun/tools/corba/se/idl/ParameterGen.java com/sun/tools/corba/se/idl/ParseException.java com/sun/tools/corba/se/idl/Parser.java com/sun/tools/corba/se/idl/PragmaEntry.java com/sun/tools/corba/se/idl/PragmaGen.java com/sun/tools/corba/se/idl/PragmaHandler.java com/sun/tools/corba/se/idl/Preprocessor.java com/sun/tools/corba/se/idl/PrimitiveEntry.java com/sun/tools/corba/se/idl/PrimitiveGen.java com/sun/tools/corba/se/idl/RepositoryID.java com/sun/tools/corba/se/idl/ResourceBundleUtil.java com/sun/tools/corba/se/idl/Scanner.java com/sun/tools/corba/se/idl/SequenceEntry.java com/sun/tools/corba/se/idl/SequenceGen.java com/sun/tools/corba/se/idl/StringEntry.java com/sun/tools/corba/se/idl/StringGen.java com/sun/tools/corba/se/idl/StructEntry.java com/sun/tools/corba/se/idl/StructGen.java com/sun/tools/corba/se/idl/SymtabEntry.java com/sun/tools/corba/se/idl/SymtabFactory.java com/sun/tools/corba/se/idl/Token.java com/sun/tools/corba/se/idl/TokenBuffer.java com/sun/tools/corba/se/idl/TypedefEntry.java com/sun/tools/corba/se/idl/TypedefGen.java com/sun/tools/corba/se/idl/UnionBranch.java com/sun/tools/corba/se/idl/UnionEntry.java com/sun/tools/corba/se/idl/UnionGen.java com/sun/tools/corba/se/idl/Util.java com/sun/tools/corba/se/idl/ValueBoxEntry.java com/sun/tools/corba/se/idl/ValueBoxGen.java com/sun/tools/corba/se/idl/ValueEntry.java com/sun/tools/corba/se/idl/ValueGen.java com/sun/tools/corba/se/idl/ValueRepositoryId.java com/sun/tools/corba/se/idl/first.set com/sun/tools/corba/se/idl/follow.set com/sun/tools/corba/se/idl/grammar.idl com/sun/tools/corba/se/idl/grammar3.idl com/sun/tools/corba/se/idl/idl_ja.prp com/sun/tools/corba/se/idl/ir.idl com/sun/tools/corba/se/idl/keywords com/sun/tools/corba/se/idl/orb.idl com/sun/tools/corba/se/logutil com/sun/tools/corba/se/logutil/SCCS com/sun/tools/corba/se/logutil/SCCS/s.IndentingPrintWriter.java com/sun/tools/corba/se/logutil/SCCS/s.Makefile com/sun/tools/corba/se/logutil/SCCS/s.StringUtil.java com/sun/tools/corba/se/logutil/lib com/sun/tools/corba/se/logutil/lib/SCCS com/sun/tools/corba/se/logutil/lib/SCCS/s.jschemelogutil.jar com/sun/tools/corba/se/logutil/lib/SCCS/s.jscheme.jar com/sun/tools/corba/se/logutil/lib/jschemelogutil.jar com/sun/tools/corba/se/logutil/lib/jscheme.jar com/sun/tools/corba/se/logutil/scripts com/sun/tools/corba/se/logutil/scripts/SCCS com/sun/tools/corba/se/logutil/scripts/SCCS/s.mc.scm com/sun/tools/corba/se/logutil/scripts/SCCS/s.mc com/sun/tools/corba/se/logutil/scripts/SCCS/s.run com/sun/tools/corba/se/logutil/scripts/mc.scm com/sun/tools/corba/se/logutil/scripts/mc com/sun/tools/corba/se/logutil/scripts/run com/sun/tools/corba/se/logutil/IndentingPrintWriter.java com/sun/tools/corba/se/logutil/Makefile com/sun/tools/corba/se/logutil/StringUtil.java com/sun/tools/doclets com/sun/tools/doclets/SCCS com/sun/tools/doclets/SCCS/s.Taglet.java com/sun/tools/doclets/SCCS/s.package.html com/sun/tools/doclets/formats com/sun/tools/doclets/formats/html com/sun/tools/doclets/formats/html/SCCS com/sun/tools/doclets/formats/html/SCCS/s.AnnotationTypeOptionalMemberWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.AbstractExecutableMemberWriter.java com/sun/tools/doclets/formats/html/SCCS/s.AbstractIndexWriter.java com/sun/tools/doclets/formats/html/SCCS/s.AbstractMemberWriter.java com/sun/tools/doclets/formats/html/SCCS/s.AbstractPackageIndexWriter.java com/sun/tools/doclets/formats/html/SCCS/s.AbstractTreeWriter.java com/sun/tools/doclets/formats/html/SCCS/s.AllClassesFrameWriter.java com/sun/tools/doclets/formats/html/SCCS/s.HtmlDocletWriter.java com/sun/tools/doclets/formats/html/SCCS/s.HelpWriter.java com/sun/tools/doclets/formats/html/SCCS/s.AnnotationTypeRequiredMemberWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.AnnotationTypeWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.ClassUseWriter.java com/sun/tools/doclets/formats/html/SCCS/s.ClassWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.ConfigurationImpl.java com/sun/tools/doclets/formats/html/SCCS/s.ConstantsSummaryWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.ConstructorWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.DeprecatedListWriter.java com/sun/tools/doclets/formats/html/SCCS/s.EnumConstantWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.FieldWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.FrameOutputWriter.java com/sun/tools/doclets/formats/html/SCCS/s.HtmlDoclet.java com/sun/tools/doclets/formats/html/SCCS/s.HtmlSerialFieldWriter.java com/sun/tools/doclets/formats/html/SCCS/s.HtmlSerialMethodWriter.java com/sun/tools/doclets/formats/html/SCCS/s.LinkFactoryImpl.java com/sun/tools/doclets/formats/html/SCCS/s.LinkInfoImpl.java com/sun/tools/doclets/formats/html/SCCS/s.LinkOutputImpl.java com/sun/tools/doclets/formats/html/SCCS/s.MethodWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.NestedClassWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.PackageFrameWriter.java com/sun/tools/doclets/formats/html/SCCS/s.PackageIndexFrameWriter.java com/sun/tools/doclets/formats/html/SCCS/s.PackageIndexWriter.java com/sun/tools/doclets/formats/html/SCCS/s.PackageTreeWriter.java com/sun/tools/doclets/formats/html/SCCS/s.PackageUseWriter.java com/sun/tools/doclets/formats/html/SCCS/s.PackageWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.SerializedFormWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.SingleIndexWriter.java com/sun/tools/doclets/formats/html/SCCS/s.SplitIndexWriter.java com/sun/tools/doclets/formats/html/SCCS/s.StylesheetWriter.java com/sun/tools/doclets/formats/html/SCCS/s.SubWriterHolderWriter.java com/sun/tools/doclets/formats/html/SCCS/s.TagletOutputImpl.java com/sun/tools/doclets/formats/html/SCCS/s.TagletWriterImpl.java com/sun/tools/doclets/formats/html/SCCS/s.TreeWriter.java com/sun/tools/doclets/formats/html/SCCS/s.WriterFactoryImpl.java com/sun/tools/doclets/formats/html/SCCS/s.package.html com/sun/tools/doclets/formats/html/markup com/sun/tools/doclets/formats/html/markup/SCCS com/sun/tools/doclets/formats/html/markup/SCCS/s.HtmlDocWriter.java com/sun/tools/doclets/formats/html/markup/SCCS/s.HtmlWriter.java com/sun/tools/doclets/formats/html/markup/SCCS/s.package.html com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java com/sun/tools/doclets/formats/html/markup/HtmlWriter.java com/sun/tools/doclets/formats/html/markup/package.html com/sun/tools/doclets/formats/html/resources com/sun/tools/doclets/formats/html/resources/SCCS com/sun/tools/doclets/formats/html/resources/SCCS/s.standard_ja.properties com/sun/tools/doclets/formats/html/resources/SCCS/s.standard.properties com/sun/tools/doclets/formats/html/resources/standard_ja.properties com/sun/tools/doclets/formats/html/resources/standard.properties com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java com/sun/tools/doclets/formats/html/AbstractIndexWriter.java com/sun/tools/doclets/formats/html/AbstractMemberWriter.java com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java com/sun/tools/doclets/formats/html/AbstractTreeWriter.java com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java com/sun/tools/doclets/formats/html/ClassUseWriter.java com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java com/sun/tools/doclets/formats/html/ClassWriterImpl.java com/sun/tools/doclets/formats/html/ConfigurationImpl.java com/sun/tools/doclets/formats/html/MethodWriterImpl.java com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java com/sun/tools/doclets/formats/html/DeprecatedListWriter.java com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java com/sun/tools/doclets/formats/html/FieldWriterImpl.java com/sun/tools/doclets/formats/html/FrameOutputWriter.java com/sun/tools/doclets/formats/html/HelpWriter.java com/sun/tools/doclets/formats/html/HtmlDoclet.java com/sun/tools/doclets/formats/html/HtmlDocletWriter.java com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java com/sun/tools/doclets/formats/html/LinkFactoryImpl.java com/sun/tools/doclets/formats/html/LinkInfoImpl.java com/sun/tools/doclets/formats/html/LinkOutputImpl.java com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java com/sun/tools/doclets/formats/html/PackageFrameWriter.java com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java com/sun/tools/doclets/formats/html/PackageIndexWriter.java com/sun/tools/doclets/formats/html/PackageTreeWriter.java com/sun/tools/doclets/formats/html/PackageUseWriter.java com/sun/tools/doclets/formats/html/PackageWriterImpl.java com/sun/tools/doclets/formats/html/SingleIndexWriter.java com/sun/tools/doclets/formats/html/SplitIndexWriter.java com/sun/tools/doclets/formats/html/StylesheetWriter.java com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java com/sun/tools/doclets/formats/html/TagletOutputImpl.java com/sun/tools/doclets/formats/html/TagletWriterImpl.java com/sun/tools/doclets/formats/html/TreeWriter.java com/sun/tools/doclets/formats/html/WriterFactoryImpl.java com/sun/tools/doclets/formats/html/package.html com/sun/tools/doclets/internal com/sun/tools/doclets/internal/toolkit com/sun/tools/doclets/internal/toolkit/SCCS com/sun/tools/doclets/internal/toolkit/SCCS/s.AnnotationTypeWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.AbstractDoclet.java com/sun/tools/doclets/internal/toolkit/SCCS/s.MethodWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.AnnotationTypeOptionalMemberWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.AnnotationTypeRequiredMemberWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.ClassWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.Configuration.java com/sun/tools/doclets/internal/toolkit/SCCS/s.ConstantsSummaryWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.ConstructorWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.EnumConstantWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.FieldWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.MemberSummaryWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.NestedClassWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.PackageSummaryWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.SerializedFormWriter.java com/sun/tools/doclets/internal/toolkit/SCCS/s.WriterFactory.java com/sun/tools/doclets/internal/toolkit/SCCS/s.package.html com/sun/tools/doclets/internal/toolkit/builders com/sun/tools/doclets/internal/toolkit/builders/SCCS com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.AbstractMemberBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.AbstractBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.AnnotationTypeBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.BuilderFactory.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.ClassBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.AnnotationTypeOptionalMemberBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.AnnotationTypeRequiredMemberBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.ConstantsSummaryBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.ConstructorBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.EnumConstantBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.FieldBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.LayoutParser.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.PackageSummaryBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.MemberSummaryBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.MethodBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.SerializedFormBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SCCS/s.package.html com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java com/sun/tools/doclets/internal/toolkit/builders/package.html com/sun/tools/doclets/internal/toolkit/resources com/sun/tools/doclets/internal/toolkit/resources/SCCS com/sun/tools/doclets/internal/toolkit/resources/SCCS/s.doclets.properties com/sun/tools/doclets/internal/toolkit/resources/SCCS/s.doclet.xml com/sun/tools/doclets/internal/toolkit/resources/SCCS/s.doclets_ja.properties com/sun/tools/doclets/internal/toolkit/resources/SCCS/s.inherit.gif com/sun/tools/doclets/internal/toolkit/resources/doclets.properties com/sun/tools/doclets/internal/toolkit/resources/doclet.xml com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties com/sun/tools/doclets/internal/toolkit/resources/inherit.gif com/sun/tools/doclets/internal/toolkit/taglets com/sun/tools/doclets/internal/toolkit/taglets/SCCS com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.BaseExecutableMemberTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.BaseInlineTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.BaseTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.CodeTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.DeprecatedTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.DocRootTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.InheritDocTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.InheritableTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.LegacyTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.LiteralTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.ParamTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.ReturnTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.SeeTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.SimpleTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.Taglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.TagletOutput.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.TagletManager.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.TagletWriter.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.ThrowsTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.ValueTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SCCS/s.package.html com/sun/tools/doclets/internal/toolkit/taglets/Taglet.java com/sun/tools/doclets/internal/toolkit/taglets/BaseExecutableMemberTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/BaseInlineTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/BaseTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/CodeTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/DeprecatedTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/DocRootTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/InheritableTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/LegacyTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/LiteralTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/ReturnTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SeeTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/SimpleTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java com/sun/tools/doclets/internal/toolkit/taglets/TagletOutput.java com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java com/sun/tools/doclets/internal/toolkit/taglets/package.html com/sun/tools/doclets/internal/toolkit/util com/sun/tools/doclets/internal/toolkit/util/SCCS com/sun/tools/doclets/internal/toolkit/util/SCCS/s.CommentedMethodFinder.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.ClassDocCatalog.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.ClassTree.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.ClassUseMapper.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.DeprecatedAPIListBuilder.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.DirectoryManager.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.DocFinder.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.DocletAbortException.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.DocletConstants.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.Extern.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.Group.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.ImplementedMethods.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.IndexBuilder.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.MessageRetriever.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.SourceToHTMLConverter.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.MetaKeywords.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.MethodFinder.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.PackageListWriter.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.SourcePath.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.TaggedMethodFinder.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.TextTag.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.Util.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.VisibleMemberMap.java com/sun/tools/doclets/internal/toolkit/util/SCCS/s.package.html com/sun/tools/doclets/internal/toolkit/util/links com/sun/tools/doclets/internal/toolkit/util/links/SCCS com/sun/tools/doclets/internal/toolkit/util/links/SCCS/s.LinkFactory.java com/sun/tools/doclets/internal/toolkit/util/links/SCCS/s.LinkInfo.java com/sun/tools/doclets/internal/toolkit/util/links/SCCS/s.LinkOutput.java com/sun/tools/doclets/internal/toolkit/util/links/SCCS/s.package.html com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java com/sun/tools/doclets/internal/toolkit/util/links/LinkOutput.java com/sun/tools/doclets/internal/toolkit/util/links/package.html com/sun/tools/doclets/internal/toolkit/util/CommentedMethodFinder.java com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java com/sun/tools/doclets/internal/toolkit/util/ClassTree.java com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java com/sun/tools/doclets/internal/toolkit/util/Extern.java com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java com/sun/tools/doclets/internal/toolkit/util/DocFinder.java com/sun/tools/doclets/internal/toolkit/util/DocletAbortException.java com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java com/sun/tools/doclets/internal/toolkit/util/Group.java com/sun/tools/doclets/internal/toolkit/util/SourceToHTMLConverter.java com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java com/sun/tools/doclets/internal/toolkit/util/MethodFinder.java com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java com/sun/tools/doclets/internal/toolkit/util/SourcePath.java com/sun/tools/doclets/internal/toolkit/util/TaggedMethodFinder.java com/sun/tools/doclets/internal/toolkit/util/TextTag.java com/sun/tools/doclets/internal/toolkit/util/Util.java com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java com/sun/tools/doclets/internal/toolkit/util/package.html com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java com/sun/tools/doclets/internal/toolkit/package.html com/sun/tools/doclets/internal/toolkit/AnnotationTypeOptionalMemberWriter.java com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java com/sun/tools/doclets/internal/toolkit/ClassWriter.java com/sun/tools/doclets/internal/toolkit/Configuration.java com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java com/sun/tools/doclets/internal/toolkit/ConstructorWriter.java com/sun/tools/doclets/internal/toolkit/EnumConstantWriter.java com/sun/tools/doclets/internal/toolkit/FieldWriter.java com/sun/tools/doclets/internal/toolkit/MethodWriter.java com/sun/tools/doclets/internal/toolkit/MemberSummaryWriter.java com/sun/tools/doclets/internal/toolkit/NestedClassWriter.java com/sun/tools/doclets/internal/toolkit/PackageSummaryWriter.java com/sun/tools/doclets/internal/toolkit/SerializedFormWriter.java com/sun/tools/doclets/internal/toolkit/WriterFactory.java com/sun/tools/doclets/standard com/sun/tools/doclets/standard/SCCS com/sun/tools/doclets/standard/SCCS/s.Standard.java com/sun/tools/doclets/standard/Standard.java com/sun/tools/doclets/package.html com/sun/tools/doclets/Taglet.java com/sun/tools/example com/sun/tools/example/SCCS com/sun/tools/example/SCCS/s.README com/sun/tools/example/debug com/sun/tools/example/debug/bdi com/sun/tools/example/debug/bdi/SCCS com/sun/tools/example/debug/bdi/SCCS/s.AmbiguousMethodException.java com/sun/tools/example/debug/bdi/SCCS/s.AccessWatchpointSpec.java com/sun/tools/example/debug/bdi/SCCS/s.BreakpointSpec.java com/sun/tools/example/debug/bdi/SCCS/s.ChildSession.java com/sun/tools/example/debug/bdi/SCCS/s.EvaluationException.java com/sun/tools/example/debug/bdi/SCCS/s.EventRequestSpec.java com/sun/tools/example/debug/bdi/SCCS/s.EventRequestSpecList.java com/sun/tools/example/debug/bdi/SCCS/s.ExceptionSpec.java com/sun/tools/example/debug/bdi/SCCS/s.ExecutionManager.java com/sun/tools/example/debug/bdi/SCCS/s.InputListener.java com/sun/tools/example/debug/bdi/SCCS/s.Session.java com/sun/tools/example/debug/bdi/SCCS/s.SourceNameReferenceTypeSpec.java com/sun/tools/example/debug/bdi/SCCS/s.FrameIndexOutOfBoundsException.java com/sun/tools/example/debug/bdi/SCCS/s.JDIEventSource.java com/sun/tools/example/debug/bdi/SCCS/s.LineBreakpointSpec.java com/sun/tools/example/debug/bdi/SCCS/s.LineNotFoundException.java com/sun/tools/example/debug/bdi/SCCS/s.MalformedMemberNameException.java com/sun/tools/example/debug/bdi/SCCS/s.MethodBreakpointSpec.java com/sun/tools/example/debug/bdi/SCCS/s.MethodNotFoundException.java com/sun/tools/example/debug/bdi/SCCS/s.ModificationWatchpointSpec.java com/sun/tools/example/debug/bdi/SCCS/s.NoSessionException.java com/sun/tools/example/debug/bdi/SCCS/s.NoThreadException.java com/sun/tools/example/debug/bdi/SCCS/s.OutputListener.java com/sun/tools/example/debug/bdi/SCCS/s.ParseException.java com/sun/tools/example/debug/bdi/SCCS/s.PatternReferenceTypeSpec.java com/sun/tools/example/debug/bdi/SCCS/s.ReferenceTypeSpec.java com/sun/tools/example/debug/bdi/SCCS/s.SessionListener.java com/sun/tools/example/debug/bdi/SCCS/s.SpecEvent.java com/sun/tools/example/debug/bdi/SCCS/s.ThreadGroupIterator.java com/sun/tools/example/debug/bdi/SCCS/s.SpecErrorEvent.java com/sun/tools/example/debug/bdi/SCCS/s.SpecListener.java com/sun/tools/example/debug/bdi/SCCS/s.VMLaunchFailureException.java com/sun/tools/example/debug/bdi/SCCS/s.ThreadInfo.java com/sun/tools/example/debug/bdi/SCCS/s.ThreadIterator.java com/sun/tools/example/debug/bdi/SCCS/s.Utils.java com/sun/tools/example/debug/bdi/SCCS/s.VMNotInterruptedException.java com/sun/tools/example/debug/bdi/SCCS/s.WatchpointSpec.java com/sun/tools/example/debug/bdi/AmbiguousMethodException.java com/sun/tools/example/debug/bdi/AccessWatchpointSpec.java com/sun/tools/example/debug/bdi/EvaluationException.java com/sun/tools/example/debug/bdi/BreakpointSpec.java com/sun/tools/example/debug/bdi/ChildSession.java com/sun/tools/example/debug/bdi/FrameIndexOutOfBoundsException.java com/sun/tools/example/debug/bdi/EventRequestSpec.java com/sun/tools/example/debug/bdi/EventRequestSpecList.java com/sun/tools/example/debug/bdi/ExceptionSpec.java com/sun/tools/example/debug/bdi/ExecutionManager.java com/sun/tools/example/debug/bdi/LineBreakpointSpec.java com/sun/tools/example/debug/bdi/InputListener.java com/sun/tools/example/debug/bdi/JDIEventSource.java com/sun/tools/example/debug/bdi/MalformedMemberNameException.java com/sun/tools/example/debug/bdi/LineNotFoundException.java com/sun/tools/example/debug/bdi/MethodNotFoundException.java com/sun/tools/example/debug/bdi/MethodBreakpointSpec.java com/sun/tools/example/debug/bdi/ThreadGroupIterator.java com/sun/tools/example/debug/bdi/ModificationWatchpointSpec.java com/sun/tools/example/debug/bdi/NoSessionException.java com/sun/tools/example/debug/bdi/NoThreadException.java com/sun/tools/example/debug/bdi/OutputListener.java com/sun/tools/example/debug/bdi/ParseException.java com/sun/tools/example/debug/bdi/PatternReferenceTypeSpec.java com/sun/tools/example/debug/bdi/ReferenceTypeSpec.java com/sun/tools/example/debug/bdi/Session.java com/sun/tools/example/debug/bdi/SessionListener.java com/sun/tools/example/debug/bdi/SourceNameReferenceTypeSpec.java com/sun/tools/example/debug/bdi/SpecErrorEvent.java com/sun/tools/example/debug/bdi/SpecEvent.java com/sun/tools/example/debug/bdi/SpecListener.java com/sun/tools/example/debug/bdi/ThreadIterator.java com/sun/tools/example/debug/bdi/ThreadInfo.java com/sun/tools/example/debug/bdi/WatchpointSpec.java com/sun/tools/example/debug/bdi/Utils.java com/sun/tools/example/debug/bdi/VMLaunchFailureException.java com/sun/tools/example/debug/bdi/VMNotInterruptedException.java com/sun/tools/example/debug/event com/sun/tools/example/debug/event/SCCS com/sun/tools/example/debug/event/SCCS/s.AccessWatchpointEventSet.java com/sun/tools/example/debug/event/SCCS/s.AbstractEventSet.java com/sun/tools/example/debug/event/SCCS/s.LocationTriggerEventSet.java com/sun/tools/example/debug/event/SCCS/s.ClassPrepareEventSet.java com/sun/tools/example/debug/event/SCCS/s.ClassUnloadEventSet.java com/sun/tools/example/debug/event/SCCS/s.ExceptionEventSet.java com/sun/tools/example/debug/event/SCCS/s.JDIAdapter.java com/sun/tools/example/debug/event/SCCS/s.JDIListener.java com/sun/tools/example/debug/event/SCCS/s.LocatableEventSet.java com/sun/tools/example/debug/event/SCCS/s.ModificationWatchpointEventSet.java com/sun/tools/example/debug/event/SCCS/s.ThreadDeathEventSet.java com/sun/tools/example/debug/event/SCCS/s.ThreadStartEventSet.java com/sun/tools/example/debug/event/SCCS/s.VMDeathEventSet.java com/sun/tools/example/debug/event/SCCS/s.VMDisconnectEventSet.java com/sun/tools/example/debug/event/SCCS/s.VMStartEventSet.java com/sun/tools/example/debug/event/SCCS/s.WatchpointEventSet.java com/sun/tools/example/debug/event/AccessWatchpointEventSet.java com/sun/tools/example/debug/event/AbstractEventSet.java com/sun/tools/example/debug/event/LocationTriggerEventSet.java com/sun/tools/example/debug/event/ClassPrepareEventSet.java com/sun/tools/example/debug/event/ClassUnloadEventSet.java com/sun/tools/example/debug/event/ExceptionEventSet.java com/sun/tools/example/debug/event/JDIAdapter.java com/sun/tools/example/debug/event/JDIListener.java com/sun/tools/example/debug/event/LocatableEventSet.java com/sun/tools/example/debug/event/ModificationWatchpointEventSet.java com/sun/tools/example/debug/event/ThreadDeathEventSet.java com/sun/tools/example/debug/event/ThreadStartEventSet.java com/sun/tools/example/debug/event/VMDeathEventSet.java com/sun/tools/example/debug/event/VMDisconnectEventSet.java com/sun/tools/example/debug/event/VMStartEventSet.java com/sun/tools/example/debug/event/WatchpointEventSet.java com/sun/tools/example/debug/expr com/sun/tools/example/debug/expr/SCCS com/sun/tools/example/debug/expr/SCCS/s.Expr.jj com/sun/tools/example/debug/expr/SCCS/s.ASCII_UCodeESC_CharStream.java com/sun/tools/example/debug/expr/SCCS/s.LValue.java com/sun/tools/example/debug/expr/SCCS/s.ExpressionParser.java com/sun/tools/example/debug/expr/SCCS/s.ExpressionParserConstants.java com/sun/tools/example/debug/expr/SCCS/s.ExpressionParserTokenManager.java com/sun/tools/example/debug/expr/SCCS/s.ParseException.java com/sun/tools/example/debug/expr/SCCS/s.Token.java com/sun/tools/example/debug/expr/SCCS/s.TokenMgrError.java com/sun/tools/example/debug/expr/Expr.jj com/sun/tools/example/debug/expr/ASCII_UCodeESC_CharStream.java com/sun/tools/example/debug/expr/LValue.java com/sun/tools/example/debug/expr/TokenMgrError.java com/sun/tools/example/debug/expr/Token.java com/sun/tools/example/debug/expr/ExpressionParser.java com/sun/tools/example/debug/expr/ExpressionParserConstants.java com/sun/tools/example/debug/expr/ExpressionParserTokenManager.java com/sun/tools/example/debug/expr/ParseException.java com/sun/tools/example/debug/gui com/sun/tools/example/debug/gui/SCCS com/sun/tools/example/debug/gui/SCCS/s.CommandInterpreter.java com/sun/tools/example/debug/gui/SCCS/s.ApplicationTool.java com/sun/tools/example/debug/gui/SCCS/s.ClassManager.java com/sun/tools/example/debug/gui/SCCS/s.ClassTreeTool.java com/sun/tools/example/debug/gui/SCCS/s.CurrentFrameChangedEvent.java com/sun/tools/example/debug/gui/SCCS/s.CommandTool.java com/sun/tools/example/debug/gui/SCCS/s.ContextListener.java com/sun/tools/example/debug/gui/SCCS/s.ContextManager.java com/sun/tools/example/debug/gui/SCCS/s.JDBFileFilter.java com/sun/tools/example/debug/gui/SCCS/s.Environment.java com/sun/tools/example/debug/gui/SCCS/s.GUI.java com/sun/tools/example/debug/gui/SCCS/s.Icons.java com/sun/tools/example/debug/gui/SCCS/s.SourcepathChangedEvent.java com/sun/tools/example/debug/gui/SCCS/s.JDBMenuBar.java com/sun/tools/example/debug/gui/SCCS/s.JDBToolBar.java com/sun/tools/example/debug/gui/SCCS/s.LaunchTool.java com/sun/tools/example/debug/gui/SCCS/s.MonitorListModel.java com/sun/tools/example/debug/gui/SCCS/s.MonitorTool.java com/sun/tools/example/debug/gui/SCCS/s.OutputSink.java com/sun/tools/example/debug/gui/SCCS/s.SearchPath.java com/sun/tools/example/debug/gui/SCCS/s.SourceListener.java com/sun/tools/example/debug/gui/SCCS/s.SingleLeafTreeSelectionModel.java com/sun/tools/example/debug/gui/SCCS/s.SourceManager.java com/sun/tools/example/debug/gui/SCCS/s.SourceModel.java com/sun/tools/example/debug/gui/SCCS/s.SourceTool.java com/sun/tools/example/debug/gui/SCCS/s.SourceTreeTool.java com/sun/tools/example/debug/gui/SCCS/s.StackTraceTool.java com/sun/tools/example/debug/gui/SCCS/s.ThreadTreeTool.java com/sun/tools/example/debug/gui/SCCS/s.TypeScript.java com/sun/tools/example/debug/gui/SCCS/s.TypeScriptOutputListener.java com/sun/tools/example/debug/gui/SCCS/s.TypeScriptWriter.java com/sun/tools/example/debug/gui/CurrentFrameChangedEvent.java com/sun/tools/example/debug/gui/ApplicationTool.java com/sun/tools/example/debug/gui/ClassManager.java com/sun/tools/example/debug/gui/ClassTreeTool.java com/sun/tools/example/debug/gui/CommandInterpreter.java com/sun/tools/example/debug/gui/CommandTool.java com/sun/tools/example/debug/gui/ContextListener.java com/sun/tools/example/debug/gui/ContextManager.java com/sun/tools/example/debug/gui/Environment.java com/sun/tools/example/debug/gui/GUI.java com/sun/tools/example/debug/gui/Icons.java com/sun/tools/example/debug/gui/JDBFileFilter.java com/sun/tools/example/debug/gui/JDBMenuBar.java com/sun/tools/example/debug/gui/JDBToolBar.java com/sun/tools/example/debug/gui/LaunchTool.java com/sun/tools/example/debug/gui/SourceListener.java com/sun/tools/example/debug/gui/OutputSink.java com/sun/tools/example/debug/gui/MonitorListModel.java com/sun/tools/example/debug/gui/MonitorTool.java com/sun/tools/example/debug/gui/SearchPath.java com/sun/tools/example/debug/gui/SingleLeafTreeSelectionModel.java com/sun/tools/example/debug/gui/SourceManager.java com/sun/tools/example/debug/gui/SourceModel.java com/sun/tools/example/debug/gui/SourceTool.java com/sun/tools/example/debug/gui/SourceTreeTool.java com/sun/tools/example/debug/gui/SourcepathChangedEvent.java com/sun/tools/example/debug/gui/StackTraceTool.java com/sun/tools/example/debug/gui/ThreadTreeTool.java com/sun/tools/example/debug/gui/TypeScript.java com/sun/tools/example/debug/gui/TypeScriptOutputListener.java com/sun/tools/example/debug/gui/TypeScriptWriter.java com/sun/tools/example/debug/tty com/sun/tools/example/debug/tty/SCCS com/sun/tools/example/debug/tty/SCCS/s.AmbiguousMethodException.java com/sun/tools/example/debug/tty/SCCS/s.AccessWatchpointSpec.java com/sun/tools/example/debug/tty/SCCS/s.LineNotFoundException.java com/sun/tools/example/debug/tty/SCCS/s.BreakpointSpec.java com/sun/tools/example/debug/tty/SCCS/s.Commands.java com/sun/tools/example/debug/tty/SCCS/s.Env.java com/sun/tools/example/debug/tty/SCCS/s.EventHandler.java com/sun/tools/example/debug/tty/SCCS/s.EventNotifier.java com/sun/tools/example/debug/tty/SCCS/s.EventRequestSpec.java com/sun/tools/example/debug/tty/SCCS/s.EventRequestSpecList.java com/sun/tools/example/debug/tty/SCCS/s.ExceptionSpec.java com/sun/tools/example/debug/tty/SCCS/s.TTY.java com/sun/tools/example/debug/tty/SCCS/s.MalformedMemberNameException.java com/sun/tools/example/debug/tty/SCCS/s.MessageOutput.java com/sun/tools/example/debug/tty/SCCS/s.ThreadGroupIterator.java com/sun/tools/example/debug/tty/SCCS/s.ModificationWatchpointSpec.java com/sun/tools/example/debug/tty/SCCS/s.PatternReferenceTypeSpec.java com/sun/tools/example/debug/tty/SCCS/s.ReferenceTypeSpec.java com/sun/tools/example/debug/tty/SCCS/s.SourceMapper.java com/sun/tools/example/debug/tty/SCCS/s.TTYResources.java com/sun/tools/example/debug/tty/SCCS/s.TTYResources_ja.java com/sun/tools/example/debug/tty/SCCS/s.ThreadIterator.java com/sun/tools/example/debug/tty/SCCS/s.ThreadInfo.java com/sun/tools/example/debug/tty/SCCS/s.VMConnection.java com/sun/tools/example/debug/tty/SCCS/s.WatchpointSpec.java com/sun/tools/example/debug/tty/SCCS/s.VMNotConnectedException.java com/sun/tools/example/debug/tty/AmbiguousMethodException.java com/sun/tools/example/debug/tty/AccessWatchpointSpec.java com/sun/tools/example/debug/tty/EventRequestSpecList.java com/sun/tools/example/debug/tty/BreakpointSpec.java com/sun/tools/example/debug/tty/Commands.java com/sun/tools/example/debug/tty/Env.java com/sun/tools/example/debug/tty/EventHandler.java com/sun/tools/example/debug/tty/EventNotifier.java com/sun/tools/example/debug/tty/EventRequestSpec.java com/sun/tools/example/debug/tty/LineNotFoundException.java com/sun/tools/example/debug/tty/ExceptionSpec.java com/sun/tools/example/debug/tty/TTY.java com/sun/tools/example/debug/tty/MalformedMemberNameException.java com/sun/tools/example/debug/tty/MessageOutput.java com/sun/tools/example/debug/tty/VMNotConnectedException.java com/sun/tools/example/debug/tty/ModificationWatchpointSpec.java com/sun/tools/example/debug/tty/PatternReferenceTypeSpec.java com/sun/tools/example/debug/tty/ReferenceTypeSpec.java com/sun/tools/example/debug/tty/SourceMapper.java com/sun/tools/example/debug/tty/TTYResources.java com/sun/tools/example/debug/tty/TTYResources_ja.java com/sun/tools/example/debug/tty/ThreadGroupIterator.java com/sun/tools/example/debug/tty/ThreadInfo.java com/sun/tools/example/debug/tty/ThreadIterator.java com/sun/tools/example/debug/tty/VMConnection.java com/sun/tools/example/debug/tty/WatchpointSpec.java com/sun/tools/example/doc com/sun/tools/example/doc/SCCS com/sun/tools/example/doc/SCCS/s.index.html com/sun/tools/example/doc/SCCS/s.javadt.html com/sun/tools/example/doc/SCCS/s.jdb.html com/sun/tools/example/doc/SCCS/s.trace.html com/sun/tools/example/doc/index.html com/sun/tools/example/doc/javadt.html com/sun/tools/example/doc/jdb.html com/sun/tools/example/doc/trace.html com/sun/tools/example/trace com/sun/tools/example/trace/SCCS com/sun/tools/example/trace/SCCS/s.StreamRedirectThread.java com/sun/tools/example/trace/SCCS/s.EventThread.java com/sun/tools/example/trace/SCCS/s.Trace.java com/sun/tools/example/trace/StreamRedirectThread.java com/sun/tools/example/trace/EventThread.java com/sun/tools/example/trace/Trace.java com/sun/tools/example/README com/sun/tools/extcheck com/sun/tools/extcheck/SCCS com/sun/tools/extcheck/SCCS/s.ExtCheck.java com/sun/tools/extcheck/SCCS/s.Main.java com/sun/tools/extcheck/ExtCheck.java com/sun/tools/extcheck/Main.java com/sun/tools/javac com/sun/tools/javac/SCCS com/sun/tools/javac/SCCS/s.Main.java com/sun/tools/javac/code com/sun/tools/javac/code/SCCS com/sun/tools/javac/code/SCCS/s.Attribute.java com/sun/tools/javac/code/SCCS/s.BoundKind.java com/sun/tools/javac/code/SCCS/s.Flags.java com/sun/tools/javac/code/SCCS/s.Kinds.java com/sun/tools/javac/code/SCCS/s.Scope.java com/sun/tools/javac/code/SCCS/s.Source.java com/sun/tools/javac/code/SCCS/s.Symbol.java com/sun/tools/javac/code/SCCS/s.Symtab.java com/sun/tools/javac/code/SCCS/s.Type.java com/sun/tools/javac/code/SCCS/s.TypeTags.java com/sun/tools/javac/code/SCCS/s.Types.java com/sun/tools/javac/code/Attribute.java com/sun/tools/javac/code/BoundKind.java com/sun/tools/javac/code/Flags.java com/sun/tools/javac/code/Kinds.java com/sun/tools/javac/code/Scope.java com/sun/tools/javac/code/Source.java com/sun/tools/javac/code/Symbol.java com/sun/tools/javac/code/Symtab.java com/sun/tools/javac/code/Type.java com/sun/tools/javac/code/TypeTags.java com/sun/tools/javac/code/Types.java com/sun/tools/javac/comp com/sun/tools/javac/comp/SCCS com/sun/tools/javac/comp/SCCS/s.AttrContext.java com/sun/tools/javac/comp/SCCS/s.Annotate.java com/sun/tools/javac/comp/SCCS/s.Attr.java com/sun/tools/javac/comp/SCCS/s.AttrContextEnv.java com/sun/tools/javac/comp/SCCS/s.Check.java com/sun/tools/javac/comp/SCCS/s.ConstFold.java com/sun/tools/javac/comp/SCCS/s.Enter.java com/sun/tools/javac/comp/SCCS/s.Env.java com/sun/tools/javac/comp/SCCS/s.Flow.java com/sun/tools/javac/comp/SCCS/s.Infer.java com/sun/tools/javac/comp/SCCS/s.Lower.java com/sun/tools/javac/comp/SCCS/s.MemberEnter.java com/sun/tools/javac/comp/SCCS/s.Resolve.java com/sun/tools/javac/comp/SCCS/s.Todo.java com/sun/tools/javac/comp/SCCS/s.TransTypes.java com/sun/tools/javac/comp/AttrContext.java com/sun/tools/javac/comp/Annotate.java com/sun/tools/javac/comp/Attr.java com/sun/tools/javac/comp/AttrContextEnv.java com/sun/tools/javac/comp/Check.java com/sun/tools/javac/comp/ConstFold.java com/sun/tools/javac/comp/Enter.java com/sun/tools/javac/comp/Env.java com/sun/tools/javac/comp/Flow.java com/sun/tools/javac/comp/Infer.java com/sun/tools/javac/comp/Lower.java com/sun/tools/javac/comp/MemberEnter.java com/sun/tools/javac/comp/Resolve.java com/sun/tools/javac/comp/Todo.java com/sun/tools/javac/comp/TransTypes.java com/sun/tools/javac/jvm com/sun/tools/javac/jvm/SCCS com/sun/tools/javac/jvm/SCCS/s.UninitializedType.java com/sun/tools/javac/jvm/SCCS/s.ByteCodes.java com/sun/tools/javac/jvm/SCCS/s.CRTFlags.java com/sun/tools/javac/jvm/SCCS/s.CRTable.java com/sun/tools/javac/jvm/SCCS/s.ClassFile.java com/sun/tools/javac/jvm/SCCS/s.ClassReader.java com/sun/tools/javac/jvm/SCCS/s.ClassWriter.java com/sun/tools/javac/jvm/SCCS/s.Code.java com/sun/tools/javac/jvm/SCCS/s.Gen.java com/sun/tools/javac/jvm/SCCS/s.Items.java com/sun/tools/javac/jvm/SCCS/s.Pool.java com/sun/tools/javac/jvm/SCCS/s.Target.java com/sun/tools/javac/jvm/ClassReader.java com/sun/tools/javac/jvm/ByteCodes.java com/sun/tools/javac/jvm/CRTFlags.java com/sun/tools/javac/jvm/CRTable.java com/sun/tools/javac/jvm/ClassFile.java com/sun/tools/javac/jvm/ClassWriter.java com/sun/tools/javac/jvm/Code.java com/sun/tools/javac/jvm/Gen.java com/sun/tools/javac/jvm/Items.java com/sun/tools/javac/jvm/Pool.java com/sun/tools/javac/jvm/Target.java com/sun/tools/javac/jvm/UninitializedType.java com/sun/tools/javac/main com/sun/tools/javac/main/SCCS com/sun/tools/javac/main/SCCS/s.CommandLine.java com/sun/tools/javac/main/SCCS/s.JavaCompiler.java com/sun/tools/javac/main/SCCS/s.Main.java com/sun/tools/javac/main/CommandLine.java com/sun/tools/javac/main/JavaCompiler.java com/sun/tools/javac/main/Main.java com/sun/tools/javac/parser com/sun/tools/javac/parser/SCCS com/sun/tools/javac/parser/SCCS/s.Keywords.java com/sun/tools/javac/parser/SCCS/s.Parser.java com/sun/tools/javac/parser/SCCS/s.Scanner.java com/sun/tools/javac/parser/SCCS/s.Tokens.java com/sun/tools/javac/parser/SCCS/s.EndPosParser.java com/sun/tools/javac/parser/Keywords.java com/sun/tools/javac/parser/Parser.java com/sun/tools/javac/parser/Scanner.java com/sun/tools/javac/parser/Tokens.java com/sun/tools/javac/parser/EndPosParser.java com/sun/tools/javac/resources com/sun/tools/javac/resources/SCCS com/sun/tools/javac/resources/SCCS/s.compiler_ja.properties com/sun/tools/javac/resources/SCCS/s.compiler.properties com/sun/tools/javac/resources/SCCS/s.javac.properties com/sun/tools/javac/resources/SCCS/s.javac_ja.properties com/sun/tools/javac/resources/compiler_ja.properties com/sun/tools/javac/resources/compiler.properties com/sun/tools/javac/resources/javac.properties com/sun/tools/javac/resources/javac_ja.properties com/sun/tools/javac/tree com/sun/tools/javac/tree/SCCS com/sun/tools/javac/tree/SCCS/s.TreeMaker.java com/sun/tools/javac/tree/SCCS/s.Pretty.java com/sun/tools/javac/tree/SCCS/s.Tree.java com/sun/tools/javac/tree/SCCS/s.TreeInfo.java com/sun/tools/javac/tree/SCCS/s.TreeScanner.java com/sun/tools/javac/tree/SCCS/s.TreeTranslator.java com/sun/tools/javac/tree/TreeInfo.java com/sun/tools/javac/tree/Pretty.java com/sun/tools/javac/tree/Tree.java com/sun/tools/javac/tree/TreeMaker.java com/sun/tools/javac/tree/TreeScanner.java com/sun/tools/javac/tree/TreeTranslator.java com/sun/tools/javac/util com/sun/tools/javac/util/SCCS com/sun/tools/javac/util/SCCS/s.ByteBuffer.java com/sun/tools/javac/util/SCCS/s.Abort.java com/sun/tools/javac/util/SCCS/s.Bits.java com/sun/tools/javac/util/SCCS/s.LayoutCharacters.java com/sun/tools/javac/util/SCCS/s.Context.java com/sun/tools/javac/util/SCCS/s.Convert.java com/sun/tools/javac/util/SCCS/s.Diagnostic.java com/sun/tools/javac/util/SCCS/s.FatalError.java com/sun/tools/javac/util/SCCS/s.FileEntry.java com/sun/tools/javac/util/SCCS/s.ListBuffer.java com/sun/tools/javac/util/SCCS/s.List.java com/sun/tools/javac/util/SCCS/s.Log.java com/sun/tools/javac/util/SCCS/s.Name.java com/sun/tools/javac/util/SCCS/s.Options.java com/sun/tools/javac/util/SCCS/s.Pair.java com/sun/tools/javac/util/SCCS/s.Paths.java com/sun/tools/javac/util/SCCS/s.Position.java com/sun/tools/javac/util/SCCS/s.Warner.java com/sun/tools/javac/util/SCCS/s.MandatoryWarningHandler.java com/sun/tools/javac/util/ByteBuffer.java com/sun/tools/javac/util/Abort.java com/sun/tools/javac/util/Bits.java com/sun/tools/javac/util/LayoutCharacters.java com/sun/tools/javac/util/Context.java com/sun/tools/javac/util/Convert.java com/sun/tools/javac/util/Diagnostic.java com/sun/tools/javac/util/FatalError.java com/sun/tools/javac/util/FileEntry.java com/sun/tools/javac/util/List.java com/sun/tools/javac/util/ListBuffer.java com/sun/tools/javac/util/Log.java com/sun/tools/javac/util/Name.java com/sun/tools/javac/util/Options.java com/sun/tools/javac/util/Pair.java com/sun/tools/javac/util/Paths.java com/sun/tools/javac/util/Position.java com/sun/tools/javac/util/Warner.java com/sun/tools/javac/util/MandatoryWarningHandler.java com/sun/tools/javac/Main.java com/sun/tools/javadoc com/sun/tools/javadoc/SCCS com/sun/tools/javadoc/SCCS/s.AnnotationDescImpl.java com/sun/tools/javadoc/SCCS/s.AbstractTypeImpl.java com/sun/tools/javadoc/SCCS/s.JavadocClassReader.java com/sun/tools/javadoc/SCCS/s.AnnotationTypeDocImpl.java com/sun/tools/javadoc/SCCS/s.AnnotationTypeElementDocImpl.java com/sun/tools/javadoc/SCCS/s.AnnotationValueImpl.java com/sun/tools/javadoc/SCCS/s.ClassDocImpl.java com/sun/tools/javadoc/SCCS/s.Comment.java com/sun/tools/javadoc/SCCS/s.ConstructorDocImpl.java com/sun/tools/javadoc/SCCS/s.DocEnv.java com/sun/tools/javadoc/SCCS/s.DocImpl.java com/sun/tools/javadoc/SCCS/s.DocLocale.java com/sun/tools/javadoc/SCCS/s.DocletInvoker.java com/sun/tools/javadoc/SCCS/s.ExecutableMemberDocImpl.java com/sun/tools/javadoc/SCCS/s.FieldDocImpl.java com/sun/tools/javadoc/SCCS/s.JavadocMemberEnter.java com/sun/tools/javadoc/SCCS/s.JavadocEnter.java com/sun/tools/javadoc/SCCS/s.MemberDocImpl.java com/sun/tools/javadoc/SCCS/s.JavadocTodo.java com/sun/tools/javadoc/SCCS/s.JavadocTool.java com/sun/tools/javadoc/SCCS/s.Main.java com/sun/tools/javadoc/SCCS/s.MethodDocImpl.java com/sun/tools/javadoc/SCCS/s.Messager.java com/sun/tools/javadoc/SCCS/s.ParameterizedTypeImpl.java com/sun/tools/javadoc/SCCS/s.ModifierFilter.java com/sun/tools/javadoc/SCCS/s.PackageDocImpl.java com/sun/tools/javadoc/SCCS/s.ParamTagImpl.java com/sun/tools/javadoc/SCCS/s.ParameterImpl.java com/sun/tools/javadoc/SCCS/s.PrimitiveType.java com/sun/tools/javadoc/SCCS/s.ProgramElementDocImpl.java com/sun/tools/javadoc/SCCS/s.RootDocImpl.java com/sun/tools/javadoc/SCCS/s.SeeTagImpl.java com/sun/tools/javadoc/SCCS/s.SerialFieldTagImpl.java com/sun/tools/javadoc/SCCS/s.SerializedForm.java com/sun/tools/javadoc/SCCS/s.SourcePositionImpl.java com/sun/tools/javadoc/SCCS/s.Start.java com/sun/tools/javadoc/SCCS/s.TagImpl.java com/sun/tools/javadoc/SCCS/s.ThrowsTagImpl.java com/sun/tools/javadoc/SCCS/s.TypeMaker.java com/sun/tools/javadoc/SCCS/s.TypeVariableImpl.java com/sun/tools/javadoc/SCCS/s.WildcardTypeImpl.java com/sun/tools/javadoc/SCCS/s.DocCommentScanner.java com/sun/tools/javadoc/resources com/sun/tools/javadoc/resources/SCCS com/sun/tools/javadoc/resources/SCCS/s.javadoc.properties com/sun/tools/javadoc/resources/SCCS/s.javadoc_ja.properties com/sun/tools/javadoc/resources/javadoc_ja.properties com/sun/tools/javadoc/resources/javadoc.properties com/sun/tools/javadoc/AnnotationTypeDocImpl.java com/sun/tools/javadoc/AbstractTypeImpl.java com/sun/tools/javadoc/AnnotationDescImpl.java com/sun/tools/javadoc/DocEnv.java com/sun/tools/javadoc/AnnotationTypeElementDocImpl.java com/sun/tools/javadoc/AnnotationValueImpl.java com/sun/tools/javadoc/ClassDocImpl.java com/sun/tools/javadoc/Comment.java com/sun/tools/javadoc/ConstructorDocImpl.java com/sun/tools/javadoc/DocImpl.java com/sun/tools/javadoc/DocLocale.java com/sun/tools/javadoc/DocletInvoker.java com/sun/tools/javadoc/MemberDocImpl.java com/sun/tools/javadoc/Main.java com/sun/tools/javadoc/ExecutableMemberDocImpl.java com/sun/tools/javadoc/FieldDocImpl.java com/sun/tools/javadoc/JavadocClassReader.java com/sun/tools/javadoc/JavadocEnter.java com/sun/tools/javadoc/JavadocMemberEnter.java com/sun/tools/javadoc/JavadocTodo.java com/sun/tools/javadoc/JavadocTool.java com/sun/tools/javadoc/MethodDocImpl.java com/sun/tools/javadoc/Messager.java com/sun/tools/javadoc/ParameterizedTypeImpl.java com/sun/tools/javadoc/ModifierFilter.java com/sun/tools/javadoc/PackageDocImpl.java com/sun/tools/javadoc/ParamTagImpl.java com/sun/tools/javadoc/ParameterImpl.java com/sun/tools/javadoc/ProgramElementDocImpl.java com/sun/tools/javadoc/PrimitiveType.java com/sun/tools/javadoc/RootDocImpl.java com/sun/tools/javadoc/SeeTagImpl.java com/sun/tools/javadoc/Start.java com/sun/tools/javadoc/SerialFieldTagImpl.java com/sun/tools/javadoc/SerializedForm.java com/sun/tools/javadoc/SourcePositionImpl.java com/sun/tools/javadoc/TagImpl.java com/sun/tools/javadoc/ThrowsTagImpl.java com/sun/tools/javadoc/TypeMaker.java com/sun/tools/javadoc/TypeVariableImpl.java com/sun/tools/javadoc/WildcardTypeImpl.java com/sun/tools/javadoc/DocCommentScanner.java com/sun/tools/javah com/sun/tools/javah/SCCS com/sun/tools/javah/SCCS/s.MainDoclet.java com/sun/tools/javah/SCCS/s.Gen.java com/sun/tools/javah/SCCS/s.JNI.java com/sun/tools/javah/SCCS/s.LLNI.java com/sun/tools/javah/SCCS/s.Main.java com/sun/tools/javah/SCCS/s.TypeSignature.java com/sun/tools/javah/SCCS/s.Mangle.java com/sun/tools/javah/SCCS/s.Util.java com/sun/tools/javah/oldjavah com/sun/tools/javah/oldjavah/SCCS com/sun/tools/javah/oldjavah/SCCS/s.Mangle.java com/sun/tools/javah/oldjavah/SCCS/s.Gen.java com/sun/tools/javah/oldjavah/SCCS/s.JNI.java com/sun/tools/javah/oldjavah/SCCS/s.LLNI.java com/sun/tools/javah/oldjavah/SCCS/s.Main.java com/sun/tools/javah/oldjavah/SCCS/s.JavahEnvironment.java com/sun/tools/javah/oldjavah/SCCS/s.OldHeaders.java com/sun/tools/javah/oldjavah/SCCS/s.OldStubs.java com/sun/tools/javah/oldjavah/SCCS/s.Util.java com/sun/tools/javah/oldjavah/resources com/sun/tools/javah/oldjavah/resources/SCCS com/sun/tools/javah/oldjavah/resources/SCCS/s.Linux_sparc.properties com/sun/tools/javah/oldjavah/resources/SCCS/s.Linux_ppc.properties com/sun/tools/javah/oldjavah/resources/SCCS/s.SunOS_sparc.properties com/sun/tools/javah/oldjavah/resources/SCCS/s.SunOS_sparcv9.properties com/sun/tools/javah/oldjavah/resources/SCCS/s.l10n.properties com/sun/tools/javah/oldjavah/resources/SCCS/s.l10n_ja.properties com/sun/tools/javah/oldjavah/resources/SCCS/s.win32_x86.properties com/sun/tools/javah/oldjavah/resources/SunOS_sparcv9.properties com/sun/tools/javah/oldjavah/resources/Linux_ppc.properties com/sun/tools/javah/oldjavah/resources/Linux_sparc.properties com/sun/tools/javah/oldjavah/resources/SunOS_sparc.properties com/sun/tools/javah/oldjavah/resources/win32_x86.properties com/sun/tools/javah/oldjavah/resources/l10n.properties com/sun/tools/javah/oldjavah/resources/l10n_ja.properties com/sun/tools/javah/oldjavah/OldHeaders.java com/sun/tools/javah/oldjavah/Gen.java com/sun/tools/javah/oldjavah/JNI.java com/sun/tools/javah/oldjavah/LLNI.java com/sun/tools/javah/oldjavah/Main.java com/sun/tools/javah/oldjavah/JavahEnvironment.java com/sun/tools/javah/oldjavah/Mangle.java com/sun/tools/javah/oldjavah/OldStubs.java com/sun/tools/javah/oldjavah/Util.java com/sun/tools/javah/resources com/sun/tools/javah/resources/SCCS com/sun/tools/javah/resources/SCCS/s.Linux_sparc.properties com/sun/tools/javah/resources/SCCS/s.Linux_ppc.properties com/sun/tools/javah/resources/SCCS/s.SunOS_sparc.properties com/sun/tools/javah/resources/SCCS/s.SunOS_sparcv9.properties com/sun/tools/javah/resources/SCCS/s.l10n.properties com/sun/tools/javah/resources/SCCS/s.l10n_ja.properties com/sun/tools/javah/resources/SCCS/s.win32_x86.properties com/sun/tools/javah/resources/SunOS_sparcv9.properties com/sun/tools/javah/resources/Linux_ppc.properties com/sun/tools/javah/resources/Linux_sparc.properties com/sun/tools/javah/resources/SunOS_sparc.properties com/sun/tools/javah/resources/win32_x86.properties com/sun/tools/javah/resources/l10n.properties com/sun/tools/javah/resources/l10n_ja.properties com/sun/tools/javah/MainDoclet.java com/sun/tools/javah/Gen.java com/sun/tools/javah/JNI.java com/sun/tools/javah/LLNI.java com/sun/tools/javah/Main.java com/sun/tools/javah/TypeSignature.java com/sun/tools/javah/Mangle.java com/sun/tools/javah/Util.java com/sun/tools/jdi com/sun/tools/jdi/META-INF com/sun/tools/jdi/META-INF/services com/sun/tools/jdi/META-INF/services/SCCS com/sun/tools/jdi/META-INF/services/SCCS/s.com.sun.jdi.connect.Connector com/sun/tools/jdi/META-INF/services/SCCS/s.com.sun.jdi.connect.spi.TransportService com/sun/tools/jdi/META-INF/services/com.sun.jdi.connect.Connector com/sun/tools/jdi/META-INF/services/com.sun.jdi.connect.spi.TransportService com/sun/tools/jdi/SCCS com/sun/tools/jdi/SCCS/s.ArrayReferenceImpl.java com/sun/tools/jdi/SCCS/s.AbstractLauncher.java com/sun/tools/jdi/SCCS/s.ClassLoaderReferenceImpl.java com/sun/tools/jdi/SCCS/s.ArrayTypeImpl.java com/sun/tools/jdi/SCCS/s.BaseLineInfo.java com/sun/tools/jdi/SCCS/s.BooleanTypeImpl.java com/sun/tools/jdi/SCCS/s.BooleanValueImpl.java com/sun/tools/jdi/SCCS/s.ByteTypeImpl.java com/sun/tools/jdi/SCCS/s.ByteValueImpl.java com/sun/tools/jdi/SCCS/s.CharTypeImpl.java com/sun/tools/jdi/SCCS/s.CharValueImpl.java com/sun/tools/jdi/SCCS/s.ClassObjectReferenceImpl.java com/sun/tools/jdi/SCCS/s.ClassTypeImpl.java com/sun/tools/jdi/SCCS/s.Packet.java com/sun/tools/jdi/SCCS/s.PrimitiveTypeImpl.java com/sun/tools/jdi/SCCS/s.CommandSender.java com/sun/tools/jdi/SCCS/s.ConcreteMethodImpl.java com/sun/tools/jdi/SCCS/s.ConnectorImpl.java com/sun/tools/jdi/SCCS/s.DoubleTypeImpl.java com/sun/tools/jdi/SCCS/s.DoubleValueImpl.java com/sun/tools/jdi/SCCS/s.EventQueueImpl.java com/sun/tools/jdi/SCCS/s.EventRequestManagerImpl.java com/sun/tools/jdi/SCCS/s.EventSetImpl.java com/sun/tools/jdi/SCCS/s.FieldImpl.java com/sun/tools/jdi/SCCS/s.FloatTypeImpl.java com/sun/tools/jdi/SCCS/s.FloatValueImpl.java com/sun/tools/jdi/SCCS/s.GenericAttachingConnector.java com/sun/tools/jdi/SCCS/s.GenericListeningConnector.java com/sun/tools/jdi/SCCS/s.IntegerTypeImpl.java com/sun/tools/jdi/SCCS/s.IntegerValueImpl.java com/sun/tools/jdi/SCCS/s.InterfaceTypeImpl.java com/sun/tools/jdi/SCCS/s.InternalEventHandler.java com/sun/tools/jdi/SCCS/s.JDWPException.java com/sun/tools/jdi/SCCS/s.JNITypeParser.java com/sun/tools/jdi/SCCS/s.LineInfo.java com/sun/tools/jdi/SCCS/s.LinkedHashMap.java com/sun/tools/jdi/SCCS/s.LocalVariableImpl.java com/sun/tools/jdi/SCCS/s.LocationImpl.java com/sun/tools/jdi/SCCS/s.LockObject.java com/sun/tools/jdi/SCCS/s.LongTypeImpl.java com/sun/tools/jdi/SCCS/s.LongValueImpl.java com/sun/tools/jdi/SCCS/s.MethodImpl.java com/sun/tools/jdi/SCCS/s.MirrorImpl.java com/sun/tools/jdi/SCCS/s.NonConcreteMethodImpl.java com/sun/tools/jdi/SCCS/s.ObjectReferenceImpl.java com/sun/tools/jdi/SCCS/s.ObsoleteMethodImpl.java com/sun/tools/jdi/SCCS/s.PacketStream.java com/sun/tools/jdi/SCCS/s.RawCommandLineLauncher.java com/sun/tools/jdi/SCCS/s.PrimitiveValueImpl.java com/sun/tools/jdi/SCCS/s.SharedMemoryTransportService.java com/sun/tools/jdi/SCCS/s.ReferenceTypeImpl.java com/sun/tools/jdi/SCCS/s.SDE.java com/sun/tools/jdi/SCCS/s.TargetVM.java com/sun/tools/jdi/SCCS/s.SharedMemoryAttachingConnector.java com/sun/tools/jdi/SCCS/s.SharedMemoryListeningConnector.java com/sun/tools/jdi/SCCS/s.ShortTypeImpl.java com/sun/tools/jdi/SCCS/s.ShortValueImpl.java com/sun/tools/jdi/SCCS/s.SocketAttachingConnector.java com/sun/tools/jdi/SCCS/s.SocketListeningConnector.java com/sun/tools/jdi/SCCS/s.VirtualMachineManagerImpl.java com/sun/tools/jdi/SCCS/s.SocketTransportService.java com/sun/tools/jdi/SCCS/s.StackFrameImpl.java com/sun/tools/jdi/SCCS/s.StratumLineInfo.java com/sun/tools/jdi/SCCS/s.StringReferenceImpl.java com/sun/tools/jdi/SCCS/s.SunCommandLineLauncher.java com/sun/tools/jdi/SCCS/s.ThreadAction.java com/sun/tools/jdi/SCCS/s.ThreadListener.java com/sun/tools/jdi/SCCS/s.ThreadGroupReferenceImpl.java com/sun/tools/jdi/SCCS/s.ThreadReferenceImpl.java com/sun/tools/jdi/SCCS/s.TypeComponentImpl.java com/sun/tools/jdi/SCCS/s.TypeImpl.java com/sun/tools/jdi/SCCS/s.VMAction.java com/sun/tools/jdi/SCCS/s.VMListener.java com/sun/tools/jdi/SCCS/s.VMModifiers.java com/sun/tools/jdi/SCCS/s.VMState.java com/sun/tools/jdi/SCCS/s.ValueContainer.java com/sun/tools/jdi/SCCS/s.ValueImpl.java com/sun/tools/jdi/SCCS/s.VirtualMachineImpl.java com/sun/tools/jdi/SCCS/s.VirtualMachineManagerService.java com/sun/tools/jdi/SCCS/s.VoidTypeImpl.java com/sun/tools/jdi/SCCS/s.VoidValueImpl.java com/sun/tools/jdi/resources com/sun/tools/jdi/resources/SCCS com/sun/tools/jdi/resources/SCCS/s.jdi.properties com/sun/tools/jdi/resources/SCCS/s.jdi_ja.properties com/sun/tools/jdi/resources/jdi_ja.properties com/sun/tools/jdi/resources/jdi.properties com/sun/tools/jdi/ClassLoaderReferenceImpl.java com/sun/tools/jdi/AbstractLauncher.java com/sun/tools/jdi/ArrayReferenceImpl.java com/sun/tools/jdi/ArrayTypeImpl.java com/sun/tools/jdi/BaseLineInfo.java com/sun/tools/jdi/BooleanTypeImpl.java com/sun/tools/jdi/BooleanValueImpl.java com/sun/tools/jdi/ByteTypeImpl.java com/sun/tools/jdi/ByteValueImpl.java com/sun/tools/jdi/CharTypeImpl.java com/sun/tools/jdi/CharValueImpl.java com/sun/tools/jdi/Packet.java com/sun/tools/jdi/ClassObjectReferenceImpl.java com/sun/tools/jdi/PrimitiveTypeImpl.java com/sun/tools/jdi/ClassTypeImpl.java com/sun/tools/jdi/CommandSender.java com/sun/tools/jdi/ConcreteMethodImpl.java com/sun/tools/jdi/ConnectorImpl.java com/sun/tools/jdi/DoubleTypeImpl.java com/sun/tools/jdi/DoubleValueImpl.java com/sun/tools/jdi/EventQueueImpl.java com/sun/tools/jdi/EventRequestManagerImpl.java com/sun/tools/jdi/EventSetImpl.java com/sun/tools/jdi/FieldImpl.java com/sun/tools/jdi/FloatTypeImpl.java com/sun/tools/jdi/FloatValueImpl.java com/sun/tools/jdi/GenericAttachingConnector.java com/sun/tools/jdi/GenericListeningConnector.java com/sun/tools/jdi/IntegerTypeImpl.java com/sun/tools/jdi/IntegerValueImpl.java com/sun/tools/jdi/InterfaceTypeImpl.java com/sun/tools/jdi/InternalEventHandler.java com/sun/tools/jdi/JDWPException.java com/sun/tools/jdi/JNITypeParser.java com/sun/tools/jdi/LineInfo.java com/sun/tools/jdi/LinkedHashMap.java com/sun/tools/jdi/LocalVariableImpl.java com/sun/tools/jdi/LocationImpl.java com/sun/tools/jdi/LockObject.java com/sun/tools/jdi/LongTypeImpl.java com/sun/tools/jdi/LongValueImpl.java com/sun/tools/jdi/MethodImpl.java com/sun/tools/jdi/MirrorImpl.java com/sun/tools/jdi/NonConcreteMethodImpl.java com/sun/tools/jdi/ObjectReferenceImpl.java com/sun/tools/jdi/ObsoleteMethodImpl.java com/sun/tools/jdi/PacketStream.java com/sun/tools/jdi/RawCommandLineLauncher.java com/sun/tools/jdi/PrimitiveValueImpl.java com/sun/tools/jdi/ReferenceTypeImpl.java com/sun/tools/jdi/SDE.java com/sun/tools/jdi/ShortTypeImpl.java com/sun/tools/jdi/StackFrameImpl.java com/sun/tools/jdi/SharedMemoryAttachingConnector.java com/sun/tools/jdi/SharedMemoryListeningConnector.java com/sun/tools/jdi/SharedMemoryTransportService.java com/sun/tools/jdi/ShortValueImpl.java com/sun/tools/jdi/SocketAttachingConnector.java com/sun/tools/jdi/SocketListeningConnector.java com/sun/tools/jdi/SocketTransportService.java com/sun/tools/jdi/TargetVM.java com/sun/tools/jdi/ThreadReferenceImpl.java com/sun/tools/jdi/StratumLineInfo.java com/sun/tools/jdi/StringReferenceImpl.java com/sun/tools/jdi/SunCommandLineLauncher.java com/sun/tools/jdi/ThreadAction.java com/sun/tools/jdi/ThreadListener.java com/sun/tools/jdi/ThreadGroupReferenceImpl.java com/sun/tools/jdi/TypeComponentImpl.java com/sun/tools/jdi/TypeImpl.java com/sun/tools/jdi/VMAction.java com/sun/tools/jdi/VMListener.java com/sun/tools/jdi/VMModifiers.java com/sun/tools/jdi/VMState.java com/sun/tools/jdi/ValueContainer.java com/sun/tools/jdi/ValueImpl.java com/sun/tools/jdi/VirtualMachineImpl.java com/sun/tools/jdi/VirtualMachineManagerImpl.java com/sun/tools/jdi/VoidTypeImpl.java com/sun/tools/jdi/VirtualMachineManagerService.java com/sun/tools/jdi/VoidValueImpl.java com/sun/tools/jdwpgen com/sun/tools/jdwpgen/SCCS com/sun/tools/jdwpgen/SCCS/s.AbstractSimpleTypeNode.java com/sun/tools/jdwpgen/SCCS/s.AbstractCommandNode.java com/sun/tools/jdwpgen/SCCS/s.AbstractGroupNode.java com/sun/tools/jdwpgen/SCCS/s.AbstractNamedNode.java com/sun/tools/jdwpgen/SCCS/s.AbstractSimpleNode.java com/sun/tools/jdwpgen/SCCS/s.ClassLoaderObjectTypeNode.java com/sun/tools/jdwpgen/SCCS/s.AbstractTypeListNode.java com/sun/tools/jdwpgen/SCCS/s.AbstractTypeNode.java com/sun/tools/jdwpgen/SCCS/s.AltNode.java com/sun/tools/jdwpgen/SCCS/s.ArrayObjectTypeNode.java com/sun/tools/jdwpgen/SCCS/s.ArrayRegionTypeNode.java com/sun/tools/jdwpgen/SCCS/s.ArrayTypeNode.java com/sun/tools/jdwpgen/SCCS/s.BooleanTypeNode.java com/sun/tools/jdwpgen/SCCS/s.ByteTypeNode.java com/sun/tools/jdwpgen/SCCS/s.ThreadGroupObjectTypeNode.java com/sun/tools/jdwpgen/SCCS/s.ClassObjectTypeNode.java com/sun/tools/jdwpgen/SCCS/s.ClassTypeNode.java com/sun/tools/jdwpgen/SCCS/s.CommandNode.java com/sun/tools/jdwpgen/SCCS/s.CommandSetNode.java com/sun/tools/jdwpgen/SCCS/s.CommentNode.java com/sun/tools/jdwpgen/SCCS/s.ConstantNode.java com/sun/tools/jdwpgen/SCCS/s.ConstantSetNode.java com/sun/tools/jdwpgen/SCCS/s.Context.java com/sun/tools/jdwpgen/SCCS/s.ErrorNode.java com/sun/tools/jdwpgen/SCCS/s.ErrorSetNode.java com/sun/tools/jdwpgen/SCCS/s.EventNode.java com/sun/tools/jdwpgen/SCCS/s.FieldTypeNode.java com/sun/tools/jdwpgen/SCCS/s.FrameTypeNode.java com/sun/tools/jdwpgen/SCCS/s.GroupNode.java com/sun/tools/jdwpgen/SCCS/s.IntTypeNode.java com/sun/tools/jdwpgen/SCCS/s.Main.java com/sun/tools/jdwpgen/SCCS/s.InterfaceTypeNode.java com/sun/tools/jdwpgen/SCCS/s.LocationTypeNode.java com/sun/tools/jdwpgen/SCCS/s.LongTypeNode.java com/sun/tools/jdwpgen/SCCS/s.MethodTypeNode.java com/sun/tools/jdwpgen/SCCS/s.NameNode.java com/sun/tools/jdwpgen/SCCS/s.NameValueNode.java com/sun/tools/jdwpgen/SCCS/s.Node.java com/sun/tools/jdwpgen/SCCS/s.ObjectTypeNode.java com/sun/tools/jdwpgen/SCCS/s.OutNode.java com/sun/tools/jdwpgen/SCCS/s.Parse.java com/sun/tools/jdwpgen/SCCS/s.ReferenceIDTypeNode.java com/sun/tools/jdwpgen/SCCS/s.ReferenceTypeNode.java com/sun/tools/jdwpgen/SCCS/s.RepeatNode.java com/sun/tools/jdwpgen/SCCS/s.ReplyNode.java com/sun/tools/jdwpgen/SCCS/s.RootNode.java com/sun/tools/jdwpgen/SCCS/s.jdwp.spec com/sun/tools/jdwpgen/SCCS/s.SelectNode.java com/sun/tools/jdwpgen/SCCS/s.TypeNode.java com/sun/tools/jdwpgen/SCCS/s.StringObjectTypeNode.java com/sun/tools/jdwpgen/SCCS/s.StringTypeNode.java com/sun/tools/jdwpgen/SCCS/s.TaggedObjectTypeNode.java com/sun/tools/jdwpgen/SCCS/s.UntaggedValueTypeNode.java com/sun/tools/jdwpgen/SCCS/s.ThreadObjectTypeNode.java com/sun/tools/jdwpgen/SCCS/s.ValueTypeNode.java com/sun/tools/jdwpgen/AbstractCommandNode.java com/sun/tools/jdwpgen/AbstractGroupNode.java com/sun/tools/jdwpgen/AbstractNamedNode.java com/sun/tools/jdwpgen/AbstractSimpleNode.java com/sun/tools/jdwpgen/AbstractSimpleTypeNode.java com/sun/tools/jdwpgen/AbstractTypeListNode.java com/sun/tools/jdwpgen/AbstractTypeNode.java com/sun/tools/jdwpgen/AltNode.java com/sun/tools/jdwpgen/ArrayObjectTypeNode.java com/sun/tools/jdwpgen/ArrayRegionTypeNode.java com/sun/tools/jdwpgen/ArrayTypeNode.java com/sun/tools/jdwpgen/BooleanTypeNode.java com/sun/tools/jdwpgen/ByteTypeNode.java com/sun/tools/jdwpgen/MethodTypeNode.java com/sun/tools/jdwpgen/Main.java com/sun/tools/jdwpgen/ClassLoaderObjectTypeNode.java com/sun/tools/jdwpgen/ClassObjectTypeNode.java com/sun/tools/jdwpgen/ClassTypeNode.java com/sun/tools/jdwpgen/CommandNode.java com/sun/tools/jdwpgen/CommandSetNode.java com/sun/tools/jdwpgen/CommentNode.java com/sun/tools/jdwpgen/ConstantNode.java com/sun/tools/jdwpgen/ConstantSetNode.java com/sun/tools/jdwpgen/Context.java com/sun/tools/jdwpgen/ErrorNode.java com/sun/tools/jdwpgen/ErrorSetNode.java com/sun/tools/jdwpgen/EventNode.java com/sun/tools/jdwpgen/FieldTypeNode.java com/sun/tools/jdwpgen/FrameTypeNode.java com/sun/tools/jdwpgen/GroupNode.java com/sun/tools/jdwpgen/IntTypeNode.java com/sun/tools/jdwpgen/InterfaceTypeNode.java com/sun/tools/jdwpgen/NameNode.java com/sun/tools/jdwpgen/LocationTypeNode.java com/sun/tools/jdwpgen/LongTypeNode.java com/sun/tools/jdwpgen/NameValueNode.java com/sun/tools/jdwpgen/ObjectTypeNode.java com/sun/tools/jdwpgen/Node.java com/sun/tools/jdwpgen/ReferenceTypeNode.java com/sun/tools/jdwpgen/OutNode.java com/sun/tools/jdwpgen/Parse.java com/sun/tools/jdwpgen/jdwp.spec com/sun/tools/jdwpgen/ReferenceIDTypeNode.java com/sun/tools/jdwpgen/RepeatNode.java com/sun/tools/jdwpgen/ReplyNode.java com/sun/tools/jdwpgen/RootNode.java com/sun/tools/jdwpgen/SelectNode.java com/sun/tools/jdwpgen/StringObjectTypeNode.java com/sun/tools/jdwpgen/StringTypeNode.java com/sun/tools/jdwpgen/TaggedObjectTypeNode.java com/sun/tools/jdwpgen/ThreadGroupObjectTypeNode.java com/sun/tools/jdwpgen/ThreadObjectTypeNode.java com/sun/tools/jdwpgen/TypeNode.java com/sun/tools/jdwpgen/UntaggedValueTypeNode.java com/sun/tools/jdwpgen/ValueTypeNode.java com/sun/tools/extractor com/sun/tools/extractor/SCCS com/sun/tools/extractor/SCCS/s.KeyedInputStream.java com/sun/tools/extractor/SCCS/s.Extractor.java com/sun/tools/extractor/SCCS/s.Installer.java com/sun/tools/extractor/SCCS/s.Maker.java com/sun/tools/extractor/SCCS/s.manifest com/sun/tools/extractor/KeyedInputStream.java com/sun/tools/extractor/Extractor.java com/sun/tools/extractor/Installer.java com/sun/tools/extractor/Maker.java com/sun/tools/extractor/manifest com/sun/demo com/sun/demo/jvmti com/sun/demo/jvmti/hprof com/sun/demo/jvmti/hprof/SCCS com/sun/demo/jvmti/hprof/SCCS/s.Tracker.java com/sun/demo/jvmti/hprof/Tracker.java java java/applet java/applet/SCCS java/applet/SCCS/s.AppletContext.java java/applet/SCCS/s.Applet.java java/applet/SCCS/s.AppletStub.java java/applet/SCCS/s.AudioClip.java java/applet/SCCS/s.package.html java/applet/AppletContext.java java/applet/Applet.java java/applet/AppletStub.java java/applet/AudioClip.java java/applet/package.html java/awt java/awt/SCCS java/awt/SCCS/s.AWTException.java java/awt/SCCS/s.AWTError.java java/awt/SCCS/s.AWTEvent.java java/awt/SCCS/s.AWTEventMulticaster.java java/awt/SCCS/s.AWTKeyStroke.java java/awt/SCCS/s.AWTPermission.java java/awt/SCCS/s.ActiveEvent.java java/awt/SCCS/s.Adjustable.java java/awt/SCCS/s.AlphaComposite.java java/awt/SCCS/s.AttributeValue.java java/awt/SCCS/s.BasicStroke.java java/awt/SCCS/s.BorderLayout.java java/awt/SCCS/s.BufferCapabilities.java java/awt/SCCS/s.Button.java java/awt/SCCS/s.Canvas.java java/awt/SCCS/s.Dimension.java java/awt/SCCS/s.Dialog.java java/awt/SCCS/s.CardLayout.java java/awt/SCCS/s.Checkbox.java java/awt/SCCS/s.CheckboxGroup.java java/awt/SCCS/s.CheckboxMenuItem.java java/awt/SCCS/s.Choice.java java/awt/SCCS/s.Color.java java/awt/SCCS/s.ColorPaintContext.java java/awt/SCCS/s.Component.java java/awt/SCCS/s.ComponentOrientation.java java/awt/SCCS/s.Composite.java java/awt/SCCS/s.CompositeContext.java java/awt/SCCS/s.Conditional.java java/awt/SCCS/s.Container.java java/awt/SCCS/s.Cursor.java java/awt/SCCS/s.ContainerOrderFocusTraversalPolicy.java java/awt/SCCS/s.DefaultFocusTraversalPolicy.java java/awt/SCCS/s.DefaultKeyboardFocusManager.java java/awt/SCCS/s.EventDispatchThread.java java/awt/SCCS/s.DisplayMode.java java/awt/SCCS/s.Event.java java/awt/SCCS/s.FocusTraversalPolicy.java java/awt/SCCS/s.EventQueue.java java/awt/SCCS/s.FileDialog.java java/awt/SCCS/s.FlowLayout.java java/awt/SCCS/s.FontMetrics.java java/awt/SCCS/s.Font.java java/awt/SCCS/s.FontFormatException.java java/awt/SCCS/s.Frame.java java/awt/SCCS/s.GradientPaint.java java/awt/SCCS/s.GradientPaintContext.java java/awt/SCCS/s.Graphics.java java/awt/SCCS/s.ItemSelectable.java java/awt/SCCS/s.Image.java java/awt/SCCS/s.Graphics2D.java java/awt/SCCS/s.GraphicsCallback.java java/awt/SCCS/s.GraphicsConfigTemplate.java java/awt/SCCS/s.GraphicsConfiguration.java java/awt/SCCS/s.GraphicsDevice.java java/awt/SCCS/s.GraphicsEnvironment.java java/awt/SCCS/s.GridBagConstraints.java java/awt/SCCS/s.GridBagLayout.java java/awt/SCCS/s.GridLayout.java java/awt/SCCS/s.HeadlessException.java java/awt/SCCS/s.IllegalComponentStateException.java java/awt/SCCS/s.Insets.java java/awt/SCCS/s.ImageCapabilities.java java/awt/SCCS/s.Label.java java/awt/SCCS/s.ScrollPaneAdjustable.java java/awt/SCCS/s.JobAttributes.java java/awt/SCCS/s.KeyEventDispatcher.java java/awt/SCCS/s.KeyEventPostProcessor.java java/awt/SCCS/s.KeyboardFocusManager.java java/awt/SCCS/s.LayoutManager.java java/awt/SCCS/s.LayoutManager2.java java/awt/SCCS/s.List.java java/awt/SCCS/s.MediaTracker.java java/awt/SCCS/s.Menu.java java/awt/SCCS/s.MenuBar.java java/awt/SCCS/s.MenuComponent.java java/awt/SCCS/s.MenuContainer.java java/awt/SCCS/s.MenuItem.java java/awt/SCCS/s.MenuShortcut.java java/awt/SCCS/s.MouseInfo.java java/awt/SCCS/s.PageAttributes.java java/awt/SCCS/s.Paint.java java/awt/SCCS/s.PaintContext.java java/awt/SCCS/s.Panel.java java/awt/SCCS/s.Point.java java/awt/SCCS/s.PointerInfo.java java/awt/SCCS/s.Polygon.java java/awt/SCCS/s.PopupMenu.java java/awt/SCCS/s.PrintGraphics.java java/awt/SCCS/s.PrintJob.java java/awt/SCCS/s.Rectangle.java java/awt/SCCS/s.RenderingHints.java java/awt/SCCS/s.Robot.java java/awt/SCCS/s.ScrollPane.java java/awt/SCCS/s.SequencedEvent.java java/awt/SCCS/s.Scrollbar.java java/awt/SCCS/s.SentEvent.java java/awt/SCCS/s.Shape.java java/awt/SCCS/s.Stroke.java java/awt/SCCS/s.SystemColor.java java/awt/SCCS/s.TextArea.java java/awt/SCCS/s.TextComponent.java java/awt/SCCS/s.TextField.java java/awt/SCCS/s.TexturePaint.java java/awt/SCCS/s.TexturePaintContext.java java/awt/SCCS/s.Toolkit.java java/awt/SCCS/s.Transparency.java java/awt/SCCS/s.Window.java java/awt/SCCS/s.package.html java/awt/color java/awt/color/SCCS java/awt/color/SCCS/s.ICC_ColorSpace.java java/awt/color/SCCS/s.CMMException.java java/awt/color/SCCS/s.ColorSpace.java java/awt/color/SCCS/s.ProfileDataException.java java/awt/color/SCCS/s.ICC_Profile.java java/awt/color/SCCS/s.ICC_ProfileGray.java java/awt/color/SCCS/s.ICC_ProfileRGB.java java/awt/color/SCCS/s.package.html java/awt/color/ICC_ProfileGray.java java/awt/color/CMMException.java java/awt/color/ColorSpace.java java/awt/color/ICC_ColorSpace.java java/awt/color/ICC_Profile.java java/awt/color/ProfileDataException.java java/awt/color/ICC_ProfileRGB.java java/awt/color/package.html java/awt/datatransfer java/awt/datatransfer/SCCS java/awt/datatransfer/SCCS/s.ClipboardOwner.java java/awt/datatransfer/SCCS/s.Clipboard.java java/awt/datatransfer/SCCS/s.MimeTypeParameterList.java java/awt/datatransfer/SCCS/s.DataFlavor.java java/awt/datatransfer/SCCS/s.FlavorEvent.java java/awt/datatransfer/SCCS/s.FlavorListener.java java/awt/datatransfer/SCCS/s.FlavorMap.java java/awt/datatransfer/SCCS/s.FlavorTable.java java/awt/datatransfer/SCCS/s.MimeType.java java/awt/datatransfer/SCCS/s.MimeTypeParseException.java java/awt/datatransfer/SCCS/s.StringSelection.java java/awt/datatransfer/SCCS/s.SystemFlavorMap.java java/awt/datatransfer/SCCS/s.Transferable.java java/awt/datatransfer/SCCS/s.package.html java/awt/datatransfer/SCCS/s.UnsupportedFlavorException.java java/awt/datatransfer/ClipboardOwner.java java/awt/datatransfer/Clipboard.java java/awt/datatransfer/MimeTypeParameterList.java java/awt/datatransfer/DataFlavor.java java/awt/datatransfer/FlavorEvent.java java/awt/datatransfer/FlavorListener.java java/awt/datatransfer/FlavorMap.java java/awt/datatransfer/FlavorTable.java java/awt/datatransfer/MimeType.java java/awt/datatransfer/UnsupportedFlavorException.java java/awt/datatransfer/MimeTypeParseException.java java/awt/datatransfer/StringSelection.java java/awt/datatransfer/SystemFlavorMap.java java/awt/datatransfer/Transferable.java java/awt/datatransfer/package.html java/awt/dnd java/awt/dnd/SCCS java/awt/dnd/SCCS/s.DnDEventMulticaster.java java/awt/dnd/SCCS/s.Autoscroll.java java/awt/dnd/SCCS/s.DnDConstants.java java/awt/dnd/SCCS/s.DragGestureListener.java java/awt/dnd/SCCS/s.DragGestureEvent.java java/awt/dnd/SCCS/s.DragGestureRecognizer.java java/awt/dnd/SCCS/s.DragSource.java java/awt/dnd/SCCS/s.DragSourceAdapter.java java/awt/dnd/SCCS/s.DragSourceContext.java java/awt/dnd/SCCS/s.DragSourceDragEvent.java java/awt/dnd/SCCS/s.DragSourceDropEvent.java java/awt/dnd/SCCS/s.DragSourceEvent.java java/awt/dnd/SCCS/s.DragSourceListener.java java/awt/dnd/SCCS/s.InvalidDnDOperationException.java java/awt/dnd/SCCS/s.DragSourceMotionListener.java java/awt/dnd/SCCS/s.DropTarget.java java/awt/dnd/SCCS/s.DropTargetAdapter.java java/awt/dnd/SCCS/s.DropTargetContext.java java/awt/dnd/SCCS/s.DropTargetDragEvent.java java/awt/dnd/SCCS/s.DropTargetDropEvent.java java/awt/dnd/SCCS/s.DropTargetEvent.java java/awt/dnd/SCCS/s.DropTargetListener.java java/awt/dnd/SCCS/s.MouseDragGestureRecognizer.java java/awt/dnd/SCCS/s.SerializationTester.java java/awt/dnd/SCCS/s.package.html java/awt/dnd/peer java/awt/dnd/peer/SCCS java/awt/dnd/peer/SCCS/s.DragSourceContextPeer.java java/awt/dnd/peer/SCCS/s.DropTargetContextPeer.java java/awt/dnd/peer/SCCS/s.DropTargetPeer.java java/awt/dnd/peer/SCCS/s.package.html java/awt/dnd/peer/DragSourceContextPeer.java java/awt/dnd/peer/DropTargetContextPeer.java java/awt/dnd/peer/DropTargetPeer.java java/awt/dnd/peer/package.html java/awt/dnd/DnDConstants.java java/awt/dnd/Autoscroll.java java/awt/dnd/DragSourceMotionListener.java java/awt/dnd/DnDEventMulticaster.java java/awt/dnd/DragGestureEvent.java java/awt/dnd/DragGestureListener.java java/awt/dnd/DragGestureRecognizer.java java/awt/dnd/DragSource.java java/awt/dnd/DragSourceAdapter.java java/awt/dnd/DragSourceContext.java java/awt/dnd/DragSourceDragEvent.java java/awt/dnd/DragSourceDropEvent.java java/awt/dnd/DragSourceEvent.java java/awt/dnd/DragSourceListener.java java/awt/dnd/DropTargetAdapter.java java/awt/dnd/DropTarget.java java/awt/dnd/DropTargetDragEvent.java java/awt/dnd/DropTargetContext.java java/awt/dnd/InvalidDnDOperationException.java java/awt/dnd/DropTargetDropEvent.java java/awt/dnd/DropTargetEvent.java java/awt/dnd/DropTargetListener.java java/awt/dnd/MouseDragGestureRecognizer.java java/awt/dnd/SerializationTester.java java/awt/dnd/package.html java/awt/doc-files java/awt/doc-files/SCCS java/awt/doc-files/SCCS/s.AWTThreadIssues.html java/awt/doc-files/SCCS/s.BorderLayout-1.gif java/awt/doc-files/SCCS/s.Button-1.gif java/awt/doc-files/SCCS/s.Checkbox-1.gif java/awt/doc-files/SCCS/s.CheckboxGroup-1.gif java/awt/doc-files/SCCS/s.Choice-1.gif java/awt/doc-files/SCCS/s.FlowLayout-1.gif java/awt/doc-files/SCCS/s.FocusCycle.gif java/awt/doc-files/SCCS/s.FocusSpec.html java/awt/doc-files/SCCS/s.FontMetrics-1.gif java/awt/doc-files/SCCS/s.GridBagLayout-1.gif java/awt/doc-files/SCCS/s.GridBagLayout-2.gif java/awt/doc-files/SCCS/s.GridLayout-1.gif java/awt/doc-files/SCCS/s.GridLayout-2.gif java/awt/doc-files/SCCS/s.Label-1.gif java/awt/doc-files/SCCS/s.List-1.gif java/awt/doc-files/SCCS/s.MenuBar-1.gif java/awt/doc-files/SCCS/s.MultiScreen.gif java/awt/doc-files/SCCS/s.Scrollbar-1.gif java/awt/doc-files/SCCS/s.Scrollbar-2.gif java/awt/doc-files/SCCS/s.TextArea-1.gif java/awt/doc-files/SCCS/s.TextField-1.gif java/awt/doc-files/AWTThreadIssues.html java/awt/doc-files/BorderLayout-1.gif java/awt/doc-files/Button-1.gif java/awt/doc-files/Checkbox-1.gif java/awt/doc-files/CheckboxGroup-1.gif java/awt/doc-files/Choice-1.gif java/awt/doc-files/FlowLayout-1.gif java/awt/doc-files/FocusCycle.gif java/awt/doc-files/FocusSpec.html java/awt/doc-files/FontMetrics-1.gif java/awt/doc-files/GridBagLayout-1.gif java/awt/doc-files/GridBagLayout-2.gif java/awt/doc-files/GridLayout-1.gif java/awt/doc-files/GridLayout-2.gif java/awt/doc-files/Label-1.gif java/awt/doc-files/List-1.gif java/awt/doc-files/MenuBar-1.gif java/awt/doc-files/MultiScreen.gif java/awt/doc-files/Scrollbar-1.gif java/awt/doc-files/Scrollbar-2.gif java/awt/doc-files/TextArea-1.gif java/awt/doc-files/TextField-1.gif java/awt/event java/awt/event/SCCS java/awt/event/SCCS/s.AWTEventListenerProxy.java java/awt/event/SCCS/s.AWTEventListener.java java/awt/event/SCCS/s.ActionListener.java java/awt/event/SCCS/s.ActionEvent.java java/awt/event/SCCS/s.AdjustmentEvent.java java/awt/event/SCCS/s.AdjustmentListener.java java/awt/event/SCCS/s.ComponentAdapter.java java/awt/event/SCCS/s.ComponentEvent.java java/awt/event/SCCS/s.ComponentListener.java java/awt/event/SCCS/s.ContainerAdapter.java java/awt/event/SCCS/s.ContainerEvent.java java/awt/event/SCCS/s.ContainerListener.java java/awt/event/SCCS/s.FocusAdapter.java java/awt/event/SCCS/s.KeyEvent.java java/awt/event/SCCS/s.MouseListener.java java/awt/event/SCCS/s.FocusEvent.java java/awt/event/SCCS/s.FocusListener.java java/awt/event/SCCS/s.HierarchyBoundsAdapter.java java/awt/event/SCCS/s.HierarchyBoundsListener.java java/awt/event/SCCS/s.HierarchyEvent.java java/awt/event/SCCS/s.HierarchyListener.java java/awt/event/SCCS/s.InputEvent.java java/awt/event/SCCS/s.InputMethodEvent.java java/awt/event/SCCS/s.InputMethodListener.java java/awt/event/SCCS/s.InvocationEvent.java java/awt/event/SCCS/s.ItemEvent.java java/awt/event/SCCS/s.ItemListener.java java/awt/event/SCCS/s.KeyAdapter.java java/awt/event/SCCS/s.KeyListener.java java/awt/event/SCCS/s.MouseAdapter.java java/awt/event/SCCS/s.MouseEvent.java java/awt/event/SCCS/s.MouseMotionAdapter.java java/awt/event/SCCS/s.MouseMotionListener.java java/awt/event/SCCS/s.MouseWheelEvent.java java/awt/event/SCCS/s.MouseWheelListener.java java/awt/event/SCCS/s.NativeLibLoader.java java/awt/event/SCCS/s.PaintEvent.java java/awt/event/SCCS/s.TextEvent.java java/awt/event/SCCS/s.TextListener.java java/awt/event/SCCS/s.WindowAdapter.java java/awt/event/SCCS/s.WindowEvent.java java/awt/event/SCCS/s.WindowFocusListener.java java/awt/event/SCCS/s.WindowListener.java java/awt/event/SCCS/s.WindowStateListener.java java/awt/event/SCCS/s.package.html java/awt/event/AWTEventListenerProxy.java java/awt/event/AWTEventListener.java java/awt/event/ActionEvent.java java/awt/event/ActionListener.java java/awt/event/AdjustmentEvent.java java/awt/event/AdjustmentListener.java java/awt/event/ComponentAdapter.java java/awt/event/ComponentEvent.java java/awt/event/ComponentListener.java java/awt/event/ContainerAdapter.java java/awt/event/ContainerEvent.java java/awt/event/ContainerListener.java java/awt/event/FocusAdapter.java java/awt/event/FocusEvent.java java/awt/event/FocusListener.java java/awt/event/HierarchyBoundsAdapter.java java/awt/event/HierarchyBoundsListener.java java/awt/event/HierarchyEvent.java java/awt/event/HierarchyListener.java java/awt/event/InputEvent.java java/awt/event/InputMethodEvent.java java/awt/event/InputMethodListener.java java/awt/event/InvocationEvent.java java/awt/event/ItemEvent.java java/awt/event/ItemListener.java java/awt/event/KeyAdapter.java java/awt/event/KeyEvent.java java/awt/event/KeyListener.java java/awt/event/MouseAdapter.java java/awt/event/MouseEvent.java java/awt/event/MouseListener.java java/awt/event/MouseMotionAdapter.java java/awt/event/MouseMotionListener.java java/awt/event/MouseWheelEvent.java java/awt/event/MouseWheelListener.java java/awt/event/NativeLibLoader.java java/awt/event/PaintEvent.java java/awt/event/TextEvent.java java/awt/event/TextListener.java java/awt/event/WindowAdapter.java java/awt/event/WindowEvent.java java/awt/event/WindowFocusListener.java java/awt/event/WindowListener.java java/awt/event/WindowStateListener.java java/awt/event/package.html java/awt/font java/awt/font/SCCS java/awt/font/SCCS/s.GlyphJustificationInfo.java java/awt/font/SCCS/s.CharArrayIterator.java java/awt/font/SCCS/s.FontRenderContext.java java/awt/font/SCCS/s.ImageGraphicAttribute.java java/awt/font/SCCS/s.GlyphMetrics.java java/awt/font/SCCS/s.GlyphVector.java java/awt/font/SCCS/s.GraphicAttribute.java java/awt/font/SCCS/s.ShapeGraphicAttribute.java java/awt/font/SCCS/s.LineBreakMeasurer.java java/awt/font/SCCS/s.LineMetrics.java java/awt/font/SCCS/s.MultipleMaster.java java/awt/font/SCCS/s.NumericShaper.java java/awt/font/SCCS/s.OpenType.java java/awt/font/SCCS/s.StyledParagraph.java java/awt/font/SCCS/s.TextLine.java java/awt/font/SCCS/s.TextAttribute.java java/awt/font/SCCS/s.TextHitInfo.java java/awt/font/SCCS/s.TextJustifier.java java/awt/font/SCCS/s.TextLayout.java java/awt/font/SCCS/s.TextMeasurer.java java/awt/font/SCCS/s.TransformAttribute.java java/awt/font/SCCS/s.package.html java/awt/font/GlyphJustificationInfo.java java/awt/font/CharArrayIterator.java java/awt/font/FontRenderContext.java java/awt/font/ImageGraphicAttribute.java java/awt/font/GlyphMetrics.java java/awt/font/GlyphVector.java java/awt/font/GraphicAttribute.java java/awt/font/LineBreakMeasurer.java java/awt/font/LineMetrics.java java/awt/font/MultipleMaster.java java/awt/font/NumericShaper.java java/awt/font/OpenType.java java/awt/font/ShapeGraphicAttribute.java java/awt/font/StyledParagraph.java java/awt/font/TextAttribute.java java/awt/font/TextHitInfo.java java/awt/font/TextJustifier.java java/awt/font/TextLayout.java java/awt/font/TextLine.java java/awt/font/TextMeasurer.java java/awt/font/TransformAttribute.java java/awt/font/package.html java/awt/geom java/awt/geom/SCCS java/awt/geom/SCCS/s.FlatteningPathIterator.java java/awt/geom/SCCS/s.AffineTransform.java java/awt/geom/SCCS/s.Arc2D.java java/awt/geom/SCCS/s.ArcIterator.java java/awt/geom/SCCS/s.Area.java java/awt/geom/SCCS/s.CubicCurve2D.java java/awt/geom/SCCS/s.CubicIterator.java java/awt/geom/SCCS/s.Dimension2D.java java/awt/geom/SCCS/s.Ellipse2D.java java/awt/geom/SCCS/s.EllipseIterator.java java/awt/geom/SCCS/s.GeneralPathIterator.java java/awt/geom/SCCS/s.GeneralPath.java java/awt/geom/SCCS/s.RectangularShape.java java/awt/geom/SCCS/s.IllegalPathStateException.java java/awt/geom/SCCS/s.Line2D.java java/awt/geom/SCCS/s.LineIterator.java java/awt/geom/SCCS/s.PathIterator.java java/awt/geom/SCCS/s.Point2D.java java/awt/geom/SCCS/s.NoninvertibleTransformException.java java/awt/geom/SCCS/s.QuadCurve2D.java java/awt/geom/SCCS/s.QuadIterator.java java/awt/geom/SCCS/s.RectIterator.java java/awt/geom/SCCS/s.Rectangle2D.java java/awt/geom/SCCS/s.RoundRectIterator.java java/awt/geom/SCCS/s.RoundRectangle2D.java java/awt/geom/SCCS/s.package.html java/awt/geom/FlatteningPathIterator.java java/awt/geom/AffineTransform.java java/awt/geom/Arc2D.java java/awt/geom/ArcIterator.java java/awt/geom/Area.java java/awt/geom/CubicCurve2D.java java/awt/geom/CubicIterator.java java/awt/geom/Dimension2D.java java/awt/geom/Ellipse2D.java java/awt/geom/EllipseIterator.java java/awt/geom/GeneralPathIterator.java java/awt/geom/GeneralPath.java java/awt/geom/LineIterator.java java/awt/geom/Line2D.java java/awt/geom/IllegalPathStateException.java java/awt/geom/PathIterator.java java/awt/geom/Point2D.java java/awt/geom/NoninvertibleTransformException.java java/awt/geom/QuadCurve2D.java java/awt/geom/QuadIterator.java java/awt/geom/RectIterator.java java/awt/geom/Rectangle2D.java java/awt/geom/RectangularShape.java java/awt/geom/RoundRectIterator.java java/awt/geom/RoundRectangle2D.java java/awt/geom/package.html java/awt/im java/awt/im/SCCS java/awt/im/SCCS/s.InputMethodHighlight.java java/awt/im/SCCS/s.InputContext.java java/awt/im/SCCS/s.InputMethodRequests.java java/awt/im/SCCS/s.InputSubset.java java/awt/im/SCCS/s.package.html java/awt/im/spi java/awt/im/spi/SCCS java/awt/im/spi/SCCS/s.InputMethodContext.java java/awt/im/spi/SCCS/s.InputMethod.java java/awt/im/spi/SCCS/s.InputMethodDescriptor.java java/awt/im/spi/SCCS/s.package.html java/awt/im/spi/InputMethodContext.java java/awt/im/spi/InputMethod.java java/awt/im/spi/InputMethodDescriptor.java java/awt/im/spi/package.html java/awt/im/InputMethodHighlight.java java/awt/im/InputContext.java java/awt/im/InputMethodRequests.java java/awt/im/InputSubset.java java/awt/im/package.html java/awt/image java/awt/image/SCCS java/awt/image/SCCS/s.AreaAveragingScaleFilter.java java/awt/image/SCCS/s.AffineTransformOp.java java/awt/image/SCCS/s.MultiPixelPackedSampleModel.java java/awt/image/SCCS/s.BandCombineOp.java java/awt/image/SCCS/s.BandedSampleModel.java java/awt/image/SCCS/s.BufferStrategy.java java/awt/image/SCCS/s.BufferedImage.java java/awt/image/SCCS/s.BufferedImageFilter.java java/awt/image/SCCS/s.BufferedImageOp.java java/awt/image/SCCS/s.ByteLookupTable.java java/awt/image/SCCS/s.ColorConvertOp.java java/awt/image/SCCS/s.ColorModel.java java/awt/image/SCCS/s.ComponentColorModel.java java/awt/image/SCCS/s.ComponentSampleModel.java java/awt/image/SCCS/s.ConvolveOp.java java/awt/image/SCCS/s.CropImageFilter.java java/awt/image/SCCS/s.DataBuffer.java java/awt/image/SCCS/s.DataBufferByte.java java/awt/image/SCCS/s.DataBufferDouble.java java/awt/image/SCCS/s.DataBufferFloat.java java/awt/image/SCCS/s.DataBufferInt.java java/awt/image/SCCS/s.DataBufferShort.java java/awt/image/SCCS/s.DataBufferUShort.java java/awt/image/SCCS/s.DirectColorModel.java java/awt/image/SCCS/s.FilteredImageSource.java java/awt/image/SCCS/s.ImageConsumer.java java/awt/image/SCCS/s.ImageFilter.java java/awt/image/SCCS/s.ImageObserver.java java/awt/image/SCCS/s.ImageProducer.java java/awt/image/SCCS/s.ImagingOpException.java java/awt/image/SCCS/s.IndexColorModel.java java/awt/image/SCCS/s.Kernel.java java/awt/image/SCCS/s.LookupOp.java java/awt/image/SCCS/s.LookupTable.java java/awt/image/SCCS/s.MemoryImageSource.java java/awt/image/SCCS/s.PackedColorModel.java java/awt/image/SCCS/s.PixelGrabber.java java/awt/image/SCCS/s.RGBImageFilter.java java/awt/image/SCCS/s.RenderedImage.java java/awt/image/SCCS/s.RasterOp.java java/awt/image/SCCS/s.PixelInterleavedSampleModel.java java/awt/image/SCCS/s.Raster.java java/awt/image/SCCS/s.RasterFormatException.java java/awt/image/SCCS/s.SinglePixelPackedSampleModel.java java/awt/image/SCCS/s.ReplicateScaleFilter.java java/awt/image/SCCS/s.RescaleOp.java java/awt/image/SCCS/s.SampleModel.java java/awt/image/SCCS/s.ShortLookupTable.java java/awt/image/SCCS/s.VolatileImage.java java/awt/image/SCCS/s.TileObserver.java java/awt/image/SCCS/s.WritableRenderedImage.java java/awt/image/SCCS/s.WritableRaster.java java/awt/image/SCCS/s.package.html java/awt/image/renderable java/awt/image/renderable/SCCS java/awt/image/renderable/SCCS/s.package.html java/awt/image/renderable/SCCS/s.ContextualRenderedImageFactory.java java/awt/image/renderable/SCCS/s.ParameterBlock.java java/awt/image/renderable/SCCS/s.RenderContext.java java/awt/image/renderable/SCCS/s.RenderableImage.java java/awt/image/renderable/SCCS/s.RenderableImageOp.java java/awt/image/renderable/SCCS/s.RenderableImageProducer.java java/awt/image/renderable/SCCS/s.RenderedImageFactory.java java/awt/image/renderable/ContextualRenderedImageFactory.java java/awt/image/renderable/ParameterBlock.java java/awt/image/renderable/RenderContext.java java/awt/image/renderable/RenderableImage.java java/awt/image/renderable/RenderableImageOp.java java/awt/image/renderable/RenderableImageProducer.java java/awt/image/renderable/RenderedImageFactory.java java/awt/image/renderable/package.html java/awt/image/AreaAveragingScaleFilter.java java/awt/image/AffineTransformOp.java java/awt/image/BandedSampleModel.java java/awt/image/BandCombineOp.java java/awt/image/BufferedImageFilter.java java/awt/image/BufferStrategy.java java/awt/image/BufferedImage.java java/awt/image/BufferedImageOp.java java/awt/image/ByteLookupTable.java java/awt/image/ColorConvertOp.java java/awt/image/ColorModel.java java/awt/image/ComponentColorModel.java java/awt/image/ConvolveOp.java java/awt/image/Raster.java java/awt/image/RenderedImage.java java/awt/image/ComponentSampleModel.java java/awt/image/CropImageFilter.java java/awt/image/DataBuffer.java java/awt/image/DataBufferByte.java java/awt/image/DataBufferDouble.java java/awt/image/DataBufferFloat.java java/awt/image/DataBufferInt.java java/awt/image/DataBufferShort.java java/awt/image/DataBufferUShort.java java/awt/image/DirectColorModel.java java/awt/image/FilteredImageSource.java java/awt/image/ImageConsumer.java java/awt/image/ImageFilter.java java/awt/image/ImageObserver.java java/awt/image/ImageProducer.java java/awt/image/ImagingOpException.java java/awt/image/Kernel.java java/awt/image/IndexColorModel.java java/awt/image/LookupOp.java java/awt/image/LookupTable.java java/awt/image/MemoryImageSource.java java/awt/image/MultiPixelPackedSampleModel.java java/awt/image/PackedColorModel.java java/awt/image/PixelGrabber.java java/awt/image/PixelInterleavedSampleModel.java java/awt/image/RGBImageFilter.java java/awt/image/RasterOp.java java/awt/image/RasterFormatException.java java/awt/image/WritableRenderedImage.java java/awt/image/ReplicateScaleFilter.java java/awt/image/RescaleOp.java java/awt/image/SampleModel.java java/awt/image/ShortLookupTable.java java/awt/image/TileObserver.java java/awt/image/package.html java/awt/image/SinglePixelPackedSampleModel.java java/awt/image/VolatileImage.java java/awt/image/WritableRaster.java java/awt/peer java/awt/peer/SCCS java/awt/peer/SCCS/s.CheckboxMenuItemPeer.java java/awt/peer/SCCS/s.ButtonPeer.java java/awt/peer/SCCS/s.CanvasPeer.java java/awt/peer/SCCS/s.ComponentPeer.java java/awt/peer/SCCS/s.CheckboxPeer.java java/awt/peer/SCCS/s.ChoicePeer.java java/awt/peer/SCCS/s.KeyboardFocusManagerPeer.java java/awt/peer/SCCS/s.ContainerPeer.java java/awt/peer/SCCS/s.DialogPeer.java java/awt/peer/SCCS/s.FileDialogPeer.java java/awt/peer/SCCS/s.FontPeer.java java/awt/peer/SCCS/s.FramePeer.java java/awt/peer/SCCS/s.MenuComponentPeer.java java/awt/peer/SCCS/s.LabelPeer.java java/awt/peer/SCCS/s.LightweightPeer.java java/awt/peer/SCCS/s.ListPeer.java java/awt/peer/SCCS/s.MenuBarPeer.java java/awt/peer/SCCS/s.MouseInfoPeer.java java/awt/peer/SCCS/s.MenuItemPeer.java java/awt/peer/SCCS/s.MenuPeer.java java/awt/peer/SCCS/s.TextComponentPeer.java java/awt/peer/SCCS/s.PanelPeer.java java/awt/peer/SCCS/s.PopupMenuPeer.java java/awt/peer/SCCS/s.RobotPeer.java java/awt/peer/SCCS/s.ScrollPanePeer.java java/awt/peer/SCCS/s.ScrollbarPeer.java java/awt/peer/SCCS/s.TextAreaPeer.java java/awt/peer/SCCS/s.TextFieldPeer.java java/awt/peer/SCCS/s.WindowPeer.java java/awt/peer/SCCS/s.package.html java/awt/peer/CheckboxPeer.java java/awt/peer/ButtonPeer.java java/awt/peer/CanvasPeer.java java/awt/peer/CheckboxMenuItemPeer.java java/awt/peer/ChoicePeer.java java/awt/peer/ComponentPeer.java java/awt/peer/ContainerPeer.java java/awt/peer/DialogPeer.java java/awt/peer/FileDialogPeer.java java/awt/peer/FontPeer.java java/awt/peer/FramePeer.java java/awt/peer/KeyboardFocusManagerPeer.java java/awt/peer/LabelPeer.java java/awt/peer/LightweightPeer.java java/awt/peer/ListPeer.java java/awt/peer/MenuBarPeer.java java/awt/peer/MenuComponentPeer.java java/awt/peer/MenuItemPeer.java java/awt/peer/MenuPeer.java java/awt/peer/MouseInfoPeer.java java/awt/peer/PanelPeer.java java/awt/peer/PopupMenuPeer.java java/awt/peer/RobotPeer.java java/awt/peer/ScrollPanePeer.java java/awt/peer/ScrollbarPeer.java java/awt/peer/TextAreaPeer.java java/awt/peer/TextComponentPeer.java java/awt/peer/TextFieldPeer.java java/awt/peer/WindowPeer.java java/awt/peer/package.html java/awt/print java/awt/print/SCCS java/awt/print/SCCS/s.PageFormat.java java/awt/print/SCCS/s.Book.java java/awt/print/SCCS/s.Printable.java java/awt/print/SCCS/s.Pageable.java java/awt/print/SCCS/s.Paper.java java/awt/print/SCCS/s.PrinterAbortException.java java/awt/print/SCCS/s.PrinterException.java java/awt/print/SCCS/s.PrinterGraphics.java java/awt/print/SCCS/s.PrinterIOException.java java/awt/print/SCCS/s.PrinterJob.java java/awt/print/SCCS/s.package.html java/awt/print/PageFormat.java java/awt/print/Book.java java/awt/print/PrinterException.java java/awt/print/Pageable.java java/awt/print/Paper.java java/awt/print/Printable.java java/awt/print/PrinterAbortException.java java/awt/print/PrinterGraphics.java java/awt/print/PrinterIOException.java java/awt/print/PrinterJob.java java/awt/print/package.html java/awt/AWTException.java java/awt/AWTError.java java/awt/AWTEvent.java java/awt/AWTEventMulticaster.java java/awt/AWTKeyStroke.java java/awt/AWTPermission.java java/awt/ActiveEvent.java java/awt/Adjustable.java java/awt/AlphaComposite.java java/awt/DefaultFocusTraversalPolicy.java java/awt/AttributeValue.java java/awt/BasicStroke.java java/awt/BorderLayout.java java/awt/BufferCapabilities.java java/awt/Button.java java/awt/Canvas.java java/awt/CardLayout.java java/awt/Checkbox.java java/awt/CheckboxGroup.java java/awt/CheckboxMenuItem.java java/awt/Choice.java java/awt/Color.java java/awt/ColorPaintContext.java java/awt/Component.java java/awt/ComponentOrientation.java java/awt/Composite.java java/awt/CompositeContext.java java/awt/Conditional.java java/awt/Container.java java/awt/Cursor.java java/awt/ContainerOrderFocusTraversalPolicy.java java/awt/Dialog.java java/awt/Dimension.java java/awt/DefaultKeyboardFocusManager.java java/awt/DisplayMode.java java/awt/Event.java java/awt/EventDispatchThread.java java/awt/EventQueue.java java/awt/FileDialog.java java/awt/FlowLayout.java java/awt/FocusTraversalPolicy.java java/awt/Font.java java/awt/FontFormatException.java java/awt/FontMetrics.java java/awt/Frame.java java/awt/Image.java java/awt/KeyEventPostProcessor.java java/awt/GradientPaint.java java/awt/GradientPaintContext.java java/awt/Graphics.java java/awt/Graphics2D.java java/awt/GraphicsCallback.java java/awt/GraphicsConfigTemplate.java java/awt/GraphicsConfiguration.java java/awt/GraphicsDevice.java java/awt/GraphicsEnvironment.java java/awt/GridBagConstraints.java java/awt/GridBagLayout.java java/awt/GridLayout.java java/awt/HeadlessException.java java/awt/IllegalComponentStateException.java java/awt/ImageCapabilities.java java/awt/Insets.java java/awt/Label.java java/awt/ItemSelectable.java java/awt/JobAttributes.java java/awt/KeyEventDispatcher.java java/awt/KeyboardFocusManager.java java/awt/LayoutManager.java java/awt/LayoutManager2.java java/awt/List.java java/awt/MediaTracker.java java/awt/Menu.java java/awt/MenuBar.java java/awt/MenuComponent.java java/awt/MenuContainer.java java/awt/MenuItem.java java/awt/MenuShortcut.java java/awt/MouseInfo.java java/awt/PageAttributes.java java/awt/Paint.java java/awt/PaintContext.java java/awt/Panel.java java/awt/Point.java java/awt/PointerInfo.java java/awt/Polygon.java java/awt/PopupMenu.java java/awt/PrintGraphics.java java/awt/PrintJob.java java/awt/Rectangle.java java/awt/RenderingHints.java java/awt/Robot.java java/awt/ScrollPane.java java/awt/ScrollPaneAdjustable.java java/awt/Scrollbar.java java/awt/SentEvent.java java/awt/SequencedEvent.java java/awt/Shape.java java/awt/Stroke.java java/awt/SystemColor.java java/awt/TextArea.java java/awt/TextComponent.java java/awt/TextField.java java/awt/TexturePaint.java java/awt/TexturePaintContext.java java/awt/Toolkit.java java/awt/Transparency.java java/awt/Window.java java/awt/package.html java/beans java/beans/SCCS java/beans/SCCS/s.DefaultPersistenceDelegate.java java/beans/SCCS/s.AppletInitializer.java java/beans/SCCS/s.BeanDescriptor.java java/beans/SCCS/s.BeanInfo.java java/beans/SCCS/s.Beans.java java/beans/SCCS/s.Customizer.java java/beans/SCCS/s.EventSetDescriptor.java java/beans/SCCS/s.DesignMode.java java/beans/SCCS/s.Encoder.java java/beans/SCCS/s.EventHandler.java java/beans/SCCS/s.ExceptionListener.java java/beans/SCCS/s.Expression.java java/beans/SCCS/s.FeatureDescriptor.java java/beans/SCCS/s.Introspector.java java/beans/SCCS/s.package.html java/beans/SCCS/s.MetaData.java java/beans/SCCS/s.IndexedPropertyChangeEvent.java java/beans/SCCS/s.IndexedPropertyDescriptor.java java/beans/SCCS/s.IntrospectionException.java java/beans/SCCS/s.MethodDescriptor.java java/beans/SCCS/s.NameGenerator.java java/beans/SCCS/s.ParameterDescriptor.java java/beans/SCCS/s.PersistenceDelegate.java java/beans/SCCS/s.PropertyChangeEvent.java java/beans/SCCS/s.PropertyChangeListener.java java/beans/SCCS/s.PropertyChangeListenerProxy.java java/beans/SCCS/s.PropertyChangeSupport.java java/beans/SCCS/s.PropertyDescriptor.java java/beans/SCCS/s.Statement.java java/beans/SCCS/s.PropertyEditor.java java/beans/SCCS/s.PropertyEditorManager.java java/beans/SCCS/s.PropertyEditorSupport.java java/beans/SCCS/s.PropertyVetoException.java java/beans/SCCS/s.ReflectionUtils.java java/beans/SCCS/s.SimpleBeanInfo.java java/beans/SCCS/s.VetoableChangeListener.java java/beans/SCCS/s.VetoableChangeListenerProxy.java java/beans/SCCS/s.VetoableChangeSupport.java java/beans/SCCS/s.Visibility.java java/beans/SCCS/s.XMLDecoder.java java/beans/SCCS/s.XMLEncoder.java java/beans/beancontext java/beans/beancontext/SCCS java/beans/beancontext/SCCS/s.BeanContextChild.java java/beans/beancontext/SCCS/s.BeanContext.java java/beans/beancontext/SCCS/s.package.html java/beans/beancontext/SCCS/s.BeanContextChildComponentProxy.java java/beans/beancontext/SCCS/s.BeanContextChildSupport.java java/beans/beancontext/SCCS/s.BeanContextContainerProxy.java java/beans/beancontext/SCCS/s.BeanContextEvent.java java/beans/beancontext/SCCS/s.BeanContextMembershipEvent.java java/beans/beancontext/SCCS/s.BeanContextMembershipListener.java java/beans/beancontext/SCCS/s.BeanContextProxy.java java/beans/beancontext/SCCS/s.BeanContextServiceAvailableEvent.java java/beans/beancontext/SCCS/s.BeanContextServiceProvider.java java/beans/beancontext/SCCS/s.BeanContextServiceProviderBeanInfo.java java/beans/beancontext/SCCS/s.BeanContextServiceRevokedEvent.java java/beans/beancontext/SCCS/s.BeanContextServiceRevokedListener.java java/beans/beancontext/SCCS/s.BeanContextServices.java java/beans/beancontext/SCCS/s.BeanContextServicesListener.java java/beans/beancontext/SCCS/s.BeanContextServicesSupport.java java/beans/beancontext/SCCS/s.BeanContextSupport.java java/beans/beancontext/BeanContextChild.java java/beans/beancontext/BeanContext.java java/beans/beancontext/BeanContextServiceProviderBeanInfo.java java/beans/beancontext/BeanContextChildComponentProxy.java java/beans/beancontext/BeanContextChildSupport.java java/beans/beancontext/BeanContextContainerProxy.java java/beans/beancontext/BeanContextEvent.java java/beans/beancontext/BeanContextMembershipEvent.java java/beans/beancontext/BeanContextMembershipListener.java java/beans/beancontext/BeanContextProxy.java java/beans/beancontext/BeanContextServiceAvailableEvent.java java/beans/beancontext/BeanContextServiceProvider.java java/beans/beancontext/BeanContextServiceRevokedListener.java java/beans/beancontext/BeanContextServiceRevokedEvent.java java/beans/beancontext/BeanContextServicesListener.java java/beans/beancontext/BeanContextServices.java java/beans/beancontext/BeanContextServicesSupport.java java/beans/beancontext/BeanContextSupport.java java/beans/beancontext/package.html java/beans/DefaultPersistenceDelegate.java java/beans/AppletInitializer.java java/beans/BeanDescriptor.java java/beans/BeanInfo.java java/beans/Beans.java java/beans/Customizer.java java/beans/EventHandler.java java/beans/DesignMode.java java/beans/Encoder.java java/beans/EventSetDescriptor.java java/beans/ExceptionListener.java java/beans/Expression.java java/beans/FeatureDescriptor.java java/beans/PropertyChangeListenerProxy.java java/beans/IndexedPropertyChangeEvent.java java/beans/IndexedPropertyDescriptor.java java/beans/IntrospectionException.java java/beans/Introspector.java java/beans/MetaData.java java/beans/MethodDescriptor.java java/beans/NameGenerator.java java/beans/ParameterDescriptor.java java/beans/PersistenceDelegate.java java/beans/PropertyChangeEvent.java java/beans/PropertyChangeListener.java java/beans/VetoableChangeListenerProxy.java java/beans/PropertyChangeSupport.java java/beans/PropertyDescriptor.java java/beans/PropertyEditor.java java/beans/PropertyEditorManager.java java/beans/PropertyEditorSupport.java java/beans/PropertyVetoException.java java/beans/ReflectionUtils.java java/beans/SimpleBeanInfo.java java/beans/Statement.java java/beans/VetoableChangeListener.java java/beans/VetoableChangeSupport.java java/beans/Visibility.java java/beans/XMLDecoder.java java/beans/XMLEncoder.java java/beans/package.html java/io java/io/SCCS java/io/SCCS/s.Bits.java java/io/SCCS/s.CharConversionException.java java/io/SCCS/s.CharArrayReader.java java/io/SCCS/s.BufferedInputStream.java java/io/SCCS/s.BufferedOutputStream.java java/io/SCCS/s.BufferedReader.java java/io/SCCS/s.BufferedWriter.java java/io/SCCS/s.ByteArrayInputStream.java java/io/SCCS/s.ByteArrayOutputStream.java java/io/SCCS/s.CharArrayWriter.java java/io/SCCS/s.DataInputStream.java java/io/SCCS/s.Closeable.java java/io/SCCS/s.DataInput.java java/io/SCCS/s.DataOutputStream.java java/io/SCCS/s.DataOutput.java java/io/SCCS/s.ExpiringCache.java java/io/SCCS/s.EOFException.java java/io/SCCS/s.FileNotFoundException.java java/io/SCCS/s.Externalizable.java java/io/SCCS/s.File.java java/io/SCCS/s.FileFilter.java java/io/SCCS/s.FileInputStream.java java/io/SCCS/s.FileOutputStream.java java/io/SCCS/s.FilePermission.java java/io/SCCS/s.FileReader.java java/io/SCCS/s.FileSystem.java java/io/SCCS/s.FileWriter.java java/io/SCCS/s.FilenameFilter.java java/io/SCCS/s.FilterInputStream.java java/io/SCCS/s.FilterOutputStream.java java/io/SCCS/s.UnsupportedEncodingException.java java/io/SCCS/s.FilterReader.java java/io/SCCS/s.FilterWriter.java java/io/SCCS/s.Flushable.java java/io/SCCS/s.IOException.java java/io/SCCS/s.InputStream.java java/io/SCCS/s.InputStreamReader.java java/io/SCCS/s.InterruptedIOException.java java/io/SCCS/s.InvalidClassException.java java/io/SCCS/s.InvalidObjectException.java java/io/SCCS/s.LineNumberInputStream.java java/io/SCCS/s.LineNumberReader.java java/io/SCCS/s.NotActiveException.java java/io/SCCS/s.NotSerializableException.java java/io/SCCS/s.ObjectInput.java java/io/SCCS/s.ObjectInputStream.java java/io/SCCS/s.ObjectInputValidation.java java/io/SCCS/s.ObjectOutput.java java/io/SCCS/s.ObjectOutputStream.java java/io/SCCS/s.ObjectStreamClass.java java/io/SCCS/s.ObjectStreamConstants.java java/io/SCCS/s.ObjectStreamException.java java/io/SCCS/s.ObjectStreamField.java java/io/SCCS/s.OptionalDataException.java java/io/SCCS/s.OutputStream.java java/io/SCCS/s.OutputStreamWriter.java java/io/SCCS/s.PipedInputStream.java java/io/SCCS/s.PipedOutputStream.java java/io/SCCS/s.PipedReader.java java/io/SCCS/s.PipedWriter.java java/io/SCCS/s.PrintStream.java java/io/SCCS/s.PrintWriter.java java/io/SCCS/s.PushbackInputStream.java java/io/SCCS/s.PushbackReader.java java/io/SCCS/s.RandomAccessFile.java java/io/SCCS/s.Reader.java java/io/SCCS/s.SequenceInputStream.java java/io/SCCS/s.Serializable.java java/io/SCCS/s.SerializablePermission.java java/io/SCCS/s.StreamCorruptedException.java java/io/SCCS/s.StreamTokenizer.java java/io/SCCS/s.StringBufferInputStream.java java/io/SCCS/s.StringReader.java java/io/SCCS/s.StringWriter.java java/io/SCCS/s.SyncFailedException.java java/io/SCCS/s.UTFDataFormatException.java java/io/SCCS/s.WriteAbortedException.java java/io/SCCS/s.Writer.java java/io/SCCS/s.package.html java/io/BufferedReader.java java/io/Bits.java java/io/CharConversionException.java java/io/BufferedInputStream.java java/io/BufferedOutputStream.java java/io/BufferedWriter.java java/io/ByteArrayInputStream.java java/io/ByteArrayOutputStream.java java/io/CharArrayReader.java java/io/CharArrayWriter.java java/io/DataInputStream.java java/io/Closeable.java java/io/DataInput.java java/io/DataOutput.java java/io/NotSerializableException.java java/io/DataOutputStream.java java/io/EOFException.java java/io/ExpiringCache.java java/io/Externalizable.java java/io/File.java java/io/FileFilter.java java/io/FileInputStream.java java/io/FileNotFoundException.java java/io/FileOutputStream.java java/io/FilePermission.java java/io/FileReader.java java/io/FileSystem.java java/io/FileWriter.java java/io/FilenameFilter.java java/io/FilterInputStream.java java/io/FilterOutputStream.java java/io/FilterReader.java java/io/FilterWriter.java java/io/Flushable.java java/io/IOException.java java/io/InputStream.java java/io/InputStreamReader.java java/io/InterruptedIOException.java java/io/InvalidClassException.java java/io/InvalidObjectException.java java/io/LineNumberInputStream.java java/io/LineNumberReader.java java/io/NotActiveException.java java/io/ObjectInputStream.java java/io/ObjectInput.java java/io/UnsupportedEncodingException.java java/io/ObjectInputValidation.java java/io/ObjectOutput.java java/io/Reader.java java/io/ObjectOutputStream.java java/io/ObjectStreamClass.java java/io/ObjectStreamConstants.java java/io/ObjectStreamException.java java/io/ObjectStreamField.java java/io/OptionalDataException.java java/io/OutputStream.java java/io/OutputStreamWriter.java java/io/PipedInputStream.java java/io/PipedOutputStream.java java/io/PipedReader.java java/io/PipedWriter.java java/io/PrintStream.java java/io/PrintWriter.java java/io/PushbackInputStream.java java/io/PushbackReader.java java/io/RandomAccessFile.java java/io/SequenceInputStream.java java/io/Serializable.java java/io/SerializablePermission.java java/io/StreamCorruptedException.java java/io/StreamTokenizer.java java/io/StringBufferInputStream.java java/io/StringReader.java java/io/StringWriter.java java/io/SyncFailedException.java java/io/UTFDataFormatException.java java/io/WriteAbortedException.java java/io/Writer.java java/io/package.html java/lang java/lang/SCCS java/lang/SCCS/s.AbstractStringBuilder.java java/lang/SCCS/s.AbstractMethodError.java java/lang/SCCS/s.ArithmeticException.java java/lang/SCCS/s.Appendable.java java/lang/SCCS/s.Boolean.java java/lang/SCCS/s.ArrayIndexOutOfBoundsException.java java/lang/SCCS/s.ArrayStoreException.java java/lang/SCCS/s.AssertionError.java java/lang/SCCS/s.AssertionStatusDirectives.java java/lang/SCCS/s.Byte.java java/lang/SCCS/s.CharSequence.java java/lang/SCCS/s.Character.java java/lang/SCCS/s.Class.java java/lang/SCCS/s.IllegalAccessError.java java/lang/SCCS/s.ClassLoader.java java/lang/SCCS/s.ClassCastException.java java/lang/SCCS/s.ClassCircularityError.java java/lang/SCCS/s.ClassFormatError.java java/lang/SCCS/s.CloneNotSupportedException.java java/lang/SCCS/s.ClassNotFoundException.java java/lang/SCCS/s.Cloneable.java java/lang/SCCS/s.Comparable.java java/lang/SCCS/s.Compiler.java java/lang/SCCS/s.Deprecated.java java/lang/SCCS/s.Enum.java java/lang/SCCS/s.ConditionalSpecialCasing.java java/lang/SCCS/s.Double.java java/lang/SCCS/s.Error.java java/lang/SCCS/s.Exception.java java/lang/SCCS/s.EnumConstantNotPresentException.java java/lang/SCCS/s.Number.java java/lang/SCCS/s.Float.java java/lang/SCCS/s.ExceptionInInitializerError.java java/lang/SCCS/s.IllegalAccessException.java java/lang/SCCS/s.IllegalArgumentException.java java/lang/SCCS/s.IllegalMonitorStateException.java java/lang/SCCS/s.IllegalStateException.java java/lang/SCCS/s.IllegalThreadStateException.java java/lang/SCCS/s.IncompatibleClassChangeError.java java/lang/SCCS/s.IndexOutOfBoundsException.java java/lang/SCCS/s.InheritableThreadLocal.java java/lang/SCCS/s.InstantiationError.java java/lang/SCCS/s.Integer.java java/lang/SCCS/s.Long.java java/lang/SCCS/s.Math.java java/lang/SCCS/s.InstantiationException.java java/lang/SCCS/s.InternalError.java java/lang/SCCS/s.InterruptedException.java java/lang/SCCS/s.Iterable.java java/lang/SCCS/s.LinkageError.java java/lang/SCCS/s.StringIndexOutOfBoundsException.java java/lang/SCCS/s.NegativeArraySizeException.java java/lang/SCCS/s.NoClassDefFoundError.java java/lang/SCCS/s.NoSuchFieldError.java java/lang/SCCS/s.NoSuchFieldException.java java/lang/SCCS/s.NoSuchMethodError.java java/lang/SCCS/s.NoSuchMethodException.java java/lang/SCCS/s.NullPointerException.java java/lang/SCCS/s.NumberFormatException.java java/lang/SCCS/s.Object.java java/lang/SCCS/s.OutOfMemoryError.java java/lang/SCCS/s.Override.java java/lang/SCCS/s.Package.java java/lang/SCCS/s.Process.java java/lang/SCCS/s.ProcessBuilder.java java/lang/SCCS/s.Readable.java java/lang/SCCS/s.Runnable.java java/lang/SCCS/s.Runtime.java java/lang/SCCS/s.RuntimeException.java java/lang/SCCS/s.RuntimePermission.java java/lang/SCCS/s.SecurityException.java java/lang/SCCS/s.SecurityManager.java java/lang/SCCS/s.Short.java java/lang/SCCS/s.Shutdown.java java/lang/SCCS/s.StackOverflowError.java java/lang/SCCS/s.StackTraceElement.java java/lang/SCCS/s.String.java java/lang/SCCS/s.StrictMath.java java/lang/SCCS/s.StringBuffer.java java/lang/SCCS/s.StringBuilder.java java/lang/SCCS/s.StringCoding.java java/lang/SCCS/s.TypeNotPresentException.java java/lang/SCCS/s.SuppressWarnings.java java/lang/SCCS/s.System.java java/lang/SCCS/s.Thread.java java/lang/SCCS/s.ThreadDeath.java java/lang/SCCS/s.ThreadGroup.java java/lang/SCCS/s.ThreadLocal.java java/lang/SCCS/s.Throwable.java java/lang/SCCS/s.UnsatisfiedLinkError.java java/lang/SCCS/s.UnknownError.java java/lang/SCCS/s.UnsupportedClassVersionError.java java/lang/SCCS/s.Void.java java/lang/SCCS/s.VerifyError.java java/lang/SCCS/s.UnsupportedOperationException.java java/lang/SCCS/s.VirtualMachineError.java java/lang/SCCS/s.package.html java/lang/annotation java/lang/annotation/SCCS java/lang/annotation/SCCS/s.Annotation.java java/lang/annotation/SCCS/s.Documented.java java/lang/annotation/SCCS/s.Target.java java/lang/annotation/SCCS/s.AnnotationFormatError.java java/lang/annotation/SCCS/s.AnnotationTypeMismatchException.java java/lang/annotation/SCCS/s.ElementType.java java/lang/annotation/SCCS/s.IncompleteAnnotationException.java java/lang/annotation/SCCS/s.Inherited.java java/lang/annotation/SCCS/s.Retention.java java/lang/annotation/SCCS/s.RetentionPolicy.java java/lang/annotation/SCCS/s.package.html java/lang/annotation/Annotation.java java/lang/annotation/Documented.java java/lang/annotation/Target.java java/lang/annotation/AnnotationFormatError.java java/lang/annotation/AnnotationTypeMismatchException.java java/lang/annotation/ElementType.java java/lang/annotation/IncompleteAnnotationException.java java/lang/annotation/Inherited.java java/lang/annotation/Retention.java java/lang/annotation/RetentionPolicy.java java/lang/annotation/package.html java/lang/doc-files java/lang/doc-files/SCCS java/lang/doc-files/SCCS/s.capchi.gif java/lang/doc-files/SCCS/s.capiota.gif java/lang/doc-files/SCCS/s.capsigma.gif java/lang/doc-files/SCCS/s.captheta.gif java/lang/doc-files/SCCS/s.capupsil.gif java/lang/doc-files/SCCS/s.chi.gif java/lang/doc-files/SCCS/s.iota.gif java/lang/doc-files/SCCS/s.sigma1.gif java/lang/doc-files/SCCS/s.theta.gif java/lang/doc-files/SCCS/s.javalang.doc.anc21.gif java/lang/doc-files/SCCS/s.javalang.doc.anc38.gif java/lang/doc-files/SCCS/s.javalang.doc.anc40.gif java/lang/doc-files/SCCS/s.javalang.doc.anc41.gif java/lang/doc-files/SCCS/s.upsilon.gif java/lang/doc-files/capsigma.gif java/lang/doc-files/capchi.gif java/lang/doc-files/capiota.gif java/lang/doc-files/javalang.doc.anc21.gif java/lang/doc-files/captheta.gif java/lang/doc-files/capupsil.gif java/lang/doc-files/chi.gif java/lang/doc-files/iota.gif java/lang/doc-files/javalang.doc.anc38.gif java/lang/doc-files/javalang.doc.anc40.gif java/lang/doc-files/javalang.doc.anc41.gif java/lang/doc-files/sigma1.gif java/lang/doc-files/theta.gif java/lang/doc-files/upsilon.gif java/lang/instrument java/lang/instrument/SCCS java/lang/instrument/SCCS/s.ClassFileTransformer.java java/lang/instrument/SCCS/s.ClassDefinition.java java/lang/instrument/SCCS/s.IllegalClassFormatException.java java/lang/instrument/SCCS/s.Instrumentation.java java/lang/instrument/SCCS/s.UnmodifiableClassException.java java/lang/instrument/SCCS/s.package.html java/lang/instrument/ClassFileTransformer.java java/lang/instrument/ClassDefinition.java java/lang/instrument/IllegalClassFormatException.java java/lang/instrument/Instrumentation.java java/lang/instrument/UnmodifiableClassException.java java/lang/instrument/package.html java/lang/management java/lang/management/SCCS java/lang/management/SCCS/s.GarbageCollectorMXBean.java java/lang/management/SCCS/s.ClassLoadingMXBean.java java/lang/management/SCCS/s.CompilationMXBean.java java/lang/management/SCCS/s.ManagementFactory.java java/lang/management/SCCS/s.ManagementPermission.java java/lang/management/SCCS/s.MemoryMXBean.java java/lang/management/SCCS/s.MemoryManagerMXBean.java java/lang/management/SCCS/s.MemoryNotificationInfo.java java/lang/management/SCCS/s.MemoryPoolMXBean.java java/lang/management/SCCS/s.MemoryType.java java/lang/management/SCCS/s.MemoryUsage.java java/lang/management/SCCS/s.OperatingSystemMXBean.java java/lang/management/SCCS/s.RuntimeMXBean.java java/lang/management/SCCS/s.ThreadInfo.java java/lang/management/SCCS/s.ThreadMXBean.java java/lang/management/SCCS/s.package.html java/lang/management/GarbageCollectorMXBean.java java/lang/management/ClassLoadingMXBean.java java/lang/management/CompilationMXBean.java java/lang/management/ThreadMXBean.java java/lang/management/ManagementFactory.java java/lang/management/ManagementPermission.java java/lang/management/MemoryMXBean.java java/lang/management/MemoryManagerMXBean.java java/lang/management/MemoryNotificationInfo.java java/lang/management/MemoryPoolMXBean.java java/lang/management/MemoryType.java java/lang/management/MemoryUsage.java java/lang/management/OperatingSystemMXBean.java java/lang/management/RuntimeMXBean.java java/lang/management/ThreadInfo.java java/lang/management/package.html java/lang/ref java/lang/ref/SCCS java/lang/ref/SCCS/s.FinalReference.java java/lang/ref/SCCS/s.Finalizer.java java/lang/ref/SCCS/s.PhantomReference.java java/lang/ref/SCCS/s.Reference.java java/lang/ref/SCCS/s.ReferenceQueue.java java/lang/ref/SCCS/s.SoftReference.java java/lang/ref/SCCS/s.WeakReference.java java/lang/ref/SCCS/s.package.html java/lang/ref/PhantomReference.java java/lang/ref/FinalReference.java java/lang/ref/Finalizer.java java/lang/ref/Reference.java java/lang/ref/ReferenceQueue.java java/lang/ref/SoftReference.java java/lang/ref/WeakReference.java java/lang/ref/package.html java/lang/reflect java/lang/reflect/SCCS java/lang/reflect/SCCS/s.GenericDeclaration.java java/lang/reflect/SCCS/s.AccessibleObject.java java/lang/reflect/SCCS/s.AnnotatedElement.java java/lang/reflect/SCCS/s.Array.java java/lang/reflect/SCCS/s.Constructor.java java/lang/reflect/SCCS/s.Field.java java/lang/reflect/SCCS/s.GenericArrayType.java java/lang/reflect/SCCS/s.MalformedParameterizedTypeException.java java/lang/reflect/SCCS/s.GenericSignatureFormatError.java java/lang/reflect/SCCS/s.InvocationHandler.java java/lang/reflect/SCCS/s.InvocationTargetException.java java/lang/reflect/SCCS/s.ReflectAccess.java java/lang/reflect/SCCS/s.Member.java java/lang/reflect/SCCS/s.Method.java java/lang/reflect/SCCS/s.Modifier.java java/lang/reflect/SCCS/s.Proxy.java java/lang/reflect/SCCS/s.Type.java java/lang/reflect/SCCS/s.ParameterizedType.java java/lang/reflect/SCCS/s.UndeclaredThrowableException.java java/lang/reflect/SCCS/s.ReflectPermission.java java/lang/reflect/SCCS/s.TypeVariable.java java/lang/reflect/SCCS/s.WildcardType.java java/lang/reflect/SCCS/s.package.html java/lang/reflect/AccessibleObject.java java/lang/reflect/AnnotatedElement.java java/lang/reflect/Array.java java/lang/reflect/Constructor.java java/lang/reflect/Field.java java/lang/reflect/GenericArrayType.java java/lang/reflect/GenericDeclaration.java java/lang/reflect/InvocationHandler.java java/lang/reflect/Member.java java/lang/reflect/GenericSignatureFormatError.java java/lang/reflect/InvocationTargetException.java java/lang/reflect/MalformedParameterizedTypeException.java java/lang/reflect/Method.java java/lang/reflect/Modifier.java java/lang/reflect/ParameterizedType.java java/lang/reflect/Proxy.java java/lang/reflect/ReflectAccess.java java/lang/reflect/ReflectPermission.java java/lang/reflect/Type.java java/lang/reflect/TypeVariable.java java/lang/reflect/WildcardType.java java/lang/reflect/package.html java/lang/reflect/UndeclaredThrowableException.java java/lang/ArrayIndexOutOfBoundsException.java java/lang/AbstractMethodError.java java/lang/AbstractStringBuilder.java java/lang/Appendable.java java/lang/ArithmeticException.java java/lang/AssertionStatusDirectives.java java/lang/ArrayStoreException.java java/lang/AssertionError.java java/lang/Boolean.java java/lang/Byte.java java/lang/ClassCircularityError.java java/lang/CharSequence.java java/lang/Character.java java/lang/Class.java java/lang/ClassCastException.java java/lang/ClassNotFoundException.java java/lang/ClassFormatError.java java/lang/ClassLoader.java java/lang/Double.java java/lang/CloneNotSupportedException.java java/lang/Cloneable.java java/lang/Comparable.java java/lang/Compiler.java java/lang/ConditionalSpecialCasing.java java/lang/Deprecated.java java/lang/Enum.java java/lang/Error.java java/lang/Exception.java java/lang/Float.java java/lang/InstantiationError.java java/lang/EnumConstantNotPresentException.java java/lang/ExceptionInInitializerError.java java/lang/IllegalAccessException.java java/lang/IllegalAccessError.java java/lang/Long.java java/lang/IllegalArgumentException.java java/lang/IllegalMonitorStateException.java java/lang/IllegalStateException.java java/lang/IllegalThreadStateException.java java/lang/IncompatibleClassChangeError.java java/lang/IndexOutOfBoundsException.java java/lang/InheritableThreadLocal.java java/lang/Override.java java/lang/Number.java java/lang/InstantiationException.java java/lang/Integer.java java/lang/InternalError.java java/lang/InterruptedException.java java/lang/Iterable.java java/lang/LinkageError.java java/lang/Math.java java/lang/NegativeArraySizeException.java java/lang/NoClassDefFoundError.java java/lang/NoSuchFieldError.java java/lang/NoSuchFieldException.java java/lang/NoSuchMethodError.java java/lang/NoSuchMethodException.java java/lang/NullPointerException.java java/lang/Object.java java/lang/Shutdown.java java/lang/Short.java java/lang/NumberFormatException.java java/lang/OutOfMemoryError.java java/lang/Package.java java/lang/Process.java java/lang/ProcessBuilder.java java/lang/Readable.java java/lang/Runnable.java java/lang/Runtime.java java/lang/RuntimeException.java java/lang/RuntimePermission.java java/lang/SecurityException.java java/lang/SecurityManager.java java/lang/StackOverflowError.java java/lang/StackTraceElement.java java/lang/StrictMath.java java/lang/String.java java/lang/System.java java/lang/TypeNotPresentException.java java/lang/StringBuffer.java java/lang/StringBuilder.java java/lang/StringCoding.java java/lang/StringIndexOutOfBoundsException.java java/lang/SuppressWarnings.java java/lang/Thread.java java/lang/ThreadDeath.java java/lang/ThreadGroup.java java/lang/ThreadLocal.java java/lang/Throwable.java java/lang/UnsatisfiedLinkError.java java/lang/UnknownError.java java/lang/VirtualMachineError.java java/lang/UnsupportedClassVersionError.java java/lang/UnsupportedOperationException.java java/lang/VerifyError.java java/lang/package.html java/lang/Void.java java/math java/math/SCCS java/math/SCCS/s.MutableBigInteger.java java/math/SCCS/s.BigDecimal.java java/math/SCCS/s.BigInteger.java java/math/SCCS/s.BitSieve.java java/math/SCCS/s.MathContext.java java/math/SCCS/s.RoundingMode.java java/math/SCCS/s.package.html java/math/SCCS/s.SignedMutableBigInteger.java java/math/MathContext.java java/math/BigDecimal.java java/math/BigInteger.java java/math/BitSieve.java java/math/SignedMutableBigInteger.java java/math/MutableBigInteger.java java/math/RoundingMode.java java/math/package.html java/net java/net/SCCS java/net/SCCS/s.ContentHandlerFactory.java java/net/SCCS/s.Authenticator.java java/net/SCCS/s.BindException.java java/net/SCCS/s.CacheRequest.java java/net/SCCS/s.CacheResponse.java java/net/SCCS/s.ConnectException.java java/net/SCCS/s.ContentHandler.java java/net/SCCS/s.DatagramSocketImpl.java java/net/SCCS/s.CookieHandler.java java/net/SCCS/s.DatagramPacket.java java/net/SCCS/s.DatagramSocket.java java/net/SCCS/s.URI.java java/net/SCCS/s.URLStreamHandler.java java/net/SCCS/s.DatagramSocketImplFactory.java java/net/SCCS/s.FileNameMap.java java/net/SCCS/s.HttpRetryException.java java/net/SCCS/s.HttpURLConnection.java java/net/SCCS/s.Inet4Address.java java/net/SCCS/s.Inet4AddressImpl.java java/net/SCCS/s.Inet6Address.java java/net/SCCS/s.Inet6AddressImpl.java java/net/SCCS/s.InetAddress.java java/net/SCCS/s.InetAddressImpl.java java/net/SCCS/s.InetSocketAddress.java java/net/SCCS/s.JarURLConnection.java java/net/SCCS/s.MalformedURLException.java java/net/SCCS/s.MulticastSocket.java java/net/SCCS/s.NetPermission.java java/net/SCCS/s.NetworkInterface.java java/net/SCCS/s.NoRouteToHostException.java java/net/SCCS/s.PasswordAuthentication.java java/net/SCCS/s.PlainDatagramSocketImpl.java java/net/SCCS/s.PlainSocketImpl.java java/net/SCCS/s.PortUnreachableException.java java/net/SCCS/s.ProtocolException.java java/net/SCCS/s.Proxy.java java/net/SCCS/s.ProxySelector.java java/net/SCCS/s.ResponseCache.java java/net/SCCS/s.SecureCacheResponse.java java/net/SCCS/s.ServerSocket.java java/net/SCCS/s.Socket.java java/net/SCCS/s.SocketAddress.java java/net/SCCS/s.SocketException.java java/net/SCCS/s.SocketImpl.java java/net/SCCS/s.SocketImplFactory.java java/net/SCCS/s.URL.java java/net/SCCS/s.SocketInputStream.java java/net/SCCS/s.SocketOptions.java java/net/SCCS/s.SocketOutputStream.java java/net/SCCS/s.SocketPermission.java java/net/SCCS/s.SocketTimeoutException.java java/net/SCCS/s.SocksConsts.java java/net/SCCS/s.SocksSocketImpl.java java/net/SCCS/s.URLDecoder.java java/net/SCCS/s.URISyntaxException.java java/net/SCCS/s.URLClassLoader.java java/net/SCCS/s.URLConnection.java java/net/SCCS/s.URLEncoder.java java/net/SCCS/s.UnknownServiceException.java java/net/SCCS/s.URLStreamHandlerFactory.java java/net/SCCS/s.UnknownHostException.java java/net/SCCS/s.package.html java/net/ConnectException.java java/net/Authenticator.java java/net/BindException.java java/net/CacheRequest.java java/net/CacheResponse.java java/net/ContentHandlerFactory.java java/net/ContentHandler.java java/net/DatagramSocketImplFactory.java java/net/CookieHandler.java java/net/DatagramPacket.java java/net/DatagramSocket.java java/net/DatagramSocketImpl.java java/net/HttpRetryException.java java/net/FileNameMap.java java/net/ProxySelector.java java/net/Proxy.java java/net/HttpURLConnection.java java/net/Inet4Address.java java/net/Inet4AddressImpl.java java/net/Inet6Address.java java/net/Inet6AddressImpl.java java/net/InetAddress.java java/net/InetAddressImpl.java java/net/InetSocketAddress.java java/net/JarURLConnection.java java/net/MalformedURLException.java java/net/MulticastSocket.java java/net/NetPermission.java java/net/NetworkInterface.java java/net/NoRouteToHostException.java java/net/PasswordAuthentication.java java/net/PlainSocketImpl.java java/net/PlainDatagramSocketImpl.java java/net/PortUnreachableException.java java/net/ProtocolException.java java/net/SecureCacheResponse.java java/net/ResponseCache.java java/net/SocketException.java java/net/ServerSocket.java java/net/Socket.java java/net/SocketAddress.java java/net/SocketImplFactory.java java/net/SocketImpl.java java/net/SocketInputStream.java java/net/SocketOptions.java java/net/SocketOutputStream.java java/net/SocketPermission.java java/net/SocketTimeoutException.java java/net/SocksConsts.java java/net/SocksSocketImpl.java java/net/URI.java java/net/URISyntaxException.java java/net/URL.java java/net/URLClassLoader.java java/net/URLConnection.java java/net/URLDecoder.java java/net/URLEncoder.java java/net/URLStreamHandler.java java/net/URLStreamHandlerFactory.java java/net/UnknownHostException.java java/net/UnknownServiceException.java java/net/package.html java/nio java/nio/SCCS java/nio/SCCS/s.Buffer.java java/nio/SCCS/s.Bits.java java/nio/SCCS/s.ByteBufferAs-X-Buffer.java java/nio/SCCS/s.ByteOrder.java java/nio/SCCS/s.Direct-X-Buffer-bin.java java/nio/SCCS/s.Direct-X-Buffer.java java/nio/SCCS/s.Heap-X-Buffer.java java/nio/SCCS/s.MappedByteBuffer.java java/nio/SCCS/s.StringCharBuffer.java java/nio/SCCS/s.X-Buffer-bin.java java/nio/SCCS/s.X-Buffer.java java/nio/SCCS/s.exceptions java/nio/SCCS/s.package.html java/nio/channels java/nio/channels/SCCS java/nio/channels/SCCS/s.DatagramChannel.java java/nio/channels/SCCS/s.ByteChannel.java java/nio/channels/SCCS/s.Channel.java java/nio/channels/SCCS/s.Channels.java java/nio/channels/SCCS/s.GatheringByteChannel.java java/nio/channels/SCCS/s.FileChannel.java java/nio/channels/SCCS/s.FileLock.java java/nio/channels/SCCS/s.InterruptibleChannel.java java/nio/channels/SCCS/s.Pipe.java java/nio/channels/SCCS/s.ReadableByteChannel.java java/nio/channels/SCCS/s.ScatteringByteChannel.java java/nio/channels/SCCS/s.SelectableChannel.java java/nio/channels/SCCS/s.SelectionKey.java java/nio/channels/SCCS/s.Selector.java java/nio/channels/SCCS/s.exceptions java/nio/channels/SCCS/s.ServerSocketChannel.java java/nio/channels/SCCS/s.SocketChannel.java java/nio/channels/SCCS/s.WritableByteChannel.java java/nio/channels/SCCS/s.package.html java/nio/channels/spi java/nio/channels/spi/SCCS java/nio/channels/spi/SCCS/s.AbstractInterruptibleChannel.java java/nio/channels/spi/SCCS/s.AbstractSelectableChannel.java java/nio/channels/spi/SCCS/s.AbstractSelectionKey.java java/nio/channels/spi/SCCS/s.AbstractSelector.java java/nio/channels/spi/SCCS/s.SelectorProvider.java java/nio/channels/spi/SCCS/s.package.html java/nio/channels/spi/AbstractInterruptibleChannel.java java/nio/channels/spi/AbstractSelectableChannel.java java/nio/channels/spi/AbstractSelectionKey.java java/nio/channels/spi/AbstractSelector.java java/nio/channels/spi/SelectorProvider.java java/nio/channels/spi/package.html java/nio/channels/DatagramChannel.java java/nio/channels/ByteChannel.java java/nio/channels/Channel.java java/nio/channels/Channels.java java/nio/channels/GatheringByteChannel.java java/nio/channels/FileChannel.java java/nio/channels/FileLock.java java/nio/channels/InterruptibleChannel.java java/nio/channels/Pipe.java java/nio/channels/ReadableByteChannel.java java/nio/channels/ScatteringByteChannel.java java/nio/channels/SelectableChannel.java java/nio/channels/SelectionKey.java java/nio/channels/Selector.java java/nio/channels/ServerSocketChannel.java java/nio/channels/SocketChannel.java java/nio/channels/WritableByteChannel.java java/nio/channels/exceptions java/nio/channels/package.html java/nio/charset java/nio/charset/SCCS java/nio/charset/SCCS/s.CoderMalfunctionError.java java/nio/charset/SCCS/s.Charset-X-Coder.java java/nio/charset/SCCS/s.Charset.java java/nio/charset/SCCS/s.CodingErrorAction.java java/nio/charset/SCCS/s.CoderResult.java java/nio/charset/SCCS/s.UnmappableCharacterException.java java/nio/charset/SCCS/s.MalformedInputException.java java/nio/charset/SCCS/s.exceptions java/nio/charset/SCCS/s.package.html java/nio/charset/spi java/nio/charset/spi/SCCS java/nio/charset/spi/SCCS/s.CharsetProvider.java java/nio/charset/spi/SCCS/s.package.html java/nio/charset/spi/CharsetProvider.java java/nio/charset/spi/package.html java/nio/charset/CoderMalfunctionError.java java/nio/charset/Charset-X-Coder.java java/nio/charset/Charset.java java/nio/charset/MalformedInputException.java java/nio/charset/CoderResult.java java/nio/charset/CodingErrorAction.java java/nio/charset/exceptions java/nio/charset/UnmappableCharacterException.java java/nio/charset/package.html java/nio/ByteOrder.java java/nio/Bits.java java/nio/Buffer.java java/nio/ByteBufferAs-X-Buffer.java java/nio/Direct-X-Buffer-bin.java java/nio/Direct-X-Buffer.java java/nio/Heap-X-Buffer.java java/nio/MappedByteBuffer.java java/nio/StringCharBuffer.java java/nio/X-Buffer-bin.java java/nio/X-Buffer.java java/nio/exceptions java/nio/package.html java/rmi java/rmi/SCCS java/rmi/SCCS/s.AlreadyBoundException.java java/rmi/SCCS/s.AccessException.java java/rmi/SCCS/s.ConnectIOException.java java/rmi/SCCS/s.ConnectException.java java/rmi/SCCS/s.NoSuchObjectException.java java/rmi/SCCS/s.MarshalException.java java/rmi/SCCS/s.MarshalledObject.java java/rmi/SCCS/s.Naming.java java/rmi/SCCS/s.NotBoundException.java java/rmi/SCCS/s.RMISecurityException.java java/rmi/SCCS/s.RMISecurityManager.java java/rmi/SCCS/s.Remote.java java/rmi/SCCS/s.RemoteException.java java/rmi/SCCS/s.ServerError.java java/rmi/SCCS/s.package.html java/rmi/SCCS/s.ServerException.java java/rmi/SCCS/s.ServerRuntimeException.java java/rmi/SCCS/s.StubNotFoundException.java java/rmi/SCCS/s.UnexpectedException.java java/rmi/SCCS/s.UnknownHostException.java java/rmi/SCCS/s.UnmarshalException.java java/rmi/activation java/rmi/activation/SCCS java/rmi/activation/SCCS/s.ActivationDesc.java java/rmi/activation/SCCS/s.Activatable.java java/rmi/activation/SCCS/s.ActivateFailedException.java java/rmi/activation/SCCS/s.ActivationException.java java/rmi/activation/SCCS/s.ActivationGroup.java java/rmi/activation/SCCS/s.ActivationGroupDesc.java java/rmi/activation/SCCS/s.ActivationGroupID.java java/rmi/activation/SCCS/s.ActivationID.java java/rmi/activation/SCCS/s.ActivationInstantiator.java java/rmi/activation/SCCS/s.ActivationMonitor.java java/rmi/activation/SCCS/s.ActivationSystem.java java/rmi/activation/SCCS/s.Activator.java java/rmi/activation/SCCS/s.package.html java/rmi/activation/SCCS/s.UnknownGroupException.java java/rmi/activation/SCCS/s.UnknownObjectException.java java/rmi/activation/Activatable.java java/rmi/activation/ActivationDesc.java java/rmi/activation/Activator.java java/rmi/activation/ActivateFailedException.java java/rmi/activation/ActivationException.java java/rmi/activation/ActivationGroup.java java/rmi/activation/ActivationGroupDesc.java java/rmi/activation/ActivationGroupID.java java/rmi/activation/ActivationID.java java/rmi/activation/ActivationInstantiator.java java/rmi/activation/ActivationMonitor.java java/rmi/activation/ActivationSystem.java java/rmi/activation/UnknownGroupException.java java/rmi/activation/UnknownObjectException.java java/rmi/activation/package.html java/rmi/dgc java/rmi/dgc/SCCS java/rmi/dgc/SCCS/s.Lease.java java/rmi/dgc/SCCS/s.DGC.java java/rmi/dgc/SCCS/s.VMID.java java/rmi/dgc/SCCS/s.package.html java/rmi/dgc/package.html java/rmi/dgc/DGC.java java/rmi/dgc/Lease.java java/rmi/dgc/VMID.java java/rmi/registry java/rmi/registry/SCCS java/rmi/registry/SCCS/s.LocateRegistry.java java/rmi/registry/SCCS/s.Registry.java java/rmi/registry/SCCS/s.RegistryHandler.java java/rmi/registry/SCCS/s.package.html java/rmi/registry/RegistryHandler.java java/rmi/registry/LocateRegistry.java java/rmi/registry/Registry.java java/rmi/registry/package.html java/rmi/server java/rmi/server/SCCS java/rmi/server/SCCS/s.RMIClassLoaderSpi.java java/rmi/server/SCCS/s.ExportException.java java/rmi/server/SCCS/s.LoaderHandler.java java/rmi/server/SCCS/s.LogStream.java java/rmi/server/SCCS/s.ObjID.java java/rmi/server/SCCS/s.Operation.java java/rmi/server/SCCS/s.RMIClassLoader.java java/rmi/server/SCCS/s.RMIClientSocketFactory.java java/rmi/server/SCCS/s.RMIFailureHandler.java java/rmi/server/SCCS/s.RMIServerSocketFactory.java java/rmi/server/SCCS/s.RMISocketFactory.java java/rmi/server/SCCS/s.RemoteCall.java java/rmi/server/SCCS/s.RemoteObject.java java/rmi/server/SCCS/s.RemoteRef.java java/rmi/server/SCCS/s.ServerNotActiveException.java java/rmi/server/SCCS/s.RemoteObjectInvocationHandler.java java/rmi/server/SCCS/s.RemoteServer.java java/rmi/server/SCCS/s.RemoteStub.java java/rmi/server/SCCS/s.ServerCloneException.java java/rmi/server/SCCS/s.ServerRef.java java/rmi/server/SCCS/s.Skeleton.java java/rmi/server/SCCS/s.UID.java java/rmi/server/SCCS/s.Unreferenced.java java/rmi/server/SCCS/s.SkeletonMismatchException.java java/rmi/server/SCCS/s.SkeletonNotFoundException.java java/rmi/server/SCCS/s.SocketSecurityException.java java/rmi/server/SCCS/s.UnicastRemoteObject.java java/rmi/server/SCCS/s.package.html java/rmi/server/RMIClientSocketFactory.java java/rmi/server/ExportException.java java/rmi/server/LoaderHandler.java java/rmi/server/LogStream.java java/rmi/server/ObjID.java java/rmi/server/Operation.java java/rmi/server/RMIClassLoader.java java/rmi/server/RMIClassLoaderSpi.java java/rmi/server/RemoteObjectInvocationHandler.java java/rmi/server/RMIFailureHandler.java java/rmi/server/RMIServerSocketFactory.java java/rmi/server/RMISocketFactory.java java/rmi/server/RemoteCall.java java/rmi/server/RemoteObject.java java/rmi/server/Unreferenced.java java/rmi/server/UID.java java/rmi/server/RemoteRef.java java/rmi/server/RemoteServer.java java/rmi/server/RemoteStub.java java/rmi/server/ServerCloneException.java java/rmi/server/ServerNotActiveException.java java/rmi/server/ServerRef.java java/rmi/server/Skeleton.java java/rmi/server/SkeletonMismatchException.java java/rmi/server/SkeletonNotFoundException.java java/rmi/server/SocketSecurityException.java java/rmi/server/UnicastRemoteObject.java java/rmi/server/package.html java/rmi/AlreadyBoundException.java java/rmi/AccessException.java java/rmi/ServerError.java java/rmi/ConnectException.java java/rmi/ConnectIOException.java java/rmi/MarshalException.java java/rmi/MarshalledObject.java java/rmi/Naming.java java/rmi/NoSuchObjectException.java java/rmi/NotBoundException.java java/rmi/RMISecurityException.java java/rmi/RMISecurityManager.java java/rmi/Remote.java java/rmi/ServerRuntimeException.java java/rmi/RemoteException.java java/rmi/ServerException.java java/rmi/StubNotFoundException.java java/rmi/UnexpectedException.java java/rmi/UnknownHostException.java java/rmi/UnmarshalException.java java/rmi/package.html java/security java/security/SCCS java/security/SCCS/s.AccessControlException.java java/security/SCCS/s.AccessControlContext.java java/security/SCCS/s.AccessController.java java/security/SCCS/s.AlgorithmParameters.java java/security/SCCS/s.DigestException.java java/security/SCCS/s.AlgorithmParameterGenerator.java java/security/SCCS/s.AlgorithmParameterGeneratorSpi.java java/security/SCCS/s.AlgorithmParametersSpi.java java/security/SCCS/s.AllPermission.java java/security/SCCS/s.AuthProvider.java java/security/SCCS/s.BasicPermission.java java/security/SCCS/s.Certificate.java java/security/SCCS/s.CodeSigner.java java/security/SCCS/s.CodeSource.java java/security/SCCS/s.GeneralSecurityException.java java/security/SCCS/s.DigestInputStream.java java/security/SCCS/s.DigestOutputStream.java java/security/SCCS/s.DomainCombiner.java java/security/SCCS/s.GuardedObject.java java/security/SCCS/s.Guard.java java/security/SCCS/s.IdentityScope.java java/security/SCCS/s.Identity.java java/security/SCCS/s.Key.java java/security/SCCS/s.InvalidAlgorithmParameterException.java java/security/SCCS/s.InvalidKeyException.java java/security/SCCS/s.InvalidParameterException.java java/security/SCCS/s.KeyException.java java/security/SCCS/s.KeyFactory.java java/security/SCCS/s.PrivilegedActionException.java java/security/SCCS/s.KeyFactorySpi.java java/security/SCCS/s.KeyManagementException.java java/security/SCCS/s.KeyPair.java java/security/SCCS/s.KeyPairGenerator.java java/security/SCCS/s.KeyPairGeneratorSpi.java java/security/SCCS/s.KeyRep.java java/security/SCCS/s.KeyStore.java java/security/SCCS/s.KeyStoreException.java java/security/SCCS/s.KeyStoreSpi.java java/security/SCCS/s.MessageDigest.java java/security/SCCS/s.MessageDigestSpi.java java/security/SCCS/s.NoSuchAlgorithmException.java java/security/SCCS/s.NoSuchProviderException.java java/security/SCCS/s.Permission.java java/security/SCCS/s.PermissionCollection.java java/security/SCCS/s.Permissions.java java/security/SCCS/s.Policy.java java/security/SCCS/s.Principal.java java/security/SCCS/s.PrivateKey.java java/security/SCCS/s.PrivilegedAction.java java/security/SCCS/s.UnresolvedPermissionCollection.java java/security/SCCS/s.PrivilegedExceptionAction.java java/security/SCCS/s.ProtectionDomain.java java/security/SCCS/s.Provider.java java/security/SCCS/s.ProviderException.java java/security/SCCS/s.PublicKey.java java/security/SCCS/s.SecureClassLoader.java java/security/SCCS/s.SecureRandom.java java/security/SCCS/s.SecureRandomSpi.java java/security/SCCS/s.Security.java java/security/SCCS/s.SecurityPermission.java java/security/SCCS/s.Signature.java java/security/SCCS/s.SignatureException.java java/security/SCCS/s.SignatureSpi.java java/security/SCCS/s.SignedObject.java java/security/SCCS/s.Signer.java java/security/SCCS/s.Timestamp.java java/security/SCCS/s.UnrecoverableEntryException.java java/security/SCCS/s.UnrecoverableKeyException.java java/security/SCCS/s.UnresolvedPermission.java java/security/SCCS/s.package.html java/security/acl java/security/acl/SCCS java/security/acl/SCCS/s.AclEntry.java java/security/acl/SCCS/s.Acl.java java/security/acl/SCCS/s.AclNotFoundException.java java/security/acl/SCCS/s.Group.java java/security/acl/SCCS/s.LastOwnerException.java java/security/acl/SCCS/s.NotOwnerException.java java/security/acl/SCCS/s.Owner.java java/security/acl/SCCS/s.Permission.java java/security/acl/SCCS/s.package.html java/security/acl/AclEntry.java java/security/acl/Acl.java java/security/acl/AclNotFoundException.java java/security/acl/Group.java java/security/acl/LastOwnerException.java java/security/acl/NotOwnerException.java java/security/acl/Owner.java java/security/acl/Permission.java java/security/acl/package.html java/security/cert java/security/cert/SCCS java/security/cert/SCCS/s.CRLException.java java/security/cert/SCCS/s.CRL.java java/security/cert/SCCS/s.CertPathBuilder.java java/security/cert/SCCS/s.CRLSelector.java java/security/cert/SCCS/s.CertPath.java java/security/cert/SCCS/s.CertificateEncodingException.java java/security/cert/SCCS/s.CertPathBuilderException.java java/security/cert/SCCS/s.CertPathBuilderResult.java java/security/cert/SCCS/s.CertPathBuilderSpi.java java/security/cert/SCCS/s.CertPathHelperImpl.java java/security/cert/SCCS/s.CertPathParameters.java java/security/cert/SCCS/s.CertPathValidator.java java/security/cert/SCCS/s.CertPathValidatorException.java java/security/cert/SCCS/s.CertPathValidatorResult.java java/security/cert/SCCS/s.CertPathValidatorSpi.java java/security/cert/SCCS/s.CertSelector.java java/security/cert/SCCS/s.CertStore.java java/security/cert/SCCS/s.CertStoreException.java java/security/cert/SCCS/s.CertStoreParameters.java java/security/cert/SCCS/s.CertStoreSpi.java java/security/cert/SCCS/s.Certificate.java java/security/cert/SCCS/s.CertificateExpiredException.java java/security/cert/SCCS/s.CertificateException.java java/security/cert/SCCS/s.CertificateFactorySpi.java java/security/cert/SCCS/s.CertificateFactory.java java/security/cert/SCCS/s.X509CRLSelector.java java/security/cert/SCCS/s.X509CRL.java java/security/cert/SCCS/s.CertificateNotYetValidException.java java/security/cert/SCCS/s.PolicyNode.java java/security/cert/SCCS/s.CertificateParsingException.java java/security/cert/SCCS/s.CollectionCertStoreParameters.java java/security/cert/SCCS/s.LDAPCertStoreParameters.java java/security/cert/SCCS/s.PKIXBuilderParameters.java java/security/cert/SCCS/s.PKIXCertPathBuilderResult.java java/security/cert/SCCS/s.PKIXCertPathChecker.java java/security/cert/SCCS/s.PKIXCertPathValidatorResult.java java/security/cert/SCCS/s.PKIXParameters.java java/security/cert/SCCS/s.PolicyQualifierInfo.java java/security/cert/SCCS/s.TrustAnchor.java java/security/cert/SCCS/s.X509CRLEntry.java java/security/cert/SCCS/s.X509CertSelector.java java/security/cert/SCCS/s.X509Certificate.java java/security/cert/SCCS/s.package.html java/security/cert/SCCS/s.X509Extension.java java/security/cert/CRLException.java java/security/cert/CRL.java java/security/cert/CertPathBuilder.java java/security/cert/CRLSelector.java java/security/cert/CertPath.java java/security/cert/CertPathBuilderException.java java/security/cert/CertPathBuilderResult.java java/security/cert/CertPathBuilderSpi.java java/security/cert/CertPathHelperImpl.java java/security/cert/CertPathParameters.java java/security/cert/CertPathValidator.java java/security/cert/CertPathValidatorException.java java/security/cert/CertPathValidatorResult.java java/security/cert/TrustAnchor.java java/security/cert/PolicyNode.java java/security/cert/CertPathValidatorSpi.java java/security/cert/CertSelector.java java/security/cert/CertStore.java java/security/cert/CertStoreException.java java/security/cert/CertStoreParameters.java java/security/cert/CertStoreSpi.java java/security/cert/Certificate.java java/security/cert/CertificateEncodingException.java java/security/cert/CertificateException.java java/security/cert/CertificateExpiredException.java java/security/cert/CertificateFactory.java java/security/cert/CertificateFactorySpi.java java/security/cert/CertificateNotYetValidException.java java/security/cert/CertificateParsingException.java java/security/cert/CollectionCertStoreParameters.java java/security/cert/LDAPCertStoreParameters.java java/security/cert/PKIXBuilderParameters.java java/security/cert/PKIXCertPathBuilderResult.java java/security/cert/PKIXCertPathChecker.java java/security/cert/PKIXCertPathValidatorResult.java java/security/cert/PKIXParameters.java java/security/cert/PolicyQualifierInfo.java java/security/cert/X509CRL.java java/security/cert/X509CRLEntry.java java/security/cert/X509CRLSelector.java java/security/cert/X509CertSelector.java java/security/cert/X509Certificate.java java/security/cert/X509Extension.java java/security/cert/package.html java/security/interfaces java/security/interfaces/SCCS java/security/interfaces/SCCS/s.DSAParams.java java/security/interfaces/SCCS/s.DSAKey.java java/security/interfaces/SCCS/s.RSAMultiPrimePrivateCrtKey.java java/security/interfaces/SCCS/s.DSAKeyPairGenerator.java java/security/interfaces/SCCS/s.DSAPrivateKey.java java/security/interfaces/SCCS/s.DSAPublicKey.java java/security/interfaces/SCCS/s.ECKey.java java/security/interfaces/SCCS/s.ECPrivateKey.java java/security/interfaces/SCCS/s.ECPublicKey.java java/security/interfaces/SCCS/s.RSAKey.java java/security/interfaces/SCCS/s.RSAPrivateCrtKey.java java/security/interfaces/SCCS/s.RSAPrivateKey.java java/security/interfaces/SCCS/s.RSAPublicKey.java java/security/interfaces/SCCS/s.package.html java/security/interfaces/DSAParams.java java/security/interfaces/DSAKey.java java/security/interfaces/DSAKeyPairGenerator.java java/security/interfaces/DSAPrivateKey.java java/security/interfaces/DSAPublicKey.java java/security/interfaces/ECKey.java java/security/interfaces/ECPrivateKey.java java/security/interfaces/ECPublicKey.java java/security/interfaces/RSAKey.java java/security/interfaces/RSAMultiPrimePrivateCrtKey.java java/security/interfaces/RSAPrivateCrtKey.java java/security/interfaces/RSAPrivateKey.java java/security/interfaces/RSAPublicKey.java java/security/interfaces/package.html java/security/spec java/security/spec/SCCS java/security/spec/SCCS/s.InvalidParameterSpecException.java java/security/spec/SCCS/s.AlgorithmParameterSpec.java java/security/spec/SCCS/s.DSAParameterSpec.java java/security/spec/SCCS/s.DSAPrivateKeySpec.java java/security/spec/SCCS/s.DSAPublicKeySpec.java java/security/spec/SCCS/s.ECField.java java/security/spec/SCCS/s.ECFieldF2m.java java/security/spec/SCCS/s.ECFieldFp.java java/security/spec/SCCS/s.ECGenParameterSpec.java java/security/spec/SCCS/s.ECParameterSpec.java java/security/spec/SCCS/s.ECPoint.java java/security/spec/SCCS/s.ECPrivateKeySpec.java java/security/spec/SCCS/s.ECPublicKeySpec.java java/security/spec/SCCS/s.EllipticCurve.java java/security/spec/SCCS/s.EncodedKeySpec.java java/security/spec/SCCS/s.InvalidKeySpecException.java java/security/spec/SCCS/s.PSSParameterSpec.java java/security/spec/SCCS/s.KeySpec.java java/security/spec/SCCS/s.RSAKeyGenParameterSpec.java java/security/spec/SCCS/s.MGF1ParameterSpec.java java/security/spec/SCCS/s.PKCS8EncodedKeySpec.java java/security/spec/SCCS/s.package.html java/security/spec/SCCS/s.RSAMultiPrimePrivateCrtKeySpec.java java/security/spec/SCCS/s.RSAOtherPrimeInfo.java java/security/spec/SCCS/s.RSAPrivateCrtKeySpec.java java/security/spec/SCCS/s.RSAPrivateKeySpec.java java/security/spec/SCCS/s.RSAPublicKeySpec.java java/security/spec/SCCS/s.X509EncodedKeySpec.java java/security/spec/AlgorithmParameterSpec.java java/security/spec/DSAParameterSpec.java java/security/spec/DSAPrivateKeySpec.java java/security/spec/DSAPublicKeySpec.java java/security/spec/ECField.java java/security/spec/ECFieldF2m.java java/security/spec/ECFieldFp.java java/security/spec/ECGenParameterSpec.java java/security/spec/ECParameterSpec.java java/security/spec/ECPoint.java java/security/spec/ECPrivateKeySpec.java java/security/spec/ECPublicKeySpec.java java/security/spec/EllipticCurve.java java/security/spec/EncodedKeySpec.java java/security/spec/MGF1ParameterSpec.java java/security/spec/KeySpec.java java/security/spec/InvalidKeySpecException.java java/security/spec/InvalidParameterSpecException.java java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java java/security/spec/PKCS8EncodedKeySpec.java java/security/spec/PSSParameterSpec.java java/security/spec/RSAKeyGenParameterSpec.java java/security/spec/RSAPrivateCrtKeySpec.java java/security/spec/RSAOtherPrimeInfo.java java/security/spec/RSAPrivateKeySpec.java java/security/spec/RSAPublicKeySpec.java java/security/spec/X509EncodedKeySpec.java java/security/spec/package.html java/security/AlgorithmParameterGenerator.java java/security/AccessControlContext.java java/security/AccessControlException.java java/security/AccessController.java java/security/Guard.java java/security/AlgorithmParameterGeneratorSpi.java java/security/AlgorithmParameters.java java/security/AlgorithmParametersSpi.java java/security/AllPermission.java java/security/AuthProvider.java java/security/BasicPermission.java java/security/InvalidKeyException.java java/security/Certificate.java java/security/CodeSigner.java java/security/CodeSource.java java/security/DigestException.java java/security/DigestInputStream.java java/security/DigestOutputStream.java java/security/DomainCombiner.java java/security/GeneralSecurityException.java java/security/GuardedObject.java java/security/Identity.java java/security/IdentityScope.java java/security/Key.java java/security/KeyFactorySpi.java java/security/InvalidAlgorithmParameterException.java java/security/InvalidParameterException.java java/security/KeyException.java java/security/KeyFactory.java java/security/NoSuchAlgorithmException.java java/security/KeyManagementException.java java/security/KeyPair.java java/security/KeyPairGenerator.java java/security/KeyPairGeneratorSpi.java java/security/KeyRep.java java/security/KeyStore.java java/security/KeyStoreException.java java/security/KeyStoreSpi.java java/security/MessageDigest.java java/security/MessageDigestSpi.java java/security/PrivilegedAction.java java/security/Policy.java java/security/NoSuchProviderException.java java/security/Permission.java java/security/PermissionCollection.java java/security/Permissions.java java/security/Principal.java java/security/PrivateKey.java java/security/UnresolvedPermission.java java/security/PrivilegedActionException.java java/security/PrivilegedExceptionAction.java java/security/ProtectionDomain.java java/security/Provider.java java/security/ProviderException.java java/security/PublicKey.java java/security/SecureClassLoader.java java/security/SecureRandom.java java/security/SecureRandomSpi.java java/security/Security.java java/security/SecurityPermission.java java/security/Signature.java java/security/SignatureException.java java/security/SignatureSpi.java java/security/SignedObject.java java/security/Signer.java java/security/Timestamp.java java/security/UnrecoverableEntryException.java java/security/UnrecoverableKeyException.java java/security/UnresolvedPermissionCollection.java java/security/package.html java/sql java/sql/SCCS java/sql/SCCS/s.Array.java java/sql/SCCS/s.Blob.java java/sql/SCCS/s.Clob.java java/sql/SCCS/s.DataTruncation.java java/sql/SCCS/s.BatchUpdateException.java java/sql/SCCS/s.CallableStatement.java java/sql/SCCS/s.Connection.java java/sql/SCCS/s.DatabaseMetaData.java java/sql/SCCS/s.Date.java java/sql/SCCS/s.Driver.java java/sql/SCCS/s.DriverManager.java java/sql/SCCS/s.DriverPropertyInfo.java java/sql/SCCS/s.ParameterMetaData.java java/sql/SCCS/s.PreparedStatement.java java/sql/SCCS/s.Ref.java java/sql/SCCS/s.ResultSet.java java/sql/SCCS/s.SQLData.java java/sql/SCCS/s.ResultSetMetaData.java java/sql/SCCS/s.SQLException.java java/sql/SCCS/s.SQLInput.java java/sql/SCCS/s.SQLOutput.java java/sql/SCCS/s.SQLPermission.java java/sql/SCCS/s.SQLWarning.java java/sql/SCCS/s.Savepoint.java java/sql/SCCS/s.Statement.java java/sql/SCCS/s.Struct.java java/sql/SCCS/s.Time.java java/sql/SCCS/s.Timestamp.java java/sql/SCCS/s.Types.java java/sql/SCCS/s.package.html java/sql/Array.java java/sql/Blob.java java/sql/Clob.java java/sql/DataTruncation.java java/sql/BatchUpdateException.java java/sql/CallableStatement.java java/sql/Connection.java java/sql/DatabaseMetaData.java java/sql/Date.java java/sql/Driver.java java/sql/DriverManager.java java/sql/DriverPropertyInfo.java java/sql/ParameterMetaData.java java/sql/PreparedStatement.java java/sql/Ref.java java/sql/ResultSet.java java/sql/ResultSetMetaData.java java/sql/Struct.java java/sql/SQLData.java java/sql/SQLException.java java/sql/SQLInput.java java/sql/SQLOutput.java java/sql/SQLPermission.java java/sql/SQLWarning.java java/sql/Savepoint.java java/sql/Statement.java java/sql/Time.java java/sql/Timestamp.java java/sql/Types.java java/sql/package.html java/text java/text/SCCS java/text/SCCS/s.AttributedString.java java/text/SCCS/s.Annotation.java java/text/SCCS/s.Bidi.java java/text/SCCS/s.AttributedCharacterIterator.java java/text/SCCS/s.ChoiceFormat.java java/text/SCCS/s.DateFormatSymbols.java java/text/SCCS/s.BreakDictionary.java java/text/SCCS/s.BreakIterator.java java/text/SCCS/s.CharacterIterator.java java/text/SCCS/s.CharacterIteratorFieldDelegate.java java/text/SCCS/s.CollationElementIterator.java java/text/SCCS/s.CollationKey.java java/text/SCCS/s.CollationRules.java java/text/SCCS/s.Collator.java java/text/SCCS/s.DateFormat.java java/text/SCCS/s.DecimalFormatSymbols.java java/text/SCCS/s.DecimalFormat.java java/text/SCCS/s.DictionaryBasedBreakIterator.java java/text/SCCS/s.DigitList.java java/text/SCCS/s.DontCareFieldPosition.java java/text/SCCS/s.EntryPair.java java/text/SCCS/s.FieldPosition.java java/text/SCCS/s.Format.java java/text/SCCS/s.MergeCollation.java java/text/SCCS/s.MessageFormat.java java/text/SCCS/s.NumberFormat.java java/text/SCCS/s.ParseException.java java/text/SCCS/s.ParsePosition.java java/text/SCCS/s.PatternEntry.java java/text/SCCS/s.RBCollationTables.java java/text/SCCS/s.package.html java/text/SCCS/s.RBTableBuilder.java java/text/SCCS/s.RuleBasedBreakIterator.java java/text/SCCS/s.RuleBasedCollator.java java/text/SCCS/s.SimpleDateFormat.java java/text/SCCS/s.StringCharacterIterator.java java/text/AttributedString.java java/text/Annotation.java java/text/BreakIterator.java java/text/Bidi.java java/text/AttributedCharacterIterator.java java/text/BreakDictionary.java java/text/CharacterIterator.java java/text/ChoiceFormat.java java/text/CollationKey.java java/text/CharacterIteratorFieldDelegate.java java/text/CollationElementIterator.java java/text/CollationRules.java java/text/Collator.java java/text/DateFormat.java java/text/DictionaryBasedBreakIterator.java java/text/DateFormatSymbols.java java/text/DecimalFormat.java java/text/DecimalFormatSymbols.java java/text/DigitList.java java/text/EntryPair.java java/text/MergeCollation.java java/text/Format.java java/text/DontCareFieldPosition.java java/text/FieldPosition.java java/text/MessageFormat.java java/text/NumberFormat.java java/text/ParseException.java java/text/ParsePosition.java java/text/PatternEntry.java java/text/RBCollationTables.java java/text/RBTableBuilder.java java/text/package.html java/text/RuleBasedCollator.java java/text/RuleBasedBreakIterator.java java/text/SimpleDateFormat.java java/text/StringCharacterIterator.java java/util java/util/SCCS java/util/SCCS/s.AbstractSequentialList.java java/util/SCCS/s.AbstractCollection.java java/util/SCCS/s.AbstractList.java java/util/SCCS/s.AbstractMap.java java/util/SCCS/s.AbstractQueue.java java/util/SCCS/s.AbstractSet.java java/util/SCCS/s.ArrayList.java java/util/SCCS/s.Arrays.java java/util/SCCS/s.BitSet.java java/util/SCCS/s.Calendar.java java/util/SCCS/s.Collection.java java/util/SCCS/s.Collections.java java/util/SCCS/s.Comparator.java java/util/SCCS/s.Currency.java java/util/SCCS/s.ConcurrentModificationException.java java/util/SCCS/s.EmptyStackException.java java/util/SCCS/s.Date.java java/util/SCCS/s.EnumMap.java java/util/SCCS/s.CurrencyData.properties java/util/SCCS/s.Dictionary.java java/util/SCCS/s.Enumeration.java java/util/SCCS/s.EnumSet.java java/util/SCCS/s.DuplicateFormatFlagsException.java java/util/SCCS/s.EventListener.java java/util/SCCS/s.EventListenerProxy.java java/util/SCCS/s.EventObject.java java/util/SCCS/s.Formattable.java java/util/SCCS/s.FormattableFlags.java java/util/SCCS/s.FormatFlagsConversionMismatchException.java java/util/SCCS/s.Formatter.java java/util/SCCS/s.Iterator.java java/util/SCCS/s.ListResourceBundle.java java/util/SCCS/s.FormatterClosedException.java java/util/SCCS/s.GregorianCalendar.java java/util/SCCS/s.HashMap.java java/util/SCCS/s.HashSet.java java/util/SCCS/s.Hashtable.java java/util/SCCS/s.IdentityHashMap.java java/util/SCCS/s.IllegalFormatCodePointException.java java/util/SCCS/s.IllegalFormatConversionException.java java/util/SCCS/s.IllegalFormatException.java java/util/SCCS/s.IllegalFormatFlagsException.java java/util/SCCS/s.IllegalFormatPrecisionException.java java/util/SCCS/s.IllegalFormatWidthException.java java/util/SCCS/s.InputMismatchException.java java/util/SCCS/s.InvalidPropertiesFormatException.java java/util/SCCS/s.JumboEnumSet.java java/util/SCCS/s.LinkedHashMap.java java/util/SCCS/s.LinkedHashSet.java java/util/SCCS/s.LinkedList.java java/util/SCCS/s.List.java java/util/SCCS/s.ListIterator.java java/util/SCCS/s.Locale.java java/util/SCCS/s.Map.java java/util/SCCS/s.NoSuchElementException.java java/util/SCCS/s.MissingFormatArgumentException.java java/util/SCCS/s.MissingFormatWidthException.java java/util/SCCS/s.MissingResourceException.java java/util/SCCS/s.Observable.java java/util/SCCS/s.SortedMap.java java/util/SCCS/s.Set.java java/util/SCCS/s.Observer.java java/util/SCCS/s.PriorityQueue.java java/util/SCCS/s.Properties.java java/util/SCCS/s.PropertyPermission.java java/util/SCCS/s.PropertyResourceBundle.java java/util/SCCS/s.Queue.java java/util/SCCS/s.Random.java java/util/SCCS/s.RandomAccess.java java/util/SCCS/s.RegularEnumSet.java java/util/SCCS/s.ResourceBundle.java java/util/SCCS/s.ResourceBundleEnumeration.java java/util/SCCS/s.Scanner.java java/util/SCCS/s.SimpleTimeZone.java java/util/SCCS/s.SortedSet.java java/util/SCCS/s.Stack.java java/util/SCCS/s.TreeMap.java java/util/SCCS/s.StringTokenizer.java java/util/SCCS/s.TimeZone.java java/util/SCCS/s.Timer.java java/util/SCCS/s.TimerTask.java java/util/SCCS/s.TooManyListenersException.java java/util/SCCS/s.TreeSet.java java/util/SCCS/s.UUID.java java/util/SCCS/s.Vector.java java/util/SCCS/s.WeakHashMap.java java/util/SCCS/s.UnknownFormatConversionException.java java/util/SCCS/s.UnknownFormatFlagsException.java java/util/SCCS/s.XMLUtils.java java/util/SCCS/s.package.html java/util/concurrent java/util/concurrent/SCCS java/util/concurrent/SCCS/s.AbstractExecutorService.java java/util/concurrent/SCCS/p.ConcurrentHashMap.java java/util/concurrent/SCCS/s.ArrayBlockingQueue.java java/util/concurrent/SCCS/s.BlockingQueue.java java/util/concurrent/SCCS/s.BrokenBarrierException.java java/util/concurrent/SCCS/s.Callable.java java/util/concurrent/SCCS/s.CancellationException.java java/util/concurrent/SCCS/s.CompletionService.java java/util/concurrent/SCCS/s.ConcurrentHashMap.java java/util/concurrent/SCCS/s.ConcurrentLinkedQueue.java java/util/concurrent/SCCS/s.ConcurrentMap.java java/util/concurrent/SCCS/s.CopyOnWriteArrayList.java java/util/concurrent/SCCS/s.Future.java java/util/concurrent/SCCS/s.LinkedBlockingQueue.java java/util/concurrent/SCCS/s.CopyOnWriteArraySet.java java/util/concurrent/SCCS/s.CountDownLatch.java java/util/concurrent/SCCS/s.CyclicBarrier.java java/util/concurrent/SCCS/s.DelayQueue.java java/util/concurrent/SCCS/s.Delayed.java java/util/concurrent/SCCS/s.Exchanger.java java/util/concurrent/SCCS/s.ExecutionException.java java/util/concurrent/SCCS/s.Executor.java java/util/concurrent/SCCS/s.ExecutorCompletionService.java java/util/concurrent/SCCS/s.ExecutorService.java java/util/concurrent/SCCS/s.Executors.java java/util/concurrent/SCCS/s.FutureTask.java java/util/concurrent/SCCS/s.RejectedExecutionException.java java/util/concurrent/SCCS/s.PriorityBlockingQueue.java java/util/concurrent/SCCS/s.RejectedExecutionHandler.java java/util/concurrent/SCCS/s.ScheduledExecutorService.java java/util/concurrent/SCCS/s.ScheduledFuture.java java/util/concurrent/SCCS/s.ScheduledThreadPoolExecutor.java java/util/concurrent/SCCS/s.Semaphore.java java/util/concurrent/SCCS/s.SynchronousQueue.java java/util/concurrent/SCCS/s.ThreadFactory.java java/util/concurrent/SCCS/s.ThreadPoolExecutor.java java/util/concurrent/SCCS/s.TimeUnit.java java/util/concurrent/SCCS/s.TimeoutException.java java/util/concurrent/SCCS/s.package.html java/util/concurrent/SCCS/p.ConcurrentLinkedQueue.java java/util/concurrent/SCCS/p.ThreadPoolExecutor.java java/util/concurrent/atomic java/util/concurrent/atomic/SCCS java/util/concurrent/atomic/SCCS/s.AtomicIntegerArray.java java/util/concurrent/atomic/SCCS/s.AtomicBoolean.java java/util/concurrent/atomic/SCCS/s.AtomicInteger.java java/util/concurrent/atomic/SCCS/s.AtomicIntegerFieldUpdater.java java/util/concurrent/atomic/SCCS/s.AtomicLong.java java/util/concurrent/atomic/SCCS/s.AtomicLongArray.java java/util/concurrent/atomic/SCCS/s.AtomicLongFieldUpdater.java java/util/concurrent/atomic/SCCS/s.AtomicMarkableReference.java java/util/concurrent/atomic/SCCS/s.AtomicReference.java java/util/concurrent/atomic/SCCS/s.AtomicReferenceArray.java java/util/concurrent/atomic/SCCS/s.AtomicReferenceFieldUpdater.java java/util/concurrent/atomic/SCCS/s.AtomicStampedReference.java java/util/concurrent/atomic/SCCS/s.package.html java/util/concurrent/atomic/AtomicIntegerArray.java java/util/concurrent/atomic/AtomicBoolean.java java/util/concurrent/atomic/AtomicInteger.java java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java java/util/concurrent/atomic/AtomicLong.java java/util/concurrent/atomic/AtomicLongArray.java java/util/concurrent/atomic/AtomicLongFieldUpdater.java java/util/concurrent/atomic/AtomicMarkableReference.java java/util/concurrent/atomic/AtomicReference.java java/util/concurrent/atomic/AtomicReferenceArray.java java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java java/util/concurrent/atomic/AtomicStampedReference.java java/util/concurrent/atomic/package.html java/util/concurrent/locks java/util/concurrent/locks/SCCS java/util/concurrent/locks/SCCS/s.LockSupport.java java/util/concurrent/locks/SCCS/s.Lock.java java/util/concurrent/locks/SCCS/s.AbstractQueuedSynchronizer.java java/util/concurrent/locks/SCCS/s.Condition.java java/util/concurrent/locks/SCCS/s.ReentrantReadWriteLock.java java/util/concurrent/locks/SCCS/s.ReadWriteLock.java java/util/concurrent/locks/SCCS/s.ReentrantLock.java java/util/concurrent/locks/SCCS/s.package.html java/util/concurrent/locks/LockSupport.java java/util/concurrent/locks/Lock.java java/util/concurrent/locks/AbstractQueuedSynchronizer.java java/util/concurrent/locks/Condition.java java/util/concurrent/locks/ReentrantReadWriteLock.java java/util/concurrent/locks/ReadWriteLock.java java/util/concurrent/locks/ReentrantLock.java java/util/concurrent/locks/package.html java/util/concurrent/AbstractExecutorService.java java/util/concurrent/AbstractExecutorService.java~ java/util/concurrent/ArrayBlockingQueue.java java/util/concurrent/BlockingQueue.java java/util/concurrent/BrokenBarrierException.java java/util/concurrent/Callable.java java/util/concurrent/CancellationException.java java/util/concurrent/CompletionService.java java/util/concurrent/CompletionService.java~ java/util/concurrent/ConcurrentHashMap.java java/util/concurrent/ConcurrentLinkedQueue.java java/util/concurrent/ConcurrentMap.java java/util/concurrent/ExecutorCompletionService.java java/util/concurrent/CopyOnWriteArrayList.java java/util/concurrent/CopyOnWriteArraySet.java java/util/concurrent/CountDownLatch.java java/util/concurrent/CyclicBarrier.java java/util/concurrent/DelayQueue.java java/util/concurrent/Delayed.java java/util/concurrent/Exchanger.java java/util/concurrent/ExecutionException.java java/util/concurrent/Executor.java java/util/concurrent/FutureTask.java java/util/concurrent/Future.java java/util/concurrent/ExecutorCompletionService.java~ java/util/concurrent/ExecutorService.java java/util/concurrent/Executors.java java/util/concurrent/RejectedExecutionException.java java/util/concurrent/LinkedBlockingQueue.java java/util/concurrent/PriorityBlockingQueue.java java/util/concurrent/ScheduledThreadPoolExecutor.java java/util/concurrent/RejectedExecutionHandler.java java/util/concurrent/ScheduledExecutorService.java java/util/concurrent/ScheduledFuture.java java/util/concurrent/SynchronousQueue.java java/util/concurrent/Semaphore.java java/util/concurrent/ThreadFactory.java java/util/concurrent/ThreadPoolExecutor.java java/util/concurrent/TimeUnit.java java/util/concurrent/TimeoutException.java java/util/concurrent/package.html java/util/jar java/util/jar/SCCS java/util/jar/SCCS/s.JarInputStream.java java/util/jar/SCCS/s.Attributes.java java/util/jar/SCCS/s.JarEntry.java java/util/jar/SCCS/s.JarException.java java/util/jar/SCCS/s.JarFile.java java/util/jar/SCCS/s.JavaUtilJarAccessImpl.java java/util/jar/SCCS/s.JarOutputStream.java java/util/jar/SCCS/s.JarVerifier.java java/util/jar/SCCS/s.Manifest.java java/util/jar/SCCS/s.Pack200.java java/util/jar/SCCS/s.package.html java/util/jar/JarException.java java/util/jar/Attributes.java java/util/jar/JarEntry.java java/util/jar/JarOutputStream.java java/util/jar/JarFile.java java/util/jar/JarInputStream.java java/util/jar/JavaUtilJarAccessImpl.java java/util/jar/JarVerifier.java java/util/jar/Manifest.java java/util/jar/Pack200.java java/util/jar/package.html java/util/logging java/util/logging/SCCS java/util/logging/SCCS/s.LoggingPermission.java java/util/logging/SCCS/s.ConsoleHandler.java java/util/logging/SCCS/s.ErrorManager.java java/util/logging/SCCS/s.FileHandler.java java/util/logging/SCCS/s.Filter.java java/util/logging/SCCS/s.Formatter.java java/util/logging/SCCS/s.Handler.java java/util/logging/SCCS/s.Level.java java/util/logging/SCCS/s.LogManager.java java/util/logging/SCCS/s.LogRecord.java java/util/logging/SCCS/s.Logger.java java/util/logging/SCCS/s.Logging.java java/util/logging/SCCS/s.LoggingMXBean.java java/util/logging/SCCS/s.MemoryHandler.java java/util/logging/SCCS/s.SimpleFormatter.java java/util/logging/SCCS/s.SocketHandler.java java/util/logging/SCCS/s.StreamHandler.java java/util/logging/SCCS/s.XMLFormatter.java java/util/logging/SCCS/s.package.html java/util/logging/LoggingPermission.java java/util/logging/ConsoleHandler.java java/util/logging/ErrorManager.java java/util/logging/FileHandler.java java/util/logging/Filter.java java/util/logging/Formatter.java java/util/logging/Handler.java java/util/logging/Level.java java/util/logging/LogManager.java java/util/logging/LogRecord.java java/util/logging/Logger.java java/util/logging/Logging.java java/util/logging/LoggingMXBean.java java/util/logging/MemoryHandler.java java/util/logging/SimpleFormatter.java java/util/logging/SocketHandler.java java/util/logging/StreamHandler.java java/util/logging/XMLFormatter.java java/util/logging/package.html java/util/prefs java/util/prefs/SCCS java/util/prefs/SCCS/s.BackingStoreException.java java/util/prefs/SCCS/s.AbstractPreferences.java java/util/prefs/SCCS/s.NodeChangeEvent.java java/util/prefs/SCCS/s.Base64.java java/util/prefs/SCCS/s.package.html java/util/prefs/SCCS/s.InvalidPreferencesFormatException.java java/util/prefs/SCCS/s.NodeChangeListener.java java/util/prefs/SCCS/s.PreferenceChangeEvent.java java/util/prefs/SCCS/s.PreferenceChangeListener.java java/util/prefs/SCCS/s.Preferences.java java/util/prefs/SCCS/s.PreferencesFactory.java java/util/prefs/SCCS/s.XmlSupport.java java/util/prefs/AbstractPreferences.java java/util/prefs/BackingStoreException.java java/util/prefs/Base64.java java/util/prefs/NodeChangeEvent.java java/util/prefs/Preferences.java java/util/prefs/InvalidPreferencesFormatException.java java/util/prefs/NodeChangeListener.java java/util/prefs/PreferenceChangeEvent.java java/util/prefs/PreferenceChangeListener.java java/util/prefs/PreferencesFactory.java java/util/prefs/XmlSupport.java java/util/prefs/package.html java/util/regex java/util/regex/SCCS java/util/regex/SCCS/s.MatchResult.java java/util/regex/SCCS/s.ASCII.java java/util/regex/SCCS/s.Matcher.java java/util/regex/SCCS/s.Pattern.java java/util/regex/SCCS/s.package.html java/util/regex/SCCS/s.PatternSyntaxException.java java/util/regex/MatchResult.java java/util/regex/ASCII.java java/util/regex/Matcher.java java/util/regex/Pattern.java java/util/regex/package.html java/util/regex/PatternSyntaxException.java java/util/zip java/util/zip/SCCS java/util/zip/SCCS/s.Adler32.java java/util/zip/SCCS/s.CRC32.java java/util/zip/SCCS/s.Checksum.java java/util/zip/SCCS/s.CheckedInputStream.java java/util/zip/SCCS/s.CheckedOutputStream.java java/util/zip/SCCS/s.DataFormatException.java java/util/zip/SCCS/s.Deflater.java java/util/zip/SCCS/s.DeflaterOutputStream.java java/util/zip/SCCS/s.GZIPInputStream.java java/util/zip/SCCS/s.GZIPOutputStream.java java/util/zip/SCCS/s.Inflater.java java/util/zip/SCCS/s.InflaterInputStream.java java/util/zip/SCCS/s.ZipConstants.java java/util/zip/SCCS/s.ZipEntry.java java/util/zip/SCCS/s.ZipException.java java/util/zip/SCCS/s.ZipFile.java java/util/zip/SCCS/s.ZipInputStream.java java/util/zip/SCCS/s.ZipOutputStream.java java/util/zip/SCCS/s.package.html java/util/zip/CheckedInputStream.java java/util/zip/Adler32.java java/util/zip/CRC32.java java/util/zip/ZipOutputStream.java java/util/zip/CheckedOutputStream.java java/util/zip/Checksum.java java/util/zip/DataFormatException.java java/util/zip/Deflater.java java/util/zip/DeflaterOutputStream.java java/util/zip/GZIPInputStream.java java/util/zip/GZIPOutputStream.java java/util/zip/Inflater.java java/util/zip/InflaterInputStream.java java/util/zip/ZipConstants.java java/util/zip/ZipEntry.java java/util/zip/ZipException.java java/util/zip/ZipFile.java java/util/zip/ZipInputStream.java java/util/zip/package.html java/util/AbstractSequentialList.java java/util/AbstractCollection.java java/util/AbstractList.java java/util/AbstractMap.java java/util/AbstractQueue.java java/util/CurrencyData.properties java/util/AbstractSet.java java/util/ArrayList.java java/util/Arrays.java java/util/BitSet.java java/util/Calendar.java java/util/Collection.java java/util/Collections.java java/util/Comparator.java java/util/Currency.java java/util/ConcurrentModificationException.java java/util/Date.java java/util/Dictionary.java java/util/EnumMap.java java/util/EnumSet.java java/util/EventListenerProxy.java java/util/DuplicateFormatFlagsException.java java/util/EmptyStackException.java java/util/Enumeration.java java/util/EventListener.java java/util/FormatterClosedException.java java/util/EventObject.java java/util/Formattable.java java/util/FormattableFlags.java java/util/FormatFlagsConversionMismatchException.java java/util/Formatter.java java/util/IllegalFormatException.java java/util/GregorianCalendar.java java/util/HashMap.java java/util/HashSet.java java/util/Hashtable.java java/util/IdentityHashMap.java java/util/MissingFormatArgumentException.java java/util/IllegalFormatCodePointException.java java/util/IllegalFormatConversionException.java java/util/IllegalFormatFlagsException.java java/util/IllegalFormatPrecisionException.java java/util/IllegalFormatWidthException.java java/util/InputMismatchException.java java/util/Iterator.java java/util/JumboEnumSet.java java/util/InvalidPropertiesFormatException.java java/util/LinkedHashMap.java java/util/LinkedHashSet.java java/util/LinkedList.java java/util/List.java java/util/ListIterator.java java/util/ListResourceBundle.java java/util/Locale.java java/util/Map.java java/util/Observer.java java/util/MissingFormatWidthException.java java/util/MissingResourceException.java java/util/NoSuchElementException.java java/util/Observable.java java/util/ResourceBundleEnumeration.java java/util/PriorityQueue.java java/util/Properties.java java/util/PropertyPermission.java java/util/PropertyResourceBundle.java java/util/Queue.java java/util/Random.java java/util/RandomAccess.java java/util/RegularEnumSet.java java/util/ResourceBundle.java java/util/SimpleTimeZone.java java/util/Scanner.java java/util/Set.java java/util/StringTokenizer.java java/util/SortedMap.java java/util/SortedSet.java java/util/Stack.java java/util/TimeZone.java java/util/Timer.java java/util/WeakHashMap.java java/util/UUID.java java/util/TimerTask.java java/util/TooManyListenersException.java java/util/TreeMap.java java/util/TreeSet.java java/util/Vector.java java/util/UnknownFormatConversionException.java java/util/UnknownFormatFlagsException.java java/util/XMLUtils.java java/util/package.html javax javax/accessibility javax/accessibility/SCCS javax/accessibility/SCCS/s.AccessibleAction.java javax/accessibility/SCCS/s.Accessible.java javax/accessibility/SCCS/s.AccessibleRelationSet.java javax/accessibility/SCCS/s.AccessibleAttributeSequence.java javax/accessibility/SCCS/s.AccessibleBundle.java javax/accessibility/SCCS/s.AccessibleComponent.java javax/accessibility/SCCS/s.AccessibleContext.java javax/accessibility/SCCS/s.AccessibleEditableText.java javax/accessibility/SCCS/s.AccessibleExtendedComponent.java javax/accessibility/SCCS/s.AccessibleExtendedTable.java javax/accessibility/SCCS/s.AccessibleExtendedText.java javax/accessibility/SCCS/s.AccessibleHyperlink.java javax/accessibility/SCCS/s.AccessibleHypertext.java javax/accessibility/SCCS/s.AccessibleIcon.java javax/accessibility/SCCS/s.AccessibleKeyBinding.java javax/accessibility/SCCS/s.AccessibleRelation.java javax/accessibility/SCCS/s.AccessibleTableModelChange.java javax/accessibility/SCCS/s.AccessibleResourceBundle.java javax/accessibility/SCCS/s.AccessibleRole.java javax/accessibility/SCCS/s.AccessibleSelection.java javax/accessibility/SCCS/s.AccessibleState.java javax/accessibility/SCCS/s.AccessibleStateSet.java javax/accessibility/SCCS/s.AccessibleStreamable.java javax/accessibility/SCCS/s.AccessibleTable.java javax/accessibility/SCCS/s.AccessibleText.java javax/accessibility/SCCS/s.AccessibleTextSequence.java javax/accessibility/SCCS/s.AccessibleValue.java javax/accessibility/SCCS/s.package.html javax/accessibility/AccessibleAction.java javax/accessibility/Accessible.java javax/accessibility/AccessibleResourceBundle.java javax/accessibility/AccessibleAttributeSequence.java javax/accessibility/AccessibleBundle.java javax/accessibility/AccessibleComponent.java javax/accessibility/AccessibleContext.java javax/accessibility/AccessibleEditableText.java javax/accessibility/AccessibleExtendedComponent.java javax/accessibility/AccessibleExtendedTable.java javax/accessibility/AccessibleExtendedText.java javax/accessibility/AccessibleHyperlink.java javax/accessibility/AccessibleHypertext.java javax/accessibility/AccessibleIcon.java javax/accessibility/AccessibleKeyBinding.java javax/accessibility/AccessibleRelation.java javax/accessibility/AccessibleRelationSet.java javax/accessibility/AccessibleSelection.java javax/accessibility/AccessibleRole.java javax/accessibility/AccessibleStreamable.java javax/accessibility/AccessibleState.java javax/accessibility/AccessibleStateSet.java javax/accessibility/AccessibleTableModelChange.java javax/accessibility/AccessibleTable.java javax/accessibility/AccessibleTextSequence.java javax/accessibility/AccessibleText.java javax/accessibility/AccessibleValue.java javax/accessibility/package.html javax/activity javax/activity/SCCS javax/activity/SCCS/s.ActivityCompletedException.java javax/activity/SCCS/s.ActivityRequiredException.java javax/activity/SCCS/s.InvalidActivityException.java javax/activity/SCCS/s.package.html javax/activity/ActivityCompletedException.java javax/activity/ActivityRequiredException.java javax/activity/InvalidActivityException.java javax/activity/package.html javax/imageio javax/imageio/SCCS javax/imageio/SCCS/s.IIOParamController.java javax/imageio/SCCS/s.IIOException.java javax/imageio/SCCS/s.IIOImage.java javax/imageio/SCCS/s.IIOParam.java javax/imageio/SCCS/s.ImageReadParam.java javax/imageio/SCCS/s.ImageIO.java javax/imageio/SCCS/s.ImageTranscoder.java javax/imageio/SCCS/s.ImageReader.java javax/imageio/SCCS/s.ImageTypeSpecifier.java javax/imageio/SCCS/s.ImageWriteParam.java javax/imageio/SCCS/s.ImageWriter.java javax/imageio/SCCS/s.package.html javax/imageio/event javax/imageio/event/SCCS javax/imageio/event/SCCS/s.IIOReadProgressListener.java javax/imageio/event/SCCS/s.IIOReadUpdateListener.java javax/imageio/event/SCCS/s.IIOReadWarningListener.java javax/imageio/event/SCCS/s.IIOWriteProgressListener.java javax/imageio/event/SCCS/s.IIOWriteWarningListener.java javax/imageio/event/SCCS/s.package.html javax/imageio/event/IIOReadProgressListener.java javax/imageio/event/IIOReadUpdateListener.java javax/imageio/event/IIOReadWarningListener.java javax/imageio/event/IIOWriteProgressListener.java javax/imageio/event/IIOWriteWarningListener.java javax/imageio/event/package.html javax/imageio/metadata javax/imageio/metadata/SCCS javax/imageio/metadata/SCCS/s.IIOInvalidTreeException.java javax/imageio/metadata/SCCS/s.IIOMetadata.java javax/imageio/metadata/SCCS/s.IIOMetadataController.java javax/imageio/metadata/SCCS/s.IIOMetadataFormat.java javax/imageio/metadata/SCCS/s.IIOMetadataFormatImpl.java javax/imageio/metadata/SCCS/s.IIOMetadataNode.java javax/imageio/metadata/SCCS/s.package.html javax/imageio/metadata/doc-files javax/imageio/metadata/doc-files/SCCS javax/imageio/metadata/doc-files/SCCS/s.jpeg_metadata.html javax/imageio/metadata/doc-files/SCCS/s.bmp_metadata.html javax/imageio/metadata/doc-files/SCCS/s.gif_metadata.html javax/imageio/metadata/doc-files/SCCS/s.standard_metadata.html javax/imageio/metadata/doc-files/SCCS/s.png_metadata.html javax/imageio/metadata/doc-files/SCCS/s.wbmp_metadata.html javax/imageio/metadata/doc-files/standard_metadata.html javax/imageio/metadata/doc-files/bmp_metadata.html javax/imageio/metadata/doc-files/gif_metadata.html javax/imageio/metadata/doc-files/jpeg_metadata.html javax/imageio/metadata/doc-files/png_metadata.html javax/imageio/metadata/doc-files/wbmp_metadata.html javax/imageio/metadata/IIOInvalidTreeException.java javax/imageio/metadata/IIOMetadata.java javax/imageio/metadata/IIOMetadataController.java javax/imageio/metadata/IIOMetadataFormat.java javax/imageio/metadata/IIOMetadataFormatImpl.java javax/imageio/metadata/IIOMetadataNode.java javax/imageio/metadata/package.html javax/imageio/plugins javax/imageio/plugins/bmp javax/imageio/plugins/bmp/SCCS javax/imageio/plugins/bmp/SCCS/s.BMPImageWriteParam.java javax/imageio/plugins/bmp/SCCS/s.package.html javax/imageio/plugins/bmp/BMPImageWriteParam.java javax/imageio/plugins/bmp/package.html javax/imageio/plugins/jpeg javax/imageio/plugins/jpeg/SCCS javax/imageio/plugins/jpeg/SCCS/s.JPEGImageReadParam.java javax/imageio/plugins/jpeg/SCCS/s.JPEGHuffmanTable.java javax/imageio/plugins/jpeg/SCCS/s.JPEGImageWriteParam.java javax/imageio/plugins/jpeg/SCCS/s.JPEGQTable.java javax/imageio/plugins/jpeg/SCCS/s.package.html javax/imageio/plugins/jpeg/JPEGImageWriteParam.java javax/imageio/plugins/jpeg/JPEGHuffmanTable.java javax/imageio/plugins/jpeg/JPEGImageReadParam.java javax/imageio/plugins/jpeg/JPEGQTable.java javax/imageio/plugins/jpeg/package.html javax/imageio/spi javax/imageio/spi/SCCS javax/imageio/spi/SCCS/s.IIOServiceProvider.java javax/imageio/spi/SCCS/s.DigraphNode.java javax/imageio/spi/SCCS/s.IIORegistry.java javax/imageio/spi/SCCS/s.ImageInputStreamSpi.java javax/imageio/spi/SCCS/s.ImageOutputStreamSpi.java javax/imageio/spi/SCCS/s.ImageReaderSpi.java javax/imageio/spi/SCCS/s.ImageReaderWriterSpi.java javax/imageio/spi/SCCS/s.ImageTranscoderSpi.java javax/imageio/spi/SCCS/s.ImageWriterSpi.java javax/imageio/spi/SCCS/s.PartiallyOrderedSet.java javax/imageio/spi/SCCS/s.RegisterableService.java javax/imageio/spi/SCCS/s.ServiceRegistry.java javax/imageio/spi/SCCS/s.package.html javax/imageio/spi/IIOServiceProvider.java javax/imageio/spi/DigraphNode.java javax/imageio/spi/IIORegistry.java javax/imageio/spi/ImageInputStreamSpi.java javax/imageio/spi/ImageOutputStreamSpi.java javax/imageio/spi/ImageReaderSpi.java javax/imageio/spi/ImageReaderWriterSpi.java javax/imageio/spi/ImageTranscoderSpi.java javax/imageio/spi/ImageWriterSpi.java javax/imageio/spi/PartiallyOrderedSet.java javax/imageio/spi/RegisterableService.java javax/imageio/spi/ServiceRegistry.java javax/imageio/spi/package.html javax/imageio/stream javax/imageio/stream/SCCS javax/imageio/stream/SCCS/s.FileCacheImageInputStream.java javax/imageio/stream/SCCS/s.FileCacheImageOutputStream.java javax/imageio/stream/SCCS/s.FileImageInputStream.java javax/imageio/stream/SCCS/s.FileImageOutputStream.java javax/imageio/stream/SCCS/s.IIOByteBuffer.java javax/imageio/stream/SCCS/s.ImageInputStream.java javax/imageio/stream/SCCS/s.ImageInputStreamImpl.java javax/imageio/stream/SCCS/s.ImageOutputStream.java javax/imageio/stream/SCCS/s.ImageOutputStreamImpl.java javax/imageio/stream/SCCS/s.MemoryCache.java javax/imageio/stream/SCCS/s.MemoryCacheImageInputStream.java javax/imageio/stream/SCCS/s.package.html javax/imageio/stream/SCCS/s.MemoryCacheImageOutputStream.java javax/imageio/stream/MemoryCacheImageInputStream.java javax/imageio/stream/FileCacheImageInputStream.java javax/imageio/stream/FileCacheImageOutputStream.java javax/imageio/stream/FileImageInputStream.java javax/imageio/stream/FileImageOutputStream.java javax/imageio/stream/IIOByteBuffer.java javax/imageio/stream/ImageInputStream.java javax/imageio/stream/ImageInputStreamImpl.java javax/imageio/stream/ImageOutputStream.java javax/imageio/stream/ImageOutputStreamImpl.java javax/imageio/stream/MemoryCache.java javax/imageio/stream/package.html javax/imageio/stream/MemoryCacheImageOutputStream.java javax/imageio/IIOParamController.java javax/imageio/IIOException.java javax/imageio/IIOImage.java javax/imageio/IIOParam.java javax/imageio/ImageTranscoder.java javax/imageio/ImageIO.java javax/imageio/ImageReadParam.java javax/imageio/ImageReader.java javax/imageio/ImageTypeSpecifier.java javax/imageio/ImageWriteParam.java javax/imageio/ImageWriter.java javax/imageio/package.html javax/management javax/management/SCCS javax/management/SCCS/s.AndQueryExp.java javax/management/SCCS/s.Attribute.java javax/management/SCCS/s.AttributeList.java javax/management/SCCS/s.QueryEval.java javax/management/SCCS/s.Query.java javax/management/SCCS/s.AttributeChangeNotification.java javax/management/SCCS/s.AttributeChangeNotificationFilter.java javax/management/SCCS/s.AttributeNotFoundException.java javax/management/SCCS/s.AttributeValueExp.java javax/management/SCCS/s.BadAttributeValueExpException.java javax/management/SCCS/s.BadBinaryOpValueExpException.java javax/management/SCCS/s.BadStringOperationException.java javax/management/SCCS/s.BetweenQueryExp.java javax/management/SCCS/s.BinaryOpValueExp.java javax/management/SCCS/s.BinaryRelQueryExp.java javax/management/SCCS/s.BooleanValueExp.java javax/management/SCCS/s.ClassAttributeValueExp.java javax/management/SCCS/s.DefaultLoaderRepository.java javax/management/SCCS/s.Descriptor.java javax/management/SCCS/s.DescriptorAccess.java javax/management/SCCS/s.DynamicMBean.java javax/management/SCCS/s.InQueryExp.java javax/management/SCCS/s.InstanceAlreadyExistsException.java javax/management/SCCS/s.InstanceNotFoundException.java javax/management/SCCS/s.IntrospectionException.java javax/management/SCCS/s.InvalidApplicationException.java javax/management/SCCS/s.JMException.java javax/management/SCCS/s.InvalidAttributeValueException.java javax/management/SCCS/s.JMRuntimeException.java javax/management/SCCS/s.ListenerNotFoundException.java javax/management/SCCS/s.MBeanAttributeInfo.java javax/management/SCCS/s.MBeanConstructorInfo.java javax/management/SCCS/s.MBeanException.java javax/management/SCCS/s.MBeanFeatureInfo.java javax/management/SCCS/s.MBeanInfo.java javax/management/SCCS/s.MBeanNotificationInfo.java javax/management/SCCS/s.MBeanOperationInfo.java javax/management/SCCS/s.MBeanParameterInfo.java javax/management/SCCS/s.MBeanPermission.java javax/management/SCCS/s.MBeanRegistration.java javax/management/SCCS/s.MBeanServer.java javax/management/SCCS/s.MBeanRegistrationException.java javax/management/SCCS/s.MBeanServerBuilder.java javax/management/SCCS/s.MBeanServerConnection.java javax/management/SCCS/s.MBeanServerDelegate.java javax/management/SCCS/s.MBeanServerDelegateMBean.java javax/management/SCCS/s.MBeanServerFactory.java javax/management/SCCS/s.MBeanServerInvocationHandler.java javax/management/SCCS/s.MBeanServerNotification.java javax/management/SCCS/s.MBeanServerPermission.java javax/management/SCCS/s.MBeanTrustPermission.java javax/management/SCCS/s.MalformedObjectNameException.java javax/management/SCCS/s.MatchQueryExp.java javax/management/SCCS/s.NotCompliantMBeanException.java javax/management/SCCS/s.NotQueryExp.java javax/management/SCCS/s.Notification.java javax/management/SCCS/s.NotificationBroadcaster.java javax/management/SCCS/s.NotificationBroadcasterSupport.java javax/management/SCCS/s.NotificationEmitter.java javax/management/SCCS/s.NotificationFilter.java javax/management/SCCS/s.NotificationFilterSupport.java javax/management/SCCS/s.NotificationListener.java javax/management/SCCS/s.NumericValueExp.java javax/management/SCCS/s.ObjectInstance.java javax/management/SCCS/s.ObjectName.java javax/management/SCCS/s.OperationsException.java javax/management/SCCS/s.OrQueryExp.java javax/management/SCCS/s.PersistentMBean.java javax/management/SCCS/s.QueryExp.java javax/management/SCCS/s.QualifiedAttributeValueExp.java javax/management/SCCS/s.RuntimeErrorException.java javax/management/SCCS/s.ReflectionException.java javax/management/SCCS/s.RuntimeMBeanException.java javax/management/SCCS/s.RuntimeOperationsException.java javax/management/SCCS/s.ServiceNotFoundException.java javax/management/SCCS/s.StandardMBean.java javax/management/SCCS/s.StringValueExp.java javax/management/SCCS/s.ValueExp.java javax/management/SCCS/s.package.html javax/management/loading javax/management/loading/SCCS javax/management/loading/SCCS/s.MLetContent.java javax/management/loading/SCCS/s.MLet.java javax/management/loading/SCCS/s.ClassLoaderRepository.java javax/management/loading/SCCS/s.DefaultLoaderRepository.java javax/management/loading/SCCS/s.MLetMBean.java javax/management/loading/SCCS/s.MLetParser.java javax/management/loading/SCCS/s.package.html javax/management/loading/SCCS/s.MLetObjectInputStream.java javax/management/loading/SCCS/s.PrivateClassLoader.java javax/management/loading/SCCS/s.PrivateMLet.java javax/management/loading/DefaultLoaderRepository.java javax/management/loading/ClassLoaderRepository.java javax/management/loading/MLetContent.java javax/management/loading/MLet.java javax/management/loading/MLetMBean.java javax/management/loading/MLetParser.java javax/management/loading/package.html javax/management/loading/MLetObjectInputStream.java javax/management/loading/PrivateClassLoader.java javax/management/loading/PrivateMLet.java javax/management/modelmbean javax/management/modelmbean/SCCS javax/management/modelmbean/SCCS/s.DescriptorSupport.java javax/management/modelmbean/SCCS/s.ModelMBean.java javax/management/modelmbean/SCCS/s.ModelMBeanInfoSupport.java javax/management/modelmbean/SCCS/s.ModelMBeanInfo.java javax/management/modelmbean/SCCS/s.InvalidTargetObjectTypeException.java javax/management/modelmbean/SCCS/s.ModelMBeanAttributeInfo.java javax/management/modelmbean/SCCS/s.ModelMBeanConstructorInfo.java javax/management/modelmbean/SCCS/s.ModelMBeanNotificationBroadcaster.java javax/management/modelmbean/SCCS/s.ModelMBeanNotificationInfo.java javax/management/modelmbean/SCCS/s.ModelMBeanOperationInfo.java javax/management/modelmbean/SCCS/s.RequiredModelMBean.java javax/management/modelmbean/SCCS/s.XMLParseException.java javax/management/modelmbean/SCCS/s.package.html javax/management/modelmbean/DescriptorSupport.java javax/management/modelmbean/ModelMBean.java javax/management/modelmbean/ModelMBeanInfo.java javax/management/modelmbean/ModelMBeanNotificationInfo.java javax/management/modelmbean/InvalidTargetObjectTypeException.java javax/management/modelmbean/ModelMBeanAttributeInfo.java javax/management/modelmbean/ModelMBeanConstructorInfo.java javax/management/modelmbean/ModelMBeanInfoSupport.java javax/management/modelmbean/package.html javax/management/modelmbean/ModelMBeanNotificationBroadcaster.java javax/management/modelmbean/ModelMBeanOperationInfo.java javax/management/modelmbean/RequiredModelMBean.java javax/management/modelmbean/XMLParseException.java javax/management/monitor javax/management/monitor/SCCS javax/management/monitor/SCCS/s.CounterMonitorMBean.java javax/management/monitor/SCCS/s.CounterMonitor.java javax/management/monitor/SCCS/s.GaugeMonitorMBean.java javax/management/monitor/SCCS/s.GaugeMonitor.java javax/management/monitor/SCCS/s.MonitorNotification.java javax/management/monitor/SCCS/s.Monitor.java javax/management/monitor/SCCS/s.MonitorMBean.java javax/management/monitor/SCCS/s.MonitorSettingException.java javax/management/monitor/SCCS/s.StringMonitor.java javax/management/monitor/SCCS/s.StringMonitorMBean.java javax/management/monitor/SCCS/s.package.html javax/management/monitor/CounterMonitorMBean.java javax/management/monitor/CounterMonitor.java javax/management/monitor/GaugeMonitorMBean.java javax/management/monitor/GaugeMonitor.java javax/management/monitor/MonitorNotification.java javax/management/monitor/Monitor.java javax/management/monitor/MonitorMBean.java javax/management/monitor/MonitorSettingException.java javax/management/monitor/StringMonitor.java javax/management/monitor/StringMonitorMBean.java javax/management/monitor/package.html javax/management/openmbean javax/management/openmbean/SCCS javax/management/openmbean/SCCS/s.CompositeData.java javax/management/openmbean/SCCS/s.ArrayType.java javax/management/openmbean/SCCS/s.KeyAlreadyExistsException.java javax/management/openmbean/SCCS/s.CompositeDataSupport.java javax/management/openmbean/SCCS/s.CompositeType.java javax/management/openmbean/SCCS/s.InvalidKeyException.java javax/management/openmbean/SCCS/s.InvalidOpenTypeException.java javax/management/openmbean/SCCS/s.OpenMBeanAttributeInfoSupport.java javax/management/openmbean/SCCS/s.OpenDataException.java javax/management/openmbean/SCCS/s.OpenMBeanAttributeInfo.java javax/management/openmbean/SCCS/s.OpenMBeanConstructorInfo.java javax/management/openmbean/SCCS/s.OpenMBeanInfo.java javax/management/openmbean/SCCS/s.OpenMBeanOperationInfo.java javax/management/openmbean/SCCS/s.OpenMBeanConstructorInfoSupport.java javax/management/openmbean/SCCS/s.OpenMBeanInfoSupport.java javax/management/openmbean/SCCS/s.SimpleType.java javax/management/openmbean/SCCS/s.OpenType.java javax/management/openmbean/SCCS/s.OpenMBeanOperationInfoSupport.java javax/management/openmbean/SCCS/s.OpenMBeanParameterInfo.java javax/management/openmbean/SCCS/s.OpenMBeanParameterInfoSupport.java javax/management/openmbean/SCCS/s.TabularDataSupport.java javax/management/openmbean/SCCS/s.TabularData.java javax/management/openmbean/SCCS/s.TabularType.java javax/management/openmbean/SCCS/s.package.html javax/management/openmbean/CompositeData.java javax/management/openmbean/ArrayType.java javax/management/openmbean/OpenMBeanAttributeInfoSupport.java javax/management/openmbean/CompositeDataSupport.java javax/management/openmbean/CompositeType.java javax/management/openmbean/InvalidKeyException.java javax/management/openmbean/InvalidOpenTypeException.java javax/management/openmbean/KeyAlreadyExistsException.java javax/management/openmbean/OpenDataException.java javax/management/openmbean/OpenMBeanAttributeInfo.java javax/management/openmbean/OpenMBeanConstructorInfo.java javax/management/openmbean/OpenMBeanInfo.java javax/management/openmbean/OpenType.java javax/management/openmbean/TabularDataSupport.java javax/management/openmbean/OpenMBeanConstructorInfoSupport.java javax/management/openmbean/OpenMBeanInfoSupport.java javax/management/openmbean/OpenMBeanOperationInfo.java javax/management/openmbean/OpenMBeanOperationInfoSupport.java javax/management/openmbean/OpenMBeanParameterInfo.java javax/management/openmbean/OpenMBeanParameterInfoSupport.java javax/management/openmbean/SimpleType.java javax/management/openmbean/TabularData.java javax/management/openmbean/TabularType.java javax/management/openmbean/package.html javax/management/relation javax/management/relation/SCCS javax/management/relation/SCCS/s.InvalidRelationServiceException.java javax/management/relation/SCCS/s.InvalidRelationIdException.java javax/management/relation/SCCS/s.Relation.java javax/management/relation/SCCS/s.InvalidRelationTypeException.java javax/management/relation/SCCS/s.InvalidRoleInfoException.java javax/management/relation/SCCS/s.InvalidRoleValueException.java javax/management/relation/SCCS/s.MBeanServerNotificationFilter.java javax/management/relation/SCCS/s.RelationService.java javax/management/relation/SCCS/s.RoleInfoNotFoundException.java javax/management/relation/SCCS/s.RelationException.java javax/management/relation/SCCS/s.RelationNotFoundException.java javax/management/relation/SCCS/s.RelationNotification.java javax/management/relation/SCCS/s.RelationServiceMBean.java javax/management/relation/SCCS/s.RelationSupport.java javax/management/relation/SCCS/s.RelationType.java javax/management/relation/SCCS/s.RelationServiceNotRegisteredException.java javax/management/relation/SCCS/s.RelationSupportMBean.java javax/management/relation/SCCS/s.RelationTypeSupport.java javax/management/relation/SCCS/s.Role.java javax/management/relation/SCCS/s.RelationTypeNotFoundException.java javax/management/relation/SCCS/s.RoleInfo.java javax/management/relation/SCCS/s.RoleList.java javax/management/relation/SCCS/s.RoleResult.java javax/management/relation/SCCS/s.RoleNotFoundException.java javax/management/relation/SCCS/s.RoleStatus.java javax/management/relation/SCCS/s.RoleUnresolved.java javax/management/relation/SCCS/s.RoleUnresolvedList.java javax/management/relation/SCCS/s.package.html javax/management/relation/InvalidRelationServiceException.java javax/management/relation/InvalidRelationIdException.java javax/management/relation/RelationServiceNotRegisteredException.java javax/management/relation/InvalidRelationTypeException.java javax/management/relation/InvalidRoleInfoException.java javax/management/relation/InvalidRoleValueException.java javax/management/relation/MBeanServerNotificationFilter.java javax/management/relation/Relation.java javax/management/relation/RelationException.java javax/management/relation/RelationNotFoundException.java javax/management/relation/RelationNotification.java javax/management/relation/RelationService.java javax/management/relation/RelationServiceMBean.java javax/management/relation/RelationSupportMBean.java javax/management/relation/RelationSupport.java javax/management/relation/RelationTypeSupport.java javax/management/relation/RelationType.java javax/management/relation/Role.java javax/management/relation/RelationTypeNotFoundException.java javax/management/relation/RoleInfo.java javax/management/relation/RoleList.java javax/management/relation/RoleResult.java javax/management/relation/RoleUnresolvedList.java javax/management/relation/RoleInfoNotFoundException.java javax/management/relation/RoleNotFoundException.java javax/management/relation/RoleStatus.java javax/management/relation/RoleUnresolved.java javax/management/relation/package.html javax/management/remote javax/management/remote/SCCS javax/management/remote/SCCS/s.JMXAuthenticator.java javax/management/remote/SCCS/s.JMXConnector.java javax/management/remote/SCCS/s.JMXProviderException.java javax/management/remote/SCCS/s.JMXPrincipal.java javax/management/remote/SCCS/s.JMXConnectionNotification.java javax/management/remote/SCCS/s.JMXConnectorFactory.java javax/management/remote/SCCS/s.JMXConnectorProvider.java javax/management/remote/SCCS/s.JMXConnectorServer.java javax/management/remote/SCCS/s.JMXConnectorServerFactory.java javax/management/remote/SCCS/s.JMXConnectorServerMBean.java javax/management/remote/SCCS/s.JMXConnectorServerProvider.java javax/management/remote/SCCS/s.JMXServiceURL.java javax/management/remote/SCCS/s.JMXServerErrorException.java javax/management/remote/SCCS/s.MBeanServerForwarder.java javax/management/remote/SCCS/s.NotificationResult.java javax/management/remote/SCCS/s.SubjectDelegationPermission.java javax/management/remote/SCCS/s.TargetedNotification.java javax/management/remote/SCCS/s.package.html javax/management/remote/rmi javax/management/remote/rmi/SCCS javax/management/remote/rmi/SCCS/s.NoCallStackClassLoader.java javax/management/remote/rmi/SCCS/s.RMIConnection.java javax/management/remote/rmi/SCCS/s.RMIConnectionImpl.java javax/management/remote/rmi/SCCS/s.RMIConnector.java javax/management/remote/rmi/SCCS/s.RMIConnectorServer.java javax/management/remote/rmi/SCCS/s.RMIIIOPServerImpl.java javax/management/remote/rmi/SCCS/s.RMIJRMPServerImpl.java javax/management/remote/rmi/SCCS/s.RMIServer.java javax/management/remote/rmi/SCCS/s.RMIServerImpl.java javax/management/remote/rmi/SCCS/s.package.html javax/management/remote/rmi/NoCallStackClassLoader.java javax/management/remote/rmi/RMIConnection.java javax/management/remote/rmi/RMIConnectionImpl.java javax/management/remote/rmi/RMIConnector.java javax/management/remote/rmi/RMIConnectorServer.java javax/management/remote/rmi/RMIIIOPServerImpl.java javax/management/remote/rmi/RMIJRMPServerImpl.java javax/management/remote/rmi/RMIServer.java javax/management/remote/rmi/RMIServerImpl.java javax/management/remote/rmi/package.html javax/management/remote/JMXConnectionNotification.java javax/management/remote/JMXAuthenticator.java javax/management/remote/JMXConnectorFactory.java javax/management/remote/JMXConnector.java javax/management/remote/JMXConnectorServerFactory.java javax/management/remote/JMXConnectorProvider.java javax/management/remote/JMXConnectorServer.java javax/management/remote/JMXConnectorServerMBean.java javax/management/remote/JMXConnectorServerProvider.java javax/management/remote/JMXPrincipal.java javax/management/remote/JMXProviderException.java javax/management/remote/JMXServerErrorException.java javax/management/remote/JMXServiceURL.java javax/management/remote/MBeanServerForwarder.java javax/management/remote/NotificationResult.java javax/management/remote/SubjectDelegationPermission.java javax/management/remote/TargetedNotification.java javax/management/remote/package.html javax/management/timer javax/management/timer/SCCS javax/management/timer/SCCS/s.TimerMBean.java javax/management/timer/SCCS/s.Timer.java javax/management/timer/SCCS/s.TimerAlarmClockNotification.java javax/management/timer/SCCS/s.TimerNotification.java javax/management/timer/SCCS/s.package.html javax/management/timer/TimerMBean.java javax/management/timer/Timer.java javax/management/timer/TimerAlarmClockNotification.java javax/management/timer/TimerNotification.java javax/management/timer/package.html javax/management/AndQueryExp.java javax/management/Attribute.java javax/management/AttributeList.java javax/management/DescriptorAccess.java javax/management/Descriptor.java javax/management/AttributeChangeNotification.java javax/management/AttributeChangeNotificationFilter.java javax/management/AttributeNotFoundException.java javax/management/AttributeValueExp.java javax/management/BadAttributeValueExpException.java javax/management/BadBinaryOpValueExpException.java javax/management/BadStringOperationException.java javax/management/BetweenQueryExp.java javax/management/BinaryOpValueExp.java javax/management/BinaryRelQueryExp.java javax/management/BooleanValueExp.java javax/management/ClassAttributeValueExp.java javax/management/DefaultLoaderRepository.java javax/management/DynamicMBean.java javax/management/InQueryExp.java javax/management/InvalidApplicationException.java javax/management/InstanceNotFoundException.java javax/management/InstanceAlreadyExistsException.java javax/management/IntrospectionException.java javax/management/Query.java javax/management/StandardMBean.java javax/management/InvalidAttributeValueException.java javax/management/JMException.java javax/management/JMRuntimeException.java javax/management/ListenerNotFoundException.java javax/management/MBeanAttributeInfo.java javax/management/MBeanConstructorInfo.java javax/management/MBeanException.java javax/management/MBeanFeatureInfo.java javax/management/MBeanInfo.java javax/management/MBeanNotificationInfo.java javax/management/MBeanOperationInfo.java javax/management/MBeanParameterInfo.java javax/management/MBeanPermission.java javax/management/MBeanRegistration.java javax/management/MBeanRegistrationException.java javax/management/MBeanServer.java javax/management/MBeanServerBuilder.java javax/management/MBeanServerConnection.java javax/management/MBeanServerDelegate.java javax/management/MBeanServerDelegateMBean.java javax/management/MBeanServerFactory.java javax/management/MBeanServerInvocationHandler.java javax/management/MBeanServerNotification.java javax/management/MBeanServerPermission.java javax/management/MBeanTrustPermission.java javax/management/MalformedObjectNameException.java javax/management/MatchQueryExp.java javax/management/NotCompliantMBeanException.java javax/management/NotQueryExp.java javax/management/Notification.java javax/management/NotificationBroadcaster.java javax/management/NotificationBroadcasterSupport.java javax/management/NotificationEmitter.java javax/management/NotificationFilter.java javax/management/NotificationFilterSupport.java javax/management/NotificationListener.java javax/management/NumericValueExp.java javax/management/ObjectInstance.java javax/management/ObjectName.java javax/management/OperationsException.java javax/management/OrQueryExp.java javax/management/PersistentMBean.java javax/management/QualifiedAttributeValueExp.java javax/management/QueryEval.java javax/management/QueryExp.java javax/management/RuntimeOperationsException.java javax/management/ReflectionException.java javax/management/RuntimeErrorException.java javax/management/RuntimeMBeanException.java javax/management/ServiceNotFoundException.java javax/management/StringValueExp.java javax/management/ValueExp.java javax/management/package.html javax/naming javax/naming/SCCS javax/naming/SCCS/s.AuthenticationException.java javax/naming/SCCS/s.BinaryRefAddr.java javax/naming/SCCS/s.Binding.java javax/naming/SCCS/s.AuthenticationNotSupportedException.java javax/naming/SCCS/s.CannotProceedException.java javax/naming/SCCS/s.CommunicationException.java javax/naming/SCCS/s.CompositeName.java javax/naming/SCCS/s.CompoundName.java javax/naming/SCCS/s.ConfigurationException.java javax/naming/SCCS/s.Context.java javax/naming/SCCS/s.ContextNotEmptyException.java javax/naming/SCCS/s.InitialContext.java javax/naming/SCCS/s.LinkRef.java javax/naming/SCCS/s.NameNotFoundException.java javax/naming/SCCS/s.InsufficientResourcesException.java javax/naming/SCCS/s.InterruptedNamingException.java javax/naming/SCCS/s.InvalidNameException.java javax/naming/SCCS/s.LimitExceededException.java javax/naming/SCCS/s.LinkException.java javax/naming/SCCS/s.LinkLoopException.java javax/naming/SCCS/s.Name.java javax/naming/SCCS/s.NameImpl.java javax/naming/SCCS/s.MalformedLinkException.java javax/naming/SCCS/s.NameClassPair.java javax/naming/SCCS/s.NameAlreadyBoundException.java javax/naming/SCCS/s.NameParser.java javax/naming/SCCS/s.NamingEnumeration.java javax/naming/SCCS/s.OperationNotSupportedException.java javax/naming/SCCS/s.NamingException.java javax/naming/SCCS/s.NamingSecurityException.java javax/naming/SCCS/s.NoInitialContextException.java javax/naming/SCCS/s.NoPermissionException.java javax/naming/SCCS/s.NotContextException.java javax/naming/SCCS/s.ServiceUnavailableException.java javax/naming/SCCS/s.PartialResultException.java javax/naming/SCCS/s.RefAddr.java javax/naming/SCCS/s.Reference.java javax/naming/SCCS/s.Referenceable.java javax/naming/SCCS/s.ReferralException.java javax/naming/SCCS/s.SizeLimitExceededException.java javax/naming/SCCS/s.StringRefAddr.java javax/naming/SCCS/s.package.html javax/naming/SCCS/s.TimeLimitExceededException.java javax/naming/directory javax/naming/directory/SCCS javax/naming/directory/SCCS/s.Attribute.java javax/naming/directory/SCCS/s.Attributes.java javax/naming/directory/SCCS/s.InvalidAttributeIdentifierException.java javax/naming/directory/SCCS/s.AttributeInUseException.java javax/naming/directory/SCCS/s.AttributeModificationException.java javax/naming/directory/SCCS/s.BasicAttribute.java javax/naming/directory/SCCS/s.BasicAttributes.java javax/naming/directory/SCCS/s.DirContext.java javax/naming/directory/SCCS/s.InitialDirContext.java javax/naming/directory/SCCS/s.package.html javax/naming/directory/SCCS/s.InvalidAttributeValueException.java javax/naming/directory/SCCS/s.InvalidAttributesException.java javax/naming/directory/SCCS/s.InvalidSearchControlsException.java javax/naming/directory/SCCS/s.InvalidSearchFilterException.java javax/naming/directory/SCCS/s.ModificationItem.java javax/naming/directory/SCCS/s.NoSuchAttributeException.java javax/naming/directory/SCCS/s.SchemaViolationException.java javax/naming/directory/SCCS/s.SearchControls.java javax/naming/directory/SCCS/s.SearchResult.java javax/naming/directory/Attribute.java javax/naming/directory/Attributes.java javax/naming/directory/InitialDirContext.java javax/naming/directory/DirContext.java javax/naming/directory/AttributeInUseException.java javax/naming/directory/AttributeModificationException.java javax/naming/directory/BasicAttribute.java javax/naming/directory/BasicAttributes.java javax/naming/directory/package.html javax/naming/directory/InvalidAttributeIdentifierException.java javax/naming/directory/InvalidAttributeValueException.java javax/naming/directory/InvalidAttributesException.java javax/naming/directory/SearchControls.java javax/naming/directory/ModificationItem.java javax/naming/directory/InvalidSearchControlsException.java javax/naming/directory/InvalidSearchFilterException.java javax/naming/directory/NoSuchAttributeException.java javax/naming/directory/SchemaViolationException.java javax/naming/directory/SearchResult.java javax/naming/event javax/naming/event/SCCS javax/naming/event/SCCS/s.EventDirContext.java javax/naming/event/SCCS/s.EventContext.java javax/naming/event/SCCS/s.NamespaceChangeListener.java javax/naming/event/SCCS/s.NamingEvent.java javax/naming/event/SCCS/s.NamingExceptionEvent.java javax/naming/event/SCCS/s.NamingListener.java javax/naming/event/SCCS/s.ObjectChangeListener.java javax/naming/event/SCCS/s.package.html javax/naming/event/EventDirContext.java javax/naming/event/EventContext.java javax/naming/event/NamespaceChangeListener.java javax/naming/event/NamingEvent.java javax/naming/event/NamingExceptionEvent.java javax/naming/event/NamingListener.java javax/naming/event/ObjectChangeListener.java javax/naming/event/package.html javax/naming/ldap javax/naming/ldap/SCCS javax/naming/ldap/SCCS/s.ControlFactory.java javax/naming/ldap/SCCS/s.BasicControl.java javax/naming/ldap/SCCS/s.Control.java javax/naming/ldap/SCCS/s.LdapReferralException.java javax/naming/ldap/SCCS/s.ExtendedRequest.java javax/naming/ldap/SCCS/s.ExtendedResponse.java javax/naming/ldap/SCCS/s.HasControls.java javax/naming/ldap/SCCS/s.InitialLdapContext.java javax/naming/ldap/SCCS/s.LdapContext.java javax/naming/ldap/SCCS/s.LdapName.java javax/naming/ldap/SCCS/s.Rdn.java javax/naming/ldap/SCCS/s.ManageReferralControl.java javax/naming/ldap/SCCS/s.PagedResultsControl.java javax/naming/ldap/SCCS/s.PagedResultsResponseControl.java javax/naming/ldap/SCCS/s.UnsolicitedNotification.java javax/naming/ldap/SCCS/s.Rfc2253Parser.java javax/naming/ldap/SCCS/s.SortControl.java javax/naming/ldap/SCCS/s.SortKey.java javax/naming/ldap/SCCS/s.SortResponseControl.java javax/naming/ldap/SCCS/s.StartTlsRequest.java javax/naming/ldap/SCCS/s.StartTlsResponse.java javax/naming/ldap/SCCS/s.UnsolicitedNotificationListener.java javax/naming/ldap/SCCS/s.UnsolicitedNotificationEvent.java javax/naming/ldap/SCCS/s.package.html javax/naming/ldap/ExtendedRequest.java javax/naming/ldap/BasicControl.java javax/naming/ldap/Control.java javax/naming/ldap/ControlFactory.java javax/naming/ldap/PagedResultsResponseControl.java javax/naming/ldap/ExtendedResponse.java javax/naming/ldap/HasControls.java javax/naming/ldap/InitialLdapContext.java javax/naming/ldap/LdapContext.java javax/naming/ldap/LdapName.java javax/naming/ldap/LdapReferralException.java javax/naming/ldap/ManageReferralControl.java javax/naming/ldap/PagedResultsControl.java javax/naming/ldap/Rdn.java javax/naming/ldap/UnsolicitedNotification.java javax/naming/ldap/Rfc2253Parser.java javax/naming/ldap/SortControl.java javax/naming/ldap/SortKey.java javax/naming/ldap/SortResponseControl.java javax/naming/ldap/StartTlsRequest.java javax/naming/ldap/StartTlsResponse.java javax/naming/ldap/UnsolicitedNotificationListener.java javax/naming/ldap/UnsolicitedNotificationEvent.java javax/naming/ldap/package.html javax/naming/spi javax/naming/spi/SCCS javax/naming/spi/SCCS/s.ContinuationDirContext.java javax/naming/spi/SCCS/s.ContinuationContext.java javax/naming/spi/SCCS/s.InitialContextFactory.java javax/naming/spi/SCCS/s.DirObjectFactory.java javax/naming/spi/SCCS/s.DirStateFactory.java javax/naming/spi/SCCS/s.DirectoryManager.java javax/naming/spi/SCCS/s.InitialContextFactoryBuilder.java javax/naming/spi/SCCS/s.NamingManager.java javax/naming/spi/SCCS/s.ObjectFactory.java javax/naming/spi/SCCS/s.ObjectFactoryBuilder.java javax/naming/spi/SCCS/s.ResolveResult.java javax/naming/spi/SCCS/s.Resolver.java javax/naming/spi/SCCS/s.StateFactory.java javax/naming/spi/SCCS/s.package.html javax/naming/spi/InitialContextFactoryBuilder.java javax/naming/spi/ContinuationContext.java javax/naming/spi/ContinuationDirContext.java javax/naming/spi/DirObjectFactory.java javax/naming/spi/DirStateFactory.java javax/naming/spi/DirectoryManager.java javax/naming/spi/InitialContextFactory.java javax/naming/spi/ObjectFactoryBuilder.java javax/naming/spi/NamingManager.java javax/naming/spi/ObjectFactory.java javax/naming/spi/ResolveResult.java javax/naming/spi/Resolver.java javax/naming/spi/StateFactory.java javax/naming/spi/package.html javax/naming/AuthenticationException.java javax/naming/BinaryRefAddr.java javax/naming/Binding.java javax/naming/LinkRef.java javax/naming/AuthenticationNotSupportedException.java javax/naming/CannotProceedException.java javax/naming/CommunicationException.java javax/naming/CompositeName.java javax/naming/CompoundName.java javax/naming/ConfigurationException.java javax/naming/Context.java javax/naming/NameClassPair.java javax/naming/Name.java javax/naming/ContextNotEmptyException.java javax/naming/InitialContext.java javax/naming/InsufficientResourcesException.java javax/naming/InterruptedNamingException.java javax/naming/InvalidNameException.java javax/naming/LimitExceededException.java javax/naming/LinkException.java javax/naming/LinkLoopException.java javax/naming/MalformedLinkException.java javax/naming/NameAlreadyBoundException.java javax/naming/NameImpl.java javax/naming/NameNotFoundException.java javax/naming/NameParser.java javax/naming/RefAddr.java javax/naming/ServiceUnavailableException.java javax/naming/NamingEnumeration.java javax/naming/NamingException.java javax/naming/NamingSecurityException.java javax/naming/NoInitialContextException.java javax/naming/NoPermissionException.java javax/naming/NotContextException.java javax/naming/OperationNotSupportedException.java javax/naming/PartialResultException.java javax/naming/Reference.java javax/naming/Referenceable.java javax/naming/ReferralException.java javax/naming/SizeLimitExceededException.java javax/naming/StringRefAddr.java javax/naming/TimeLimitExceededException.java javax/naming/package.html javax/pack javax/pack/SCCS javax/print javax/print/SCCS javax/print/SCCS/s.AttributeException.java javax/print/SCCS/s.CancelablePrintJob.java javax/print/SCCS/s.Doc.java javax/print/SCCS/s.DocFlavor.java javax/print/SCCS/s.DocPrintJob.java javax/print/SCCS/s.FlavorException.java javax/print/SCCS/s.MimeType.java javax/print/SCCS/s.MultiDoc.java javax/print/SCCS/s.MultiDocPrintJob.java javax/print/SCCS/s.MultiDocPrintService.java javax/print/SCCS/s.PrintException.java javax/print/SCCS/s.PrintService.java javax/print/SCCS/s.PrintServiceLookup.java javax/print/SCCS/s.ServiceUI.java javax/print/SCCS/s.URIException.java javax/print/SCCS/s.ServiceUIFactory.java javax/print/SCCS/s.SimpleDoc.java javax/print/SCCS/s.StreamPrintService.java javax/print/SCCS/s.StreamPrintServiceFactory.java javax/print/SCCS/s.package.html javax/print/attribute javax/print/attribute/SCCS javax/print/attribute/SCCS/s.DateTimeSyntax.java javax/print/attribute/SCCS/s.Attribute.java javax/print/attribute/SCCS/s.AttributeSet.java javax/print/attribute/SCCS/s.AttributeSetUtilities.java javax/print/attribute/SCCS/s.DocAttribute.java javax/print/attribute/SCCS/s.DocAttributeSet.java javax/print/attribute/SCCS/s.EnumSyntax.java javax/print/attribute/SCCS/s.HashAttributeSet.java javax/print/attribute/SCCS/s.HashDocAttributeSet.java javax/print/attribute/SCCS/s.HashPrintJobAttributeSet.java javax/print/attribute/SCCS/s.HashPrintRequestAttributeSet.java javax/print/attribute/SCCS/s.HashPrintServiceAttributeSet.java javax/print/attribute/SCCS/s.IntegerSyntax.java javax/print/attribute/SCCS/s.PrintRequestAttribute.java javax/print/attribute/SCCS/s.PrintJobAttribute.java javax/print/attribute/SCCS/s.PrintJobAttributeSet.java javax/print/attribute/SCCS/s.PrintRequestAttributeSet.java javax/print/attribute/SCCS/s.PrintServiceAttribute.java javax/print/attribute/SCCS/s.PrintServiceAttributeSet.java javax/print/attribute/SCCS/s.ResolutionSyntax.java javax/print/attribute/SCCS/s.SetOfIntegerSyntax.java javax/print/attribute/SCCS/s.Size2DSyntax.java javax/print/attribute/SCCS/s.SupportedValuesAttribute.java javax/print/attribute/SCCS/s.TextSyntax.java javax/print/attribute/SCCS/s.URISyntax.java javax/print/attribute/SCCS/s.UnmodifiableSetException.java javax/print/attribute/SCCS/s.package.html javax/print/attribute/standard javax/print/attribute/standard/SCCS javax/print/attribute/standard/SCCS/s.ColorSupported.java javax/print/attribute/standard/SCCS/s.Chromaticity.java javax/print/attribute/standard/SCCS/s.DateTimeAtCompleted.java javax/print/attribute/standard/SCCS/s.Compression.java javax/print/attribute/standard/SCCS/s.Copies.java javax/print/attribute/standard/SCCS/s.CopiesSupported.java javax/print/attribute/standard/SCCS/s.DateTimeAtCreation.java javax/print/attribute/standard/SCCS/s.DateTimeAtProcessing.java javax/print/attribute/standard/SCCS/s.Destination.java javax/print/attribute/standard/SCCS/s.DocumentName.java javax/print/attribute/standard/SCCS/s.Fidelity.java javax/print/attribute/standard/SCCS/s.Finishings.java javax/print/attribute/standard/SCCS/s.JobHoldUntil.java javax/print/attribute/standard/SCCS/s.JobImpressions.java javax/print/attribute/standard/SCCS/s.PrinterResolution.java javax/print/attribute/standard/SCCS/s.PrinterName.java javax/print/attribute/standard/SCCS/s.JobImpressionsCompleted.java javax/print/attribute/standard/SCCS/s.JobImpressionsSupported.java javax/print/attribute/standard/SCCS/s.JobKOctets.java javax/print/attribute/standard/SCCS/s.JobKOctetsProcessed.java javax/print/attribute/standard/SCCS/s.JobKOctetsSupported.java javax/print/attribute/standard/SCCS/s.JobMediaSheets.java javax/print/attribute/standard/SCCS/s.JobMediaSheetsCompleted.java javax/print/attribute/standard/SCCS/s.JobMediaSheetsSupported.java javax/print/attribute/standard/SCCS/s.JobMessageFromOperator.java javax/print/attribute/standard/SCCS/s.JobName.java javax/print/attribute/standard/SCCS/s.JobOriginatingUserName.java javax/print/attribute/standard/SCCS/s.JobPriority.java javax/print/attribute/standard/SCCS/s.JobPrioritySupported.java javax/print/attribute/standard/SCCS/s.JobSheets.java javax/print/attribute/standard/SCCS/s.JobState.java javax/print/attribute/standard/SCCS/s.JobStateReason.java javax/print/attribute/standard/SCCS/s.JobStateReasons.java javax/print/attribute/standard/SCCS/s.Media.java javax/print/attribute/standard/SCCS/s.MediaName.java javax/print/attribute/standard/SCCS/s.MediaPrintableArea.java javax/print/attribute/standard/SCCS/s.MediaSize.java javax/print/attribute/standard/SCCS/s.MediaSizeName.java javax/print/attribute/standard/SCCS/s.MediaTray.java javax/print/attribute/standard/SCCS/s.MultipleDocumentHandling.java javax/print/attribute/standard/SCCS/s.NumberOfDocuments.java javax/print/attribute/standard/SCCS/s.NumberOfInterveningJobs.java javax/print/attribute/standard/SCCS/s.NumberUp.java javax/print/attribute/standard/SCCS/s.NumberUpSupported.java javax/print/attribute/standard/SCCS/s.OrientationRequested.java javax/print/attribute/standard/SCCS/s.OutputDeviceAssigned.java javax/print/attribute/standard/SCCS/s.Severity.java javax/print/attribute/standard/SCCS/s.PDLOverrideSupported.java javax/print/attribute/standard/SCCS/s.PageRanges.java javax/print/attribute/standard/SCCS/s.PagesPerMinute.java javax/print/attribute/standard/SCCS/s.PagesPerMinuteColor.java javax/print/attribute/standard/SCCS/s.PresentationDirection.java javax/print/attribute/standard/SCCS/s.PrintQuality.java javax/print/attribute/standard/SCCS/s.PrinterInfo.java javax/print/attribute/standard/SCCS/s.PrinterIsAcceptingJobs.java javax/print/attribute/standard/SCCS/s.PrinterLocation.java javax/print/attribute/standard/SCCS/s.PrinterMakeAndModel.java javax/print/attribute/standard/SCCS/s.PrinterMessageFromOperator.java javax/print/attribute/standard/SCCS/s.PrinterMoreInfo.java javax/print/attribute/standard/SCCS/s.PrinterMoreInfoManufacturer.java javax/print/attribute/standard/SCCS/s.Sides.java javax/print/attribute/standard/SCCS/s.PrinterState.java javax/print/attribute/standard/SCCS/s.PrinterStateReason.java javax/print/attribute/standard/SCCS/s.PrinterStateReasons.java javax/print/attribute/standard/SCCS/s.PrinterURI.java javax/print/attribute/standard/SCCS/s.QueuedJobCount.java javax/print/attribute/standard/SCCS/s.ReferenceUriSchemesSupported.java javax/print/attribute/standard/SCCS/s.RequestingUserName.java javax/print/attribute/standard/SCCS/s.SheetCollate.java javax/print/attribute/standard/SCCS/s.package.html javax/print/attribute/standard/CopiesSupported.java javax/print/attribute/standard/Chromaticity.java javax/print/attribute/standard/ColorSupported.java javax/print/attribute/standard/Compression.java javax/print/attribute/standard/Copies.java javax/print/attribute/standard/MediaName.java javax/print/attribute/standard/Media.java javax/print/attribute/standard/DateTimeAtCompleted.java javax/print/attribute/standard/DateTimeAtCreation.java javax/print/attribute/standard/DateTimeAtProcessing.java javax/print/attribute/standard/Destination.java javax/print/attribute/standard/DocumentName.java javax/print/attribute/standard/Fidelity.java javax/print/attribute/standard/Finishings.java javax/print/attribute/standard/JobHoldUntil.java javax/print/attribute/standard/JobImpressions.java javax/print/attribute/standard/JobKOctets.java javax/print/attribute/standard/JobImpressionsCompleted.java javax/print/attribute/standard/JobImpressionsSupported.java javax/print/attribute/standard/JobKOctetsProcessed.java javax/print/attribute/standard/JobKOctetsSupported.java javax/print/attribute/standard/JobMediaSheets.java javax/print/attribute/standard/JobMediaSheetsCompleted.java javax/print/attribute/standard/JobMediaSheetsSupported.java javax/print/attribute/standard/JobMessageFromOperator.java javax/print/attribute/standard/JobName.java javax/print/attribute/standard/JobOriginatingUserName.java javax/print/attribute/standard/JobPriority.java javax/print/attribute/standard/JobPrioritySupported.java javax/print/attribute/standard/JobSheets.java javax/print/attribute/standard/JobState.java javax/print/attribute/standard/JobStateReason.java javax/print/attribute/standard/JobStateReasons.java javax/print/attribute/standard/MultipleDocumentHandling.java javax/print/attribute/standard/MediaPrintableArea.java javax/print/attribute/standard/MediaSize.java javax/print/attribute/standard/MediaSizeName.java javax/print/attribute/standard/MediaTray.java javax/print/attribute/standard/NumberOfInterveningJobs.java javax/print/attribute/standard/NumberOfDocuments.java javax/print/attribute/standard/NumberUpSupported.java javax/print/attribute/standard/NumberUp.java javax/print/attribute/standard/PrinterMessageFromOperator.java javax/print/attribute/standard/OrientationRequested.java javax/print/attribute/standard/OutputDeviceAssigned.java javax/print/attribute/standard/PDLOverrideSupported.java javax/print/attribute/standard/PageRanges.java javax/print/attribute/standard/PagesPerMinute.java javax/print/attribute/standard/PagesPerMinuteColor.java javax/print/attribute/standard/PresentationDirection.java javax/print/attribute/standard/PrintQuality.java javax/print/attribute/standard/PrinterInfo.java javax/print/attribute/standard/PrinterIsAcceptingJobs.java javax/print/attribute/standard/PrinterLocation.java javax/print/attribute/standard/PrinterMakeAndModel.java javax/print/attribute/standard/PrinterMoreInfo.java javax/print/attribute/standard/PrinterName.java javax/print/attribute/standard/ReferenceUriSchemesSupported.java javax/print/attribute/standard/PrinterMoreInfoManufacturer.java javax/print/attribute/standard/PrinterResolution.java javax/print/attribute/standard/PrinterState.java javax/print/attribute/standard/PrinterStateReason.java javax/print/attribute/standard/PrinterStateReasons.java javax/print/attribute/standard/PrinterURI.java javax/print/attribute/standard/QueuedJobCount.java javax/print/attribute/standard/RequestingUserName.java javax/print/attribute/standard/Severity.java javax/print/attribute/standard/SheetCollate.java javax/print/attribute/standard/Sides.java javax/print/attribute/standard/package.html javax/print/attribute/AttributeSet.java javax/print/attribute/Attribute.java javax/print/attribute/HashPrintRequestAttributeSet.java javax/print/attribute/AttributeSetUtilities.java javax/print/attribute/DateTimeSyntax.java javax/print/attribute/DocAttribute.java javax/print/attribute/DocAttributeSet.java javax/print/attribute/EnumSyntax.java javax/print/attribute/HashAttributeSet.java javax/print/attribute/HashDocAttributeSet.java javax/print/attribute/HashPrintJobAttributeSet.java javax/print/attribute/HashPrintServiceAttributeSet.java javax/print/attribute/IntegerSyntax.java javax/print/attribute/Size2DSyntax.java javax/print/attribute/PrintJobAttribute.java javax/print/attribute/PrintJobAttributeSet.java javax/print/attribute/PrintRequestAttribute.java javax/print/attribute/PrintRequestAttributeSet.java javax/print/attribute/PrintServiceAttribute.java javax/print/attribute/PrintServiceAttributeSet.java javax/print/attribute/ResolutionSyntax.java javax/print/attribute/SetOfIntegerSyntax.java javax/print/attribute/SupportedValuesAttribute.java javax/print/attribute/TextSyntax.java javax/print/attribute/URISyntax.java javax/print/attribute/UnmodifiableSetException.java javax/print/attribute/package.html javax/print/event javax/print/event/SCCS javax/print/event/SCCS/s.PrintJobAdapter.java javax/print/event/SCCS/s.PrintEvent.java javax/print/event/SCCS/s.PrintServiceAttributeListener.java javax/print/event/SCCS/s.PrintJobAttributeEvent.java javax/print/event/SCCS/s.PrintJobAttributeListener.java javax/print/event/SCCS/s.PrintJobEvent.java javax/print/event/SCCS/s.PrintJobListener.java javax/print/event/SCCS/s.PrintServiceAttributeEvent.java javax/print/event/SCCS/s.package.html javax/print/event/PrintJobAdapter.java javax/print/event/PrintEvent.java javax/print/event/PrintJobAttributeListener.java javax/print/event/PrintJobAttributeEvent.java javax/print/event/PrintServiceAttributeEvent.java javax/print/event/PrintJobEvent.java javax/print/event/PrintJobListener.java javax/print/event/PrintServiceAttributeListener.java javax/print/event/package.html javax/print/MultiDocPrintService.java javax/print/AttributeException.java javax/print/CancelablePrintJob.java javax/print/Doc.java javax/print/DocFlavor.java javax/print/DocPrintJob.java javax/print/FlavorException.java javax/print/MimeType.java javax/print/MultiDoc.java javax/print/MultiDocPrintJob.java javax/print/StreamPrintServiceFactory.java javax/print/PrintException.java javax/print/PrintService.java javax/print/PrintServiceLookup.java javax/print/ServiceUI.java javax/print/ServiceUIFactory.java javax/print/SimpleDoc.java javax/print/StreamPrintService.java javax/print/URIException.java javax/print/package.html javax/rmi javax/rmi/CORBA javax/rmi/CORBA/SCCS javax/rmi/CORBA/SCCS/s.ClassDesc.java javax/rmi/CORBA/SCCS/s.Stub.java javax/rmi/CORBA/SCCS/s.StubDelegate.java javax/rmi/CORBA/SCCS/s.GetORBPropertiesFileAction.java javax/rmi/CORBA/SCCS/s.PortableRemoteObjectDelegate.java javax/rmi/CORBA/SCCS/s.Tie.java javax/rmi/CORBA/SCCS/s.Util.java javax/rmi/CORBA/SCCS/s.UtilDelegate.java javax/rmi/CORBA/SCCS/s.ValueHandler.java javax/rmi/CORBA/SCCS/s.package.html javax/rmi/CORBA/SCCS/s.ValueHandlerMultiFormat.java javax/rmi/CORBA/ClassDesc.java javax/rmi/CORBA/Stub.java javax/rmi/CORBA/Tie.java javax/rmi/CORBA/ValueHandlerMultiFormat.java javax/rmi/CORBA/GetORBPropertiesFileAction.java javax/rmi/CORBA/PortableRemoteObjectDelegate.java javax/rmi/CORBA/StubDelegate.java javax/rmi/CORBA/Util.java javax/rmi/CORBA/UtilDelegate.java javax/rmi/CORBA/ValueHandler.java javax/rmi/CORBA/package.html javax/rmi/SCCS javax/rmi/SCCS/s.PortableRemoteObject.java javax/rmi/SCCS/s.package.html javax/rmi/ssl javax/rmi/ssl/SCCS javax/rmi/ssl/SCCS/s.SslRMIClientSocketFactory.java javax/rmi/ssl/SCCS/s.SslRMIServerSocketFactory.java javax/rmi/ssl/SCCS/s.package.html javax/rmi/ssl/SslRMIClientSocketFactory.java javax/rmi/ssl/SslRMIServerSocketFactory.java javax/rmi/ssl/package.html javax/rmi/PortableRemoteObject.java javax/rmi/package.html javax/security javax/security/auth javax/security/auth/SCCS javax/security/auth/SCCS/s.DestroyFailedException.java javax/security/auth/SCCS/s.AuthPermission.java javax/security/auth/SCCS/s.Destroyable.java javax/security/auth/SCCS/s.Policy.java javax/security/auth/SCCS/s.Refreshable.java javax/security/auth/SCCS/s.Subject.java javax/security/auth/SCCS/s.PrivateCredentialPermission.java javax/security/auth/SCCS/s.RefreshFailedException.java javax/security/auth/SCCS/s.package.html javax/security/auth/SCCS/s.SubjectDomainCombiner.java javax/security/auth/callback javax/security/auth/callback/SCCS javax/security/auth/callback/SCCS/s.CallbackHandler.java javax/security/auth/callback/SCCS/s.Callback.java javax/security/auth/callback/SCCS/s.ConfirmationCallback.java javax/security/auth/callback/SCCS/s.ChoiceCallback.java javax/security/auth/callback/SCCS/s.UnsupportedCallbackException.java javax/security/auth/callback/SCCS/s.LanguageCallback.java javax/security/auth/callback/SCCS/s.NameCallback.java javax/security/auth/callback/SCCS/s.PasswordCallback.java javax/security/auth/callback/SCCS/s.TextInputCallback.java javax/security/auth/callback/SCCS/s.TextOutputCallback.java javax/security/auth/callback/SCCS/s.package.html javax/security/auth/callback/CallbackHandler.java javax/security/auth/callback/Callback.java javax/security/auth/callback/ConfirmationCallback.java javax/security/auth/callback/ChoiceCallback.java javax/security/auth/callback/LanguageCallback.java javax/security/auth/callback/NameCallback.java javax/security/auth/callback/PasswordCallback.java javax/security/auth/callback/TextInputCallback.java javax/security/auth/callback/TextOutputCallback.java javax/security/auth/callback/package.html javax/security/auth/callback/UnsupportedCallbackException.java javax/security/auth/kerberos javax/security/auth/kerberos/SCCS javax/security/auth/kerberos/SCCS/s.DelegationPermission.java javax/security/auth/kerberos/SCCS/s.KerberosKey.java javax/security/auth/kerberos/SCCS/s.KerberosPrincipal.java javax/security/auth/kerberos/SCCS/s.KerberosTicket.java javax/security/auth/kerberos/SCCS/s.KeyImpl.java javax/security/auth/kerberos/SCCS/s.ServicePermission.java javax/security/auth/kerberos/SCCS/s.package.html javax/security/auth/kerberos/DelegationPermission.java javax/security/auth/kerberos/KerberosKey.java javax/security/auth/kerberos/KerberosPrincipal.java javax/security/auth/kerberos/KerberosTicket.java javax/security/auth/kerberos/KeyImpl.java javax/security/auth/kerberos/ServicePermission.java javax/security/auth/kerberos/package.html javax/security/auth/login javax/security/auth/login/SCCS javax/security/auth/login/SCCS/s.AccountExpiredException.java javax/security/auth/login/SCCS/s.AccountException.java javax/security/auth/login/SCCS/s.CredentialExpiredException.java javax/security/auth/login/SCCS/s.AccountLockedException.java javax/security/auth/login/SCCS/s.AccountNotFoundException.java javax/security/auth/login/SCCS/s.AppConfigurationEntry.java javax/security/auth/login/SCCS/s.Configuration.java javax/security/auth/login/SCCS/s.CredentialException.java javax/security/auth/login/SCCS/s.CredentialNotFoundException.java javax/security/auth/login/SCCS/s.FailedLoginException.java javax/security/auth/login/SCCS/s.LoginContext.java javax/security/auth/login/SCCS/s.LoginException.java javax/security/auth/login/SCCS/s.package.html javax/security/auth/login/AccountExpiredException.java javax/security/auth/login/AccountException.java javax/security/auth/login/AccountNotFoundException.java javax/security/auth/login/AccountLockedException.java javax/security/auth/login/CredentialNotFoundException.java javax/security/auth/login/AppConfigurationEntry.java javax/security/auth/login/Configuration.java javax/security/auth/login/CredentialException.java javax/security/auth/login/CredentialExpiredException.java javax/security/auth/login/FailedLoginException.java javax/security/auth/login/LoginContext.java javax/security/auth/login/LoginException.java javax/security/auth/login/package.html javax/security/auth/spi javax/security/auth/spi/SCCS javax/security/auth/spi/SCCS/s.LoginModule.java javax/security/auth/spi/SCCS/s.package.html javax/security/auth/spi/LoginModule.java javax/security/auth/spi/package.html javax/security/auth/x500 javax/security/auth/x500/SCCS javax/security/auth/x500/SCCS/s.X500PrivateCredential.java javax/security/auth/x500/SCCS/s.X500Principal.java javax/security/auth/x500/SCCS/s.package.html javax/security/auth/x500/X500PrivateCredential.java javax/security/auth/x500/X500Principal.java javax/security/auth/x500/package.html javax/security/auth/DestroyFailedException.java javax/security/auth/AuthPermission.java javax/security/auth/RefreshFailedException.java javax/security/auth/Destroyable.java javax/security/auth/Policy.java javax/security/auth/PrivateCredentialPermission.java javax/security/auth/Refreshable.java javax/security/auth/Subject.java javax/security/auth/SubjectDomainCombiner.java javax/security/auth/package.html javax/security/sasl javax/security/sasl/SCCS javax/security/sasl/SCCS/s.SaslClient.java javax/security/sasl/SCCS/s.Sasl.java javax/security/sasl/SCCS/s.AuthenticationException.java javax/security/sasl/SCCS/s.AuthorizeCallback.java javax/security/sasl/SCCS/s.RealmCallback.java javax/security/sasl/SCCS/s.RealmChoiceCallback.java javax/security/sasl/SCCS/s.SaslClientFactory.java javax/security/sasl/SCCS/s.SaslException.java javax/security/sasl/SCCS/s.SaslServer.java javax/security/sasl/SCCS/s.SaslServerFactory.java javax/security/sasl/SCCS/s.package.html javax/security/sasl/SaslClient.java javax/security/sasl/Sasl.java javax/security/sasl/AuthenticationException.java javax/security/sasl/AuthorizeCallback.java javax/security/sasl/RealmCallback.java javax/security/sasl/RealmChoiceCallback.java javax/security/sasl/SaslClientFactory.java javax/security/sasl/SaslException.java javax/security/sasl/SaslServer.java javax/security/sasl/SaslServerFactory.java javax/security/sasl/package.html javax/sound javax/sound/midi javax/sound/midi/SCCS javax/sound/midi/SCCS/s.Sequencer.java javax/sound/midi/SCCS/s.ControllerEventListener.java javax/sound/midi/SCCS/s.Instrument.java javax/sound/midi/SCCS/s.InvalidMidiDataException.java javax/sound/midi/SCCS/s.MetaEventListener.java javax/sound/midi/SCCS/s.MetaMessage.java javax/sound/midi/SCCS/s.MidiChannel.java javax/sound/midi/SCCS/s.MidiDevice.java javax/sound/midi/SCCS/s.MidiEvent.java javax/sound/midi/SCCS/s.MidiFileFormat.java javax/sound/midi/SCCS/s.MidiMessage.java javax/sound/midi/SCCS/s.MidiSystem.java javax/sound/midi/SCCS/s.MidiUnavailableException.java javax/sound/midi/SCCS/s.Patch.java javax/sound/midi/SCCS/s.Receiver.java javax/sound/midi/SCCS/s.Sequence.java javax/sound/midi/SCCS/s.SoundbankResource.java javax/sound/midi/SCCS/s.ShortMessage.java javax/sound/midi/SCCS/s.Soundbank.java javax/sound/midi/SCCS/s.Synthesizer.java javax/sound/midi/SCCS/s.SysexMessage.java javax/sound/midi/SCCS/s.Track.java javax/sound/midi/SCCS/s.Transmitter.java javax/sound/midi/SCCS/s.VoiceStatus.java javax/sound/midi/SCCS/s.package.html javax/sound/midi/spi javax/sound/midi/spi/SCCS javax/sound/midi/spi/SCCS/s.MidiDeviceProvider.java javax/sound/midi/spi/SCCS/s.MidiFileReader.java javax/sound/midi/spi/SCCS/s.MidiFileWriter.java javax/sound/midi/spi/SCCS/s.SoundbankReader.java javax/sound/midi/spi/SCCS/s.package.html javax/sound/midi/spi/MidiDeviceProvider.java javax/sound/midi/spi/MidiFileReader.java javax/sound/midi/spi/MidiFileWriter.java javax/sound/midi/spi/SoundbankReader.java javax/sound/midi/spi/package.html javax/sound/midi/Receiver.java javax/sound/midi/Patch.java javax/sound/midi/ControllerEventListener.java javax/sound/midi/Instrument.java javax/sound/midi/InvalidMidiDataException.java javax/sound/midi/MetaEventListener.java javax/sound/midi/MetaMessage.java javax/sound/midi/MidiChannel.java javax/sound/midi/MidiDevice.java javax/sound/midi/MidiEvent.java javax/sound/midi/MidiFileFormat.java javax/sound/midi/MidiMessage.java javax/sound/midi/MidiSystem.java javax/sound/midi/MidiUnavailableException.java javax/sound/midi/ShortMessage.java javax/sound/midi/Sequence.java javax/sound/midi/Sequencer.java javax/sound/midi/SoundbankResource.java javax/sound/midi/Soundbank.java javax/sound/midi/Synthesizer.java javax/sound/midi/SysexMessage.java javax/sound/midi/Track.java javax/sound/midi/Transmitter.java javax/sound/midi/VoiceStatus.java javax/sound/midi/package.html javax/sound/sampled javax/sound/sampled/SCCS javax/sound/sampled/SCCS/s.AudioFileFormat.java javax/sound/sampled/SCCS/s.AudioFormat.java javax/sound/sampled/SCCS/s.AudioInputStream.java javax/sound/sampled/SCCS/s.AudioPermission.java javax/sound/sampled/SCCS/s.AudioSystem.java javax/sound/sampled/SCCS/s.BooleanControl.java javax/sound/sampled/SCCS/s.Clip.java javax/sound/sampled/SCCS/s.CompoundControl.java javax/sound/sampled/SCCS/s.Control.java javax/sound/sampled/SCCS/s.DataLine.java javax/sound/sampled/SCCS/s.EnumControl.java javax/sound/sampled/SCCS/s.FloatControl.java javax/sound/sampled/SCCS/s.Line.java javax/sound/sampled/SCCS/s.LineEvent.java javax/sound/sampled/SCCS/s.LineListener.java javax/sound/sampled/SCCS/s.Mixer.java javax/sound/sampled/SCCS/s.UnsupportedAudioFileException.java javax/sound/sampled/SCCS/s.LineUnavailableException.java javax/sound/sampled/SCCS/s.Port.java javax/sound/sampled/SCCS/s.ReverbType.java javax/sound/sampled/SCCS/s.SourceDataLine.java javax/sound/sampled/SCCS/s.TargetDataLine.java javax/sound/sampled/SCCS/s.package.html javax/sound/sampled/spi javax/sound/sampled/spi/SCCS javax/sound/sampled/spi/SCCS/s.FormatConversionProvider.java javax/sound/sampled/spi/SCCS/s.AudioFileReader.java javax/sound/sampled/spi/SCCS/s.AudioFileWriter.java javax/sound/sampled/spi/SCCS/s.MixerProvider.java javax/sound/sampled/spi/SCCS/s.package.html javax/sound/sampled/spi/FormatConversionProvider.java javax/sound/sampled/spi/AudioFileReader.java javax/sound/sampled/spi/AudioFileWriter.java javax/sound/sampled/spi/MixerProvider.java javax/sound/sampled/spi/package.html javax/sound/sampled/AudioFileFormat.java javax/sound/sampled/AudioFormat.java javax/sound/sampled/AudioInputStream.java javax/sound/sampled/AudioPermission.java javax/sound/sampled/AudioSystem.java javax/sound/sampled/BooleanControl.java javax/sound/sampled/Clip.java javax/sound/sampled/CompoundControl.java javax/sound/sampled/Control.java javax/sound/sampled/DataLine.java javax/sound/sampled/EnumControl.java javax/sound/sampled/FloatControl.java javax/sound/sampled/Line.java javax/sound/sampled/LineEvent.java javax/sound/sampled/LineListener.java javax/sound/sampled/Mixer.java javax/sound/sampled/SourceDataLine.java javax/sound/sampled/LineUnavailableException.java javax/sound/sampled/Port.java javax/sound/sampled/ReverbType.java javax/sound/sampled/TargetDataLine.java javax/sound/sampled/package.html javax/sound/sampled/UnsupportedAudioFileException.java javax/sql javax/sql/SCCS javax/sql/SCCS/s.ConnectionEventListener.java javax/sql/SCCS/s.ConnectionEvent.java javax/sql/SCCS/s.ConnectionPoolDataSource.java javax/sql/SCCS/s.DataSource.java javax/sql/SCCS/s.PooledConnection.java javax/sql/SCCS/s.RowSet.java javax/sql/SCCS/s.RowSetEvent.java javax/sql/SCCS/s.RowSetInternal.java javax/sql/SCCS/s.RowSetListener.java javax/sql/SCCS/s.RowSetMetaData.java javax/sql/SCCS/s.RowSetReader.java javax/sql/SCCS/s.RowSetWriter.java javax/sql/SCCS/s.XAConnection.java javax/sql/SCCS/s.XADataSource.java javax/sql/SCCS/s.package.html javax/sql/rowset javax/sql/rowset/SCCS javax/sql/rowset/SCCS/s.FilteredRowSet.java javax/sql/rowset/SCCS/s.BaseRowSet.java javax/sql/rowset/SCCS/s.CachedRowSet.java javax/sql/rowset/SCCS/s.RowSetMetaDataImpl.java javax/sql/rowset/SCCS/s.JdbcRowSet.java javax/sql/rowset/SCCS/s.JoinRowSet.java javax/sql/rowset/SCCS/s.Joinable.java javax/sql/rowset/SCCS/s.Predicate.java javax/sql/rowset/SCCS/s.RowSetWarning.java javax/sql/rowset/SCCS/s.WebRowSet.java javax/sql/rowset/SCCS/s.package.html javax/sql/rowset/SCCS/s.rowset.properties javax/sql/rowset/SCCS/s.sqlxml.xsd javax/sql/rowset/SCCS/s.webrowset.xsd javax/sql/rowset/serial javax/sql/rowset/serial/SCCS javax/sql/rowset/serial/SCCS/s.SQLOutputImpl.java javax/sql/rowset/serial/SCCS/s.SQLInputImpl.java javax/sql/rowset/serial/SCCS/s.SerialArray.java javax/sql/rowset/serial/SCCS/s.SerialBlob.java javax/sql/rowset/serial/SCCS/s.SerialClob.java javax/sql/rowset/serial/SCCS/s.SerialDatalink.java javax/sql/rowset/serial/SCCS/s.SerialException.java javax/sql/rowset/serial/SCCS/s.SerialJavaObject.java javax/sql/rowset/serial/SCCS/s.SerialRef.java javax/sql/rowset/serial/SCCS/s.SerialStruct.java javax/sql/rowset/serial/SCCS/s.package.html javax/sql/rowset/serial/SerialException.java javax/sql/rowset/serial/SQLInputImpl.java javax/sql/rowset/serial/SQLOutputImpl.java javax/sql/rowset/serial/SerialArray.java javax/sql/rowset/serial/SerialBlob.java javax/sql/rowset/serial/SerialClob.java javax/sql/rowset/serial/SerialDatalink.java javax/sql/rowset/serial/SerialJavaObject.java javax/sql/rowset/serial/SerialRef.java javax/sql/rowset/serial/SerialStruct.java javax/sql/rowset/serial/package.html javax/sql/rowset/spi javax/sql/rowset/spi/SCCS javax/sql/rowset/spi/SCCS/s.SyncFactoryException.java javax/sql/rowset/spi/SCCS/s.SyncFactory.java javax/sql/rowset/spi/SCCS/s.SyncProvider.java javax/sql/rowset/spi/SCCS/s.SyncResolver.java javax/sql/rowset/spi/SCCS/s.package.html javax/sql/rowset/spi/SCCS/s.SyncProviderException.java javax/sql/rowset/spi/SCCS/s.TransactionalWriter.java javax/sql/rowset/spi/SCCS/s.XmlReader.java javax/sql/rowset/spi/SCCS/s.XmlWriter.java javax/sql/rowset/spi/SyncFactoryException.java javax/sql/rowset/spi/SyncFactory.java javax/sql/rowset/spi/SyncProviderException.java javax/sql/rowset/spi/SyncProvider.java javax/sql/rowset/spi/TransactionalWriter.java javax/sql/rowset/spi/SyncResolver.java javax/sql/rowset/spi/XmlReader.java javax/sql/rowset/spi/XmlWriter.java javax/sql/rowset/spi/package.html javax/sql/rowset/CachedRowSet.java javax/sql/rowset/BaseRowSet.java javax/sql/rowset/FilteredRowSet.java javax/sql/rowset/JdbcRowSet.java javax/sql/rowset/JoinRowSet.java javax/sql/rowset/Joinable.java javax/sql/rowset/Predicate.java javax/sql/rowset/RowSetMetaDataImpl.java javax/sql/rowset/RowSetWarning.java javax/sql/rowset/WebRowSet.java javax/sql/rowset/package.html javax/sql/rowset/rowset.properties javax/sql/rowset/sqlxml.xsd javax/sql/rowset/webrowset.xsd javax/sql/ConnectionEventListener.java javax/sql/ConnectionEvent.java javax/sql/RowSetEvent.java javax/sql/RowSet.java javax/sql/ConnectionPoolDataSource.java javax/sql/DataSource.java javax/sql/PooledConnection.java javax/sql/RowSetInternal.java javax/sql/RowSetListener.java javax/sql/RowSetMetaData.java javax/sql/RowSetReader.java javax/sql/RowSetWriter.java javax/sql/XAConnection.java javax/sql/XADataSource.java javax/sql/package.html javax/swing javax/swing/SCCS javax/swing/SCCS/s.AbstractAction.java javax/swing/SCCS/s.AbstractButton.java javax/swing/SCCS/s.Action.java javax/swing/SCCS/s.AbstractActionPropertyChangeListener.java javax/swing/SCCS/s.AbstractCellEditor.java javax/swing/SCCS/s.AbstractListModel.java javax/swing/SCCS/s.AbstractSpinnerModel.java javax/swing/SCCS/s.ActionMap.java javax/swing/SCCS/s.AncestorNotifier.java javax/swing/SCCS/s.ArrayTable.java javax/swing/SCCS/s.Autoscroller.java javax/swing/SCCS/s.BorderFactory.java javax/swing/SCCS/s.BoundedRangeModel.java javax/swing/SCCS/s.Box.java javax/swing/SCCS/s.CellRendererPane.java javax/swing/SCCS/s.BoxLayout.java javax/swing/SCCS/s.ButtonGroup.java javax/swing/SCCS/s.ButtonModel.java javax/swing/SCCS/s.CellEditor.java javax/swing/SCCS/s.ComponentInputMap.java javax/swing/SCCS/s.ComboBoxEditor.java javax/swing/SCCS/s.ComboBoxModel.java javax/swing/SCCS/s.DebugGraphicsObserver.java javax/swing/SCCS/s.DebugGraphics.java javax/swing/SCCS/s.DebugGraphicsFilter.java javax/swing/SCCS/s.DebugGraphicsInfo.java javax/swing/SCCS/s.DefaultDesktopManager.java javax/swing/SCCS/s.DefaultBoundedRangeModel.java javax/swing/SCCS/s.DefaultButtonModel.java javax/swing/SCCS/s.DefaultCellEditor.java javax/swing/SCCS/s.DefaultComboBoxModel.java javax/swing/SCCS/s.DefaultListCellRenderer.java javax/swing/SCCS/s.DefaultFocusManager.java javax/swing/SCCS/s.DefaultListModel.java javax/swing/SCCS/s.DesktopManager.java javax/swing/SCCS/s.Icon.java javax/swing/SCCS/s.DefaultListSelectionModel.java javax/swing/SCCS/s.DefaultSingleSelectionModel.java javax/swing/SCCS/s.DelegatingDefaultFocusManager.java javax/swing/SCCS/s.FocusManager.java javax/swing/SCCS/s.GraphicsWrapper.java javax/swing/SCCS/s.GrayFilter.java javax/swing/SCCS/s.ImageIcon.java javax/swing/SCCS/s.InputMap.java javax/swing/SCCS/s.JCheckBoxMenuItem.java javax/swing/SCCS/s.InputVerifier.java javax/swing/SCCS/s.JApplet.java javax/swing/SCCS/s.JButton.java javax/swing/SCCS/s.InternalFrameFocusTraversalPolicy.java javax/swing/SCCS/s.JCheckBox.java javax/swing/SCCS/s.JColorChooser.java javax/swing/SCCS/s.JComboBox.java javax/swing/SCCS/s.JComponent.java javax/swing/SCCS/s.JDesktopPane.java javax/swing/SCCS/s.JDialog.java javax/swing/SCCS/s.JEditorPane.java javax/swing/SCCS/s.JFileChooser.java javax/swing/SCCS/s.JFormattedTextField.java javax/swing/SCCS/s.JFrame.java javax/swing/SCCS/s.JInternalFrame.java javax/swing/SCCS/s.JLabel.java javax/swing/SCCS/s.JRadioButtonMenuItem.java javax/swing/SCCS/s.JLayeredPane.java javax/swing/SCCS/s.JList.java javax/swing/SCCS/s.JMenu.java javax/swing/SCCS/s.JMenuBar.java javax/swing/SCCS/s.JMenuItem.java javax/swing/SCCS/s.JOptionPane.java javax/swing/SCCS/s.JPanel.java javax/swing/SCCS/s.JPasswordField.java javax/swing/SCCS/s.JPopupMenu.java javax/swing/SCCS/s.JProgressBar.java javax/swing/SCCS/s.JRadioButton.java javax/swing/SCCS/s.JRootPane.java javax/swing/SCCS/s.JScrollBar.java javax/swing/SCCS/s.JScrollPane.java javax/swing/SCCS/s.JSeparator.java javax/swing/SCCS/s.JSlider.java javax/swing/SCCS/s.JSpinner.java javax/swing/SCCS/s.JViewport.java javax/swing/SCCS/s.JToolBar.java javax/swing/SCCS/s.JSplitPane.java javax/swing/SCCS/s.JTabbedPane.java javax/swing/SCCS/s.JTable.java javax/swing/SCCS/s.JTextArea.java javax/swing/SCCS/s.JTextField.java javax/swing/SCCS/s.JTextPane.java javax/swing/SCCS/s.JToggleButton.java javax/swing/SCCS/s.JToolTip.java javax/swing/SCCS/s.JTree.java javax/swing/SCCS/s.KeyStroke.java javax/swing/SCCS/s.JWindow.java javax/swing/SCCS/s.KeyboardManager.java javax/swing/SCCS/s.LayoutComparator.java javax/swing/SCCS/s.Popup.java javax/swing/SCCS/s.LayoutFocusTraversalPolicy.java javax/swing/SCCS/s.LegacyGlueFocusTraversalPolicy.java javax/swing/SCCS/s.ProgressMonitor.java javax/swing/SCCS/s.ListCellRenderer.java javax/swing/SCCS/s.ListModel.java javax/swing/SCCS/s.ListSelectionModel.java javax/swing/SCCS/s.LookAndFeel.java javax/swing/SCCS/s.MenuElement.java javax/swing/SCCS/s.MenuSelectionManager.java javax/swing/SCCS/s.MultiUIDefaults.java javax/swing/SCCS/s.MutableComboBoxModel.java javax/swing/SCCS/s.OverlayLayout.java javax/swing/SCCS/s.PopupFactory.java javax/swing/SCCS/s.ProgressMonitorInputStream.java javax/swing/SCCS/s.Renderer.java javax/swing/SCCS/s.RepaintManager.java javax/swing/SCCS/s.RootPaneContainer.java javax/swing/SCCS/s.package.html javax/swing/SCCS/s.ScrollPaneConstants.java javax/swing/SCCS/s.ScrollPaneLayout.java javax/swing/SCCS/s.Scrollable.java javax/swing/SCCS/s.SingleSelectionModel.java javax/swing/SCCS/s.SizeRequirements.java javax/swing/SCCS/s.SizeSequence.java javax/swing/SCCS/s.SortingFocusTraversalPolicy.java javax/swing/SCCS/s.SpinnerDateModel.java javax/swing/SCCS/s.SpinnerListModel.java javax/swing/SCCS/s.SpinnerModel.java javax/swing/SCCS/s.SpinnerNumberModel.java javax/swing/SCCS/s.Spring.java javax/swing/SCCS/s.SpringLayout.java javax/swing/SCCS/s.SwingConstants.java javax/swing/SCCS/s.SwingUtilities.java javax/swing/SCCS/s.TablePrintable.java javax/swing/SCCS/s.Timer.java javax/swing/SCCS/s.SystemEventQueueUtilities.java javax/swing/SCCS/s.TimerQueue.java javax/swing/SCCS/s.ToolTipManager.java javax/swing/SCCS/s.TransferHandler.java javax/swing/SCCS/s.UIDefaults.java javax/swing/SCCS/s.UIManager.java javax/swing/SCCS/s.UnsupportedLookAndFeelException.java javax/swing/SCCS/s.ViewportLayout.java javax/swing/SCCS/s.WindowConstants.java javax/swing/border javax/swing/border/SCCS javax/swing/border/SCCS/s.AbstractBorder.java javax/swing/border/SCCS/s.BevelBorder.java javax/swing/border/SCCS/s.Border.java javax/swing/border/SCCS/s.CompoundBorder.java javax/swing/border/SCCS/s.EmptyBorder.java javax/swing/border/SCCS/s.EtchedBorder.java javax/swing/border/SCCS/s.LineBorder.java javax/swing/border/SCCS/s.MatteBorder.java javax/swing/border/SCCS/s.SoftBevelBorder.java javax/swing/border/SCCS/s.TitledBorder.java javax/swing/border/SCCS/s.package.html javax/swing/border/SoftBevelBorder.java javax/swing/border/AbstractBorder.java javax/swing/border/BevelBorder.java javax/swing/border/Border.java javax/swing/border/CompoundBorder.java javax/swing/border/EmptyBorder.java javax/swing/border/EtchedBorder.java javax/swing/border/LineBorder.java javax/swing/border/MatteBorder.java javax/swing/border/TitledBorder.java javax/swing/border/package.html javax/swing/colorchooser javax/swing/colorchooser/SCCS javax/swing/colorchooser/SCCS/s.AbstractColorChooserPanel.java javax/swing/colorchooser/SCCS/s.CenterLayout.java javax/swing/colorchooser/SCCS/s.ColorChooserComponentFactory.java javax/swing/colorchooser/SCCS/s.ColorSelectionModel.java javax/swing/colorchooser/SCCS/s.DefaultColorSelectionModel.java javax/swing/colorchooser/SCCS/s.DefaultHSBChooserPanel.java javax/swing/colorchooser/SCCS/s.DefaultPreviewPanel.java javax/swing/colorchooser/SCCS/s.DefaultRGBChooserPanel.java javax/swing/colorchooser/SCCS/s.DefaultSwatchChooserPanel.java javax/swing/colorchooser/SCCS/s.SmartGridLayout.java javax/swing/colorchooser/SCCS/s.SyntheticImage.java javax/swing/colorchooser/SCCS/s.package.html javax/swing/colorchooser/ColorChooserComponentFactory.java javax/swing/colorchooser/AbstractColorChooserPanel.java javax/swing/colorchooser/CenterLayout.java javax/swing/colorchooser/ColorSelectionModel.java javax/swing/colorchooser/DefaultColorSelectionModel.java javax/swing/colorchooser/DefaultHSBChooserPanel.java javax/swing/colorchooser/DefaultPreviewPanel.java javax/swing/colorchooser/DefaultRGBChooserPanel.java javax/swing/colorchooser/DefaultSwatchChooserPanel.java javax/swing/colorchooser/SmartGridLayout.java javax/swing/colorchooser/SyntheticImage.java javax/swing/colorchooser/package.html javax/swing/doc-files javax/swing/doc-files/SCCS javax/swing/doc-files/SCCS/s.JLayeredPane-1.gif javax/swing/doc-files/SCCS/s.BoxLayout-1.gif javax/swing/doc-files/SCCS/s.JRootPane-1.gif javax/swing/doc-files/SCCS/s.JRootPane-2.gif javax/swing/doc-files/SCCS/s.JScrollPane-1.gif javax/swing/doc-files/SCCS/s.SizeSequence-1.gif javax/swing/doc-files/JLayeredPane-1.gif javax/swing/doc-files/BoxLayout-1.gif javax/swing/doc-files/JRootPane-1.gif javax/swing/doc-files/JRootPane-2.gif javax/swing/doc-files/JScrollPane-1.gif javax/swing/doc-files/SizeSequence-1.gif javax/swing/event javax/swing/event/SCCS javax/swing/event/SCCS/s.CellEditorListener.java javax/swing/event/SCCS/s.AncestorEvent.java javax/swing/event/SCCS/s.AncestorListener.java javax/swing/event/SCCS/s.CaretEvent.java javax/swing/event/SCCS/s.CaretListener.java javax/swing/event/SCCS/s.EventListenerList.java javax/swing/event/SCCS/s.ChangeEvent.java javax/swing/event/SCCS/s.ChangeListener.java javax/swing/event/SCCS/s.DocumentEvent.java javax/swing/event/SCCS/s.DocumentListener.java javax/swing/event/SCCS/s.HyperlinkEvent.java javax/swing/event/SCCS/s.HyperlinkListener.java javax/swing/event/SCCS/s.InternalFrameAdapter.java javax/swing/event/SCCS/s.MenuKeyListener.java javax/swing/event/SCCS/s.MenuEvent.java javax/swing/event/SCCS/s.InternalFrameEvent.java javax/swing/event/SCCS/s.InternalFrameListener.java javax/swing/event/SCCS/s.ListDataEvent.java javax/swing/event/SCCS/s.ListDataListener.java javax/swing/event/SCCS/s.ListSelectionEvent.java javax/swing/event/SCCS/s.ListSelectionListener.java javax/swing/event/SCCS/s.MenuDragMouseEvent.java javax/swing/event/SCCS/s.MenuDragMouseListener.java javax/swing/event/SCCS/s.MenuKeyEvent.java javax/swing/event/SCCS/s.MouseInputAdapter.java javax/swing/event/SCCS/s.MenuListener.java javax/swing/event/SCCS/s.MouseInputListener.java javax/swing/event/SCCS/s.PopupMenuEvent.java javax/swing/event/SCCS/s.package.html javax/swing/event/SCCS/s.PopupMenuListener.java javax/swing/event/SCCS/s.SwingPropertyChangeSupport.java javax/swing/event/SCCS/s.TableColumnModelEvent.java javax/swing/event/SCCS/s.TableColumnModelListener.java javax/swing/event/SCCS/s.TableModelEvent.java javax/swing/event/SCCS/s.TableModelListener.java javax/swing/event/SCCS/s.TreeExpansionEvent.java javax/swing/event/SCCS/s.TreeExpansionListener.java javax/swing/event/SCCS/s.TreeModelEvent.java javax/swing/event/SCCS/s.TreeModelListener.java javax/swing/event/SCCS/s.TreeSelectionEvent.java javax/swing/event/SCCS/s.TreeSelectionListener.java javax/swing/event/SCCS/s.TreeWillExpandListener.java javax/swing/event/SCCS/s.UndoableEditEvent.java javax/swing/event/SCCS/s.UndoableEditListener.java javax/swing/event/AncestorListener.java javax/swing/event/AncestorEvent.java javax/swing/event/CellEditorListener.java javax/swing/event/CaretEvent.java javax/swing/event/CaretListener.java javax/swing/event/InternalFrameAdapter.java javax/swing/event/ChangeEvent.java javax/swing/event/ChangeListener.java javax/swing/event/DocumentEvent.java javax/swing/event/DocumentListener.java javax/swing/event/EventListenerList.java javax/swing/event/HyperlinkEvent.java javax/swing/event/HyperlinkListener.java javax/swing/event/InternalFrameEvent.java javax/swing/event/InternalFrameListener.java javax/swing/event/ListDataEvent.java javax/swing/event/ListDataListener.java javax/swing/event/ListSelectionEvent.java javax/swing/event/ListSelectionListener.java javax/swing/event/MenuDragMouseEvent.java javax/swing/event/MenuDragMouseListener.java javax/swing/event/MenuEvent.java javax/swing/event/MenuKeyEvent.java javax/swing/event/MenuKeyListener.java javax/swing/event/MenuListener.java javax/swing/event/MouseInputAdapter.java javax/swing/event/MouseInputListener.java javax/swing/event/PopupMenuEvent.java javax/swing/event/PopupMenuListener.java javax/swing/event/SwingPropertyChangeSupport.java javax/swing/event/TableColumnModelEvent.java javax/swing/event/TableColumnModelListener.java javax/swing/event/TableModelEvent.java javax/swing/event/TableModelListener.java javax/swing/event/TreeExpansionEvent.java javax/swing/event/TreeExpansionListener.java javax/swing/event/TreeModelEvent.java javax/swing/event/TreeModelListener.java javax/swing/event/TreeSelectionEvent.java javax/swing/event/TreeSelectionListener.java javax/swing/event/TreeWillExpandListener.java javax/swing/event/UndoableEditEvent.java javax/swing/event/UndoableEditListener.java javax/swing/event/package.html javax/swing/filechooser javax/swing/filechooser/SCCS javax/swing/filechooser/SCCS/s.FileSystemView.java javax/swing/filechooser/SCCS/s.FileFilter.java javax/swing/filechooser/SCCS/s.FileView.java javax/swing/filechooser/SCCS/s.package.html javax/swing/filechooser/FileSystemView.java javax/swing/filechooser/FileFilter.java javax/swing/filechooser/FileView.java javax/swing/filechooser/package.html javax/swing/plaf javax/swing/plaf/SCCS javax/swing/plaf/SCCS/s.ComponentInputMapUIResource.java javax/swing/plaf/SCCS/s.ActionMapUIResource.java javax/swing/plaf/SCCS/s.BorderUIResource.java javax/swing/plaf/SCCS/s.ButtonUI.java javax/swing/plaf/SCCS/s.ColorChooserUI.java javax/swing/plaf/SCCS/s.ColorUIResource.java javax/swing/plaf/SCCS/s.ComboBoxUI.java javax/swing/plaf/SCCS/s.DesktopIconUI.java javax/swing/plaf/SCCS/s.ComponentUI.java javax/swing/plaf/SCCS/s.DesktopPaneUI.java javax/swing/plaf/SCCS/s.DimensionUIResource.java javax/swing/plaf/SCCS/s.FileChooserUI.java javax/swing/plaf/SCCS/s.FontUIResource.java javax/swing/plaf/SCCS/s.LabelUI.java javax/swing/plaf/SCCS/s.IconUIResource.java javax/swing/plaf/SCCS/s.InputMapUIResource.java javax/swing/plaf/SCCS/s.InsetsUIResource.java javax/swing/plaf/SCCS/s.InternalFrameUI.java javax/swing/plaf/SCCS/s.ListUI.java javax/swing/plaf/SCCS/s.MenuBarUI.java javax/swing/plaf/SCCS/s.MenuItemUI.java javax/swing/plaf/SCCS/s.OptionPaneUI.java javax/swing/plaf/SCCS/s.PanelUI.java javax/swing/plaf/SCCS/s.PopupMenuUI.java javax/swing/plaf/SCCS/s.ProgressBarUI.java javax/swing/plaf/SCCS/s.RootPaneUI.java javax/swing/plaf/SCCS/s.ScrollBarUI.java javax/swing/plaf/SCCS/s.ScrollPaneUI.java javax/swing/plaf/SCCS/s.SeparatorUI.java javax/swing/plaf/SCCS/s.SliderUI.java javax/swing/plaf/SCCS/s.SpinnerUI.java javax/swing/plaf/SCCS/s.TableUI.java javax/swing/plaf/SCCS/s.SplitPaneUI.java javax/swing/plaf/SCCS/s.TabbedPaneUI.java javax/swing/plaf/SCCS/s.TableHeaderUI.java javax/swing/plaf/SCCS/s.TextUI.java javax/swing/plaf/SCCS/s.ToolBarUI.java javax/swing/plaf/SCCS/s.ToolTipUI.java javax/swing/plaf/SCCS/s.TreeUI.java javax/swing/plaf/SCCS/s.UIResource.java javax/swing/plaf/SCCS/s.ViewportUI.java javax/swing/plaf/SCCS/s.package.html javax/swing/plaf/basic javax/swing/plaf/basic/SCCS javax/swing/plaf/basic/SCCS/s.BasicButtonListener.java javax/swing/plaf/basic/SCCS/s.BasicArrowButton.java javax/swing/plaf/basic/SCCS/s.BasicBorders.java javax/swing/plaf/basic/SCCS/s.BasicCheckBoxMenuItemUI.java javax/swing/plaf/basic/SCCS/s.BasicButtonUI.java javax/swing/plaf/basic/SCCS/s.BasicComboBoxRenderer.java javax/swing/plaf/basic/SCCS/s.BasicCheckBoxUI.java javax/swing/plaf/basic/SCCS/s.BasicColorChooserUI.java javax/swing/plaf/basic/SCCS/s.BasicComboBoxEditor.java javax/swing/plaf/basic/SCCS/s.BasicComboBoxUI.java javax/swing/plaf/basic/SCCS/s.BasicComboPopup.java javax/swing/plaf/basic/SCCS/s.BasicDesktopIconUI.java javax/swing/plaf/basic/SCCS/s.BasicHTML.java javax/swing/plaf/basic/SCCS/s.BasicInternalFrameTitlePane.java javax/swing/plaf/basic/SCCS/s.BasicDesktopPaneUI.java javax/swing/plaf/basic/SCCS/s.BasicDirectoryModel.java javax/swing/plaf/basic/SCCS/s.BasicDragGestureRecognizer.java javax/swing/plaf/basic/SCCS/s.BasicDropTargetListener.java javax/swing/plaf/basic/SCCS/s.BasicEditorPaneUI.java javax/swing/plaf/basic/SCCS/s.BasicFileChooserUI.java javax/swing/plaf/basic/SCCS/s.BasicFormattedTextFieldUI.java javax/swing/plaf/basic/SCCS/s.BasicGraphicsUtils.java javax/swing/plaf/basic/SCCS/s.BasicIconFactory.java javax/swing/plaf/basic/SCCS/s.BasicPopupMenuSeparatorUI.java javax/swing/plaf/basic/SCCS/s.BasicInternalFrameUI.java javax/swing/plaf/basic/SCCS/s.BasicLabelUI.java javax/swing/plaf/basic/SCCS/s.BasicListUI.java javax/swing/plaf/basic/SCCS/s.BasicLookAndFeel.java javax/swing/plaf/basic/SCCS/s.BasicMenuBarUI.java javax/swing/plaf/basic/SCCS/s.BasicMenuItemUI.java javax/swing/plaf/basic/SCCS/s.BasicMenuUI.java javax/swing/plaf/basic/SCCS/s.BasicOptionPaneUI.java javax/swing/plaf/basic/SCCS/s.BasicPanelUI.java javax/swing/plaf/basic/SCCS/s.BasicPasswordFieldUI.java javax/swing/plaf/basic/SCCS/s.BasicProgressBarUI.java javax/swing/plaf/basic/SCCS/s.BasicPopupMenuUI.java javax/swing/plaf/basic/SCCS/s.BasicSplitPaneDivider.java javax/swing/plaf/basic/SCCS/s.BasicRadioButtonMenuItemUI.java javax/swing/plaf/basic/SCCS/s.BasicRadioButtonUI.java javax/swing/plaf/basic/SCCS/s.BasicRootPaneUI.java javax/swing/plaf/basic/SCCS/s.BasicScrollBarUI.java javax/swing/plaf/basic/SCCS/s.BasicScrollPaneUI.java javax/swing/plaf/basic/SCCS/s.BasicSeparatorUI.java javax/swing/plaf/basic/SCCS/s.BasicSliderUI.java javax/swing/plaf/basic/SCCS/s.BasicSpinnerUI.java javax/swing/plaf/basic/SCCS/s.BasicTabbedPaneUI.java javax/swing/plaf/basic/SCCS/s.BasicSplitPaneUI.java javax/swing/plaf/basic/SCCS/s.BasicTableHeaderUI.java javax/swing/plaf/basic/SCCS/s.BasicTableUI.java javax/swing/plaf/basic/SCCS/s.BasicTextAreaUI.java javax/swing/plaf/basic/SCCS/s.BasicTextFieldUI.java javax/swing/plaf/basic/SCCS/s.BasicTextPaneUI.java javax/swing/plaf/basic/SCCS/s.BasicTextUI.java javax/swing/plaf/basic/SCCS/s.BasicToggleButtonUI.java javax/swing/plaf/basic/SCCS/s.BasicToolBarSeparatorUI.java javax/swing/plaf/basic/SCCS/s.BasicToolBarUI.java javax/swing/plaf/basic/SCCS/s.BasicToolTipUI.java javax/swing/plaf/basic/SCCS/s.BasicTransferable.java javax/swing/plaf/basic/SCCS/s.BasicTreeUI.java javax/swing/plaf/basic/SCCS/s.BasicViewportUI.java javax/swing/plaf/basic/SCCS/s.CenterLayout.java javax/swing/plaf/basic/SCCS/s.ComboPopup.java javax/swing/plaf/basic/SCCS/s.DefaultMenuLayout.java javax/swing/plaf/basic/SCCS/s.LazyActionMap.java javax/swing/plaf/basic/SCCS/s.package.html javax/swing/plaf/basic/icons javax/swing/plaf/basic/icons/SCCS javax/swing/plaf/basic/icons/SCCS/s.JavaCup16.png javax/swing/plaf/basic/icons/JavaCup16.png javax/swing/plaf/basic/BasicButtonListener.java javax/swing/plaf/basic/BasicArrowButton.java javax/swing/plaf/basic/BasicBorders.java javax/swing/plaf/basic/BasicButtonUI.java javax/swing/plaf/basic/BasicCheckBoxUI.java javax/swing/plaf/basic/BasicIconFactory.java javax/swing/plaf/basic/BasicHTML.java javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java javax/swing/plaf/basic/BasicColorChooserUI.java javax/swing/plaf/basic/BasicComboBoxEditor.java javax/swing/plaf/basic/BasicComboBoxRenderer.java javax/swing/plaf/basic/BasicComboBoxUI.java javax/swing/plaf/basic/BasicComboPopup.java javax/swing/plaf/basic/BasicDesktopIconUI.java javax/swing/plaf/basic/BasicDesktopPaneUI.java javax/swing/plaf/basic/BasicDirectoryModel.java javax/swing/plaf/basic/BasicDragGestureRecognizer.java javax/swing/plaf/basic/BasicDropTargetListener.java javax/swing/plaf/basic/BasicEditorPaneUI.java javax/swing/plaf/basic/BasicFileChooserUI.java javax/swing/plaf/basic/BasicFormattedTextFieldUI.java javax/swing/plaf/basic/BasicGraphicsUtils.java javax/swing/plaf/basic/BasicInternalFrameTitlePane.java javax/swing/plaf/basic/BasicInternalFrameUI.java javax/swing/plaf/basic/BasicLabelUI.java javax/swing/plaf/basic/BasicListUI.java javax/swing/plaf/basic/BasicLookAndFeel.java javax/swing/plaf/basic/BasicMenuBarUI.java javax/swing/plaf/basic/BasicMenuItemUI.java javax/swing/plaf/basic/BasicMenuUI.java javax/swing/plaf/basic/BasicOptionPaneUI.java javax/swing/plaf/basic/BasicPanelUI.java javax/swing/plaf/basic/BasicPasswordFieldUI.java javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java javax/swing/plaf/basic/BasicPopupMenuUI.java javax/swing/plaf/basic/BasicProgressBarUI.java javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java javax/swing/plaf/basic/BasicRadioButtonUI.java javax/swing/plaf/basic/BasicRootPaneUI.java javax/swing/plaf/basic/BasicScrollBarUI.java javax/swing/plaf/basic/BasicScrollPaneUI.java javax/swing/plaf/basic/BasicSeparatorUI.java javax/swing/plaf/basic/ComboPopup.java javax/swing/plaf/basic/BasicSliderUI.java javax/swing/plaf/basic/BasicSpinnerUI.java javax/swing/plaf/basic/BasicSplitPaneDivider.java javax/swing/plaf/basic/BasicSplitPaneUI.java javax/swing/plaf/basic/BasicTabbedPaneUI.java javax/swing/plaf/basic/BasicTableHeaderUI.java javax/swing/plaf/basic/BasicTableUI.java javax/swing/plaf/basic/BasicTextAreaUI.java javax/swing/plaf/basic/BasicTextFieldUI.java javax/swing/plaf/basic/BasicTextPaneUI.java javax/swing/plaf/basic/BasicTextUI.java javax/swing/plaf/basic/BasicToggleButtonUI.java javax/swing/plaf/basic/BasicToolBarSeparatorUI.java javax/swing/plaf/basic/BasicToolBarUI.java javax/swing/plaf/basic/BasicToolTipUI.java javax/swing/plaf/basic/BasicTransferable.java javax/swing/plaf/basic/BasicTreeUI.java javax/swing/plaf/basic/BasicViewportUI.java javax/swing/plaf/basic/CenterLayout.java javax/swing/plaf/basic/DefaultMenuLayout.java javax/swing/plaf/basic/LazyActionMap.java javax/swing/plaf/basic/package.html javax/swing/plaf/metal javax/swing/plaf/metal/SCCS javax/swing/plaf/metal/SCCS/s.DefaultMetalTheme.java javax/swing/plaf/metal/SCCS/s.MetalCheckBoxIcon.java javax/swing/plaf/metal/SCCS/s.MetalBorders.java javax/swing/plaf/metal/SCCS/s.MetalBumps.java javax/swing/plaf/metal/SCCS/s.MetalButtonUI.java javax/swing/plaf/metal/SCCS/s.MetalCheckBoxUI.java javax/swing/plaf/metal/SCCS/s.MetalComboBoxButton.java javax/swing/plaf/metal/SCCS/s.MetalComboBoxEditor.java javax/swing/plaf/metal/SCCS/s.MetalComboBoxIcon.java javax/swing/plaf/metal/SCCS/s.MetalComboBoxUI.java javax/swing/plaf/metal/SCCS/s.MetalDesktopIconUI.java javax/swing/plaf/metal/SCCS/s.MetalFileChooserUI.java javax/swing/plaf/metal/SCCS/s.MetalFontDesktopProperty.java javax/swing/plaf/metal/SCCS/s.MetalHighContrastTheme.java javax/swing/plaf/metal/SCCS/s.MetalIconFactory.java javax/swing/plaf/metal/SCCS/s.MetalInternalFrameTitlePane.java javax/swing/plaf/metal/SCCS/s.MetalInternalFrameUI.java javax/swing/plaf/metal/SCCS/s.MetalLabelUI.java javax/swing/plaf/metal/SCCS/s.MetalLookAndFeel.java javax/swing/plaf/metal/SCCS/s.MetalMenuBarUI.java javax/swing/plaf/metal/SCCS/s.MetalPopupMenuSeparatorUI.java javax/swing/plaf/metal/SCCS/s.MetalProgressBarUI.java javax/swing/plaf/metal/SCCS/s.MetalRadioButtonUI.java javax/swing/plaf/metal/SCCS/s.MetalRootPaneUI.java javax/swing/plaf/metal/SCCS/s.MetalScrollBarUI.java javax/swing/plaf/metal/SCCS/s.MetalScrollButton.java javax/swing/plaf/metal/SCCS/s.MetalScrollPaneUI.java javax/swing/plaf/metal/SCCS/s.MetalSeparatorUI.java javax/swing/plaf/metal/SCCS/s.package.html javax/swing/plaf/metal/SCCS/s.MetalSliderUI.java javax/swing/plaf/metal/SCCS/s.MetalSplitPaneDivider.java javax/swing/plaf/metal/SCCS/s.MetalSplitPaneUI.java javax/swing/plaf/metal/SCCS/s.MetalTabbedPaneUI.java javax/swing/plaf/metal/SCCS/s.MetalTextFieldUI.java javax/swing/plaf/metal/SCCS/s.MetalTheme.java javax/swing/plaf/metal/SCCS/s.MetalTitlePane.java javax/swing/plaf/metal/SCCS/s.MetalToggleButtonUI.java javax/swing/plaf/metal/SCCS/s.MetalToolBarUI.java javax/swing/plaf/metal/SCCS/s.MetalToolTipUI.java javax/swing/plaf/metal/SCCS/s.MetalTreeUI.java javax/swing/plaf/metal/SCCS/s.MetalUtils.java javax/swing/plaf/metal/SCCS/s.OceanTheme.java javax/swing/plaf/metal/icons javax/swing/plaf/metal/icons/SCCS javax/swing/plaf/metal/icons/SCCS/s.Inform.gif javax/swing/plaf/metal/icons/SCCS/s.Error.gif javax/swing/plaf/metal/icons/SCCS/s.Question.gif javax/swing/plaf/metal/icons/SCCS/s.Warn.gif javax/swing/plaf/metal/icons/ocean javax/swing/plaf/metal/icons/ocean/SCCS javax/swing/plaf/metal/icons/ocean/SCCS/s.iconify-pressed.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.close-pressed.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.close.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.collapsed-rtl.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.collapsed.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.computer.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.directory.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.error.png javax/swing/plaf/metal/icons/ocean/SCCS/s.expanded.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.file.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.floppy.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.hardDrive.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.homeFolder.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.maximize-pressed.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.iconify.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.info.png javax/swing/plaf/metal/icons/ocean/SCCS/s.maximize.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.menu.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.minimize-pressed.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.minimize.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.newFolder.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.paletteClose-pressed.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.paletteClose.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.question.png javax/swing/plaf/metal/icons/ocean/SCCS/s.upFolder.gif javax/swing/plaf/metal/icons/ocean/SCCS/s.warning.png javax/swing/plaf/metal/icons/ocean/maximize-pressed.gif javax/swing/plaf/metal/icons/ocean/close-pressed.gif javax/swing/plaf/metal/icons/ocean/close.gif javax/swing/plaf/metal/icons/ocean/collapsed-rtl.gif javax/swing/plaf/metal/icons/ocean/collapsed.gif javax/swing/plaf/metal/icons/ocean/computer.gif javax/swing/plaf/metal/icons/ocean/directory.gif javax/swing/plaf/metal/icons/ocean/error.png javax/swing/plaf/metal/icons/ocean/expanded.gif javax/swing/plaf/metal/icons/ocean/file.gif javax/swing/plaf/metal/icons/ocean/floppy.gif javax/swing/plaf/metal/icons/ocean/hardDrive.gif javax/swing/plaf/metal/icons/ocean/homeFolder.gif javax/swing/plaf/metal/icons/ocean/iconify-pressed.gif javax/swing/plaf/metal/icons/ocean/iconify.gif javax/swing/plaf/metal/icons/ocean/info.png javax/swing/plaf/metal/icons/ocean/maximize.gif javax/swing/plaf/metal/icons/ocean/menu.gif javax/swing/plaf/metal/icons/ocean/warning.png javax/swing/plaf/metal/icons/ocean/minimize.gif javax/swing/plaf/metal/icons/ocean/minimize-pressed.gif javax/swing/plaf/metal/icons/ocean/newFolder.gif javax/swing/plaf/metal/icons/ocean/paletteClose-pressed.gif javax/swing/plaf/metal/icons/ocean/paletteClose.gif javax/swing/plaf/metal/icons/ocean/question.png javax/swing/plaf/metal/icons/ocean/upFolder.gif javax/swing/plaf/metal/icons/Question.gif javax/swing/plaf/metal/icons/Error.gif javax/swing/plaf/metal/icons/Inform.gif javax/swing/plaf/metal/icons/Warn.gif javax/swing/plaf/metal/sounds javax/swing/plaf/metal/sounds/SCCS javax/swing/plaf/metal/sounds/SCCS/s.FrameRestoreDown.wav javax/swing/plaf/metal/sounds/SCCS/s.FrameClose.wav javax/swing/plaf/metal/sounds/SCCS/s.FrameMaximize.wav javax/swing/plaf/metal/sounds/SCCS/s.FrameMinimize.wav javax/swing/plaf/metal/sounds/SCCS/s.FrameRestoreUp.wav javax/swing/plaf/metal/sounds/SCCS/s.MenuItemCommand.wav javax/swing/plaf/metal/sounds/SCCS/s.OptionPaneError.wav javax/swing/plaf/metal/sounds/SCCS/s.OptionPaneInformation.wav javax/swing/plaf/metal/sounds/SCCS/s.OptionPaneQuestion.wav javax/swing/plaf/metal/sounds/SCCS/s.OptionPaneWarning.wav javax/swing/plaf/metal/sounds/SCCS/s.PopupMenuPopup.wav javax/swing/plaf/metal/sounds/FrameMaximize.wav javax/swing/plaf/metal/sounds/FrameClose.wav javax/swing/plaf/metal/sounds/OptionPaneInformation.wav javax/swing/plaf/metal/sounds/FrameMinimize.wav javax/swing/plaf/metal/sounds/FrameRestoreDown.wav javax/swing/plaf/metal/sounds/FrameRestoreUp.wav javax/swing/plaf/metal/sounds/MenuItemCommand.wav javax/swing/plaf/metal/sounds/OptionPaneError.wav javax/swing/plaf/metal/sounds/OptionPaneQuestion.wav javax/swing/plaf/metal/sounds/OptionPaneWarning.wav javax/swing/plaf/metal/sounds/PopupMenuPopup.wav javax/swing/plaf/metal/DefaultMetalTheme.java javax/swing/plaf/metal/MetalComboBoxButton.java javax/swing/plaf/metal/MetalBorders.java javax/swing/plaf/metal/MetalBumps.java javax/swing/plaf/metal/MetalButtonUI.java javax/swing/plaf/metal/MetalCheckBoxIcon.java javax/swing/plaf/metal/MetalCheckBoxUI.java javax/swing/plaf/metal/MetalComboBoxEditor.java javax/swing/plaf/metal/MetalComboBoxIcon.java javax/swing/plaf/metal/MetalComboBoxUI.java javax/swing/plaf/metal/MetalDesktopIconUI.java javax/swing/plaf/metal/MetalLabelUI.java javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java javax/swing/plaf/metal/MetalMenuBarUI.java javax/swing/plaf/metal/MetalFileChooserUI.java javax/swing/plaf/metal/MetalFontDesktopProperty.java javax/swing/plaf/metal/MetalHighContrastTheme.java javax/swing/plaf/metal/MetalIconFactory.java javax/swing/plaf/metal/MetalInternalFrameTitlePane.java javax/swing/plaf/metal/MetalInternalFrameUI.java javax/swing/plaf/metal/MetalLookAndFeel.java javax/swing/plaf/metal/MetalSplitPaneDivider.java javax/swing/plaf/metal/MetalProgressBarUI.java javax/swing/plaf/metal/MetalRadioButtonUI.java javax/swing/plaf/metal/MetalRootPaneUI.java javax/swing/plaf/metal/MetalScrollBarUI.java javax/swing/plaf/metal/MetalScrollButton.java javax/swing/plaf/metal/MetalScrollPaneUI.java javax/swing/plaf/metal/MetalSeparatorUI.java javax/swing/plaf/metal/MetalSliderUI.java javax/swing/plaf/metal/MetalToggleButtonUI.java javax/swing/plaf/metal/MetalSplitPaneUI.java javax/swing/plaf/metal/MetalTabbedPaneUI.java javax/swing/plaf/metal/MetalTextFieldUI.java javax/swing/plaf/metal/MetalTheme.java javax/swing/plaf/metal/MetalTitlePane.java javax/swing/plaf/metal/MetalToolBarUI.java javax/swing/plaf/metal/MetalToolTipUI.java javax/swing/plaf/metal/MetalTreeUI.java javax/swing/plaf/metal/MetalUtils.java javax/swing/plaf/metal/OceanTheme.java javax/swing/plaf/metal/package.html javax/swing/plaf/multi javax/swing/plaf/multi/SCCS javax/swing/plaf/multi/SCCS/s.MultiColorChooserUI.java javax/swing/plaf/multi/SCCS/s.MultiButtonUI.java javax/swing/plaf/multi/SCCS/s.MultiComboBoxUI.java javax/swing/plaf/multi/SCCS/s.MultiDesktopIconUI.java javax/swing/plaf/multi/SCCS/s.MultiDesktopPaneUI.java javax/swing/plaf/multi/SCCS/s.MultiFileChooserUI.java javax/swing/plaf/multi/SCCS/s.MultiInternalFrameUI.java javax/swing/plaf/multi/SCCS/s.MultiLabelUI.java javax/swing/plaf/multi/SCCS/s.MultiListUI.java javax/swing/plaf/multi/SCCS/s.MultiLookAndFeel.java javax/swing/plaf/multi/SCCS/s.MultiMenuBarUI.java javax/swing/plaf/multi/SCCS/s.MultiMenuItemUI.java javax/swing/plaf/multi/SCCS/s.MultiOptionPaneUI.java javax/swing/plaf/multi/SCCS/s.MultiPanelUI.java javax/swing/plaf/multi/SCCS/s.MultiTableUI.java javax/swing/plaf/multi/SCCS/s.MultiPopupMenuUI.java javax/swing/plaf/multi/SCCS/s.MultiProgressBarUI.java javax/swing/plaf/multi/SCCS/s.MultiRootPaneUI.java javax/swing/plaf/multi/SCCS/s.MultiScrollBarUI.java javax/swing/plaf/multi/SCCS/s.MultiScrollPaneUI.java javax/swing/plaf/multi/SCCS/s.MultiSeparatorUI.java javax/swing/plaf/multi/SCCS/s.MultiSliderUI.java javax/swing/plaf/multi/SCCS/s.MultiSpinnerUI.java javax/swing/plaf/multi/SCCS/s.MultiSplitPaneUI.java javax/swing/plaf/multi/SCCS/s.MultiTabbedPaneUI.java javax/swing/plaf/multi/SCCS/s.MultiTableHeaderUI.java javax/swing/plaf/multi/SCCS/s.MultiTextUI.java javax/swing/plaf/multi/SCCS/s.MultiToolBarUI.java javax/swing/plaf/multi/SCCS/s.MultiTreeUI.java javax/swing/plaf/multi/SCCS/s.MultiToolTipUI.java javax/swing/plaf/multi/SCCS/s.package.html javax/swing/plaf/multi/SCCS/s.MultiViewportUI.java javax/swing/plaf/multi/doc-files javax/swing/plaf/multi/doc-files/SCCS javax/swing/plaf/multi/doc-files/SCCS/s.multi_tsc.html javax/swing/plaf/multi/doc-files/multi_tsc.html javax/swing/plaf/multi/MultiColorChooserUI.java javax/swing/plaf/multi/MultiButtonUI.java javax/swing/plaf/multi/MultiInternalFrameUI.java javax/swing/plaf/multi/MultiComboBoxUI.java javax/swing/plaf/multi/MultiDesktopIconUI.java javax/swing/plaf/multi/MultiDesktopPaneUI.java javax/swing/plaf/multi/MultiFileChooserUI.java javax/swing/plaf/multi/MultiLabelUI.java javax/swing/plaf/multi/MultiListUI.java javax/swing/plaf/multi/MultiLookAndFeel.java javax/swing/plaf/multi/MultiMenuBarUI.java javax/swing/plaf/multi/MultiMenuItemUI.java javax/swing/plaf/multi/MultiOptionPaneUI.java javax/swing/plaf/multi/MultiPanelUI.java javax/swing/plaf/multi/MultiPopupMenuUI.java javax/swing/plaf/multi/MultiProgressBarUI.java javax/swing/plaf/multi/MultiRootPaneUI.java javax/swing/plaf/multi/MultiScrollBarUI.java javax/swing/plaf/multi/MultiScrollPaneUI.java javax/swing/plaf/multi/MultiSeparatorUI.java javax/swing/plaf/multi/MultiSliderUI.java javax/swing/plaf/multi/MultiSpinnerUI.java javax/swing/plaf/multi/MultiSplitPaneUI.java javax/swing/plaf/multi/MultiTabbedPaneUI.java javax/swing/plaf/multi/MultiTableHeaderUI.java javax/swing/plaf/multi/MultiTableUI.java javax/swing/plaf/multi/MultiTextUI.java javax/swing/plaf/multi/MultiToolBarUI.java javax/swing/plaf/multi/MultiToolTipUI.java javax/swing/plaf/multi/MultiTreeUI.java javax/swing/plaf/multi/package.html javax/swing/plaf/multi/MultiViewportUI.java javax/swing/plaf/synth javax/swing/plaf/synth/SCCS javax/swing/plaf/synth/SCCS/s.DefaultMenuLayout.java javax/swing/plaf/synth/SCCS/s.ColorType.java javax/swing/plaf/synth/SCCS/s.DefaultSynthStyleFactory.java javax/swing/plaf/synth/SCCS/s.ImagePainter.java javax/swing/plaf/synth/SCCS/s.ParsedSynthStyle.java javax/swing/plaf/synth/SCCS/s.Region.java javax/swing/plaf/synth/SCCS/s.SynthArrowButton.java javax/swing/plaf/synth/SCCS/s.SynthBorder.java javax/swing/plaf/synth/SCCS/s.SynthButtonUI.java javax/swing/plaf/synth/SCCS/s.SynthCheckBoxMenuItemUI.java javax/swing/plaf/synth/SCCS/s.SynthCheckBoxUI.java javax/swing/plaf/synth/SCCS/s.SynthColorChooserUI.java javax/swing/plaf/synth/SCCS/s.SynthComboBoxUI.java javax/swing/plaf/synth/SCCS/s.SynthLabelUI.java javax/swing/plaf/synth/SCCS/s.SynthOptionPaneUI.java javax/swing/plaf/synth/SCCS/s.SynthComboPopup.java javax/swing/plaf/synth/SCCS/s.SynthConstants.java javax/swing/plaf/synth/SCCS/s.SynthContext.java javax/swing/plaf/synth/SCCS/s.SynthDefaultLookup.java javax/swing/plaf/synth/SCCS/s.SynthDesktopIconUI.java javax/swing/plaf/synth/SCCS/s.SynthDesktopPaneUI.java javax/swing/plaf/synth/SCCS/s.SynthEditorPaneUI.java javax/swing/plaf/synth/SCCS/s.SynthFormattedTextFieldUI.java javax/swing/plaf/synth/SCCS/s.SynthGraphicsUtils.java javax/swing/plaf/synth/SCCS/s.SynthInternalFrameTitlePane.java javax/swing/plaf/synth/SCCS/s.SynthInternalFrameUI.java javax/swing/plaf/synth/SCCS/s.SynthListUI.java javax/swing/plaf/synth/SCCS/s.SynthLookAndFeel.java javax/swing/plaf/synth/SCCS/s.SynthMenuBarUI.java javax/swing/plaf/synth/SCCS/s.package.html javax/swing/plaf/synth/SCCS/s.SynthMenuItemUI.java javax/swing/plaf/synth/SCCS/s.SynthMenuUI.java javax/swing/plaf/synth/SCCS/s.SynthPasswordFieldUI.java javax/swing/plaf/synth/SCCS/s.SynthPainter.java javax/swing/plaf/synth/SCCS/s.SynthPanelUI.java javax/swing/plaf/synth/SCCS/s.SynthParser.java javax/swing/plaf/synth/SCCS/s.SynthProgressBarUI.java javax/swing/plaf/synth/SCCS/s.SynthPopupMenuUI.java javax/swing/plaf/synth/SCCS/s.SynthRadioButtonMenuItemUI.java javax/swing/plaf/synth/SCCS/s.SynthRadioButtonUI.java javax/swing/plaf/synth/SCCS/s.SynthRootPaneUI.java javax/swing/plaf/synth/SCCS/s.SynthScrollBarUI.java javax/swing/plaf/synth/SCCS/s.SynthScrollPaneUI.java javax/swing/plaf/synth/SCCS/s.SynthSeparatorUI.java javax/swing/plaf/synth/SCCS/s.SynthSliderUI.java javax/swing/plaf/synth/SCCS/s.SynthSpinnerUI.java javax/swing/plaf/synth/SCCS/s.SynthSplitPaneDivider.java javax/swing/plaf/synth/SCCS/s.SynthSplitPaneUI.java javax/swing/plaf/synth/SCCS/s.SynthStyle.java javax/swing/plaf/synth/SCCS/s.SynthStyleFactory.java javax/swing/plaf/synth/SCCS/s.SynthTabbedPaneUI.java javax/swing/plaf/synth/SCCS/s.SynthTableHeaderUI.java javax/swing/plaf/synth/SCCS/s.SynthTableUI.java javax/swing/plaf/synth/SCCS/s.SynthTextAreaUI.java javax/swing/plaf/synth/SCCS/s.SynthTextFieldUI.java javax/swing/plaf/synth/SCCS/s.SynthTextPaneUI.java javax/swing/plaf/synth/SCCS/s.SynthToggleButtonUI.java javax/swing/plaf/synth/SCCS/s.SynthToolBarUI.java javax/swing/plaf/synth/SCCS/s.SynthToolTipUI.java javax/swing/plaf/synth/SCCS/s.SynthTreeUI.java javax/swing/plaf/synth/SCCS/s.SynthViewportUI.java javax/swing/plaf/synth/doc-files javax/swing/plaf/synth/doc-files/SCCS javax/swing/plaf/synth/doc-files/SCCS/s.componentProperties.html javax/swing/plaf/synth/doc-files/SCCS/s.synth.dtd javax/swing/plaf/synth/doc-files/SCCS/s.synthFileFormat.html javax/swing/plaf/synth/doc-files/componentProperties.html javax/swing/plaf/synth/doc-files/synth.dtd javax/swing/plaf/synth/doc-files/synthFileFormat.html javax/swing/plaf/synth/DefaultMenuLayout.java javax/swing/plaf/synth/ColorType.java javax/swing/plaf/synth/SynthBorder.java javax/swing/plaf/synth/Region.java javax/swing/plaf/synth/DefaultSynthStyleFactory.java javax/swing/plaf/synth/ImagePainter.java javax/swing/plaf/synth/ParsedSynthStyle.java javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java javax/swing/plaf/synth/SynthArrowButton.java javax/swing/plaf/synth/SynthButtonUI.java javax/swing/plaf/synth/SynthColorChooserUI.java javax/swing/plaf/synth/SynthCheckBoxUI.java javax/swing/plaf/synth/SynthComboBoxUI.java javax/swing/plaf/synth/SynthInternalFrameTitlePane.java javax/swing/plaf/synth/SynthComboPopup.java javax/swing/plaf/synth/SynthConstants.java javax/swing/plaf/synth/SynthContext.java javax/swing/plaf/synth/SynthDefaultLookup.java javax/swing/plaf/synth/SynthDesktopIconUI.java javax/swing/plaf/synth/SynthDesktopPaneUI.java javax/swing/plaf/synth/SynthEditorPaneUI.java javax/swing/plaf/synth/SynthFormattedTextFieldUI.java javax/swing/plaf/synth/SynthGraphicsUtils.java javax/swing/plaf/synth/SynthPasswordFieldUI.java javax/swing/plaf/synth/SynthInternalFrameUI.java javax/swing/plaf/synth/SynthLabelUI.java javax/swing/plaf/synth/SynthListUI.java javax/swing/plaf/synth/SynthLookAndFeel.java javax/swing/plaf/synth/SynthMenuBarUI.java javax/swing/plaf/synth/SynthMenuItemUI.java javax/swing/plaf/synth/SynthMenuUI.java javax/swing/plaf/synth/SynthOptionPaneUI.java javax/swing/plaf/synth/SynthPainter.java javax/swing/plaf/synth/SynthPanelUI.java javax/swing/plaf/synth/SynthParser.java javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java javax/swing/plaf/synth/SynthPopupMenuUI.java javax/swing/plaf/synth/SynthProgressBarUI.java javax/swing/plaf/synth/SynthRadioButtonUI.java javax/swing/plaf/synth/SynthRootPaneUI.java javax/swing/plaf/synth/SynthScrollBarUI.java javax/swing/plaf/synth/SynthScrollPaneUI.java javax/swing/plaf/synth/SynthSeparatorUI.java javax/swing/plaf/synth/SynthSliderUI.java javax/swing/plaf/synth/SynthSpinnerUI.java javax/swing/plaf/synth/SynthSplitPaneDivider.java javax/swing/plaf/synth/SynthSplitPaneUI.java javax/swing/plaf/synth/SynthStyle.java javax/swing/plaf/synth/SynthStyleFactory.java javax/swing/plaf/synth/SynthTabbedPaneUI.java javax/swing/plaf/synth/SynthTableHeaderUI.java javax/swing/plaf/synth/SynthTableUI.java javax/swing/plaf/synth/SynthTextAreaUI.java javax/swing/plaf/synth/SynthTextFieldUI.java javax/swing/plaf/synth/SynthTextPaneUI.java javax/swing/plaf/synth/SynthToggleButtonUI.java javax/swing/plaf/synth/SynthToolBarUI.java javax/swing/plaf/synth/SynthToolTipUI.java javax/swing/plaf/synth/SynthTreeUI.java javax/swing/plaf/synth/SynthViewportUI.java javax/swing/plaf/synth/package.html javax/swing/plaf/ComponentInputMapUIResource.java javax/swing/plaf/ActionMapUIResource.java javax/swing/plaf/BorderUIResource.java javax/swing/plaf/ButtonUI.java javax/swing/plaf/ColorChooserUI.java javax/swing/plaf/ColorUIResource.java javax/swing/plaf/ComboBoxUI.java javax/swing/plaf/DimensionUIResource.java javax/swing/plaf/ComponentUI.java javax/swing/plaf/DesktopIconUI.java javax/swing/plaf/DesktopPaneUI.java javax/swing/plaf/FileChooserUI.java javax/swing/plaf/FontUIResource.java javax/swing/plaf/IconUIResource.java javax/swing/plaf/InputMapUIResource.java javax/swing/plaf/InsetsUIResource.java javax/swing/plaf/InternalFrameUI.java javax/swing/plaf/LabelUI.java javax/swing/plaf/ListUI.java javax/swing/plaf/MenuBarUI.java javax/swing/plaf/MenuItemUI.java javax/swing/plaf/OptionPaneUI.java javax/swing/plaf/PanelUI.java javax/swing/plaf/PopupMenuUI.java javax/swing/plaf/ProgressBarUI.java javax/swing/plaf/RootPaneUI.java javax/swing/plaf/ScrollBarUI.java javax/swing/plaf/ScrollPaneUI.java javax/swing/plaf/SeparatorUI.java javax/swing/plaf/SliderUI.java javax/swing/plaf/SpinnerUI.java javax/swing/plaf/SplitPaneUI.java javax/swing/plaf/TabbedPaneUI.java javax/swing/plaf/TableHeaderUI.java javax/swing/plaf/TableUI.java javax/swing/plaf/TextUI.java javax/swing/plaf/ToolBarUI.java javax/swing/plaf/ToolTipUI.java javax/swing/plaf/TreeUI.java javax/swing/plaf/UIResource.java javax/swing/plaf/ViewportUI.java javax/swing/plaf/package.html javax/swing/table javax/swing/table/SCCS javax/swing/table/SCCS/s.DefaultTableCellRenderer.java javax/swing/table/SCCS/s.AbstractTableModel.java javax/swing/table/SCCS/s.DefaultTableColumnModel.java javax/swing/table/SCCS/s.DefaultTableModel.java javax/swing/table/SCCS/s.JTableHeader.java javax/swing/table/SCCS/s.TableCellEditor.java javax/swing/table/SCCS/s.TableCellRenderer.java javax/swing/table/SCCS/s.TableColumn.java javax/swing/table/SCCS/s.TableColumnModel.java javax/swing/table/SCCS/s.TableModel.java javax/swing/table/SCCS/s.package.html javax/swing/table/DefaultTableCellRenderer.java javax/swing/table/AbstractTableModel.java javax/swing/table/DefaultTableColumnModel.java javax/swing/table/DefaultTableModel.java javax/swing/table/JTableHeader.java javax/swing/table/TableCellEditor.java javax/swing/table/TableCellRenderer.java javax/swing/table/TableColumn.java javax/swing/table/TableColumnModel.java javax/swing/table/TableModel.java javax/swing/table/package.html javax/swing/text javax/swing/text/SCCS javax/swing/text/SCCS/s.BadLocationException.java javax/swing/text/SCCS/s.AbstractDocument.java javax/swing/text/SCCS/s.AbstractWriter.java javax/swing/text/SCCS/s.AsyncBoxView.java javax/swing/text/SCCS/s.AttributeSet.java javax/swing/text/SCCS/s.ComponentView.java javax/swing/text/SCCS/s.BoxView.java javax/swing/text/SCCS/s.Caret.java javax/swing/text/SCCS/s.SegmentCache.java javax/swing/text/SCCS/s.ChangedCharSetException.java javax/swing/text/SCCS/s.CompositeView.java javax/swing/text/SCCS/s.DateFormatter.java javax/swing/text/SCCS/s.DefaultCaret.java javax/swing/text/SCCS/s.DefaultEditorKit.java javax/swing/text/SCCS/s.DefaultFormatter.java javax/swing/text/SCCS/s.Segment.java javax/swing/text/SCCS/s.DefaultFormatterFactory.java javax/swing/text/SCCS/s.DefaultHighlighter.java javax/swing/text/SCCS/s.DefaultStyledDocument.java javax/swing/text/SCCS/s.DefaultTextUI.java javax/swing/text/SCCS/s.Document.java javax/swing/text/SCCS/s.DocumentFilter.java javax/swing/text/SCCS/s.EditorKit.java javax/swing/text/SCCS/s.Element.java javax/swing/text/SCCS/s.ElementIterator.java javax/swing/text/SCCS/s.FieldView.java javax/swing/text/SCCS/s.FlowView.java javax/swing/text/SCCS/s.GapContent.java javax/swing/text/SCCS/s.GapVector.java javax/swing/text/SCCS/s.GlyphPainter1.java javax/swing/text/SCCS/s.GlyphPainter2.java javax/swing/text/SCCS/s.GlyphView.java javax/swing/text/SCCS/s.IconView.java javax/swing/text/SCCS/s.Highlighter.java javax/swing/text/SCCS/s.InternationalFormatter.java javax/swing/text/SCCS/s.JTextComponent.java javax/swing/text/SCCS/s.Keymap.java javax/swing/text/SCCS/s.LabelView.java javax/swing/text/SCCS/s.LayeredHighlighter.java javax/swing/text/SCCS/s.LayoutQueue.java javax/swing/text/SCCS/s.MaskFormatter.java javax/swing/text/SCCS/s.MutableAttributeSet.java javax/swing/text/SCCS/s.NavigationFilter.java javax/swing/text/SCCS/s.NumberFormatter.java javax/swing/text/SCCS/s.ParagraphView.java javax/swing/text/SCCS/s.PasswordView.java javax/swing/text/SCCS/s.PlainDocument.java javax/swing/text/SCCS/s.PlainView.java javax/swing/text/SCCS/s.Position.java javax/swing/text/SCCS/s.View.java javax/swing/text/SCCS/s.WrappedPlainView.java javax/swing/text/SCCS/s.SimpleAttributeSet.java javax/swing/text/SCCS/s.StateInvariantError.java javax/swing/text/SCCS/s.StringContent.java javax/swing/text/SCCS/s.Style.java javax/swing/text/SCCS/s.StyleConstants.java javax/swing/text/SCCS/s.StyleContext.java javax/swing/text/SCCS/s.StyledDocument.java javax/swing/text/SCCS/s.StyledEditorKit.java javax/swing/text/SCCS/s.TabExpander.java javax/swing/text/SCCS/s.TabSet.java javax/swing/text/SCCS/s.TabStop.java javax/swing/text/SCCS/s.TabableView.java javax/swing/text/SCCS/s.TableView.java javax/swing/text/SCCS/s.TextAction.java javax/swing/text/SCCS/s.TextLayoutStrategy.java javax/swing/text/SCCS/s.Utilities.java javax/swing/text/SCCS/s.ViewFactory.java javax/swing/text/SCCS/s.ZoneView.java javax/swing/text/SCCS/s.package.html javax/swing/text/doc-files javax/swing/text/doc-files/SCCS javax/swing/text/doc-files/SCCS/s.Document-notification.gif javax/swing/text/doc-files/SCCS/s.Document-coord.gif javax/swing/text/doc-files/SCCS/s.Document-insert.gif javax/swing/text/doc-files/SCCS/s.Document-remove.gif javax/swing/text/doc-files/SCCS/s.Document-structure.gif javax/swing/text/doc-files/SCCS/s.OpenBookIcon.gif javax/swing/text/doc-files/SCCS/s.View-flexibility.jpg javax/swing/text/doc-files/SCCS/s.View-layout.jpg javax/swing/text/doc-files/SCCS/s.editor.gif javax/swing/text/doc-files/SCCS/s.paragraph.gif javax/swing/text/doc-files/Document-notification.gif javax/swing/text/doc-files/Document-coord.gif javax/swing/text/doc-files/Document-insert.gif javax/swing/text/doc-files/Document-structure.gif javax/swing/text/doc-files/Document-remove.gif javax/swing/text/doc-files/OpenBookIcon.gif javax/swing/text/doc-files/View-flexibility.jpg javax/swing/text/doc-files/View-layout.jpg javax/swing/text/doc-files/editor.gif javax/swing/text/doc-files/paragraph.gif javax/swing/text/html javax/swing/text/html/SCCS javax/swing/text/html/SCCS/s.AccessibleHTML.java javax/swing/text/html/SCCS/s.BRView.java javax/swing/text/html/SCCS/s.BlockView.java javax/swing/text/html/SCCS/s.CSS.java javax/swing/text/html/SCCS/s.CSSParser.java javax/swing/text/html/SCCS/s.CommentView.java javax/swing/text/html/SCCS/s.EditableView.java javax/swing/text/html/SCCS/s.FormSubmitEvent.java javax/swing/text/html/SCCS/s.FormView.java javax/swing/text/html/SCCS/s.FrameSetView.java javax/swing/text/html/SCCS/s.FrameView.java javax/swing/text/html/SCCS/s.HRuleView.java javax/swing/text/html/SCCS/s.HTML.java javax/swing/text/html/SCCS/s.HTMLDocument.java javax/swing/text/html/SCCS/s.HTMLEditorKit.java javax/swing/text/html/SCCS/s.HTMLWriter.java javax/swing/text/html/SCCS/s.NoFramesView.java javax/swing/text/html/SCCS/s.Map.java javax/swing/text/html/SCCS/s.HTMLFrameHyperlinkEvent.java javax/swing/text/html/SCCS/s.HiddenTagView.java javax/swing/text/html/SCCS/s.ImageView.java javax/swing/text/html/SCCS/s.InlineView.java javax/swing/text/html/SCCS/s.IsindexView.java javax/swing/text/html/SCCS/s.LineView.java javax/swing/text/html/SCCS/s.ListView.java javax/swing/text/html/SCCS/s.MinimalHTMLWriter.java javax/swing/text/html/SCCS/s.MuxingAttributeSet.java javax/swing/text/html/SCCS/s.ObjectView.java javax/swing/text/html/SCCS/s.Option.java javax/swing/text/html/SCCS/s.OptionComboBoxModel.java javax/swing/text/html/SCCS/s.OptionListModel.java javax/swing/text/html/SCCS/s.ParagraphView.java javax/swing/text/html/SCCS/s.ResourceLoader.java javax/swing/text/html/SCCS/s.StyleSheet.java javax/swing/text/html/SCCS/s.default.css javax/swing/text/html/SCCS/s.TableView.java javax/swing/text/html/SCCS/s.TextAreaDocument.java javax/swing/text/html/SCCS/s.package.html javax/swing/text/html/icons javax/swing/text/html/icons/SCCS javax/swing/text/html/icons/SCCS/s.image-delayed.gif javax/swing/text/html/icons/SCCS/s.image-failed.gif javax/swing/text/html/icons/image-delayed.gif javax/swing/text/html/icons/image-failed.gif javax/swing/text/html/parser javax/swing/text/html/parser/SCCS javax/swing/text/html/parser/SCCS/s.ContentModelState.java javax/swing/text/html/parser/SCCS/s.AttributeList.java javax/swing/text/html/parser/SCCS/s.ContentModel.java javax/swing/text/html/parser/SCCS/s.DTDConstants.java javax/swing/text/html/parser/SCCS/s.DTD.java javax/swing/text/html/parser/SCCS/s.DocumentParser.java javax/swing/text/html/parser/SCCS/s.Element.java javax/swing/text/html/parser/SCCS/s.Entity.java javax/swing/text/html/parser/SCCS/s.Parser.java javax/swing/text/html/parser/SCCS/s.ParserDelegator.java javax/swing/text/html/parser/SCCS/s.ResourceLoader.java javax/swing/text/html/parser/SCCS/s.TagElement.java javax/swing/text/html/parser/SCCS/s.TagStack.java javax/swing/text/html/parser/SCCS/s.html32.bdtd javax/swing/text/html/parser/SCCS/s.package.html javax/swing/text/html/parser/ContentModelState.java javax/swing/text/html/parser/AttributeList.java javax/swing/text/html/parser/ContentModel.java javax/swing/text/html/parser/DTDConstants.java javax/swing/text/html/parser/DTD.java javax/swing/text/html/parser/DocumentParser.java javax/swing/text/html/parser/Element.java javax/swing/text/html/parser/Entity.java javax/swing/text/html/parser/Parser.java javax/swing/text/html/parser/ParserDelegator.java javax/swing/text/html/parser/ResourceLoader.java javax/swing/text/html/parser/TagElement.java javax/swing/text/html/parser/TagStack.java javax/swing/text/html/parser/html32.bdtd javax/swing/text/html/parser/package.html javax/swing/text/html/FormSubmitEvent.java javax/swing/text/html/AccessibleHTML.java javax/swing/text/html/BRView.java javax/swing/text/html/BlockView.java javax/swing/text/html/CSS.java javax/swing/text/html/CSSParser.java javax/swing/text/html/CommentView.java javax/swing/text/html/EditableView.java javax/swing/text/html/FormView.java javax/swing/text/html/FrameSetView.java javax/swing/text/html/FrameView.java javax/swing/text/html/HRuleView.java javax/swing/text/html/HTML.java javax/swing/text/html/HTMLDocument.java javax/swing/text/html/HTMLEditorKit.java javax/swing/text/html/HTMLWriter.java javax/swing/text/html/MinimalHTMLWriter.java javax/swing/text/html/HTMLFrameHyperlinkEvent.java javax/swing/text/html/HiddenTagView.java javax/swing/text/html/ImageView.java javax/swing/text/html/InlineView.java javax/swing/text/html/IsindexView.java javax/swing/text/html/LineView.java javax/swing/text/html/ListView.java javax/swing/text/html/Map.java javax/swing/text/html/OptionComboBoxModel.java javax/swing/text/html/MuxingAttributeSet.java javax/swing/text/html/NoFramesView.java javax/swing/text/html/ObjectView.java javax/swing/text/html/Option.java javax/swing/text/html/OptionListModel.java javax/swing/text/html/ParagraphView.java javax/swing/text/html/ResourceLoader.java javax/swing/text/html/StyleSheet.java javax/swing/text/html/TableView.java javax/swing/text/html/default.css javax/swing/text/html/TextAreaDocument.java javax/swing/text/html/package.html javax/swing/text/rtf javax/swing/text/rtf/SCCS javax/swing/text/rtf/SCCS/s.AbstractFilter.java javax/swing/text/rtf/SCCS/s.Constants.java javax/swing/text/rtf/SCCS/s.MockAttributeSet.java javax/swing/text/rtf/SCCS/s.RTFAttribute.java javax/swing/text/rtf/SCCS/s.RTFAttributes.java javax/swing/text/rtf/SCCS/s.RTFEditorKit.java javax/swing/text/rtf/SCCS/s.RTFGenerator.java javax/swing/text/rtf/SCCS/s.RTFParser.java javax/swing/text/rtf/SCCS/s.RTFReader.java javax/swing/text/rtf/SCCS/s.package.html javax/swing/text/rtf/charsets javax/swing/text/rtf/charsets/SCCS javax/swing/text/rtf/charsets/SCCS/s.cpg437.txt javax/swing/text/rtf/charsets/SCCS/s.NeXT.txt javax/swing/text/rtf/charsets/SCCS/s.ansi.txt javax/swing/text/rtf/charsets/SCCS/s.cpg850.txt javax/swing/text/rtf/charsets/SCCS/s.mac.txt javax/swing/text/rtf/charsets/NeXT.txt javax/swing/text/rtf/charsets/ansi.txt javax/swing/text/rtf/charsets/cpg437.txt javax/swing/text/rtf/charsets/cpg850.txt javax/swing/text/rtf/charsets/mac.txt javax/swing/text/rtf/MockAttributeSet.java javax/swing/text/rtf/AbstractFilter.java javax/swing/text/rtf/Constants.java javax/swing/text/rtf/RTFAttribute.java javax/swing/text/rtf/RTFAttributes.java javax/swing/text/rtf/RTFEditorKit.java javax/swing/text/rtf/RTFGenerator.java javax/swing/text/rtf/RTFParser.java javax/swing/text/rtf/RTFReader.java javax/swing/text/rtf/package.html javax/swing/text/BadLocationException.java javax/swing/text/AbstractDocument.java javax/swing/text/AbstractWriter.java javax/swing/text/AsyncBoxView.java javax/swing/text/AttributeSet.java javax/swing/text/BoxView.java javax/swing/text/Caret.java javax/swing/text/ComponentView.java javax/swing/text/DefaultFormatterFactory.java javax/swing/text/ChangedCharSetException.java javax/swing/text/CompositeView.java javax/swing/text/DateFormatter.java javax/swing/text/DefaultCaret.java javax/swing/text/DefaultEditorKit.java javax/swing/text/DefaultFormatter.java javax/swing/text/DefaultStyledDocument.java javax/swing/text/DefaultHighlighter.java javax/swing/text/DefaultTextUI.java javax/swing/text/Document.java javax/swing/text/DocumentFilter.java javax/swing/text/EditorKit.java javax/swing/text/Element.java javax/swing/text/ElementIterator.java javax/swing/text/FieldView.java javax/swing/text/FlowView.java javax/swing/text/GapContent.java javax/swing/text/GapVector.java javax/swing/text/GlyphPainter1.java javax/swing/text/GlyphPainter2.java javax/swing/text/GlyphView.java javax/swing/text/Highlighter.java javax/swing/text/LabelView.java javax/swing/text/Keymap.java javax/swing/text/IconView.java javax/swing/text/InternationalFormatter.java javax/swing/text/JTextComponent.java javax/swing/text/MutableAttributeSet.java javax/swing/text/LayeredHighlighter.java javax/swing/text/LayoutQueue.java javax/swing/text/MaskFormatter.java javax/swing/text/NavigationFilter.java javax/swing/text/NumberFormatter.java javax/swing/text/ParagraphView.java javax/swing/text/PasswordView.java javax/swing/text/PlainDocument.java javax/swing/text/PlainView.java javax/swing/text/Position.java javax/swing/text/Segment.java javax/swing/text/SegmentCache.java javax/swing/text/SimpleAttributeSet.java javax/swing/text/Style.java javax/swing/text/StateInvariantError.java javax/swing/text/StringContent.java javax/swing/text/StyleConstants.java javax/swing/text/StyleContext.java javax/swing/text/StyledDocument.java javax/swing/text/StyledEditorKit.java javax/swing/text/TabExpander.java javax/swing/text/TabSet.java javax/swing/text/TabStop.java javax/swing/text/TabableView.java javax/swing/text/TableView.java javax/swing/text/TextAction.java javax/swing/text/TextLayoutStrategy.java javax/swing/text/Utilities.java javax/swing/text/View.java javax/swing/text/ViewFactory.java javax/swing/text/ZoneView.java javax/swing/text/WrappedPlainView.java javax/swing/text/package.html javax/swing/tree javax/swing/tree/SCCS javax/swing/tree/SCCS/s.DefaultMutableTreeNode.java javax/swing/tree/SCCS/s.AbstractLayoutCache.java javax/swing/tree/SCCS/s.DefaultTreeCellEditor.java javax/swing/tree/SCCS/s.DefaultTreeCellRenderer.java javax/swing/tree/SCCS/s.DefaultTreeModel.java javax/swing/tree/SCCS/s.DefaultTreeSelectionModel.java javax/swing/tree/SCCS/s.ExpandVetoException.java javax/swing/tree/SCCS/s.FixedHeightLayoutCache.java javax/swing/tree/SCCS/s.MutableTreeNode.java javax/swing/tree/SCCS/s.RowMapper.java javax/swing/tree/SCCS/s.TreeCellEditor.java javax/swing/tree/SCCS/s.TreeCellRenderer.java javax/swing/tree/SCCS/s.TreeModel.java javax/swing/tree/SCCS/s.TreeNode.java javax/swing/tree/SCCS/s.TreePath.java javax/swing/tree/SCCS/s.TreeSelectionModel.java javax/swing/tree/SCCS/s.VariableHeightLayoutCache.java javax/swing/tree/SCCS/s.package.html javax/swing/tree/DefaultTreeCellRenderer.java javax/swing/tree/AbstractLayoutCache.java javax/swing/tree/DefaultMutableTreeNode.java javax/swing/tree/DefaultTreeCellEditor.java javax/swing/tree/DefaultTreeSelectionModel.java javax/swing/tree/DefaultTreeModel.java javax/swing/tree/ExpandVetoException.java javax/swing/tree/FixedHeightLayoutCache.java javax/swing/tree/MutableTreeNode.java javax/swing/tree/RowMapper.java javax/swing/tree/TreeCellEditor.java javax/swing/tree/TreeCellRenderer.java javax/swing/tree/TreeModel.java javax/swing/tree/VariableHeightLayoutCache.java javax/swing/tree/TreeNode.java javax/swing/tree/TreePath.java javax/swing/tree/TreeSelectionModel.java javax/swing/tree/package.html javax/swing/undo javax/swing/undo/SCCS javax/swing/undo/SCCS/s.AbstractUndoableEdit.java javax/swing/undo/SCCS/s.CannotRedoException.java javax/swing/undo/SCCS/s.CannotUndoException.java javax/swing/undo/SCCS/s.CompoundEdit.java javax/swing/undo/SCCS/s.StateEdit.java javax/swing/undo/SCCS/s.StateEditable.java javax/swing/undo/SCCS/s.UndoManager.java javax/swing/undo/SCCS/s.UndoableEdit.java javax/swing/undo/SCCS/s.UndoableEditSupport.java javax/swing/undo/SCCS/s.package.html javax/swing/undo/AbstractUndoableEdit.java javax/swing/undo/CannotRedoException.java javax/swing/undo/CannotUndoException.java javax/swing/undo/CompoundEdit.java javax/swing/undo/StateEdit.java javax/swing/undo/StateEditable.java javax/swing/undo/UndoManager.java javax/swing/undo/UndoableEdit.java javax/swing/undo/UndoableEditSupport.java javax/swing/undo/package.html javax/swing/AbstractAction.java javax/swing/AbstractButton.java javax/swing/Action.java javax/swing/AbstractActionPropertyChangeListener.java javax/swing/AbstractCellEditor.java javax/swing/AbstractListModel.java javax/swing/AbstractSpinnerModel.java javax/swing/ActionMap.java javax/swing/DefaultBoundedRangeModel.java javax/swing/AncestorNotifier.java javax/swing/ArrayTable.java javax/swing/Autoscroller.java javax/swing/BorderFactory.java javax/swing/BoundedRangeModel.java javax/swing/Box.java javax/swing/BoxLayout.java javax/swing/ButtonGroup.java javax/swing/ButtonModel.java javax/swing/CellEditor.java javax/swing/CellRendererPane.java javax/swing/ComboBoxEditor.java javax/swing/ComboBoxModel.java javax/swing/ComponentInputMap.java javax/swing/DebugGraphics.java javax/swing/DebugGraphicsFilter.java javax/swing/DebugGraphicsInfo.java javax/swing/DesktopManager.java javax/swing/DebugGraphicsObserver.java javax/swing/DefaultComboBoxModel.java javax/swing/DefaultButtonModel.java javax/swing/DefaultCellEditor.java javax/swing/DefaultSingleSelectionModel.java javax/swing/DefaultDesktopManager.java javax/swing/DefaultFocusManager.java javax/swing/DefaultListCellRenderer.java javax/swing/DefaultListModel.java javax/swing/DefaultListSelectionModel.java javax/swing/DelegatingDefaultFocusManager.java javax/swing/FocusManager.java javax/swing/GraphicsWrapper.java javax/swing/LayoutFocusTraversalPolicy.java javax/swing/GrayFilter.java javax/swing/Icon.java javax/swing/ImageIcon.java javax/swing/InputMap.java javax/swing/InputVerifier.java javax/swing/JApplet.java javax/swing/JButton.java javax/swing/InternalFrameFocusTraversalPolicy.java javax/swing/JCheckBox.java javax/swing/JCheckBoxMenuItem.java javax/swing/JColorChooser.java javax/swing/JComboBox.java javax/swing/JComponent.java javax/swing/JDesktopPane.java javax/swing/JDialog.java javax/swing/JEditorPane.java javax/swing/JFileChooser.java javax/swing/JFormattedTextField.java javax/swing/JFrame.java javax/swing/JInternalFrame.java javax/swing/JLabel.java javax/swing/JLayeredPane.java javax/swing/JList.java javax/swing/JMenu.java javax/swing/JMenuBar.java javax/swing/JMenuItem.java javax/swing/JOptionPane.java javax/swing/JPanel.java javax/swing/JPasswordField.java javax/swing/JPopupMenu.java javax/swing/JProgressBar.java javax/swing/JRadioButton.java javax/swing/JRadioButtonMenuItem.java javax/swing/JRootPane.java javax/swing/JScrollBar.java javax/swing/JScrollPane.java javax/swing/JSeparator.java javax/swing/JSlider.java javax/swing/JSpinner.java javax/swing/JSplitPane.java javax/swing/JTabbedPane.java javax/swing/JTable.java javax/swing/JTextArea.java javax/swing/JTextField.java javax/swing/JTextPane.java javax/swing/JToggleButton.java javax/swing/JToolBar.java javax/swing/JToolTip.java javax/swing/JTree.java javax/swing/JViewport.java javax/swing/JWindow.java javax/swing/KeyStroke.java javax/swing/KeyboardManager.java javax/swing/LayoutComparator.java javax/swing/ListSelectionModel.java javax/swing/LegacyGlueFocusTraversalPolicy.java javax/swing/ListCellRenderer.java javax/swing/ListModel.java javax/swing/MenuSelectionManager.java javax/swing/LookAndFeel.java javax/swing/MenuElement.java javax/swing/MutableComboBoxModel.java javax/swing/MultiUIDefaults.java javax/swing/ProgressMonitorInputStream.java javax/swing/OverlayLayout.java javax/swing/Popup.java javax/swing/PopupFactory.java javax/swing/ProgressMonitor.java javax/swing/RepaintManager.java javax/swing/Renderer.java javax/swing/RootPaneContainer.java javax/swing/ScrollPaneConstants.java javax/swing/ScrollPaneLayout.java javax/swing/SpringLayout.java javax/swing/Spring.java javax/swing/Scrollable.java javax/swing/SingleSelectionModel.java javax/swing/SizeRequirements.java javax/swing/SizeSequence.java javax/swing/SortingFocusTraversalPolicy.java javax/swing/SpinnerDateModel.java javax/swing/SpinnerListModel.java javax/swing/SpinnerModel.java javax/swing/SpinnerNumberModel.java javax/swing/SwingConstants.java javax/swing/SwingUtilities.java javax/swing/TablePrintable.java javax/swing/Timer.java javax/swing/SystemEventQueueUtilities.java javax/swing/TimerQueue.java javax/swing/ViewportLayout.java javax/swing/UIDefaults.java javax/swing/ToolTipManager.java javax/swing/TransferHandler.java javax/swing/UIManager.java javax/swing/package.html javax/swing/UnsupportedLookAndFeelException.java javax/swing/WindowConstants.java javax/transaction javax/transaction/SCCS javax/transaction/SCCS/s.TransactionRolledbackException.java javax/transaction/SCCS/s.InvalidTransactionException.java javax/transaction/SCCS/s.TransactionRequiredException.java javax/transaction/SCCS/s.package.html javax/transaction/xa javax/transaction/xa/SCCS javax/transaction/xa/SCCS/s.XAException.java javax/transaction/xa/SCCS/s.XAResource.java javax/transaction/xa/SCCS/s.Xid.java javax/transaction/xa/SCCS/s.package.html javax/transaction/xa/XAException.java javax/transaction/xa/XAResource.java javax/transaction/xa/Xid.java javax/transaction/xa/package.html javax/transaction/InvalidTransactionException.java javax/transaction/TransactionRequiredException.java javax/transaction/TransactionRolledbackException.java javax/transaction/package.html javax/xml javax/xml/SCCS javax/xml/SCCS/s.XMLConstants.java javax/xml/SCCS/s.package.html javax/xml/datatype javax/xml/datatype/SCCS javax/xml/datatype/SCCS/s.FactoryFinder.java javax/xml/datatype/SCCS/s.Duration.java javax/xml/datatype/SCCS/s.DatatypeConfigurationException.java javax/xml/datatype/SCCS/s.DatatypeConstants.java javax/xml/datatype/SCCS/s.DatatypeFactory.java javax/xml/datatype/SCCS/s.XMLGregorianCalendar.java javax/xml/datatype/SCCS/s.package.html javax/xml/datatype/DatatypeConfigurationException.java javax/xml/datatype/DatatypeConstants.java javax/xml/datatype/DatatypeFactory.java javax/xml/datatype/Duration.java javax/xml/datatype/FactoryFinder.java javax/xml/datatype/XMLGregorianCalendar.java javax/xml/datatype/package.html javax/xml/namespace javax/xml/namespace/SCCS javax/xml/namespace/SCCS/s.NamespaceContext.java javax/xml/namespace/SCCS/s.QName.java javax/xml/namespace/SCCS/s.package.html javax/xml/namespace/NamespaceContext.java javax/xml/namespace/QName.java javax/xml/namespace/package.html javax/xml/parsers javax/xml/parsers/SCCS javax/xml/parsers/SCCS/s.DocumentBuilderFactory.java javax/xml/parsers/SCCS/s.DocumentBuilder.java javax/xml/parsers/SCCS/s.FactoryConfigurationError.java javax/xml/parsers/SCCS/s.FactoryFinder.java javax/xml/parsers/SCCS/s.ParserConfigurationException.java javax/xml/parsers/SCCS/s.SAXParser.java javax/xml/parsers/SCCS/s.SAXParserFactory.java javax/xml/parsers/SCCS/s.SecuritySupport.java javax/xml/parsers/SCCS/s.package.html javax/xml/parsers/DocumentBuilderFactory.java javax/xml/parsers/DocumentBuilder.java javax/xml/parsers/FactoryConfigurationError.java javax/xml/parsers/FactoryFinder.java javax/xml/parsers/ParserConfigurationException.java javax/xml/parsers/SAXParser.java javax/xml/parsers/SAXParserFactory.java javax/xml/parsers/SecuritySupport.java javax/xml/parsers/package.html javax/xml/transform javax/xml/transform/SCCS javax/xml/transform/SCCS/s.TransformerException.java javax/xml/transform/SCCS/s.ErrorListener.java javax/xml/transform/SCCS/s.FactoryFinder.java javax/xml/transform/SCCS/s.OutputKeys.java javax/xml/transform/SCCS/s.Result.java javax/xml/transform/SCCS/s.SecuritySupport.java javax/xml/transform/SCCS/s.Source.java javax/xml/transform/SCCS/s.SourceLocator.java javax/xml/transform/SCCS/s.Templates.java javax/xml/transform/SCCS/s.Transformer.java javax/xml/transform/SCCS/s.overview.html javax/xml/transform/SCCS/s.TransformerConfigurationException.java javax/xml/transform/SCCS/s.TransformerFactory.java javax/xml/transform/SCCS/s.URIResolver.java javax/xml/transform/SCCS/s.TransformerFactoryConfigurationError.java javax/xml/transform/SCCS/s.package.html javax/xml/transform/dom javax/xml/transform/dom/SCCS javax/xml/transform/dom/SCCS/s.DOMLocator.java javax/xml/transform/dom/SCCS/s.DOMResult.java javax/xml/transform/dom/SCCS/s.DOMSource.java javax/xml/transform/dom/SCCS/s.package.html javax/xml/transform/dom/DOMLocator.java javax/xml/transform/dom/DOMResult.java javax/xml/transform/dom/DOMSource.java javax/xml/transform/dom/package.html javax/xml/transform/sax javax/xml/transform/sax/SCCS javax/xml/transform/sax/SCCS/s.TemplatesHandler.java javax/xml/transform/sax/SCCS/s.SAXResult.java javax/xml/transform/sax/SCCS/s.SAXSource.java javax/xml/transform/sax/SCCS/s.SAXTransformerFactory.java javax/xml/transform/sax/SCCS/s.TransformerHandler.java javax/xml/transform/sax/SCCS/s.package.html javax/xml/transform/sax/TemplatesHandler.java javax/xml/transform/sax/SAXResult.java javax/xml/transform/sax/SAXSource.java javax/xml/transform/sax/SAXTransformerFactory.java javax/xml/transform/sax/TransformerHandler.java javax/xml/transform/sax/package.html javax/xml/transform/stream javax/xml/transform/stream/SCCS javax/xml/transform/stream/SCCS/s.StreamResult.java javax/xml/transform/stream/SCCS/s.StreamSource.java javax/xml/transform/stream/SCCS/s.package.html javax/xml/transform/stream/StreamResult.java javax/xml/transform/stream/StreamSource.java javax/xml/transform/stream/package.html javax/xml/transform/SecuritySupport.java javax/xml/transform/ErrorListener.java javax/xml/transform/FactoryFinder.java javax/xml/transform/OutputKeys.java javax/xml/transform/Result.java javax/xml/transform/SourceLocator.java javax/xml/transform/Source.java javax/xml/transform/TransformerException.java javax/xml/transform/Templates.java javax/xml/transform/Transformer.java javax/xml/transform/TransformerConfigurationException.java javax/xml/transform/TransformerFactory.java javax/xml/transform/URIResolver.java javax/xml/transform/TransformerFactoryConfigurationError.java javax/xml/transform/overview.html javax/xml/transform/package.html javax/xml/validation javax/xml/validation/SCCS javax/xml/validation/SCCS/s.SchemaFactory.java javax/xml/validation/SCCS/s.Schema.java javax/xml/validation/SCCS/s.SchemaFactoryFinder.java javax/xml/validation/SCCS/s.SchemaFactoryLoader.java javax/xml/validation/SCCS/s.TypeInfoProvider.java javax/xml/validation/SCCS/s.Validator.java javax/xml/validation/SCCS/s.ValidatorHandler.java javax/xml/validation/SCCS/s.package.html javax/xml/validation/SchemaFactory.java javax/xml/validation/Schema.java javax/xml/validation/SchemaFactoryFinder.java javax/xml/validation/SchemaFactoryLoader.java javax/xml/validation/TypeInfoProvider.java javax/xml/validation/Validator.java javax/xml/validation/ValidatorHandler.java javax/xml/validation/package.html javax/xml/xpath javax/xml/xpath/SCCS javax/xml/xpath/SCCS/s.XPathConstants.java javax/xml/xpath/SCCS/s.XPath.java javax/xml/xpath/SCCS/s.XPathExpressionException.java javax/xml/xpath/SCCS/s.XPathException.java javax/xml/xpath/SCCS/s.XPathExpression.java javax/xml/xpath/SCCS/s.XPathFactoryFinder.java javax/xml/xpath/SCCS/s.XPathFactory.java javax/xml/xpath/SCCS/s.package.html javax/xml/xpath/SCCS/s.XPathFactoryConfigurationException.java javax/xml/xpath/SCCS/s.XPathFunction.java javax/xml/xpath/SCCS/s.XPathFunctionException.java javax/xml/xpath/SCCS/s.XPathFunctionResolver.java javax/xml/xpath/SCCS/s.XPathVariableResolver.java javax/xml/xpath/XPathConstants.java javax/xml/xpath/XPath.java javax/xml/xpath/XPathExpression.java javax/xml/xpath/XPathException.java javax/xml/xpath/XPathFactoryConfigurationException.java javax/xml/xpath/XPathExpressionException.java javax/xml/xpath/XPathFactory.java javax/xml/xpath/XPathFactoryFinder.java javax/xml/xpath/XPathFunction.java javax/xml/xpath/XPathFunctionException.java javax/xml/xpath/XPathFunctionResolver.java javax/xml/xpath/XPathVariableResolver.java javax/xml/xpath/package.html javax/xml/XMLConstants.java javax/xml/package.html org org/ietf org/ietf/jgss org/ietf/jgss/SCCS org/ietf/jgss/SCCS/s.ChannelBinding.java org/ietf/jgss/SCCS/s.GSSContext.java org/ietf/jgss/SCCS/s.GSSCredential.java org/ietf/jgss/SCCS/s.GSSException.java org/ietf/jgss/SCCS/s.GSSManager.java org/ietf/jgss/SCCS/s.GSSName.java org/ietf/jgss/SCCS/s.MessageProp.java org/ietf/jgss/SCCS/s.Oid.java org/ietf/jgss/SCCS/s.package.html org/ietf/jgss/ChannelBinding.java org/ietf/jgss/GSSContext.java org/ietf/jgss/GSSCredential.java org/ietf/jgss/GSSException.java org/ietf/jgss/GSSManager.java org/ietf/jgss/GSSName.java org/ietf/jgss/MessageProp.java org/ietf/jgss/Oid.java org/ietf/jgss/package.html org/omg org/omg/CORBA org/omg/CORBA/DynAnyPackage org/omg/CORBA/DynAnyPackage/SCCS org/omg/CORBA/DynAnyPackage/SCCS/s.InvalidSeq.java org/omg/CORBA/DynAnyPackage/SCCS/s.Invalid.java org/omg/CORBA/DynAnyPackage/SCCS/s.InvalidValue.java org/omg/CORBA/DynAnyPackage/SCCS/s.TypeMismatch.java org/omg/CORBA/DynAnyPackage/SCCS/s.package.html org/omg/CORBA/DynAnyPackage/InvalidValue.java org/omg/CORBA/DynAnyPackage/Invalid.java org/omg/CORBA/DynAnyPackage/InvalidSeq.java org/omg/CORBA/DynAnyPackage/TypeMismatch.java org/omg/CORBA/DynAnyPackage/package.html org/omg/CORBA/ORBPackage org/omg/CORBA/ORBPackage/SCCS org/omg/CORBA/ORBPackage/SCCS/s.InconsistentTypeCode.java org/omg/CORBA/ORBPackage/SCCS/s.InvalidName.java org/omg/CORBA/ORBPackage/SCCS/s.package.html org/omg/CORBA/ORBPackage/InconsistentTypeCode.java org/omg/CORBA/ORBPackage/InvalidName.java org/omg/CORBA/ORBPackage/package.html org/omg/CORBA/SCCS org/omg/CORBA/SCCS/s.ACTIVITY_COMPLETED.java org/omg/CORBA/SCCS/s.ACTIVITY_REQUIRED.java org/omg/CORBA/SCCS/s.ARG_IN.java org/omg/CORBA/SCCS/s.ARG_INOUT.java org/omg/CORBA/SCCS/s.ARG_OUT.java org/omg/CORBA/SCCS/s.Any.java org/omg/CORBA/SCCS/s.AnyHolder.java org/omg/CORBA/SCCS/s.AnySeqHelper.java org/omg/CORBA/SCCS/s.AnySeqHolder.java org/omg/CORBA/SCCS/s.BAD_CONTEXT.java org/omg/CORBA/SCCS/s.BAD_INV_ORDER.java org/omg/CORBA/SCCS/s.BAD_OPERATION.java org/omg/CORBA/SCCS/s.BAD_PARAM.java org/omg/CORBA/SCCS/s.BAD_POLICY.java org/omg/CORBA/SCCS/s.BAD_POLICY_TYPE.java org/omg/CORBA/SCCS/s.ContextList.java org/omg/CORBA/SCCS/s.Context.java org/omg/CORBA/SCCS/s.BAD_POLICY_VALUE.java org/omg/CORBA/SCCS/s.BAD_QOS.java org/omg/CORBA/SCCS/s.BAD_TYPECODE.java org/omg/CORBA/SCCS/s.BooleanHolder.java org/omg/CORBA/SCCS/s.BooleanSeqHelper.java org/omg/CORBA/SCCS/s.BooleanSeqHolder.java org/omg/CORBA/SCCS/s.Bounds.java org/omg/CORBA/SCCS/s.ByteHolder.java org/omg/CORBA/SCCS/s.CODESET_INCOMPATIBLE.java org/omg/CORBA/SCCS/s.COMM_FAILURE.java org/omg/CORBA/SCCS/s.CTX_RESTRICT_SCOPE.java org/omg/CORBA/SCCS/s.CharHolder.java org/omg/CORBA/SCCS/s.CharSeqHelper.java org/omg/CORBA/SCCS/s.CharSeqHolder.java org/omg/CORBA/SCCS/s.CompletionStatus.java org/omg/CORBA/SCCS/s.CompletionStatusHelper.java org/omg/CORBA/SCCS/s.CurrentHelper.java org/omg/CORBA/SCCS/s.Current.java org/omg/CORBA/SCCS/s.CurrentOperations.java org/omg/CORBA/SCCS/s.CurrentHolder.java org/omg/CORBA/SCCS/s.DomainManagerOperations.java org/omg/CORBA/SCCS/s.CustomMarshal.java org/omg/CORBA/SCCS/s.DATA_CONVERSION.java org/omg/CORBA/SCCS/s.DataInputStream.java org/omg/CORBA/SCCS/s.DataOutputStream.java org/omg/CORBA/SCCS/s.DefinitionKind.java org/omg/CORBA/SCCS/s.DefinitionKindHelper.java org/omg/CORBA/SCCS/s.DomainManager.java org/omg/CORBA/SCCS/s.DoubleHolder.java org/omg/CORBA/SCCS/s.DoubleSeqHelper.java org/omg/CORBA/SCCS/s.FieldNameHelper.java org/omg/CORBA/SCCS/s.FREE_MEM.java org/omg/CORBA/SCCS/s.DoubleSeqHolder.java org/omg/CORBA/SCCS/s.DynAny.java org/omg/CORBA/SCCS/s.DynArray.java org/omg/CORBA/SCCS/s.DynEnum.java org/omg/CORBA/SCCS/s.DynFixed.java org/omg/CORBA/SCCS/s.DynSequence.java org/omg/CORBA/SCCS/s.DynStruct.java org/omg/CORBA/SCCS/s.DynUnion.java org/omg/CORBA/SCCS/s.DynValue.java org/omg/CORBA/SCCS/s.DynamicImplementation.java org/omg/CORBA/SCCS/s.Environment.java org/omg/CORBA/SCCS/s.ExceptionList.java org/omg/CORBA/SCCS/s.FloatSeqHelper.java org/omg/CORBA/SCCS/s.FixedHolder.java org/omg/CORBA/SCCS/s.FloatHolder.java org/omg/CORBA/SCCS/s.IDLTypeHelper.java org/omg/CORBA/SCCS/s.FloatSeqHolder.java org/omg/CORBA/SCCS/s.IDLType.java org/omg/CORBA/SCCS/s.ServiceInformationHelper.java org/omg/CORBA/SCCS/s.IDLTypeOperations.java org/omg/CORBA/SCCS/s.IMP_LIMIT.java org/omg/CORBA/SCCS/s.INITIALIZE.java org/omg/CORBA/SCCS/s.INTERNAL.java org/omg/CORBA/SCCS/s.INTF_REPOS.java org/omg/CORBA/SCCS/s.INVALID_ACTIVITY.java org/omg/CORBA/SCCS/s.INVALID_TRANSACTION.java org/omg/CORBA/SCCS/s.INV_FLAG.java org/omg/CORBA/SCCS/s.INV_IDENT.java org/omg/CORBA/SCCS/s.INV_OBJREF.java org/omg/CORBA/SCCS/s.INV_POLICY.java org/omg/CORBA/SCCS/s.IRObject.java org/omg/CORBA/SCCS/s.IRObjectOperations.java org/omg/CORBA/SCCS/s.IdentifierHelper.java org/omg/CORBA/SCCS/s.IntHolder.java org/omg/CORBA/SCCS/s.LocalObject.java org/omg/CORBA/SCCS/s.LongHolder.java org/omg/CORBA/SCCS/s.LongLongSeqHelper.java org/omg/CORBA/SCCS/s.LongLongSeqHolder.java org/omg/CORBA/SCCS/s.LongSeqHelper.java org/omg/CORBA/SCCS/s.LongSeqHolder.java org/omg/CORBA/SCCS/s.MARSHAL.java org/omg/CORBA/SCCS/s.NO_IMPLEMENT.java org/omg/CORBA/SCCS/s.NO_MEMORY.java org/omg/CORBA/SCCS/s.NO_PERMISSION.java org/omg/CORBA/SCCS/s.NO_RESOURCES.java org/omg/CORBA/SCCS/s.NO_RESPONSE.java org/omg/CORBA/SCCS/s.NVList.java org/omg/CORBA/SCCS/s.NameValuePair.java org/omg/CORBA/SCCS/s.NameValuePairHelper.java org/omg/CORBA/SCCS/s.NamedValue.java org/omg/CORBA/SCCS/s.OBJECT_NOT_EXIST.java org/omg/CORBA/SCCS/s.OBJ_ADAPTER.java org/omg/CORBA/SCCS/s.OMGVMCID.java org/omg/CORBA/SCCS/s.ORB.java org/omg/CORBA/SCCS/s.Object.java org/omg/CORBA/SCCS/s.ObjectHelper.java org/omg/CORBA/SCCS/s.ObjectHolder.java org/omg/CORBA/SCCS/s.OctetSeqHelper.java org/omg/CORBA/SCCS/s.OctetSeqHolder.java org/omg/CORBA/SCCS/s.PERSIST_STORE.java org/omg/CORBA/SCCS/s.PRIVATE_MEMBER.java org/omg/CORBA/SCCS/s.PUBLIC_MEMBER.java org/omg/CORBA/SCCS/s.Policy.java org/omg/CORBA/SCCS/s.PolicyError.java org/omg/CORBA/SCCS/s.PolicyHelper.java org/omg/CORBA/SCCS/s.PolicyHolder.java org/omg/CORBA/SCCS/s.PolicyListHelper.java org/omg/CORBA/SCCS/s.PolicyListHolder.java org/omg/CORBA/SCCS/s.PolicyOperations.java org/omg/CORBA/SCCS/s.REBIND.java org/omg/CORBA/SCCS/s.PolicyTypeHelper.java org/omg/CORBA/SCCS/s.Principal.java org/omg/CORBA/SCCS/s.PrincipalHolder.java org/omg/CORBA/SCCS/s.RepositoryIdHelper.java org/omg/CORBA/SCCS/s.Request.java org/omg/CORBA/SCCS/s.ServerRequest.java org/omg/CORBA/SCCS/s.ServiceDetail.java org/omg/CORBA/SCCS/s.ServiceDetailHelper.java org/omg/CORBA/SCCS/s.ServiceInformation.java org/omg/CORBA/SCCS/s.ServiceInformationHolder.java org/omg/CORBA/SCCS/s.SetOverrideType.java org/omg/CORBA/SCCS/s.SetOverrideTypeHelper.java org/omg/CORBA/SCCS/s.ShortHolder.java org/omg/CORBA/SCCS/s.ShortSeqHelper.java org/omg/CORBA/SCCS/s.ir.idl org/omg/CORBA/SCCS/s.ShortSeqHolder.java org/omg/CORBA/SCCS/s.StringHolder.java org/omg/CORBA/SCCS/s.StringValueHelper.java org/omg/CORBA/SCCS/s.StructMember.java org/omg/CORBA/SCCS/s.StructMemberHelper.java org/omg/CORBA/SCCS/s.SystemException.java org/omg/CORBA/SCCS/s.TCKind.java org/omg/CORBA/SCCS/s.TIMEOUT.java org/omg/CORBA/SCCS/s.TRANSACTION_MODE.java org/omg/CORBA/SCCS/s.TRANSACTION_REQUIRED.java org/omg/CORBA/SCCS/s.TRANSACTION_ROLLEDBACK.java org/omg/CORBA/SCCS/s.TRANSACTION_UNAVAILABLE.java org/omg/CORBA/SCCS/s.TRANSIENT.java org/omg/CORBA/SCCS/s.TypeCode.java org/omg/CORBA/SCCS/s.TypeCodeHolder.java org/omg/CORBA/SCCS/s.ULongLongSeqHelper.java org/omg/CORBA/SCCS/s.ULongLongSeqHolder.java org/omg/CORBA/SCCS/s.ULongSeqHelper.java org/omg/CORBA/SCCS/s.ULongSeqHolder.java org/omg/CORBA/SCCS/s.UNKNOWN.java org/omg/CORBA/SCCS/s.UNSUPPORTED_POLICY.java org/omg/CORBA/SCCS/s.UNSUPPORTED_POLICY_VALUE.java org/omg/CORBA/SCCS/s.UShortSeqHelper.java org/omg/CORBA/SCCS/s.UShortSeqHolder.java org/omg/CORBA/SCCS/s.UnionMember.java org/omg/CORBA/SCCS/s.UnionMemberHelper.java org/omg/CORBA/SCCS/s.UnknownUserException.java org/omg/CORBA/SCCS/s.UnknownUserExceptionHelper.java org/omg/CORBA/SCCS/s.UnknownUserExceptionHolder.java org/omg/CORBA/SCCS/s.UserException.java org/omg/CORBA/SCCS/s.VM_ABSTRACT.java org/omg/CORBA/SCCS/s.VM_CUSTOM.java org/omg/CORBA/SCCS/s.VM_NONE.java org/omg/CORBA/SCCS/s.VM_TRUNCATABLE.java org/omg/CORBA/SCCS/s.ValueBaseHelper.java org/omg/CORBA/SCCS/s.ValueBaseHolder.java org/omg/CORBA/SCCS/s.ValueMember.java org/omg/CORBA/SCCS/s.ValueMemberHelper.java org/omg/CORBA/SCCS/s.VersionSpecHelper.java org/omg/CORBA/SCCS/s.VisibilityHelper.java org/omg/CORBA/SCCS/s.WCharSeqHelper.java org/omg/CORBA/SCCS/s.WCharSeqHolder.java org/omg/CORBA/SCCS/s.WStringValueHelper.java org/omg/CORBA/SCCS/s.WrongTransaction.java org/omg/CORBA/SCCS/s.WrongTransactionHelper.java org/omg/CORBA/SCCS/s.WrongTransactionHolder.java org/omg/CORBA/SCCS/s.orb.idl org/omg/CORBA/SCCS/s._IDLTypeStub.java org/omg/CORBA/SCCS/s._PolicyStub.java org/omg/CORBA/SCCS/s.package.html org/omg/CORBA/TypeCodePackage org/omg/CORBA/TypeCodePackage/SCCS org/omg/CORBA/TypeCodePackage/SCCS/s.BadKind.java org/omg/CORBA/TypeCodePackage/SCCS/s.Bounds.java org/omg/CORBA/TypeCodePackage/SCCS/s.package.html org/omg/CORBA/TypeCodePackage/BadKind.java org/omg/CORBA/TypeCodePackage/Bounds.java org/omg/CORBA/TypeCodePackage/package.html org/omg/CORBA/doc-files org/omg/CORBA/doc-files/SCCS org/omg/CORBA/doc-files/SCCS/s.generatedfiles.html org/omg/CORBA/doc-files/SCCS/s.compliance.html org/omg/CORBA/doc-files/generatedfiles.html org/omg/CORBA/doc-files/compliance.html org/omg/CORBA/portable org/omg/CORBA/portable/SCCS org/omg/CORBA/portable/SCCS/s.ApplicationException.java org/omg/CORBA/portable/SCCS/s.BoxedValueHelper.java org/omg/CORBA/portable/SCCS/s.CustomValue.java org/omg/CORBA/portable/SCCS/s.Delegate.java org/omg/CORBA/portable/SCCS/s.IDLEntity.java org/omg/CORBA/portable/SCCS/s.IndirectionException.java org/omg/CORBA/portable/SCCS/s.InputStream.java org/omg/CORBA/portable/SCCS/s.InvokeHandler.java org/omg/CORBA/portable/SCCS/s.ObjectImpl.java org/omg/CORBA/portable/SCCS/s.OutputStream.java org/omg/CORBA/portable/SCCS/s.RemarshalException.java org/omg/CORBA/portable/SCCS/s.ResponseHandler.java org/omg/CORBA/portable/SCCS/s.ServantObject.java org/omg/CORBA/portable/SCCS/s.Streamable.java org/omg/CORBA/portable/SCCS/s.StreamableValue.java org/omg/CORBA/portable/SCCS/s.ValueBase.java org/omg/CORBA/portable/SCCS/s.UnknownException.java org/omg/CORBA/portable/SCCS/s.ValueFactory.java org/omg/CORBA/portable/SCCS/s.ValueInputStream.java org/omg/CORBA/portable/SCCS/s.ValueOutputStream.java org/omg/CORBA/portable/SCCS/s.package.html org/omg/CORBA/portable/ApplicationException.java org/omg/CORBA/portable/BoxedValueHelper.java org/omg/CORBA/portable/CustomValue.java org/omg/CORBA/portable/Delegate.java org/omg/CORBA/portable/IDLEntity.java org/omg/CORBA/portable/IndirectionException.java org/omg/CORBA/portable/InputStream.java org/omg/CORBA/portable/InvokeHandler.java org/omg/CORBA/portable/ObjectImpl.java org/omg/CORBA/portable/OutputStream.java org/omg/CORBA/portable/RemarshalException.java org/omg/CORBA/portable/ResponseHandler.java org/omg/CORBA/portable/ServantObject.java org/omg/CORBA/portable/Streamable.java org/omg/CORBA/portable/ValueBase.java org/omg/CORBA/portable/StreamableValue.java org/omg/CORBA/portable/UnknownException.java org/omg/CORBA/portable/ValueFactory.java org/omg/CORBA/portable/ValueInputStream.java org/omg/CORBA/portable/ValueOutputStream.java org/omg/CORBA/portable/package.html org/omg/CORBA/ACTIVITY_COMPLETED.java org/omg/CORBA/ACTIVITY_REQUIRED.java org/omg/CORBA/ARG_IN.java org/omg/CORBA/ARG_INOUT.java org/omg/CORBA/ARG_OUT.java org/omg/CORBA/Any.java org/omg/CORBA/AnyHolder.java org/omg/CORBA/AnySeqHelper.java org/omg/CORBA/AnySeqHolder.java org/omg/CORBA/BAD_CONTEXT.java org/omg/CORBA/BAD_INV_ORDER.java org/omg/CORBA/BAD_OPERATION.java org/omg/CORBA/DynArray.java org/omg/CORBA/DynAny.java org/omg/CORBA/BAD_PARAM.java org/omg/CORBA/BAD_POLICY.java org/omg/CORBA/BAD_POLICY_TYPE.java org/omg/CORBA/BAD_POLICY_VALUE.java org/omg/CORBA/BAD_QOS.java org/omg/CORBA/BAD_TYPECODE.java org/omg/CORBA/BooleanHolder.java org/omg/CORBA/BooleanSeqHelper.java org/omg/CORBA/BooleanSeqHolder.java org/omg/CORBA/Bounds.java org/omg/CORBA/ByteHolder.java org/omg/CORBA/CODESET_INCOMPATIBLE.java org/omg/CORBA/COMM_FAILURE.java org/omg/CORBA/CTX_RESTRICT_SCOPE.java org/omg/CORBA/CharHolder.java org/omg/CORBA/CharSeqHelper.java org/omg/CORBA/CharSeqHolder.java org/omg/CORBA/CompletionStatus.java org/omg/CORBA/CompletionStatusHelper.java org/omg/CORBA/Context.java org/omg/CORBA/ContextList.java org/omg/CORBA/Current.java org/omg/CORBA/CurrentHelper.java org/omg/CORBA/CurrentHolder.java org/omg/CORBA/CurrentOperations.java org/omg/CORBA/CustomMarshal.java org/omg/CORBA/DATA_CONVERSION.java org/omg/CORBA/DataInputStream.java org/omg/CORBA/DataOutputStream.java org/omg/CORBA/DefinitionKind.java org/omg/CORBA/DefinitionKindHelper.java org/omg/CORBA/DomainManager.java org/omg/CORBA/DomainManagerOperations.java org/omg/CORBA/DoubleHolder.java org/omg/CORBA/DynEnum.java org/omg/CORBA/DoubleSeqHelper.java org/omg/CORBA/DoubleSeqHolder.java org/omg/CORBA/DynSequence.java org/omg/CORBA/DynFixed.java org/omg/CORBA/DynStruct.java org/omg/CORBA/DynUnion.java org/omg/CORBA/DynValue.java org/omg/CORBA/Environment.java org/omg/CORBA/DynamicImplementation.java org/omg/CORBA/ExceptionList.java org/omg/CORBA/FREE_MEM.java org/omg/CORBA/FieldNameHelper.java org/omg/CORBA/FixedHolder.java org/omg/CORBA/FloatHolder.java org/omg/CORBA/FloatSeqHelper.java org/omg/CORBA/FloatSeqHolder.java org/omg/CORBA/IDLType.java org/omg/CORBA/INVALID_TRANSACTION.java org/omg/CORBA/IDLTypeHelper.java org/omg/CORBA/IDLTypeOperations.java org/omg/CORBA/IMP_LIMIT.java org/omg/CORBA/INITIALIZE.java org/omg/CORBA/INTERNAL.java org/omg/CORBA/INTF_REPOS.java org/omg/CORBA/INVALID_ACTIVITY.java org/omg/CORBA/IRObjectOperations.java org/omg/CORBA/INV_FLAG.java org/omg/CORBA/INV_IDENT.java org/omg/CORBA/INV_OBJREF.java org/omg/CORBA/INV_POLICY.java org/omg/CORBA/IRObject.java org/omg/CORBA/NameValuePairHelper.java org/omg/CORBA/IdentifierHelper.java org/omg/CORBA/IntHolder.java org/omg/CORBA/LocalObject.java org/omg/CORBA/LongHolder.java org/omg/CORBA/MARSHAL.java org/omg/CORBA/LongLongSeqHelper.java org/omg/CORBA/LongLongSeqHolder.java org/omg/CORBA/LongSeqHelper.java org/omg/CORBA/LongSeqHolder.java org/omg/CORBA/NO_IMPLEMENT.java org/omg/CORBA/NO_MEMORY.java org/omg/CORBA/NO_PERMISSION.java org/omg/CORBA/NO_RESOURCES.java org/omg/CORBA/NO_RESPONSE.java org/omg/CORBA/NVList.java org/omg/CORBA/NameValuePair.java org/omg/CORBA/OBJECT_NOT_EXIST.java org/omg/CORBA/NamedValue.java org/omg/CORBA/OBJ_ADAPTER.java org/omg/CORBA/OMGVMCID.java org/omg/CORBA/ORB.java org/omg/CORBA/Object.java org/omg/CORBA/Policy.java org/omg/CORBA/ServiceDetailHelper.java org/omg/CORBA/ObjectHelper.java org/omg/CORBA/ObjectHolder.java org/omg/CORBA/OctetSeqHelper.java org/omg/CORBA/OctetSeqHolder.java org/omg/CORBA/PERSIST_STORE.java org/omg/CORBA/PRIVATE_MEMBER.java org/omg/CORBA/PUBLIC_MEMBER.java org/omg/CORBA/PolicyError.java org/omg/CORBA/PolicyHelper.java org/omg/CORBA/PolicyHolder.java org/omg/CORBA/PolicyListHelper.java org/omg/CORBA/PolicyListHolder.java org/omg/CORBA/PolicyOperations.java org/omg/CORBA/PolicyTypeHelper.java org/omg/CORBA/Principal.java org/omg/CORBA/PrincipalHolder.java org/omg/CORBA/REBIND.java org/omg/CORBA/Request.java org/omg/CORBA/RepositoryIdHelper.java org/omg/CORBA/ServerRequest.java org/omg/CORBA/ServiceDetail.java org/omg/CORBA/ServiceInformationHelper.java org/omg/CORBA/ServiceInformation.java org/omg/CORBA/TRANSACTION_REQUIRED.java org/omg/CORBA/ServiceInformationHolder.java org/omg/CORBA/SetOverrideType.java org/omg/CORBA/SetOverrideTypeHelper.java org/omg/CORBA/ShortHolder.java org/omg/CORBA/ShortSeqHelper.java org/omg/CORBA/ShortSeqHolder.java org/omg/CORBA/StringHolder.java org/omg/CORBA/StringValueHelper.java org/omg/CORBA/StructMember.java org/omg/CORBA/StructMemberHelper.java org/omg/CORBA/SystemException.java org/omg/CORBA/TCKind.java org/omg/CORBA/TIMEOUT.java org/omg/CORBA/TRANSACTION_MODE.java org/omg/CORBA/TRANSACTION_UNAVAILABLE.java org/omg/CORBA/TRANSACTION_ROLLEDBACK.java org/omg/CORBA/ULongLongSeqHelper.java org/omg/CORBA/TRANSIENT.java org/omg/CORBA/TypeCode.java org/omg/CORBA/TypeCodeHolder.java org/omg/CORBA/ULongLongSeqHolder.java org/omg/CORBA/ULongSeqHelper.java org/omg/CORBA/ULongSeqHolder.java org/omg/CORBA/UNKNOWN.java org/omg/CORBA/UNSUPPORTED_POLICY.java org/omg/CORBA/UShortSeqHelper.java org/omg/CORBA/UnknownUserExceptionHelper.java org/omg/CORBA/UNSUPPORTED_POLICY_VALUE.java org/omg/CORBA/UShortSeqHolder.java org/omg/CORBA/UnionMember.java org/omg/CORBA/UnionMemberHelper.java org/omg/CORBA/UnknownUserException.java org/omg/CORBA/ir.idl org/omg/CORBA/UnknownUserExceptionHolder.java org/omg/CORBA/UserException.java org/omg/CORBA/VM_ABSTRACT.java org/omg/CORBA/VM_CUSTOM.java org/omg/CORBA/VM_NONE.java org/omg/CORBA/VM_TRUNCATABLE.java org/omg/CORBA/ValueBaseHelper.java org/omg/CORBA/ValueBaseHolder.java org/omg/CORBA/ValueMember.java org/omg/CORBA/ValueMemberHelper.java org/omg/CORBA/VersionSpecHelper.java org/omg/CORBA/VisibilityHelper.java org/omg/CORBA/WCharSeqHelper.java org/omg/CORBA/WCharSeqHolder.java org/omg/CORBA/WStringValueHelper.java org/omg/CORBA/WrongTransaction.java org/omg/CORBA/WrongTransactionHelper.java org/omg/CORBA/WrongTransactionHolder.java org/omg/CORBA/_IDLTypeStub.java org/omg/CORBA/_PolicyStub.java org/omg/CORBA/orb.idl org/omg/CORBA/package.html org/omg/CORBA_2_3 org/omg/CORBA_2_3/SCCS org/omg/CORBA_2_3/SCCS/s.package.html org/omg/CORBA_2_3/SCCS/s.ORB.java org/omg/CORBA_2_3/portable org/omg/CORBA_2_3/portable/SCCS org/omg/CORBA_2_3/portable/SCCS/s.InputStream.java org/omg/CORBA_2_3/portable/SCCS/s.Delegate.java org/omg/CORBA_2_3/portable/SCCS/s.ObjectImpl.java org/omg/CORBA_2_3/portable/SCCS/s.OutputStream.java org/omg/CORBA_2_3/portable/SCCS/s.package.html org/omg/CORBA_2_3/portable/InputStream.java org/omg/CORBA_2_3/portable/Delegate.java org/omg/CORBA_2_3/portable/ObjectImpl.java org/omg/CORBA_2_3/portable/OutputStream.java org/omg/CORBA_2_3/portable/package.html org/omg/CORBA_2_3/package.html org/omg/CORBA_2_3/ORB.java org/omg/CosNaming org/omg/CosNaming/NamingContextExtPackage org/omg/CosNaming/NamingContextExtPackage/SCCS org/omg/CosNaming/NamingContextExtPackage/SCCS/s.package.html org/omg/CosNaming/NamingContextExtPackage/package.html org/omg/CosNaming/NamingContextPackage org/omg/CosNaming/NamingContextPackage/SCCS org/omg/CosNaming/NamingContextPackage/SCCS/s.package.html org/omg/CosNaming/NamingContextPackage/package.html org/omg/CosNaming/SCCS org/omg/CosNaming/SCCS/s._BindingIteratorImplBase.java org/omg/CosNaming/SCCS/s._NamingContextImplBase.java org/omg/CosNaming/SCCS/s.nameservice.idl org/omg/CosNaming/SCCS/s.package.html org/omg/CosNaming/_BindingIteratorImplBase.java org/omg/CosNaming/_NamingContextImplBase.java org/omg/CosNaming/nameservice.idl org/omg/CosNaming/package.html org/omg/Dynamic org/omg/Dynamic/SCCS org/omg/Dynamic/SCCS/s.package.html org/omg/Dynamic/package.html org/omg/DynamicAny org/omg/DynamicAny/DynAnyFactoryPackage org/omg/DynamicAny/DynAnyFactoryPackage/SCCS org/omg/DynamicAny/DynAnyFactoryPackage/SCCS/s.package.html org/omg/DynamicAny/DynAnyFactoryPackage/package.html org/omg/DynamicAny/DynAnyPackage org/omg/DynamicAny/DynAnyPackage/SCCS org/omg/DynamicAny/DynAnyPackage/SCCS/s.package.html org/omg/DynamicAny/DynAnyPackage/package.html org/omg/DynamicAny/SCCS org/omg/DynamicAny/SCCS/s.DynamicAny.idl org/omg/DynamicAny/SCCS/s.package.html org/omg/DynamicAny/DynamicAny.idl org/omg/DynamicAny/package.html org/omg/IOP org/omg/IOP/CodecFactoryPackage org/omg/IOP/CodecFactoryPackage/SCCS org/omg/IOP/CodecFactoryPackage/SCCS/s.package.html org/omg/IOP/CodecFactoryPackage/package.html org/omg/IOP/CodecPackage org/omg/IOP/CodecPackage/SCCS org/omg/IOP/CodecPackage/SCCS/s.package.html org/omg/IOP/CodecPackage/package.html org/omg/IOP/SCCS org/omg/IOP/SCCS/s.package.html org/omg/IOP/package.html org/omg/Messaging org/omg/Messaging/SCCS org/omg/Messaging/SCCS/s.package.html org/omg/Messaging/package.html org/omg/PortableInterceptor org/omg/PortableInterceptor/ORBInitInfoPackage org/omg/PortableInterceptor/ORBInitInfoPackage/SCCS org/omg/PortableInterceptor/ORBInitInfoPackage/SCCS/s.package.html org/omg/PortableInterceptor/ORBInitInfoPackage/package.html org/omg/PortableInterceptor/SCCS org/omg/PortableInterceptor/SCCS/s.Interceptors.idl org/omg/PortableInterceptor/SCCS/s.CORBAX.idl org/omg/PortableInterceptor/SCCS/s.IOP.idl org/omg/PortableInterceptor/SCCS/s.Messaging.idl org/omg/PortableInterceptor/SCCS/s.package.html org/omg/PortableInterceptor/Interceptors.idl org/omg/PortableInterceptor/CORBAX.idl org/omg/PortableInterceptor/IOP.idl org/omg/PortableInterceptor/Messaging.idl org/omg/PortableInterceptor/package.html org/omg/PortableServer org/omg/PortableServer/CurrentPackage org/omg/PortableServer/CurrentPackage/SCCS org/omg/PortableServer/CurrentPackage/SCCS/s.package.html org/omg/PortableServer/CurrentPackage/package.html org/omg/PortableServer/POAManagerPackage org/omg/PortableServer/POAManagerPackage/SCCS org/omg/PortableServer/POAManagerPackage/SCCS/s.package.html org/omg/PortableServer/POAManagerPackage/package.html org/omg/PortableServer/POAPackage org/omg/PortableServer/POAPackage/SCCS org/omg/PortableServer/POAPackage/SCCS/s.package.html org/omg/PortableServer/POAPackage/package.html org/omg/PortableServer/SCCS org/omg/PortableServer/SCCS/s.DynamicImplementation.java org/omg/PortableServer/SCCS/s.CurrentHelper.java org/omg/PortableServer/SCCS/s.POAHelper.java org/omg/PortableServer/SCCS/s.Servant.java org/omg/PortableServer/SCCS/s.corba.idl org/omg/PortableServer/SCCS/s.package.html org/omg/PortableServer/SCCS/s.poa.idl org/omg/PortableServer/ServantLocatorPackage org/omg/PortableServer/ServantLocatorPackage/SCCS org/omg/PortableServer/ServantLocatorPackage/SCCS/s.CookieHolder.java org/omg/PortableServer/ServantLocatorPackage/SCCS/s.package.html org/omg/PortableServer/ServantLocatorPackage/CookieHolder.java org/omg/PortableServer/ServantLocatorPackage/package.html org/omg/PortableServer/portable org/omg/PortableServer/portable/SCCS org/omg/PortableServer/portable/SCCS/s.Delegate.java org/omg/PortableServer/portable/SCCS/s.package.html org/omg/PortableServer/portable/Delegate.java org/omg/PortableServer/portable/package.html org/omg/PortableServer/DynamicImplementation.java org/omg/PortableServer/CurrentHelper.java org/omg/PortableServer/POAHelper.java org/omg/PortableServer/Servant.java org/omg/PortableServer/corba.idl org/omg/PortableServer/package.html org/omg/PortableServer/poa.idl org/omg/SendingContext org/omg/SendingContext/SCCS org/omg/SendingContext/SCCS/s.RunTime.java org/omg/SendingContext/SCCS/s.package.html org/omg/SendingContext/SCCS/s.RunTimeOperations.java org/omg/SendingContext/RunTimeOperations.java org/omg/SendingContext/RunTime.java org/omg/SendingContext/package.html org/omg/stub org/omg/stub/java org/omg/stub/java/rmi org/omg/stub/java/rmi/SCCS org/omg/stub/java/rmi/SCCS/s._Remote_Stub.java org/omg/stub/java/rmi/SCCS/s.package.html org/omg/stub/java/rmi/_Remote_Stub.java org/omg/stub/java/rmi/package.html org/w3c org/w3c/dom org/w3c/dom/SCCS org/w3c/dom/SCCS/s.CDATASection.java org/w3c/dom/SCCS/s.Attr.java org/w3c/dom/SCCS/s.DOMImplementation.java org/w3c/dom/SCCS/s.CharacterData.java org/w3c/dom/SCCS/s.Comment.java org/w3c/dom/SCCS/s.DOMConfiguration.java org/w3c/dom/SCCS/s.DOMError.java org/w3c/dom/SCCS/s.DOMErrorHandler.java org/w3c/dom/SCCS/s.DOMException.java org/w3c/dom/SCCS/s.Node.java org/w3c/dom/SCCS/s.DOMImplementationList.java org/w3c/dom/SCCS/s.DOMImplementationSource.java org/w3c/dom/SCCS/s.DOMLocator.java org/w3c/dom/SCCS/s.DOMStringList.java org/w3c/dom/SCCS/s.Document.java org/w3c/dom/SCCS/s.TypeInfo.java org/w3c/dom/SCCS/s.Text.java org/w3c/dom/SCCS/s.DocumentFragment.java org/w3c/dom/SCCS/s.DocumentType.java org/w3c/dom/SCCS/s.Element.java org/w3c/dom/SCCS/s.Entity.java org/w3c/dom/SCCS/s.EntityReference.java org/w3c/dom/SCCS/s.NameList.java org/w3c/dom/SCCS/s.NamedNodeMap.java org/w3c/dom/SCCS/s.NodeList.java org/w3c/dom/SCCS/s.Notation.java org/w3c/dom/SCCS/s.ProcessingInstruction.java org/w3c/dom/SCCS/s.UserDataHandler.java org/w3c/dom/SCCS/s.package.html org/w3c/dom/bootstrap org/w3c/dom/bootstrap/SCCS org/w3c/dom/bootstrap/SCCS/s.DOMImplementationRegistry.java org/w3c/dom/bootstrap/DOMImplementationRegistry.java org/w3c/dom/css org/w3c/dom/css/SCCS org/w3c/dom/css/SCCS/s.CSSPrimitiveValue.java org/w3c/dom/css/SCCS/s.CSS2Properties.java org/w3c/dom/css/SCCS/s.CSSCharsetRule.java org/w3c/dom/css/SCCS/s.CSSFontFaceRule.java org/w3c/dom/css/SCCS/s.CSSImportRule.java org/w3c/dom/css/SCCS/s.CSSMediaRule.java org/w3c/dom/css/SCCS/s.CSSPageRule.java org/w3c/dom/css/SCCS/s.CSSStyleDeclaration.java org/w3c/dom/css/SCCS/s.CSSRule.java org/w3c/dom/css/SCCS/s.CSSRuleList.java org/w3c/dom/css/SCCS/s.CSSStyleSheet.java org/w3c/dom/css/SCCS/s.CSSStyleRule.java org/w3c/dom/css/SCCS/s.DOMImplementationCSS.java org/w3c/dom/css/SCCS/s.CSSUnknownRule.java org/w3c/dom/css/SCCS/s.CSSValue.java org/w3c/dom/css/SCCS/s.CSSValueList.java org/w3c/dom/css/SCCS/s.Counter.java org/w3c/dom/css/SCCS/s.DocumentCSS.java org/w3c/dom/css/SCCS/s.RGBColor.java org/w3c/dom/css/SCCS/s.Rect.java org/w3c/dom/css/SCCS/s.ElementCSSInlineStyle.java org/w3c/dom/css/SCCS/s.ViewCSS.java org/w3c/dom/css/CSSFontFaceRule.java org/w3c/dom/css/CSS2Properties.java org/w3c/dom/css/CSSCharsetRule.java org/w3c/dom/css/CSSStyleDeclaration.java org/w3c/dom/css/CSSImportRule.java org/w3c/dom/css/CSSMediaRule.java org/w3c/dom/css/CSSPageRule.java org/w3c/dom/css/CSSPrimitiveValue.java org/w3c/dom/css/CSSRule.java org/w3c/dom/css/CSSRuleList.java org/w3c/dom/css/CSSStyleRule.java org/w3c/dom/css/CSSStyleSheet.java org/w3c/dom/css/CSSUnknownRule.java org/w3c/dom/css/CSSValue.java org/w3c/dom/css/CSSValueList.java org/w3c/dom/css/Counter.java org/w3c/dom/css/Rect.java org/w3c/dom/css/DOMImplementationCSS.java org/w3c/dom/css/DocumentCSS.java org/w3c/dom/css/ElementCSSInlineStyle.java org/w3c/dom/css/RGBColor.java org/w3c/dom/css/ViewCSS.java org/w3c/dom/events org/w3c/dom/events/SCCS org/w3c/dom/events/SCCS/s.DocumentEvent.java org/w3c/dom/events/SCCS/s.Event.java org/w3c/dom/events/SCCS/s.EventException.java org/w3c/dom/events/SCCS/s.EventListener.java org/w3c/dom/events/SCCS/s.EventTarget.java org/w3c/dom/events/SCCS/s.MouseEvent.java org/w3c/dom/events/SCCS/s.MutationEvent.java org/w3c/dom/events/SCCS/s.UIEvent.java org/w3c/dom/events/DocumentEvent.java org/w3c/dom/events/Event.java org/w3c/dom/events/EventException.java org/w3c/dom/events/EventListener.java org/w3c/dom/events/EventTarget.java org/w3c/dom/events/MouseEvent.java org/w3c/dom/events/MutationEvent.java org/w3c/dom/events/UIEvent.java org/w3c/dom/html org/w3c/dom/html/SCCS org/w3c/dom/html/SCCS/s.HTMLDOMImplementation.java org/w3c/dom/html/SCCS/s.HTMLAnchorElement.java org/w3c/dom/html/SCCS/s.HTMLAppletElement.java org/w3c/dom/html/SCCS/s.HTMLAreaElement.java org/w3c/dom/html/SCCS/s.HTMLBRElement.java org/w3c/dom/html/SCCS/s.HTMLBaseElement.java org/w3c/dom/html/SCCS/s.HTMLBaseFontElement.java org/w3c/dom/html/SCCS/s.HTMLBodyElement.java org/w3c/dom/html/SCCS/s.HTMLButtonElement.java org/w3c/dom/html/SCCS/s.HTMLCollection.java org/w3c/dom/html/SCCS/s.HTMLDListElement.java org/w3c/dom/html/SCCS/s.HTMLDirectoryElement.java org/w3c/dom/html/SCCS/s.HTMLDivElement.java org/w3c/dom/html/SCCS/s.HTMLTableCaptionElement.java org/w3c/dom/html/SCCS/s.HTMLDocument.java org/w3c/dom/html/SCCS/s.HTMLElement.java org/w3c/dom/html/SCCS/s.HTMLFieldSetElement.java org/w3c/dom/html/SCCS/s.HTMLFontElement.java org/w3c/dom/html/SCCS/s.HTMLFormElement.java org/w3c/dom/html/SCCS/s.HTMLFrameElement.java org/w3c/dom/html/SCCS/s.HTMLFrameSetElement.java org/w3c/dom/html/SCCS/s.HTMLHRElement.java org/w3c/dom/html/SCCS/s.HTMLHeadElement.java org/w3c/dom/html/SCCS/s.HTMLHeadingElement.java org/w3c/dom/html/SCCS/s.HTMLHtmlElement.java org/w3c/dom/html/SCCS/s.HTMLIFrameElement.java org/w3c/dom/html/SCCS/s.HTMLImageElement.java org/w3c/dom/html/SCCS/s.HTMLInputElement.java org/w3c/dom/html/SCCS/s.HTMLIsIndexElement.java org/w3c/dom/html/SCCS/s.HTMLLIElement.java org/w3c/dom/html/SCCS/s.HTMLLabelElement.java org/w3c/dom/html/SCCS/s.HTMLLegendElement.java org/w3c/dom/html/SCCS/s.HTMLLinkElement.java org/w3c/dom/html/SCCS/s.HTMLMapElement.java org/w3c/dom/html/SCCS/s.HTMLMenuElement.java org/w3c/dom/html/SCCS/s.HTMLMetaElement.java org/w3c/dom/html/SCCS/s.HTMLModElement.java org/w3c/dom/html/SCCS/s.HTMLOListElement.java org/w3c/dom/html/SCCS/s.HTMLObjectElement.java org/w3c/dom/html/SCCS/s.HTMLOptGroupElement.java org/w3c/dom/html/SCCS/s.HTMLOptionElement.java org/w3c/dom/html/SCCS/s.HTMLParagraphElement.java org/w3c/dom/html/SCCS/s.HTMLParamElement.java org/w3c/dom/html/SCCS/s.HTMLPreElement.java org/w3c/dom/html/SCCS/s.HTMLQuoteElement.java org/w3c/dom/html/SCCS/s.HTMLScriptElement.java org/w3c/dom/html/SCCS/s.HTMLSelectElement.java org/w3c/dom/html/SCCS/s.HTMLStyleElement.java org/w3c/dom/html/SCCS/s.HTMLTableSectionElement.java org/w3c/dom/html/SCCS/s.HTMLTableCellElement.java org/w3c/dom/html/SCCS/s.HTMLTableColElement.java org/w3c/dom/html/SCCS/s.HTMLTableElement.java org/w3c/dom/html/SCCS/s.HTMLTableRowElement.java org/w3c/dom/html/SCCS/s.HTMLTextAreaElement.java org/w3c/dom/html/SCCS/s.HTMLTitleElement.java org/w3c/dom/html/SCCS/s.HTMLUListElement.java org/w3c/dom/html/HTMLBaseFontElement.java org/w3c/dom/html/HTMLAnchorElement.java org/w3c/dom/html/HTMLAppletElement.java org/w3c/dom/html/HTMLAreaElement.java org/w3c/dom/html/HTMLBRElement.java org/w3c/dom/html/HTMLBaseElement.java org/w3c/dom/html/HTMLBodyElement.java org/w3c/dom/html/HTMLButtonElement.java org/w3c/dom/html/HTMLCollection.java org/w3c/dom/html/HTMLDListElement.java org/w3c/dom/html/HTMLDOMImplementation.java org/w3c/dom/html/HTMLDirectoryElement.java org/w3c/dom/html/HTMLDivElement.java org/w3c/dom/html/HTMLDocument.java org/w3c/dom/html/HTMLElement.java org/w3c/dom/html/HTMLFieldSetElement.java org/w3c/dom/html/HTMLFontElement.java org/w3c/dom/html/HTMLFormElement.java org/w3c/dom/html/HTMLFrameElement.java org/w3c/dom/html/HTMLFrameSetElement.java org/w3c/dom/html/HTMLHRElement.java org/w3c/dom/html/HTMLHeadElement.java org/w3c/dom/html/HTMLHeadingElement.java org/w3c/dom/html/HTMLHtmlElement.java org/w3c/dom/html/HTMLIFrameElement.java org/w3c/dom/html/HTMLImageElement.java org/w3c/dom/html/HTMLInputElement.java org/w3c/dom/html/HTMLIsIndexElement.java org/w3c/dom/html/HTMLLIElement.java org/w3c/dom/html/HTMLLabelElement.java org/w3c/dom/html/HTMLLegendElement.java org/w3c/dom/html/HTMLLinkElement.java org/w3c/dom/html/HTMLMapElement.java org/w3c/dom/html/HTMLMenuElement.java org/w3c/dom/html/HTMLMetaElement.java org/w3c/dom/html/HTMLModElement.java org/w3c/dom/html/HTMLOListElement.java org/w3c/dom/html/HTMLObjectElement.java org/w3c/dom/html/HTMLOptGroupElement.java org/w3c/dom/html/HTMLOptionElement.java org/w3c/dom/html/HTMLParagraphElement.java org/w3c/dom/html/HTMLParamElement.java org/w3c/dom/html/HTMLPreElement.java org/w3c/dom/html/HTMLQuoteElement.java org/w3c/dom/html/HTMLScriptElement.java org/w3c/dom/html/HTMLSelectElement.java org/w3c/dom/html/HTMLStyleElement.java org/w3c/dom/html/HTMLTableCaptionElement.java org/w3c/dom/html/HTMLTableCellElement.java org/w3c/dom/html/HTMLTableColElement.java org/w3c/dom/html/HTMLTableElement.java org/w3c/dom/html/HTMLTableRowElement.java org/w3c/dom/html/HTMLTableSectionElement.java org/w3c/dom/html/HTMLTextAreaElement.java org/w3c/dom/html/HTMLTitleElement.java org/w3c/dom/html/HTMLUListElement.java org/w3c/dom/ls org/w3c/dom/ls/SCCS org/w3c/dom/ls/SCCS/s.DOMImplementationLS.java org/w3c/dom/ls/SCCS/s.LSException.java org/w3c/dom/ls/SCCS/s.LSInput.java org/w3c/dom/ls/SCCS/s.LSLoadEvent.java org/w3c/dom/ls/SCCS/s.LSOutput.java org/w3c/dom/ls/SCCS/s.LSParser.java org/w3c/dom/ls/SCCS/s.LSParserFilter.java org/w3c/dom/ls/SCCS/s.LSProgressEvent.java org/w3c/dom/ls/SCCS/s.LSResourceResolver.java org/w3c/dom/ls/SCCS/s.LSSerializer.java org/w3c/dom/ls/SCCS/s.LSSerializerFilter.java org/w3c/dom/ls/DOMImplementationLS.java org/w3c/dom/ls/LSException.java org/w3c/dom/ls/LSInput.java org/w3c/dom/ls/LSLoadEvent.java org/w3c/dom/ls/LSOutput.java org/w3c/dom/ls/LSParser.java org/w3c/dom/ls/LSParserFilter.java org/w3c/dom/ls/LSProgressEvent.java org/w3c/dom/ls/LSResourceResolver.java org/w3c/dom/ls/LSSerializer.java org/w3c/dom/ls/LSSerializerFilter.java org/w3c/dom/ranges org/w3c/dom/ranges/SCCS org/w3c/dom/ranges/SCCS/s.DocumentRange.java org/w3c/dom/ranges/SCCS/s.Range.java org/w3c/dom/ranges/SCCS/s.RangeException.java org/w3c/dom/ranges/SCCS/s.package.html org/w3c/dom/ranges/DocumentRange.java org/w3c/dom/ranges/Range.java org/w3c/dom/ranges/RangeException.java org/w3c/dom/ranges/package.html org/w3c/dom/stylesheets org/w3c/dom/stylesheets/SCCS org/w3c/dom/stylesheets/SCCS/s.DocumentStyle.java org/w3c/dom/stylesheets/SCCS/s.LinkStyle.java org/w3c/dom/stylesheets/SCCS/s.MediaList.java org/w3c/dom/stylesheets/SCCS/s.StyleSheet.java org/w3c/dom/stylesheets/SCCS/s.StyleSheetList.java org/w3c/dom/stylesheets/DocumentStyle.java org/w3c/dom/stylesheets/LinkStyle.java org/w3c/dom/stylesheets/MediaList.java org/w3c/dom/stylesheets/StyleSheet.java org/w3c/dom/stylesheets/StyleSheetList.java org/w3c/dom/traversal org/w3c/dom/traversal/SCCS org/w3c/dom/traversal/SCCS/s.DocumentTraversal.java org/w3c/dom/traversal/SCCS/s.NodeFilter.java org/w3c/dom/traversal/SCCS/s.NodeIterator.java org/w3c/dom/traversal/SCCS/s.TreeWalker.java org/w3c/dom/traversal/DocumentTraversal.java org/w3c/dom/traversal/NodeFilter.java org/w3c/dom/traversal/NodeIterator.java org/w3c/dom/traversal/TreeWalker.java org/w3c/dom/views org/w3c/dom/views/SCCS org/w3c/dom/views/SCCS/s.AbstractView.java org/w3c/dom/views/SCCS/s.DocumentView.java org/w3c/dom/views/AbstractView.java org/w3c/dom/views/DocumentView.java org/w3c/dom/CDATASection.java org/w3c/dom/Attr.java org/w3c/dom/DOMConfiguration.java org/w3c/dom/CharacterData.java org/w3c/dom/Comment.java org/w3c/dom/DOMErrorHandler.java org/w3c/dom/DOMError.java org/w3c/dom/DOMException.java org/w3c/dom/DOMImplementation.java org/w3c/dom/DOMLocator.java org/w3c/dom/Entity.java org/w3c/dom/NamedNodeMap.java org/w3c/dom/DOMImplementationList.java org/w3c/dom/DOMImplementationSource.java org/w3c/dom/DOMStringList.java org/w3c/dom/Document.java org/w3c/dom/DocumentFragment.java org/w3c/dom/DocumentType.java org/w3c/dom/Element.java org/w3c/dom/NameList.java org/w3c/dom/EntityReference.java org/w3c/dom/Node.java org/w3c/dom/NodeList.java org/w3c/dom/Notation.java org/w3c/dom/ProcessingInstruction.java org/w3c/dom/Text.java org/w3c/dom/TypeInfo.java org/w3c/dom/UserDataHandler.java org/w3c/dom/package.html org/xml org/xml/sax org/xml/sax/SCCS org/xml/sax/SCCS/s.AttributeList.java org/xml/sax/SCCS/s.Attributes.java org/xml/sax/SCCS/s.COPYING org/xml/sax/SCCS/s.COPYING.txt org/xml/sax/SCCS/s.ContentHandler.java org/xml/sax/SCCS/s.DTDHandler.java org/xml/sax/SCCS/s.DocumentHandler.java org/xml/sax/SCCS/s.EntityResolver.java org/xml/sax/SCCS/s.ErrorHandler.java org/xml/sax/SCCS/s.HandlerBase.java org/xml/sax/SCCS/s.InputSource.java org/xml/sax/SCCS/s.Locator.java org/xml/sax/SCCS/s.Parser.java org/xml/sax/SCCS/s.SAXException.java org/xml/sax/SCCS/s.SAXNotRecognizedException.java org/xml/sax/SCCS/s.SAXNotSupportedException.java org/xml/sax/SCCS/s.SAXParseException.java org/xml/sax/SCCS/s.XMLFilter.java org/xml/sax/SCCS/s.XMLReader.java org/xml/sax/SCCS/s.package.html org/xml/sax/ext org/xml/sax/ext/SCCS org/xml/sax/ext/SCCS/s.Attributes2Impl.java org/xml/sax/ext/SCCS/s.Attributes2.java org/xml/sax/ext/SCCS/s.DeclHandler.java org/xml/sax/ext/SCCS/s.DefaultHandler2.java org/xml/sax/ext/SCCS/s.EntityResolver2.java org/xml/sax/ext/SCCS/s.LexicalHandler.java org/xml/sax/ext/SCCS/s.Locator2.java org/xml/sax/ext/SCCS/s.Locator2Impl.java org/xml/sax/ext/SCCS/s.package.html org/xml/sax/ext/Attributes2Impl.java org/xml/sax/ext/Attributes2.java org/xml/sax/ext/DeclHandler.java org/xml/sax/ext/DefaultHandler2.java org/xml/sax/ext/EntityResolver2.java org/xml/sax/ext/LexicalHandler.java org/xml/sax/ext/Locator2.java org/xml/sax/ext/Locator2Impl.java org/xml/sax/ext/package.html org/xml/sax/helpers org/xml/sax/helpers/SCCS org/xml/sax/helpers/SCCS/s.AttributeListImpl.java org/xml/sax/helpers/SCCS/s.AttributesImpl.java org/xml/sax/helpers/SCCS/s.DefaultHandler.java org/xml/sax/helpers/SCCS/s.LocatorImpl.java org/xml/sax/helpers/SCCS/s.NamespaceSupport.java org/xml/sax/helpers/SCCS/s.NewInstance.java org/xml/sax/helpers/SCCS/s.ParserAdapter.java org/xml/sax/helpers/SCCS/s.ParserFactory.java org/xml/sax/helpers/SCCS/s.XMLFilterImpl.java org/xml/sax/helpers/SCCS/s.XMLReaderAdapter.java org/xml/sax/helpers/SCCS/s.XMLReaderFactory.java org/xml/sax/helpers/SCCS/s.package.html org/xml/sax/helpers/AttributeListImpl.java org/xml/sax/helpers/AttributesImpl.java org/xml/sax/helpers/DefaultHandler.java org/xml/sax/helpers/LocatorImpl.java org/xml/sax/helpers/NamespaceSupport.java org/xml/sax/helpers/NewInstance.java org/xml/sax/helpers/ParserAdapter.java org/xml/sax/helpers/ParserFactory.java org/xml/sax/helpers/XMLFilterImpl.java org/xml/sax/helpers/XMLReaderAdapter.java org/xml/sax/helpers/XMLReaderFactory.java org/xml/sax/helpers/package.html org/xml/sax/DocumentHandler.java org/xml/sax/AttributeList.java org/xml/sax/Attributes.java org/xml/sax/COPYING org/xml/sax/COPYING.txt org/xml/sax/ContentHandler.java org/xml/sax/DTDHandler.java org/xml/sax/SAXNotRecognizedException.java org/xml/sax/EntityResolver.java org/xml/sax/ErrorHandler.java org/xml/sax/HandlerBase.java org/xml/sax/InputSource.java org/xml/sax/Locator.java org/xml/sax/Parser.java org/xml/sax/SAXException.java org/xml/sax/SAXNotSupportedException.java org/xml/sax/SAXParseException.java org/xml/sax/XMLFilter.java org/xml/sax/XMLReader.java org/xml/sax/package.html sun sun/applet sun/applet/SCCS sun/applet/SCCS/s.AppletClassLoader.java sun/applet/SCCS/s.AppletAudioClip.java sun/applet/SCCS/s.AppletIOException.java sun/applet/SCCS/s.AppletEvent.java sun/applet/SCCS/s.AppletIllegalArgumentException.java sun/applet/SCCS/s.AppletEventMulticaster.java sun/applet/SCCS/s.AppletObjectInputStream.java sun/applet/SCCS/s.AppletImageRef.java sun/applet/SCCS/s.AppletListener.java sun/applet/SCCS/s.AppletMessageHandler.java sun/applet/SCCS/s.AppletPanel.java sun/applet/SCCS/s.AppletProps.java sun/applet/SCCS/s.AppletSecurityException.java sun/applet/SCCS/s.AppletSecurity.java sun/applet/SCCS/s.AppletResourceLoader.java sun/applet/SCCS/s.AppletThreadGroup.java sun/applet/SCCS/s.AppletViewer.java sun/applet/SCCS/s.AppletViewerFactory.java sun/applet/SCCS/s.AppletViewerPanel.java sun/applet/SCCS/s.Main.java sun/applet/resources sun/applet/resources/SCCS sun/applet/resources/SCCS/s.MsgAppletViewer_de.java sun/applet/resources/SCCS/s.MsgAppletViewer.java sun/applet/resources/SCCS/s.MsgAppletViewer_es.java sun/applet/resources/SCCS/s.MsgAppletViewer_fr.java sun/applet/resources/SCCS/s.MsgAppletViewer_it.java sun/applet/resources/SCCS/s.MsgAppletViewer_ja.java sun/applet/resources/SCCS/s.MsgAppletViewer_ko.java sun/applet/resources/SCCS/s.MsgAppletViewer_sv.java sun/applet/resources/SCCS/s.MsgAppletViewer_zh_CN.java sun/applet/resources/SCCS/s.MsgAppletViewer_zh_TW.java sun/applet/resources/MsgAppletViewer_zh_CN.java sun/applet/resources/MsgAppletViewer.java sun/applet/resources/MsgAppletViewer_de.java sun/applet/resources/MsgAppletViewer_es.java sun/applet/resources/MsgAppletViewer_fr.java sun/applet/resources/MsgAppletViewer_it.java sun/applet/resources/MsgAppletViewer_ja.java sun/applet/resources/MsgAppletViewer_ko.java sun/applet/resources/MsgAppletViewer_sv.java sun/applet/resources/MsgAppletViewer_zh_TW.java sun/applet/AppletEventMulticaster.java sun/applet/AppletAudioClip.java sun/applet/AppletClassLoader.java sun/applet/AppletEvent.java sun/applet/AppletIOException.java sun/applet/AppletImageRef.java sun/applet/AppletPanel.java sun/applet/AppletIllegalArgumentException.java sun/applet/AppletListener.java sun/applet/AppletMessageHandler.java sun/applet/AppletObjectInputStream.java sun/applet/AppletProps.java sun/applet/Main.java sun/applet/AppletResourceLoader.java sun/applet/AppletSecurity.java sun/applet/AppletSecurityException.java sun/applet/AppletThreadGroup.java sun/applet/AppletViewer.java sun/applet/AppletViewerFactory.java sun/applet/AppletViewerPanel.java sun/audio sun/audio/SCCS sun/audio/SCCS/s.AudioDataStream.java sun/audio/SCCS/s.AudioData.java sun/audio/SCCS/s.AudioSecurityAction.java sun/audio/SCCS/s.AudioDevice.java sun/audio/SCCS/s.AudioPlayer.java sun/audio/SCCS/s.AudioSecurityExceptionAction.java sun/audio/SCCS/s.AudioStream.java sun/audio/SCCS/s.AudioStreamSequence.java sun/audio/SCCS/s.AudioTranslatorStream.java sun/audio/SCCS/s.ContinuousAudioDataStream.java sun/audio/SCCS/s.InvalidAudioFormatException.java sun/audio/SCCS/s.NativeAudioStream.java sun/audio/AudioDataStream.java sun/audio/AudioData.java sun/audio/AudioSecurityAction.java sun/audio/AudioDevice.java sun/audio/AudioPlayer.java sun/audio/AudioSecurityExceptionAction.java sun/audio/AudioStream.java sun/audio/AudioStreamSequence.java sun/audio/AudioTranslatorStream.java sun/audio/ContinuousAudioDataStream.java sun/audio/InvalidAudioFormatException.java sun/audio/NativeAudioStream.java sun/awt sun/awt/SCCS sun/awt/SCCS/s.AWTSecurityManager.java sun/awt/SCCS/s.AWTAutoShutdown.java sun/awt/SCCS/s.ConstrainableGraphics.java sun/awt/SCCS/s.AppContext.java sun/awt/SCCS/s.CharToByteSymbol.java sun/awt/SCCS/s.CharsetString.java sun/awt/SCCS/s.ComponentFactory.java sun/awt/SCCS/s.DebugHelper.java.m4 sun/awt/SCCS/s.CustomCursor.java sun/awt/SCCS/s.DisplayChangedListener.java sun/awt/SCCS/s.DebugHelperImpl.java sun/awt/SCCS/s.DebugSettings.java sun/awt/SCCS/s.DefaultMouseInfoPeer.java sun/awt/SCCS/s.EmbeddedFrame.java sun/awt/SCCS/s.Mutex.java sun/awt/SCCS/s.EventListenerAggregate.java sun/awt/SCCS/s.FocusingTextField.java sun/awt/SCCS/s.FontConfiguration.java sun/awt/SCCS/s.FontDescriptor.java sun/awt/SCCS/s.GlobalCursorManager.java sun/awt/SCCS/s.Graphics2Delegate.java sun/awt/SCCS/s.HeadlessToolkit.java sun/awt/SCCS/s.HorizBagLayout.java sun/awt/SCCS/s.InputMethodSupport.java sun/awt/SCCS/s.KeyboardFocusManagerPeerImpl.java sun/awt/SCCS/s.ModalExclude.java sun/awt/SCCS/s.NativeLibLoader.java sun/awt/SCCS/s.NullComponentPeer.java sun/awt/SCCS/s.OrientableFlowLayout.java sun/awt/SCCS/s.PeerEvent.java sun/awt/SCCS/s.PlatformFont.java sun/awt/SCCS/s.RepaintArea.java sun/awt/SCCS/s.ScrollPaneWheelScroller.java sun/awt/SCCS/s.SunDisplayChanger.java sun/awt/SCCS/s.SunGraphicsCallback.java sun/awt/SCCS/s.SunHints.java sun/awt/SCCS/s.SunToolkit.java sun/awt/SCCS/s.TracedEventQueue.java sun/awt/SCCS/s.VariableGridLayout.java sun/awt/SCCS/s.VerticalBagLayout.java sun/awt/SCCS/s.WindowClosingListener.java sun/awt/SCCS/s.WindowClosingSupport.java sun/awt/color sun/awt/color/SCCS sun/awt/color/SCCS/s.CMM.java sun/awt/color/SCCS/s.CMMImageLayout.java sun/awt/color/SCCS/s.ICC_Transform.java sun/awt/color/SCCS/s.ProfileActivator.java sun/awt/color/SCCS/s.ProfileDeferralInfo.java sun/awt/color/SCCS/s.ProfileDeferralMgr.java sun/awt/color/CMMImageLayout.java sun/awt/color/CMM.java sun/awt/color/ProfileActivator.java sun/awt/color/ICC_Transform.java sun/awt/color/ProfileDeferralInfo.java sun/awt/color/ProfileDeferralMgr.java sun/awt/datatransfer sun/awt/datatransfer/SCCS sun/awt/datatransfer/SCCS/s.ToolkitThreadBlockedHandler.java sun/awt/datatransfer/SCCS/s.ClipboardTransferable.java sun/awt/datatransfer/SCCS/s.DataTransferer.java sun/awt/datatransfer/SCCS/s.SunClipboard.java sun/awt/datatransfer/SCCS/s.TransferableProxy.java sun/awt/datatransfer/ToolkitThreadBlockedHandler.java sun/awt/datatransfer/ClipboardTransferable.java sun/awt/datatransfer/DataTransferer.java sun/awt/datatransfer/SunClipboard.java sun/awt/datatransfer/TransferableProxy.java sun/awt/dnd sun/awt/dnd/SCCS sun/awt/dnd/SCCS/s.SunDragSourceContextPeer.java sun/awt/dnd/SCCS/s.SunDropTargetContextPeer.java sun/awt/dnd/SCCS/s.SunDropTargetEvent.java sun/awt/dnd/SunDragSourceContextPeer.java sun/awt/dnd/SunDropTargetContextPeer.java sun/awt/dnd/SunDropTargetEvent.java sun/awt/geom sun/awt/geom/SCCS sun/awt/geom/SCCS/s.Crossings.java sun/awt/geom/SCCS/s.AreaOp.java sun/awt/geom/SCCS/s.ChainEnd.java sun/awt/geom/SCCS/s.Curve.java sun/awt/geom/SCCS/s.CurveLink.java sun/awt/geom/SCCS/s.Edge.java sun/awt/geom/SCCS/s.Order0.java sun/awt/geom/SCCS/s.Order1.java sun/awt/geom/SCCS/s.Order2.java sun/awt/geom/SCCS/s.Order3.java sun/awt/geom/ChainEnd.java sun/awt/geom/AreaOp.java sun/awt/geom/Crossings.java sun/awt/geom/Curve.java sun/awt/geom/CurveLink.java sun/awt/geom/Edge.java sun/awt/geom/Order0.java sun/awt/geom/Order1.java sun/awt/geom/Order2.java sun/awt/geom/Order3.java sun/awt/im sun/awt/im/SCCS sun/awt/im/SCCS/s.CompositionAreaHandler.java sun/awt/im/SCCS/s.CompositionArea.java sun/awt/im/SCCS/s.InputMethodAdapter.java sun/awt/im/SCCS/s.InputContext.java sun/awt/im/SCCS/s.SimpleInputMethodWindow.java sun/awt/im/SCCS/s.InputMethodContext.java sun/awt/im/SCCS/s.InputMethodJFrame.java sun/awt/im/SCCS/s.InputMethodLocator.java sun/awt/im/SCCS/s.InputMethodManager.java sun/awt/im/SCCS/s.InputMethodPopupMenu.java sun/awt/im/SCCS/s.InputMethodWindow.java sun/awt/im/CompositionAreaHandler.java sun/awt/im/CompositionArea.java sun/awt/im/InputMethodPopupMenu.java sun/awt/im/InputContext.java sun/awt/im/InputMethodAdapter.java sun/awt/im/InputMethodContext.java sun/awt/im/InputMethodJFrame.java sun/awt/im/InputMethodLocator.java sun/awt/im/InputMethodManager.java sun/awt/im/SimpleInputMethodWindow.java sun/awt/im/InputMethodWindow.java sun/awt/image sun/awt/image/SCCS sun/awt/image/SCCS/s.BufImgVolatileSurfaceManager.java sun/awt/image/SCCS/s.BadDepthException.java sun/awt/image/SCCS/s.BufImgSurfaceData.java sun/awt/image/SCCS/s.BufferedImageGraphicsConfig.java sun/awt/image/SCCS/s.BufferedImageDevice.java sun/awt/image/SCCS/s.ByteInterleavedRaster.java sun/awt/image/SCCS/s.ByteArrayImageSource.java sun/awt/image/SCCS/s.ByteBandedRaster.java sun/awt/image/SCCS/s.ByteComponentRaster.java sun/awt/image/SCCS/s.CachingSurfaceManager.java sun/awt/image/SCCS/s.BytePackedRaster.java sun/awt/image/SCCS/s.InputStreamImageSource.java sun/awt/image/SCCS/s.DataBufferNative.java sun/awt/image/SCCS/s.FileImageSource.java sun/awt/image/SCCS/s.GifImageDecoder.java sun/awt/image/SCCS/s.ImageAccessException.java sun/awt/image/SCCS/s.ImageConsumerQueue.java sun/awt/image/SCCS/s.ImageDecoder.java sun/awt/image/SCCS/s.ImageFetchable.java sun/awt/image/SCCS/s.ImageFetcher.java sun/awt/image/SCCS/s.ImageFormatException.java sun/awt/image/SCCS/s.ImageRepresentation.java sun/awt/image/SCCS/s.ImageWatched.java sun/awt/image/SCCS/s.ImagingLib.java sun/awt/image/SCCS/s.IntegerComponentRaster.java sun/awt/image/SCCS/s.IntegerInterleavedRaster.java sun/awt/image/SCCS/s.JPEGImageDecoder.java sun/awt/image/SCCS/s.Manageable.java sun/awt/image/SCCS/s.NativeLibLoader.java sun/awt/image/SCCS/s.OffScreenImage.java sun/awt/image/SCCS/s.OffScreenImageSource.java sun/awt/image/SCCS/s.PNGImageDecoder.java sun/awt/image/SCCS/s.PixelConverter.java sun/awt/image/SCCS/s.RasterListener.java sun/awt/image/SCCS/s.RemoteOffScreenImage.java sun/awt/image/SCCS/s.ShortBandedRaster.java sun/awt/image/SCCS/s.ShortComponentRaster.java sun/awt/image/SCCS/s.ShortInterleavedRaster.java sun/awt/image/SCCS/s.SunVolatileImage.java sun/awt/image/SCCS/s.SunWritableRaster.java sun/awt/image/SCCS/s.SurfaceManager.java sun/awt/image/SCCS/s.ToolkitImage.java sun/awt/image/SCCS/s.URLImageSource.java sun/awt/image/SCCS/s.VolatileSurfaceManager.java sun/awt/image/SCCS/s.WritableRasterNative.java sun/awt/image/SCCS/s.XbmImageDecoder.java sun/awt/image/SCCS/s.OffScreenSurfaceManager.java sun/awt/image/codec sun/awt/image/codec/SCCS sun/awt/image/codec/SCCS/s.JPEGImageDecoderImpl.java sun/awt/image/codec/SCCS/s.JPEGImageEncoderImpl.java sun/awt/image/codec/SCCS/s.JPEGParam.java sun/awt/image/codec/JPEGImageDecoderImpl.java sun/awt/image/codec/JPEGImageEncoderImpl.java sun/awt/image/codec/JPEGParam.java sun/awt/image/BufferedImageDevice.java sun/awt/image/BadDepthException.java sun/awt/image/BufImgSurfaceData.java sun/awt/image/BufImgVolatileSurfaceManager.java sun/awt/image/BufferedImageGraphicsConfig.java sun/awt/image/ByteArrayImageSource.java sun/awt/image/ByteBandedRaster.java sun/awt/image/ByteComponentRaster.java sun/awt/image/ByteInterleavedRaster.java sun/awt/image/BytePackedRaster.java sun/awt/image/CachingSurfaceManager.java sun/awt/image/DataBufferNative.java sun/awt/image/ImageDecoder.java sun/awt/image/FileImageSource.java sun/awt/image/GifImageDecoder.java sun/awt/image/ImageAccessException.java sun/awt/image/ImageConsumerQueue.java sun/awt/image/ImageFetchable.java sun/awt/image/ImageFetcher.java sun/awt/image/ImageFormatException.java sun/awt/image/ImageRepresentation.java sun/awt/image/ImageWatched.java sun/awt/image/ImagingLib.java sun/awt/image/InputStreamImageSource.java sun/awt/image/IntegerComponentRaster.java sun/awt/image/IntegerInterleavedRaster.java sun/awt/image/Manageable.java sun/awt/image/JPEGImageDecoder.java sun/awt/image/NativeLibLoader.java sun/awt/image/OffScreenImage.java sun/awt/image/OffScreenImageSource.java sun/awt/image/PNGImageDecoder.java sun/awt/image/PixelConverter.java sun/awt/image/RasterListener.java sun/awt/image/RemoteOffScreenImage.java sun/awt/image/ShortBandedRaster.java sun/awt/image/ShortComponentRaster.java sun/awt/image/ShortInterleavedRaster.java sun/awt/image/SunVolatileImage.java sun/awt/image/SunWritableRaster.java sun/awt/image/SurfaceManager.java sun/awt/image/ToolkitImage.java sun/awt/image/URLImageSource.java sun/awt/image/VolatileSurfaceManager.java sun/awt/image/WritableRasterNative.java sun/awt/image/XbmImageDecoder.java sun/awt/image/OffScreenSurfaceManager.java sun/awt/resources sun/awt/resources/SCCS sun/awt/resources/SCCS/s.awt_zh_CN.properties sun/awt/resources/SCCS/s.awt.properties sun/awt/resources/SCCS/s.awt_de.properties sun/awt/resources/SCCS/s.awt_es.properties sun/awt/resources/SCCS/s.awt_fr.properties sun/awt/resources/SCCS/s.awt_it.properties sun/awt/resources/SCCS/s.awt_ja.properties sun/awt/resources/SCCS/s.awt_ko.properties sun/awt/resources/SCCS/s.awt_sv.properties sun/awt/resources/SCCS/s.awt_zh_TW.properties sun/awt/resources/awt_de.properties sun/awt/resources/awt.properties sun/awt/resources/awt_es.properties sun/awt/resources/awt_fr.properties sun/awt/resources/awt_it.properties sun/awt/resources/awt_ja.properties sun/awt/resources/awt_ko.properties sun/awt/resources/awt_sv.properties sun/awt/resources/awt_zh_CN.properties sun/awt/resources/awt_zh_TW.properties sun/awt/robot sun/awt/robot/SCCS sun/awt/robot/SCCS/s.RobotPeer.java sun/awt/robot/SCCS/s.Robot.java sun/awt/robot/SCCS/s.ScreenCaptureProducer.java sun/awt/robot/SCCS/s.ScreenCapture.java sun/awt/robot/RobotPeer.java sun/awt/robot/Robot.java sun/awt/robot/ScreenCaptureProducer.java sun/awt/robot/ScreenCapture.java sun/awt/shell sun/awt/shell/SCCS sun/awt/shell/SCCS/s.DefaultShellFolder.java sun/awt/shell/SCCS/s.ShellFolder.java sun/awt/shell/SCCS/s.ShellFolderManager.java sun/awt/shell/DefaultShellFolder.java sun/awt/shell/ShellFolder.java sun/awt/shell/ShellFolderManager.java sun/awt/ConstrainableGraphics.java sun/awt/AWTAutoShutdown.java sun/awt/AWTSecurityManager.java sun/awt/AppContext.java sun/awt/CharToByteSymbol.java sun/awt/CharsetString.java sun/awt/ComponentFactory.java sun/awt/CustomCursor.java sun/awt/DebugHelper.java.m4 sun/awt/Mutex.java sun/awt/PlatformFont.java sun/awt/DebugHelperImpl.java sun/awt/DebugSettings.java sun/awt/DefaultMouseInfoPeer.java sun/awt/DisplayChangedListener.java sun/awt/EmbeddedFrame.java sun/awt/EventListenerAggregate.java sun/awt/FocusingTextField.java sun/awt/FontConfiguration.java sun/awt/FontDescriptor.java sun/awt/GlobalCursorManager.java sun/awt/Graphics2Delegate.java sun/awt/HeadlessToolkit.java sun/awt/HorizBagLayout.java sun/awt/InputMethodSupport.java sun/awt/KeyboardFocusManagerPeerImpl.java sun/awt/ModalExclude.java sun/awt/OrientableFlowLayout.java sun/awt/NativeLibLoader.java sun/awt/NullComponentPeer.java sun/awt/PeerEvent.java sun/awt/RepaintArea.java sun/awt/SunDisplayChanger.java sun/awt/TracedEventQueue.java sun/awt/SunHints.java sun/awt/ScrollPaneWheelScroller.java sun/awt/SunGraphicsCallback.java sun/awt/SunToolkit.java sun/awt/VariableGridLayout.java sun/awt/VerticalBagLayout.java sun/awt/WindowClosingListener.java sun/awt/WindowClosingSupport.java sun/beans sun/beans/editors sun/beans/editors/SCCS sun/beans/editors/SCCS/s.BoolEditor.java sun/beans/editors/SCCS/s.ByteEditor.java sun/beans/editors/SCCS/s.ColorEditor.java sun/beans/editors/SCCS/s.DoubleEditor.java sun/beans/editors/SCCS/s.FloatEditor.java sun/beans/editors/SCCS/s.FontEditor.java sun/beans/editors/SCCS/s.IntEditor.java sun/beans/editors/SCCS/s.LongEditor.java sun/beans/editors/SCCS/s.NumberEditor.java sun/beans/editors/SCCS/s.ShortEditor.java sun/beans/editors/SCCS/s.StringEditor.java sun/beans/editors/ColorEditor.java sun/beans/editors/BoolEditor.java sun/beans/editors/ByteEditor.java sun/beans/editors/DoubleEditor.java sun/beans/editors/FloatEditor.java sun/beans/editors/FontEditor.java sun/beans/editors/IntEditor.java sun/beans/editors/LongEditor.java sun/beans/editors/NumberEditor.java sun/beans/editors/ShortEditor.java sun/beans/editors/StringEditor.java sun/beans/infos sun/beans/infos/SCCS sun/beans/infos/SCCS/s.ComponentBeanInfo.java sun/beans/infos/ComponentBeanInfo.java sun/corba sun/corba/SCCS sun/corba/SCCS/s.BridgePermission.java sun/corba/SCCS/s.Bridge.java sun/corba/SCCS/s.package.html sun/corba/package.html sun/corba/Bridge.java sun/corba/BridgePermission.java sun/dc sun/dc/path sun/dc/path/SCCS sun/dc/path/SCCS/s.FastPathProducer.java sun/dc/path/SCCS/s.PathConsumer.java sun/dc/path/SCCS/s.PathError.java sun/dc/path/SCCS/s.PathException.java sun/dc/path/FastPathProducer.java sun/dc/path/PathConsumer.java sun/dc/path/PathError.java sun/dc/path/PathException.java sun/dc/pr sun/dc/pr/SCCS sun/dc/pr/SCCS/s.PRException.java sun/dc/pr/SCCS/s.PRError.java sun/dc/pr/SCCS/s.PathDasher.java sun/dc/pr/SCCS/s.PathFiller.java sun/dc/pr/SCCS/s.PathStroker.java sun/dc/pr/SCCS/s.Rasterizer.java sun/dc/pr/PRException.java sun/dc/pr/PRError.java sun/dc/pr/PathDasher.java sun/dc/pr/PathFiller.java sun/dc/pr/PathStroker.java sun/dc/pr/Rasterizer.java sun/font sun/font/SCCS sun/font/SCCS/s.CharToGlyphMapper.java sun/font/SCCS/s.AdvanceCache.java sun/font/SCCS/s.BidiUtils.java sun/font/SCCS/s.CMap.java sun/font/SCCS/s.CompositeFontDescriptor.java sun/font/SCCS/s.CompositeFont.java sun/font/SCCS/s.ExtendedTextSourceLabel.java sun/font/SCCS/s.CompositeGlyphMapper.java sun/font/SCCS/s.CompositeStrike.java sun/font/SCCS/s.CoreMetrics.java sun/font/SCCS/s.Decoration.java sun/font/SCCS/s.DelegatingShape.java sun/font/SCCS/s.ExtendedTextLabel.java sun/font/SCCS/s.FileFont.java sun/font/SCCS/s.FileFontStrike.java sun/font/SCCS/s.Font2D.java sun/font/SCCS/s.Font2DHandle.java sun/font/SCCS/s.FontDesignMetrics.java sun/font/SCCS/s.FontFamily.java sun/font/SCCS/s.FontLineMetrics.java sun/font/SCCS/s.FontManager.java sun/font/SCCS/s.FontResolver.java sun/font/SCCS/s.FontRunIterator.java sun/font/SCCS/s.FontStrike.java sun/font/SCCS/s.FontStrikeDesc.java sun/font/SCCS/s.FontStrikeDisposer.java sun/font/SCCS/s.GlyphLayout.java sun/font/SCCS/s.GlyphList.java sun/font/SCCS/s.GraphicComponent.java sun/font/SCCS/s.PhysicalFont.java sun/font/SCCS/s.PhysicalStrike.java sun/font/SCCS/s.Script.java sun/font/SCCS/s.ScriptRun.java sun/font/SCCS/s.ScriptRunData.java sun/font/SCCS/s.StandardGlyphVector.java sun/font/SCCS/s.StandardTextSource.java sun/font/SCCS/s.StrikeCache.java sun/font/SCCS/s.StrikeMetrics.java sun/font/SCCS/s.SunLayoutEngine.java sun/font/SCCS/s.TextLabel.java sun/font/SCCS/s.TextLabelFactory.java sun/font/SCCS/s.TextLineComponent.java sun/font/SCCS/s.TextRecord.java sun/font/SCCS/s.TextSource.java sun/font/SCCS/s.TextSourceLabel.java sun/font/SCCS/s.TrueTypeFont.java sun/font/SCCS/s.TrueTypeGlyphMapper.java sun/font/SCCS/s.Type1Font.java sun/font/SCCS/s.Type1GlyphMapper.java sun/font/SCCS/s.Underline.java sun/font/CharToGlyphMapper.java sun/font/AdvanceCache.java sun/font/BidiUtils.java sun/font/CMap.java sun/font/CompositeGlyphMapper.java sun/font/CompositeFont.java sun/font/Font2DHandle.java sun/font/Font2D.java sun/font/CompositeFontDescriptor.java sun/font/CompositeStrike.java sun/font/CoreMetrics.java sun/font/Decoration.java sun/font/DelegatingShape.java sun/font/ExtendedTextLabel.java sun/font/ExtendedTextSourceLabel.java sun/font/FileFont.java sun/font/FileFontStrike.java sun/font/StandardGlyphVector.java sun/font/FontDesignMetrics.java sun/font/FontFamily.java sun/font/FontLineMetrics.java sun/font/FontManager.java sun/font/FontResolver.java sun/font/FontRunIterator.java sun/font/FontStrike.java sun/font/FontStrikeDesc.java sun/font/FontStrikeDisposer.java sun/font/GlyphLayout.java sun/font/GlyphList.java sun/font/GraphicComponent.java sun/font/PhysicalFont.java sun/font/PhysicalStrike.java sun/font/Script.java sun/font/ScriptRun.java sun/font/ScriptRunData.java sun/font/TrueTypeGlyphMapper.java sun/font/StandardTextSource.java sun/font/StrikeCache.java sun/font/StrikeMetrics.java sun/font/SunLayoutEngine.java sun/font/TextLabel.java sun/font/TextLabelFactory.java sun/font/TextLineComponent.java sun/font/TextRecord.java sun/font/TextSource.java sun/font/TextSourceLabel.java sun/font/TrueTypeFont.java sun/font/Type1GlyphMapper.java sun/font/Type1Font.java sun/font/Underline.java sun/instrument sun/instrument/SCCS sun/instrument/SCCS/s.InstrumentationImpl.java sun/instrument/SCCS/s.TransformerManager.java sun/instrument/InstrumentationImpl.java sun/instrument/TransformerManager.java sun/io sun/io/SCCS sun/io/SCCS/s.ByteToCharBig5_HKSCS.java sun/io/SCCS/s.ByteToCharASCII.java sun/io/SCCS/s.ByteToCharBig5.java sun/io/SCCS/s.ByteToCharBig5_Solaris.java sun/io/SCCS/s.ByteToCharConverter.java sun/io/SCCS/s.ByteToCharCp037.java sun/io/SCCS/s.ByteToCharCp1006.java sun/io/SCCS/s.ByteToCharCp1025.java sun/io/SCCS/s.ByteToCharCp1026.java sun/io/SCCS/s.ByteToCharCp1046.java sun/io/SCCS/s.ByteToCharCp1047.java sun/io/SCCS/s.ByteToCharCp1097.java sun/io/SCCS/s.ByteToCharCp1098.java sun/io/SCCS/s.ByteToCharCp1112.java sun/io/SCCS/s.ByteToCharCp1122.java sun/io/SCCS/s.ByteToCharCp1123.java sun/io/SCCS/s.ByteToCharCp1124.java sun/io/SCCS/s.ByteToCharCp1140.java sun/io/SCCS/s.ByteToCharCp1141.java sun/io/SCCS/s.ByteToCharCp1142.java sun/io/SCCS/s.ByteToCharCp1143.java sun/io/SCCS/s.ByteToCharCp1144.java sun/io/SCCS/s.ByteToCharCp1145.java sun/io/SCCS/s.ByteToCharCp1146.java sun/io/SCCS/s.ByteToCharCp1147.java sun/io/SCCS/s.ByteToCharCp1148.java sun/io/SCCS/s.ByteToCharCp1149.java sun/io/SCCS/s.ByteToCharCp1250.java sun/io/SCCS/s.ByteToCharCp1251.java sun/io/SCCS/s.ByteToCharCp1252.java sun/io/SCCS/s.ByteToCharCp1253.java sun/io/SCCS/s.ByteToCharCp1254.java sun/io/SCCS/s.ByteToCharCp1255.java sun/io/SCCS/s.ByteToCharCp1256.java sun/io/SCCS/s.ByteToCharCp1257.java sun/io/SCCS/s.ByteToCharCp1258.java sun/io/SCCS/s.ByteToCharCp1381.java sun/io/SCCS/s.ByteToCharCp1383.java sun/io/SCCS/s.ByteToCharCp273.java sun/io/SCCS/s.ByteToCharCp277.java sun/io/SCCS/s.ByteToCharCp278.java sun/io/SCCS/s.ByteToCharCp280.java sun/io/SCCS/s.ByteToCharCp284.java sun/io/SCCS/s.ByteToCharCp285.java sun/io/SCCS/s.ByteToCharCp297.java sun/io/SCCS/s.ByteToCharCp420.java sun/io/SCCS/s.ByteToCharCp33722.java sun/io/SCCS/s.ByteToCharCp424.java sun/io/SCCS/s.ByteToCharCp437.java sun/io/SCCS/s.ByteToCharCp500.java sun/io/SCCS/s.ByteToCharCp737.java sun/io/SCCS/s.ByteToCharCp775.java sun/io/SCCS/s.ByteToCharCp838.java sun/io/SCCS/s.ByteToCharCp850.java sun/io/SCCS/s.ByteToCharCp852.java sun/io/SCCS/s.ByteToCharCp855.java sun/io/SCCS/s.ByteToCharCp856.java sun/io/SCCS/s.ByteToCharCp857.java sun/io/SCCS/s.ByteToCharCp858.java sun/io/SCCS/s.ByteToCharCp860.java sun/io/SCCS/s.Converters.java sun/io/SCCS/s.ByteToCharCp861.java sun/io/SCCS/s.ByteToCharCp862.java sun/io/SCCS/s.ByteToCharCp863.java sun/io/SCCS/s.ByteToCharCp864.java sun/io/SCCS/s.ByteToCharCp865.java sun/io/SCCS/s.ByteToCharCp866.java sun/io/SCCS/s.ByteToCharCp868.java sun/io/SCCS/s.ByteToCharCp869.java sun/io/SCCS/s.ByteToCharCp870.java sun/io/SCCS/s.ByteToCharCp871.java sun/io/SCCS/s.ByteToCharCp874.java sun/io/SCCS/s.ByteToCharCp875.java sun/io/SCCS/s.ByteToCharCp918.java sun/io/SCCS/s.ByteToCharCp921.java sun/io/SCCS/s.ByteToCharCp922.java sun/io/SCCS/s.ByteToCharCp930.java sun/io/SCCS/s.ByteToCharCp933.java sun/io/SCCS/s.ByteToCharCp935.java sun/io/SCCS/s.ByteToCharCp937.java sun/io/SCCS/s.ByteToCharCp939.java sun/io/SCCS/s.ByteToCharCp942.java sun/io/SCCS/s.ByteToCharCp942C.java sun/io/SCCS/s.ByteToCharCp943.java sun/io/SCCS/s.ByteToCharCp943C.java sun/io/SCCS/s.ByteToCharCp948.java sun/io/SCCS/s.ByteToCharCp949.java sun/io/SCCS/s.ByteToCharCp949C.java sun/io/SCCS/s.ByteToCharCp950.java sun/io/SCCS/s.ByteToCharCp964.java sun/io/SCCS/s.ByteToCharCp970.java sun/io/SCCS/s.ByteToCharDBCS_ASCII.java sun/io/SCCS/s.ByteToCharDBCS_EBCDIC.java sun/io/SCCS/s.ByteToCharDoubleByte.java sun/io/SCCS/s.ByteToCharEUC.java sun/io/SCCS/s.ByteToCharEUC_CN.java sun/io/SCCS/s.ByteToCharEUC_JP.java sun/io/SCCS/s.ByteToCharEUC_JP_LINUX.java sun/io/SCCS/s.ByteToCharEUC_JP_Solaris.java sun/io/SCCS/s.ByteToCharEUC_KR.java sun/io/SCCS/s.ByteToCharEUC_TW.java sun/io/SCCS/s.ByteToCharGB18030.java sun/io/SCCS/s.ByteToCharGB18030DB.java sun/io/SCCS/s.ByteToCharGBK.java sun/io/SCCS/s.ByteToCharHKSCS.java sun/io/SCCS/s.ByteToCharHKSCS_2001.java sun/io/SCCS/s.ByteToCharISCII91.java sun/io/SCCS/s.ByteToCharISO2022.java sun/io/SCCS/s.ByteToCharISO2022CN.java sun/io/SCCS/s.ByteToCharISO2022JP.java sun/io/SCCS/s.ByteToCharISO2022KR.java sun/io/SCCS/s.ByteToCharISO8859_1.java sun/io/SCCS/s.ByteToCharISO8859_13.java sun/io/SCCS/s.ByteToCharISO8859_15.java sun/io/SCCS/s.ByteToCharISO8859_2.java sun/io/SCCS/s.ByteToCharISO8859_3.java sun/io/SCCS/s.ByteToCharISO8859_4.java sun/io/SCCS/s.ByteToCharISO8859_5.java sun/io/SCCS/s.ByteToCharISO8859_6.java sun/io/SCCS/s.ByteToCharISO8859_7.java sun/io/SCCS/s.ByteToCharISO8859_8.java sun/io/SCCS/s.ByteToCharISO8859_9.java sun/io/SCCS/s.ByteToCharJIS0201.java sun/io/SCCS/s.ByteToCharJIS0208.java sun/io/SCCS/s.ByteToCharJIS0208_Solaris.java sun/io/SCCS/s.ByteToCharJIS0212.java sun/io/SCCS/s.ByteToCharJIS0212_Solaris.java sun/io/SCCS/s.ByteToCharJISAutoDetect.java sun/io/SCCS/s.ByteToCharJohab.java sun/io/SCCS/s.ByteToCharKOI8_R.java sun/io/SCCS/s.ByteToCharMS874.java sun/io/SCCS/s.ByteToCharMS932.java sun/io/SCCS/s.ByteToCharMS932DB.java sun/io/SCCS/s.ByteToCharMS936.java sun/io/SCCS/s.ByteToCharMS949.java sun/io/SCCS/s.ByteToCharMS950.java sun/io/SCCS/s.ByteToCharMS950_HKSCS.java sun/io/SCCS/s.ByteToCharMacArabic.java sun/io/SCCS/s.ByteToCharMacCentralEurope.java sun/io/SCCS/s.ByteToCharMacCroatian.java sun/io/SCCS/s.ByteToCharMacCyrillic.java sun/io/SCCS/s.ByteToCharMacDingbat.java sun/io/SCCS/s.ByteToCharMacGreek.java sun/io/SCCS/s.ByteToCharMacHebrew.java sun/io/SCCS/s.ByteToCharMacIceland.java sun/io/SCCS/s.ByteToCharMacRoman.java sun/io/SCCS/s.ByteToCharMacRomania.java sun/io/SCCS/s.ByteToCharPCK.java sun/io/SCCS/s.ByteToCharSJIS.java sun/io/SCCS/s.ByteToCharMacSymbol.java sun/io/SCCS/s.ByteToCharMacThai.java sun/io/SCCS/s.ByteToCharMacTurkish.java sun/io/SCCS/s.ByteToCharMacUkraine.java sun/io/SCCS/s.ByteToCharSingleByte.java sun/io/SCCS/s.ByteToCharTIS620.java sun/io/SCCS/s.ByteToCharUTF16.java sun/io/SCCS/s.ByteToCharUTF8.java sun/io/SCCS/s.ByteToCharUnicode.java sun/io/SCCS/s.ByteToCharUnicodeBig.java sun/io/SCCS/s.ByteToCharUnicodeBigUnmarked.java sun/io/SCCS/s.ByteToCharUnicodeLittle.java sun/io/SCCS/s.ByteToCharUnicodeLittleUnmarked.java sun/io/SCCS/s.CharToByteASCII.java sun/io/SCCS/s.CharToByteBig5.java sun/io/SCCS/s.CharToByteBig5_HKSCS.java sun/io/SCCS/s.CharToByteBig5_Solaris.java sun/io/SCCS/s.CharToByteConverter.java sun/io/SCCS/s.CharToByteCp037.java sun/io/SCCS/s.CharToByteCp1006.java sun/io/SCCS/s.CharToByteCp1025.java sun/io/SCCS/s.CharToByteCp1026.java sun/io/SCCS/s.CharToByteCp1046.java sun/io/SCCS/s.CharToByteCp1047.java sun/io/SCCS/s.CharToByteCp1097.java sun/io/SCCS/s.CharToByteCp1098.java sun/io/SCCS/s.CharToByteCp1112.java sun/io/SCCS/s.CharToByteCp1122.java sun/io/SCCS/s.CharToByteCp1123.java sun/io/SCCS/s.CharToByteCp1124.java sun/io/SCCS/s.CharToByteCp1140.java sun/io/SCCS/s.CharToByteCp1141.java sun/io/SCCS/s.CharToByteCp1142.java sun/io/SCCS/s.CharToByteCp1143.java sun/io/SCCS/s.CharToByteCp1144.java sun/io/SCCS/s.CharToByteCp1145.java sun/io/SCCS/s.CharToByteCp1146.java sun/io/SCCS/s.CharToByteCp1147.java sun/io/SCCS/s.CharToByteCp1148.java sun/io/SCCS/s.CharToByteCp1149.java sun/io/SCCS/s.CharToByteCp1250.java sun/io/SCCS/s.CharToByteCp1251.java sun/io/SCCS/s.CharToByteCp1252.java sun/io/SCCS/s.CharToByteCp1253.java sun/io/SCCS/s.CharToByteCp1254.java sun/io/SCCS/s.CharToByteCp1255.java sun/io/SCCS/s.CharToByteCp1256.java sun/io/SCCS/s.CharToByteCp1257.java sun/io/SCCS/s.CharToByteCp1258.java sun/io/SCCS/s.CharToByteCp1381.java sun/io/SCCS/s.CharToByteCp1383.java sun/io/SCCS/s.CharToByteCp273.java sun/io/SCCS/s.CharToByteCp277.java sun/io/SCCS/s.CharToByteCp278.java sun/io/SCCS/s.CharToByteCp280.java sun/io/SCCS/s.CharToByteCp284.java sun/io/SCCS/s.CharToByteCp285.java sun/io/SCCS/s.CharToByteCp297.java sun/io/SCCS/s.CharToByteCp33722.java sun/io/SCCS/s.CharToByteCp420.java sun/io/SCCS/s.CharToByteCp424.java sun/io/SCCS/s.CharToByteCp437.java sun/io/SCCS/s.CharToByteCp500.java sun/io/SCCS/s.CharToByteCp737.java sun/io/SCCS/s.CharToByteCp775.java sun/io/SCCS/s.CharToByteCp838.java sun/io/SCCS/s.CharToByteCp850.java sun/io/SCCS/s.CharToByteCp852.java sun/io/SCCS/s.CharToByteCp855.java sun/io/SCCS/s.CharToByteCp856.java sun/io/SCCS/s.CharToByteCp857.java sun/io/SCCS/s.CharToByteCp858.java sun/io/SCCS/s.CharToByteCp860.java sun/io/SCCS/s.CharToByteCp861.java sun/io/SCCS/s.CharToByteCp862.java sun/io/SCCS/s.CharToByteCp863.java sun/io/SCCS/s.CharToByteCp864.java sun/io/SCCS/s.CharToByteCp865.java sun/io/SCCS/s.CharToByteCp866.java sun/io/SCCS/s.CharToByteCp868.java sun/io/SCCS/s.CharToByteCp869.java sun/io/SCCS/s.CharToByteCp870.java sun/io/SCCS/s.CharToByteCp871.java sun/io/SCCS/s.CharToByteCp874.java sun/io/SCCS/s.CharToByteCp875.java sun/io/SCCS/s.CharToByteCp918.java sun/io/SCCS/s.CharToByteCp921.java sun/io/SCCS/s.CharToByteCp922.java sun/io/SCCS/s.CharToByteCp930.java sun/io/SCCS/s.CharToByteCp933.java sun/io/SCCS/s.CharToByteCp935.java sun/io/SCCS/s.CharToByteCp937.java sun/io/SCCS/s.CharToByteCp939.java sun/io/SCCS/s.CharToByteCp942.java sun/io/SCCS/s.CharToByteCp942C.java sun/io/SCCS/s.CharToByteCp943.java sun/io/SCCS/s.CharToByteCp943C.java sun/io/SCCS/s.CharToByteCp948.java sun/io/SCCS/s.CharToByteCp949.java sun/io/SCCS/s.CharToByteCp949C.java sun/io/SCCS/s.CharToByteCp950.java sun/io/SCCS/s.CharToByteCp964.java sun/io/SCCS/s.CharToByteCp970.java sun/io/SCCS/s.CharToByteDBCS_ASCII.java sun/io/SCCS/s.CharToByteDBCS_EBCDIC.java sun/io/SCCS/s.CharToByteDoubleByte.java sun/io/SCCS/s.CharToByteEUC.java sun/io/SCCS/s.CharToByteEUC_CN.java sun/io/SCCS/s.CharToByteEUC_JP.java sun/io/SCCS/s.CharToByteEUC_JP_LINUX.java sun/io/SCCS/s.CharToByteEUC_JP_Solaris.java sun/io/SCCS/s.CharToByteEUC_KR.java sun/io/SCCS/s.CharToByteEUC_TW.java sun/io/SCCS/s.CharToByteGB18030.java sun/io/SCCS/s.CharToByteGBK.java sun/io/SCCS/s.CharToByteHKSCS.java sun/io/SCCS/s.CharToByteHKSCS_2001.java sun/io/SCCS/s.CharToByteISCII91.java sun/io/SCCS/s.CharToByteISO2022.java sun/io/SCCS/s.CharToByteISO2022CN_CNS.java sun/io/SCCS/s.CharToByteISO2022CN_GB.java sun/io/SCCS/s.CharToByteISO2022JP.java sun/io/SCCS/s.CharToByteISO2022KR.java sun/io/SCCS/s.CharToByteISO8859_1.java sun/io/SCCS/s.CharToByteISO8859_13.java sun/io/SCCS/s.CharToByteISO8859_15.java sun/io/SCCS/s.CharToByteISO8859_2.java sun/io/SCCS/s.CharToByteISO8859_3.java sun/io/SCCS/s.CharToByteISO8859_4.java sun/io/SCCS/s.CharToByteISO8859_5.java sun/io/SCCS/s.CharToByteISO8859_6.java sun/io/SCCS/s.CharToByteISO8859_7.java sun/io/SCCS/s.CharToByteISO8859_8.java sun/io/SCCS/s.CharToByteISO8859_9.java sun/io/SCCS/s.CharToByteJIS0201.java sun/io/SCCS/s.CharToByteJIS0208.java sun/io/SCCS/s.CharToByteJIS0208_Solaris.java sun/io/SCCS/s.CharToByteJIS0212.java sun/io/SCCS/s.CharToByteJIS0212_Solaris.java sun/io/SCCS/s.CharToByteJohab.java sun/io/SCCS/s.CharToByteKOI8_R.java sun/io/SCCS/s.CharToByteMS874.java sun/io/SCCS/s.CharToByteMS932.java sun/io/SCCS/s.CharToByteMS932DB.java sun/io/SCCS/s.CharToByteMS936.java sun/io/SCCS/s.CharToByteMS949.java sun/io/SCCS/s.CharToByteMS950.java sun/io/SCCS/s.CharToByteMS950_HKSCS.java sun/io/SCCS/s.CharToByteMacArabic.java sun/io/SCCS/s.CharToByteMacCentralEurope.java sun/io/SCCS/s.CharToByteMacCroatian.java sun/io/SCCS/s.CharToByteMacCyrillic.java sun/io/SCCS/s.CharToByteMacDingbat.java sun/io/SCCS/s.CharToByteMacGreek.java sun/io/SCCS/s.CharToByteMacHebrew.java sun/io/SCCS/s.CharToByteMacIceland.java sun/io/SCCS/s.CharToByteMacRoman.java sun/io/SCCS/s.CharToByteMacRomania.java sun/io/SCCS/s.CharToByteMacSymbol.java sun/io/SCCS/s.CharToByteMacThai.java sun/io/SCCS/s.CharToByteMacTurkish.java sun/io/SCCS/s.CharToByteMacUkraine.java sun/io/SCCS/s.CharToBytePCK.java sun/io/SCCS/s.CharToByteSJIS.java sun/io/SCCS/s.CharToByteSingleByte.java sun/io/SCCS/s.CharToByteTIS620.java sun/io/SCCS/s.CharToByteUTF16.java sun/io/SCCS/s.CharToByteUTF8.java sun/io/SCCS/s.CharToByteUnicode.java sun/io/SCCS/s.CharToByteUnicodeBig.java sun/io/SCCS/s.CharToByteUnicodeBigUnmarked.java sun/io/SCCS/s.CharToByteUnicodeLittle.java sun/io/SCCS/s.CharToByteUnicodeLittleUnmarked.java sun/io/SCCS/s.CharacterEncoding.java sun/io/SCCS/s.MalformedInputException.java sun/io/SCCS/s.ConversionBufferFullException.java sun/io/SCCS/s.UnknownCharacterException.java sun/io/ByteToCharBig5_HKSCS.java sun/io/ByteToCharASCII.java sun/io/ByteToCharBig5.java sun/io/ByteToCharUnicodeBigUnmarked.java sun/io/ByteToCharBig5_Solaris.java sun/io/ByteToCharConverter.java sun/io/ByteToCharCp037.java sun/io/ByteToCharCp1006.java sun/io/ByteToCharCp1025.java sun/io/ByteToCharCp1026.java sun/io/ByteToCharCp1046.java sun/io/ByteToCharCp1047.java sun/io/ByteToCharCp1097.java sun/io/ByteToCharCp1098.java sun/io/ByteToCharCp1112.java sun/io/ByteToCharCp1122.java sun/io/ByteToCharCp1123.java sun/io/ByteToCharCp1124.java sun/io/ByteToCharCp1140.java sun/io/ByteToCharCp1141.java sun/io/ByteToCharCp1142.java sun/io/ByteToCharCp1143.java sun/io/ByteToCharCp1144.java sun/io/ByteToCharCp1145.java sun/io/ByteToCharCp1146.java sun/io/ByteToCharCp1147.java sun/io/ByteToCharCp1148.java sun/io/ByteToCharCp1149.java sun/io/ByteToCharCp1250.java sun/io/ByteToCharCp1251.java sun/io/ByteToCharCp1252.java sun/io/ByteToCharCp1253.java sun/io/ByteToCharCp1254.java sun/io/ByteToCharCp1255.java sun/io/ByteToCharCp1256.java sun/io/ByteToCharCp1257.java sun/io/ByteToCharCp1258.java sun/io/ByteToCharCp1381.java sun/io/ByteToCharCp1383.java sun/io/ByteToCharCp273.java sun/io/ByteToCharCp277.java sun/io/ByteToCharCp278.java sun/io/ByteToCharCp280.java sun/io/ByteToCharCp284.java sun/io/ByteToCharCp285.java sun/io/ByteToCharCp297.java sun/io/ByteToCharCp33722.java sun/io/ByteToCharCp420.java sun/io/ByteToCharCp424.java sun/io/ByteToCharCp437.java sun/io/ByteToCharCp500.java sun/io/ByteToCharCp737.java sun/io/ByteToCharCp775.java sun/io/ByteToCharCp838.java sun/io/ByteToCharCp850.java sun/io/ByteToCharCp852.java sun/io/ByteToCharCp855.java sun/io/ByteToCharCp856.java sun/io/ByteToCharCp857.java sun/io/ByteToCharCp858.java sun/io/ByteToCharCp860.java sun/io/ByteToCharCp861.java sun/io/ByteToCharCp862.java sun/io/ByteToCharCp863.java sun/io/ByteToCharCp864.java sun/io/ByteToCharCp865.java sun/io/ByteToCharCp866.java sun/io/ByteToCharCp868.java sun/io/ByteToCharCp869.java sun/io/ByteToCharCp870.java sun/io/ByteToCharCp871.java sun/io/ByteToCharCp874.java sun/io/ByteToCharCp875.java sun/io/ByteToCharCp918.java sun/io/ByteToCharCp921.java sun/io/ByteToCharCp922.java sun/io/ByteToCharCp930.java sun/io/ByteToCharCp933.java sun/io/ByteToCharCp935.java sun/io/ByteToCharCp937.java sun/io/ByteToCharCp939.java sun/io/ByteToCharCp942.java sun/io/ByteToCharCp942C.java sun/io/ByteToCharCp943.java sun/io/ByteToCharCp943C.java sun/io/ByteToCharCp948.java sun/io/ByteToCharCp949.java sun/io/ByteToCharCp949C.java sun/io/ByteToCharCp950.java sun/io/ByteToCharCp964.java sun/io/ByteToCharCp970.java sun/io/ByteToCharDBCS_ASCII.java sun/io/ByteToCharDBCS_EBCDIC.java sun/io/Converters.java sun/io/ByteToCharDoubleByte.java sun/io/ByteToCharEUC.java sun/io/ByteToCharEUC_CN.java sun/io/ByteToCharEUC_JP.java sun/io/ByteToCharEUC_JP_LINUX.java sun/io/ByteToCharEUC_JP_Solaris.java sun/io/ByteToCharEUC_KR.java sun/io/ByteToCharEUC_TW.java sun/io/ByteToCharGB18030.java sun/io/ByteToCharGB18030DB.java sun/io/ByteToCharGBK.java sun/io/ByteToCharHKSCS.java sun/io/ByteToCharHKSCS_2001.java sun/io/ByteToCharISCII91.java sun/io/ByteToCharISO2022.java sun/io/ByteToCharISO2022CN.java sun/io/ByteToCharISO2022JP.java sun/io/ByteToCharISO2022KR.java sun/io/ByteToCharISO8859_1.java sun/io/ByteToCharISO8859_13.java sun/io/ByteToCharISO8859_15.java sun/io/ByteToCharISO8859_2.java sun/io/ByteToCharISO8859_3.java sun/io/ByteToCharISO8859_4.java sun/io/ByteToCharISO8859_5.java sun/io/ByteToCharISO8859_6.java sun/io/ByteToCharISO8859_7.java sun/io/ByteToCharISO8859_8.java sun/io/ByteToCharISO8859_9.java sun/io/ByteToCharJIS0201.java sun/io/ByteToCharJIS0208.java sun/io/ByteToCharJIS0208_Solaris.java sun/io/ByteToCharJIS0212.java sun/io/ByteToCharJIS0212_Solaris.java sun/io/ByteToCharJISAutoDetect.java sun/io/ByteToCharJohab.java sun/io/ByteToCharKOI8_R.java sun/io/ByteToCharMS874.java sun/io/ByteToCharMS932.java sun/io/ByteToCharMS932DB.java sun/io/ByteToCharMS936.java sun/io/ByteToCharMS949.java sun/io/ByteToCharMS950.java sun/io/ByteToCharMS950_HKSCS.java sun/io/ByteToCharMacArabic.java sun/io/ByteToCharMacCentralEurope.java sun/io/ByteToCharMacCroatian.java sun/io/ByteToCharMacCyrillic.java sun/io/ByteToCharMacDingbat.java sun/io/ByteToCharMacGreek.java sun/io/ByteToCharMacHebrew.java sun/io/ByteToCharMacIceland.java sun/io/ByteToCharMacRoman.java sun/io/ByteToCharMacRomania.java sun/io/ByteToCharMacSymbol.java sun/io/ByteToCharMacThai.java sun/io/ByteToCharMacTurkish.java sun/io/ByteToCharMacUkraine.java sun/io/ByteToCharPCK.java sun/io/ByteToCharSJIS.java sun/io/ByteToCharSingleByte.java sun/io/ByteToCharTIS620.java sun/io/ByteToCharUTF16.java sun/io/ByteToCharUTF8.java sun/io/ByteToCharUnicode.java sun/io/ByteToCharUnicodeBig.java sun/io/ByteToCharUnicodeLittleUnmarked.java sun/io/ByteToCharUnicodeLittle.java sun/io/CharToByteBig5_HKSCS.java sun/io/CharToByteASCII.java sun/io/CharToByteBig5.java sun/io/CharToByteEUC_JP_Solaris.java sun/io/CharToByteCp037.java sun/io/CharToByteBig5_Solaris.java sun/io/CharToByteConverter.java sun/io/CharToByteCp1006.java sun/io/CharToByteCp1025.java sun/io/CharToByteCp1026.java sun/io/CharToByteCp1046.java sun/io/CharToByteCp1047.java sun/io/CharToByteCp1097.java sun/io/CharToByteCp1098.java sun/io/CharToByteCp1112.java sun/io/CharToByteCp1122.java sun/io/CharToByteCp1123.java sun/io/CharToByteCp1124.java sun/io/CharToByteCp1140.java sun/io/CharToByteCp1141.java sun/io/CharToByteCp1142.java sun/io/CharToByteCp1143.java sun/io/CharToByteCp1144.java sun/io/CharToByteCp1145.java sun/io/CharToByteCp1146.java sun/io/CharToByteCp1147.java sun/io/CharToByteCp1148.java sun/io/CharToByteCp1149.java sun/io/CharToByteCp1250.java sun/io/CharToByteCp1251.java sun/io/CharToByteCp1252.java sun/io/CharToByteCp1253.java sun/io/CharToByteCp1254.java sun/io/CharToByteCp1255.java sun/io/CharToByteCp1256.java sun/io/CharToByteCp1257.java sun/io/CharToByteCp1258.java sun/io/CharToByteCp1381.java sun/io/CharToByteCp1383.java sun/io/CharToByteCp273.java sun/io/CharToByteCp277.java sun/io/CharToByteCp278.java sun/io/CharToByteCp280.java sun/io/CharToByteCp284.java sun/io/CharToByteCp285.java sun/io/CharToByteCp297.java sun/io/CharToByteCp33722.java sun/io/CharToByteCp420.java sun/io/CharToByteCp424.java sun/io/CharToByteCp437.java sun/io/CharToByteCp500.java sun/io/CharToByteCp737.java sun/io/CharToByteCp775.java sun/io/CharToByteCp838.java sun/io/CharToByteCp850.java sun/io/CharToByteCp852.java sun/io/CharToByteCp855.java sun/io/CharToByteCp856.java sun/io/CharToByteCp857.java sun/io/CharToByteCp858.java sun/io/CharToByteCp860.java sun/io/CharToByteCp861.java sun/io/CharToByteCp862.java sun/io/CharToByteCp863.java sun/io/CharToByteCp864.java sun/io/CharToByteCp865.java sun/io/CharToByteCp866.java sun/io/CharToByteCp868.java sun/io/CharToByteCp869.java sun/io/CharToByteCp870.java sun/io/CharToByteCp871.java sun/io/CharToByteCp874.java sun/io/CharToByteCp875.java sun/io/CharToByteCp918.java sun/io/CharToByteCp921.java sun/io/CharToByteCp922.java sun/io/CharToByteCp930.java sun/io/CharToByteCp933.java sun/io/CharToByteCp935.java sun/io/CharToByteCp937.java sun/io/CharToByteCp939.java sun/io/CharToByteCp942.java sun/io/CharToByteCp942C.java sun/io/CharToByteCp943.java sun/io/CharToByteCp943C.java sun/io/CharToByteCp948.java sun/io/CharToByteCp949.java sun/io/CharToByteCp949C.java sun/io/CharToByteCp950.java sun/io/CharToByteCp964.java sun/io/CharToByteCp970.java sun/io/CharToByteDBCS_ASCII.java sun/io/CharToByteDBCS_EBCDIC.java sun/io/CharToByteDoubleByte.java sun/io/CharToByteEUC.java sun/io/CharToByteEUC_CN.java sun/io/CharToByteEUC_JP.java sun/io/CharToByteEUC_JP_LINUX.java sun/io/CharToByteUnicodeLittleUnmarked.java sun/io/CharToByteEUC_KR.java sun/io/CharToByteEUC_TW.java sun/io/CharToByteGB18030.java sun/io/CharToByteGBK.java sun/io/CharToByteHKSCS.java sun/io/CharToByteHKSCS_2001.java sun/io/CharToByteISCII91.java sun/io/CharToByteISO2022.java sun/io/CharToByteISO2022CN_CNS.java sun/io/CharToByteISO2022CN_GB.java sun/io/CharToByteISO2022JP.java sun/io/CharToByteISO2022KR.java sun/io/CharToByteISO8859_1.java sun/io/CharToByteISO8859_13.java sun/io/CharToByteISO8859_15.java sun/io/CharToByteISO8859_2.java sun/io/CharToByteISO8859_3.java sun/io/CharToByteISO8859_4.java sun/io/CharToByteISO8859_5.java sun/io/CharToByteISO8859_6.java sun/io/CharToByteISO8859_7.java sun/io/CharToByteISO8859_8.java sun/io/CharToByteISO8859_9.java sun/io/CharToByteJIS0201.java sun/io/CharToByteJIS0208.java sun/io/CharToByteJIS0208_Solaris.java sun/io/CharToByteJIS0212.java sun/io/CharToByteJIS0212_Solaris.java sun/io/CharToByteJohab.java sun/io/CharToByteKOI8_R.java sun/io/CharToByteMS874.java sun/io/CharToByteMS932.java sun/io/CharToByteMS932DB.java sun/io/CharToByteMS936.java sun/io/CharToByteMS949.java sun/io/CharToByteMS950.java sun/io/CharToByteMS950_HKSCS.java sun/io/CharToByteMacArabic.java sun/io/CharToByteMacCentralEurope.java sun/io/CharToByteMacCroatian.java sun/io/CharToByteMacCyrillic.java sun/io/CharToByteMacDingbat.java sun/io/CharToByteMacGreek.java sun/io/CharToByteMacHebrew.java sun/io/CharToByteMacIceland.java sun/io/CharToByteMacRoman.java sun/io/CharToByteMacRomania.java sun/io/CharToByteMacSymbol.java sun/io/CharToByteMacThai.java sun/io/CharToByteMacTurkish.java sun/io/CharToByteMacUkraine.java sun/io/CharToBytePCK.java sun/io/CharToByteSJIS.java sun/io/CharToByteSingleByte.java sun/io/CharToByteTIS620.java sun/io/CharToByteUTF16.java sun/io/CharToByteUTF8.java sun/io/CharToByteUnicode.java sun/io/CharToByteUnicodeBig.java sun/io/CharToByteUnicodeBigUnmarked.java sun/io/CharToByteUnicodeLittle.java sun/io/MalformedInputException.java sun/io/CharacterEncoding.java sun/io/ConversionBufferFullException.java sun/io/UnknownCharacterException.java sun/java2d sun/java2d/SCCS sun/java2d/SCCS/s.HeadlessGraphicsEnvironment.java sun/java2d/SCCS/s.DefaultDisposerRecord.java sun/java2d/SCCS/s.Disposer.java sun/java2d/SCCS/s.DisposerRecord.java sun/java2d/SCCS/s.DisposerTarget.java sun/java2d/SCCS/s.FontSupport.java sun/java2d/SCCS/s.InvalidPipeException.java sun/java2d/SCCS/s.NullSurfaceData.java sun/java2d/SCCS/s.Spans.java sun/java2d/SCCS/s.SunCompositeContext.java sun/java2d/SCCS/s.SunGraphics2D.java sun/java2d/SCCS/s.SunGraphicsEnvironment.java sun/java2d/SCCS/s.SurfaceData.java sun/java2d/loops sun/java2d/loops/SCCS sun/java2d/loops/SCCS/s.BlitBg.java sun/java2d/loops/SCCS/s.Blit.java sun/java2d/loops/SCCS/s.CompositeType.java sun/java2d/loops/SCCS/s.CustomComponent.java sun/java2d/loops/SCCS/s.DrawGlyphList.java sun/java2d/loops/SCCS/s.DrawGlyphListAA.java sun/java2d/loops/SCCS/s.DrawLine.java sun/java2d/loops/SCCS/s.DrawPolygons.java sun/java2d/loops/SCCS/s.DrawRect.java sun/java2d/loops/SCCS/s.FillRect.java sun/java2d/loops/SCCS/s.FillSpans.java sun/java2d/loops/SCCS/s.FontInfo.java sun/java2d/loops/SCCS/s.GeneralRenderer.java sun/java2d/loops/SCCS/s.GraphicsPrimitive.java sun/java2d/loops/SCCS/s.GraphicsPrimitiveMgr.java sun/java2d/loops/SCCS/s.MaskBlit.java sun/java2d/loops/SCCS/s.TransformBlit.java sun/java2d/loops/SCCS/s.GraphicsPrimitiveProxy.java sun/java2d/loops/SCCS/s.MaskFill.java sun/java2d/loops/SCCS/s.RenderCache.java sun/java2d/loops/SCCS/s.RenderLoops.java sun/java2d/loops/SCCS/s.ScaledBlit.java sun/java2d/loops/SCCS/s.SurfaceType.java sun/java2d/loops/SCCS/s.TransformHelper.java sun/java2d/loops/SCCS/s.XORComposite.java sun/java2d/loops/CompositeType.java sun/java2d/loops/Blit.java sun/java2d/loops/BlitBg.java sun/java2d/loops/GraphicsPrimitiveMgr.java sun/java2d/loops/CustomComponent.java sun/java2d/loops/DrawGlyphList.java sun/java2d/loops/DrawGlyphListAA.java sun/java2d/loops/DrawLine.java sun/java2d/loops/DrawPolygons.java sun/java2d/loops/DrawRect.java sun/java2d/loops/FillRect.java sun/java2d/loops/FillSpans.java sun/java2d/loops/FontInfo.java sun/java2d/loops/GeneralRenderer.java sun/java2d/loops/GraphicsPrimitive.java sun/java2d/loops/MaskBlit.java sun/java2d/loops/GraphicsPrimitiveProxy.java sun/java2d/loops/MaskFill.java sun/java2d/loops/RenderCache.java sun/java2d/loops/RenderLoops.java sun/java2d/loops/ScaledBlit.java sun/java2d/loops/SurfaceType.java sun/java2d/loops/TransformBlit.java sun/java2d/loops/XORComposite.java sun/java2d/loops/TransformHelper.java sun/java2d/opengl sun/java2d/opengl/SCCS sun/java2d/opengl/SCCS/s.OGLSurfaceData.java sun/java2d/opengl/SCCS/s.OGLBlitLoops.java sun/java2d/opengl/SCCS/s.OGLContext.java sun/java2d/opengl/SCCS/s.OGLDrawImage.java sun/java2d/opengl/SCCS/s.OGLMaskBlit.java sun/java2d/opengl/SCCS/s.OGLMaskFill.java sun/java2d/opengl/SCCS/s.OGLRenderer.java sun/java2d/opengl/SCCS/s.OGLTextRenderer.java sun/java2d/opengl/OGLTextRenderer.java sun/java2d/opengl/OGLBlitLoops.java sun/java2d/opengl/OGLContext.java sun/java2d/opengl/OGLDrawImage.java sun/java2d/opengl/OGLMaskBlit.java sun/java2d/opengl/OGLMaskFill.java sun/java2d/opengl/OGLRenderer.java sun/java2d/opengl/OGLSurfaceData.java sun/java2d/pipe sun/java2d/pipe/SCCS sun/java2d/pipe/SCCS/s.DuctusShapeRenderer.java sun/java2d/pipe/SCCS/s.AATextRenderer.java sun/java2d/pipe/SCCS/s.AlphaColorPipe.java sun/java2d/pipe/SCCS/s.AlphaPaintPipe.java sun/java2d/pipe/SCCS/s.CompositePipe.java sun/java2d/pipe/SCCS/s.DrawImage.java sun/java2d/pipe/SCCS/s.DrawImagePipe.java sun/java2d/pipe/SCCS/s.DuctusRenderer.java sun/java2d/pipe/SCCS/s.GeneralCompositePipe.java sun/java2d/pipe/SCCS/s.GlyphListPipe.java sun/java2d/pipe/SCCS/s.LoopPipe.java sun/java2d/pipe/SCCS/s.NullPipe.java sun/java2d/pipe/SCCS/s.OutlineTextRenderer.java sun/java2d/pipe/SCCS/s.PixelDrawPipe.java sun/java2d/pipe/SCCS/s.PixelFillPipe.java sun/java2d/pipe/SCCS/s.PixelToShapeConverter.java sun/java2d/pipe/SCCS/s.Region.java sun/java2d/pipe/SCCS/s.RegionClipSpanIterator.java sun/java2d/pipe/SCCS/s.RegionIterator.java sun/java2d/pipe/SCCS/s.RegionSpanIterator.java sun/java2d/pipe/SCCS/s.ShapeDrawPipe.java sun/java2d/pipe/SCCS/s.ShapeSpanIterator.java sun/java2d/pipe/SCCS/s.SolidTextRenderer.java sun/java2d/pipe/SCCS/s.SpanClipRenderer.java sun/java2d/pipe/SCCS/s.SpanIterator.java sun/java2d/pipe/SCCS/s.SpanShapeRenderer.java sun/java2d/pipe/SCCS/s.TextPipe.java sun/java2d/pipe/SCCS/s.TextRenderer.java sun/java2d/pipe/SCCS/s.ValidatePipe.java sun/java2d/pipe/DuctusShapeRenderer.java sun/java2d/pipe/AATextRenderer.java sun/java2d/pipe/AlphaColorPipe.java sun/java2d/pipe/AlphaPaintPipe.java sun/java2d/pipe/CompositePipe.java sun/java2d/pipe/DrawImage.java sun/java2d/pipe/DrawImagePipe.java sun/java2d/pipe/DuctusRenderer.java sun/java2d/pipe/PixelToShapeConverter.java sun/java2d/pipe/GeneralCompositePipe.java sun/java2d/pipe/GlyphListPipe.java sun/java2d/pipe/LoopPipe.java sun/java2d/pipe/NullPipe.java sun/java2d/pipe/OutlineTextRenderer.java sun/java2d/pipe/PixelDrawPipe.java sun/java2d/pipe/PixelFillPipe.java sun/java2d/pipe/RegionIterator.java sun/java2d/pipe/Region.java sun/java2d/pipe/RegionClipSpanIterator.java sun/java2d/pipe/RegionSpanIterator.java sun/java2d/pipe/ShapeDrawPipe.java sun/java2d/pipe/ShapeSpanIterator.java sun/java2d/pipe/SolidTextRenderer.java sun/java2d/pipe/SpanClipRenderer.java sun/java2d/pipe/SpanIterator.java sun/java2d/pipe/SpanShapeRenderer.java sun/java2d/pipe/TextPipe.java sun/java2d/pipe/TextRenderer.java sun/java2d/pipe/ValidatePipe.java sun/java2d/HeadlessGraphicsEnvironment.java sun/java2d/DefaultDisposerRecord.java sun/java2d/Disposer.java sun/java2d/DisposerRecord.java sun/java2d/DisposerTarget.java sun/java2d/FontSupport.java sun/java2d/InvalidPipeException.java sun/java2d/NullSurfaceData.java sun/java2d/Spans.java sun/java2d/SunCompositeContext.java sun/java2d/SunGraphics2D.java sun/java2d/SunGraphicsEnvironment.java sun/java2d/SurfaceData.java sun/jdbc sun/jdbc/odbc sun/jdbc/odbc/SCCS sun/jdbc/odbc/SCCS/s.JdbcOdbcBoundCol.java sun/jdbc/odbc/SCCS/s.JdbcOdbc.c sun/jdbc/odbc/SCCS/s.JdbcOdbc.java sun/jdbc/odbc/SCCS/s.JdbcOdbcPreparedStatement.java sun/jdbc/odbc/SCCS/s.JdbcOdbcBatchUpdateException.java sun/jdbc/odbc/SCCS/s.JdbcOdbcBoundArrayOfParams.java sun/jdbc/odbc/SCCS/s.JdbcOdbcBoundParam.java sun/jdbc/odbc/SCCS/s.JdbcOdbcCallableStatement.java sun/jdbc/odbc/SCCS/s.JdbcOdbcConnection.java sun/jdbc/odbc/SCCS/s.JdbcOdbcConnectionInterface.java sun/jdbc/odbc/SCCS/s.JdbcOdbcDatabaseMetaData.java sun/jdbc/odbc/SCCS/s.JdbcOdbcDriver.java sun/jdbc/odbc/SCCS/s.JdbcOdbcDriverInterface.java sun/jdbc/odbc/SCCS/s.JdbcOdbcInputStream.java sun/jdbc/odbc/SCCS/s.JdbcOdbcLimits.java sun/jdbc/odbc/SCCS/s.JdbcOdbcObject.java sun/jdbc/odbc/SCCS/s.JdbcOdbcPlatform.java sun/jdbc/odbc/SCCS/s.JdbcOdbcResultSetInterface.java sun/jdbc/odbc/SCCS/s.JdbcOdbcPseudoCol.java sun/jdbc/odbc/SCCS/s.JdbcOdbcResultSet.java sun/jdbc/odbc/SCCS/s.odbcver.h sun/jdbc/odbc/SCCS/s.JdbcOdbcResultSetMetaData.java sun/jdbc/odbc/SCCS/s.JdbcOdbcSQLWarning.java sun/jdbc/odbc/SCCS/s.JdbcOdbcStatement.java sun/jdbc/odbc/SCCS/s.JdbcOdbcTracer.java sun/jdbc/odbc/SCCS/s.JdbcOdbcTypeInfo.java sun/jdbc/odbc/SCCS/s.JdbcOdbcTypes.java sun/jdbc/odbc/SCCS/s.JdbcOdbcUtils.java sun/jdbc/odbc/SCCS/s.OdbcDef.java sun/jdbc/odbc/SCCS/s.odbcinst.h sun/jdbc/odbc/SCCS/s.sql.h sun/jdbc/odbc/SCCS/s.sqlext.h sun/jdbc/odbc/SCCS/s.sqltypes.h sun/jdbc/odbc/SCCS/s.sqlucode.h sun/jdbc/odbc/SCCS/s.sqlunx.h sun/jdbc/odbc/SCCS/s.wodbcinst.h sun/jdbc/odbc/SCCS/s.wodbcver.h sun/jdbc/odbc/SCCS/s.wsql.h sun/jdbc/odbc/SCCS/s.wsqlext.h sun/jdbc/odbc/SCCS/s.wsqltypes.h sun/jdbc/odbc/SCCS/s.wsqlucode.h sun/jdbc/odbc/ee sun/jdbc/odbc/ee/SCCS sun/jdbc/odbc/ee/SCCS/s.ConnectionAttributes.java sun/jdbc/odbc/ee/SCCS/s.CommonDataSource.java sun/jdbc/odbc/ee/SCCS/s.ConnectionEventListener.java sun/jdbc/odbc/ee/SCCS/s.ConnectionHandler.java sun/jdbc/odbc/ee/SCCS/s.ConnectionPool.java sun/jdbc/odbc/ee/SCCS/s.ConnectionPoolDataSource.java sun/jdbc/odbc/ee/SCCS/s.ConnectionPoolFactory.java sun/jdbc/odbc/ee/SCCS/s.DataSource.java sun/jdbc/odbc/ee/SCCS/s.ObjectFactory.java sun/jdbc/odbc/ee/SCCS/s.ObjectPool.java sun/jdbc/odbc/ee/SCCS/s.PoolProperties.java sun/jdbc/odbc/ee/SCCS/s.PoolWorker.java sun/jdbc/odbc/ee/SCCS/s.PooledConnection.java sun/jdbc/odbc/ee/SCCS/s.PooledObject.java sun/jdbc/odbc/ee/ConnectionAttributes.java sun/jdbc/odbc/ee/CommonDataSource.java sun/jdbc/odbc/ee/ConnectionEventListener.java sun/jdbc/odbc/ee/ConnectionHandler.java sun/jdbc/odbc/ee/ConnectionPool.java sun/jdbc/odbc/ee/ConnectionPoolDataSource.java sun/jdbc/odbc/ee/ConnectionPoolFactory.java sun/jdbc/odbc/ee/DataSource.java sun/jdbc/odbc/ee/ObjectFactory.java sun/jdbc/odbc/ee/ObjectPool.java sun/jdbc/odbc/ee/PoolProperties.java sun/jdbc/odbc/ee/PoolWorker.java sun/jdbc/odbc/ee/PooledConnection.java sun/jdbc/odbc/ee/PooledObject.java sun/jdbc/odbc/JdbcOdbc.java sun/jdbc/odbc/JdbcOdbc.c sun/jdbc/odbc/OdbcDef.java sun/jdbc/odbc/JdbcOdbcBatchUpdateException.java sun/jdbc/odbc/JdbcOdbcBoundArrayOfParams.java sun/jdbc/odbc/JdbcOdbcBoundCol.java sun/jdbc/odbc/JdbcOdbcBoundParam.java sun/jdbc/odbc/JdbcOdbcCallableStatement.java sun/jdbc/odbc/JdbcOdbcConnection.java sun/jdbc/odbc/JdbcOdbcConnectionInterface.java sun/jdbc/odbc/JdbcOdbcDatabaseMetaData.java sun/jdbc/odbc/JdbcOdbcDriver.java sun/jdbc/odbc/JdbcOdbcLimits.java sun/jdbc/odbc/JdbcOdbcObject.java sun/jdbc/odbc/JdbcOdbcDriverInterface.java sun/jdbc/odbc/JdbcOdbcInputStream.java sun/jdbc/odbc/JdbcOdbcPlatform.java sun/jdbc/odbc/JdbcOdbcPreparedStatement.java sun/jdbc/odbc/JdbcOdbcPseudoCol.java sun/jdbc/odbc/JdbcOdbcResultSet.java sun/jdbc/odbc/JdbcOdbcResultSetInterface.java sun/jdbc/odbc/JdbcOdbcResultSetMetaData.java sun/jdbc/odbc/JdbcOdbcSQLWarning.java sun/jdbc/odbc/JdbcOdbcStatement.java sun/jdbc/odbc/JdbcOdbcTracer.java sun/jdbc/odbc/JdbcOdbcTypeInfo.java sun/jdbc/odbc/JdbcOdbcTypes.java sun/jdbc/odbc/JdbcOdbcUtils.java sun/jdbc/odbc/odbcinst.h sun/jdbc/odbc/odbcver.h sun/jdbc/odbc/sql.h sun/jdbc/odbc/sqlext.h sun/jdbc/odbc/sqltypes.h sun/jdbc/odbc/sqlucode.h sun/jdbc/odbc/sqlunx.h sun/jdbc/odbc/wodbcinst.h sun/jdbc/odbc/wodbcver.h sun/jdbc/odbc/wsql.h sun/jdbc/odbc/wsqlext.h sun/jdbc/odbc/wsqltypes.h sun/jdbc/odbc/wsqlucode.h sun/jvmstat sun/jvmstat/monitor sun/jvmstat/monitor/SCCS sun/jvmstat/monitor/SCCS/s.AbstractMonitor.java sun/jvmstat/monitor/SCCS/s.ByteArrayMonitor.java sun/jvmstat/monitor/SCCS/s.HostIdentifier.java sun/jvmstat/monitor/SCCS/s.IntegerMonitor.java sun/jvmstat/monitor/SCCS/s.LongMonitor.java sun/jvmstat/monitor/SCCS/s.Monitor.java sun/jvmstat/monitor/SCCS/s.MonitorException.java sun/jvmstat/monitor/SCCS/s.MonitoredHost.java sun/jvmstat/monitor/SCCS/s.MonitoredVm.java sun/jvmstat/monitor/SCCS/s.MonitoredVmUtil.java sun/jvmstat/monitor/SCCS/s.StringMonitor.java sun/jvmstat/monitor/SCCS/s.VmIdentifier.java sun/jvmstat/monitor/SCCS/s.package.html sun/jvmstat/monitor/event sun/jvmstat/monitor/event/SCCS sun/jvmstat/monitor/event/SCCS/s.HostEvent.java sun/jvmstat/monitor/event/SCCS/s.HostListener.java sun/jvmstat/monitor/event/SCCS/s.VmEvent.java sun/jvmstat/monitor/event/SCCS/s.package.html sun/jvmstat/monitor/event/SCCS/s.MonitorStatusChangeEvent.java sun/jvmstat/monitor/event/SCCS/s.VmListener.java sun/jvmstat/monitor/event/SCCS/s.VmStatusChangeEvent.java sun/jvmstat/monitor/event/HostListener.java sun/jvmstat/monitor/event/HostEvent.java sun/jvmstat/monitor/event/MonitorStatusChangeEvent.java sun/jvmstat/monitor/event/VmEvent.java sun/jvmstat/monitor/event/VmListener.java sun/jvmstat/monitor/event/VmStatusChangeEvent.java sun/jvmstat/monitor/event/package.html sun/jvmstat/monitor/remote sun/jvmstat/monitor/remote/SCCS sun/jvmstat/monitor/remote/SCCS/s.BufferedMonitoredVm.java sun/jvmstat/monitor/remote/SCCS/s.RemoteHost.java sun/jvmstat/monitor/remote/SCCS/s.RemoteVm.java sun/jvmstat/monitor/remote/SCCS/s.package.html sun/jvmstat/monitor/remote/BufferedMonitoredVm.java sun/jvmstat/monitor/remote/RemoteHost.java sun/jvmstat/monitor/remote/RemoteVm.java sun/jvmstat/monitor/remote/package.html sun/jvmstat/monitor/AbstractMonitor.java sun/jvmstat/monitor/ByteArrayMonitor.java sun/jvmstat/monitor/HostIdentifier.java sun/jvmstat/monitor/IntegerMonitor.java sun/jvmstat/monitor/LongMonitor.java sun/jvmstat/monitor/Monitor.java sun/jvmstat/monitor/MonitorException.java sun/jvmstat/monitor/MonitoredHost.java sun/jvmstat/monitor/MonitoredVm.java sun/jvmstat/monitor/MonitoredVmUtil.java sun/jvmstat/monitor/StringMonitor.java sun/jvmstat/monitor/VmIdentifier.java sun/jvmstat/monitor/package.html sun/jvmstat/perfdata sun/jvmstat/perfdata/monitor sun/jvmstat/perfdata/monitor/SCCS sun/jvmstat/perfdata/monitor/SCCS/s.AbstractPerfDataBuffer.java sun/jvmstat/perfdata/monitor/SCCS/s.AbstractMonitoredVm.java sun/jvmstat/perfdata/monitor/SCCS/s.package.html sun/jvmstat/perfdata/monitor/SCCS/s.AbstractPerfDataBufferPrologue.java sun/jvmstat/perfdata/monitor/SCCS/s.AliasFileParser.java sun/jvmstat/perfdata/monitor/SCCS/s.CountedTimerTask.java sun/jvmstat/perfdata/monitor/SCCS/s.CountedTimerTaskUtils.java sun/jvmstat/perfdata/monitor/SCCS/s.MonitorDataException.java sun/jvmstat/perfdata/monitor/SCCS/s.MonitorStatus.java sun/jvmstat/perfdata/monitor/SCCS/s.MonitorStructureException.java sun/jvmstat/perfdata/monitor/SCCS/s.MonitorTypeException.java sun/jvmstat/perfdata/monitor/SCCS/s.MonitorVersionException.java sun/jvmstat/perfdata/monitor/SCCS/s.PerfByteArrayMonitor.java sun/jvmstat/perfdata/monitor/SCCS/s.PerfDataBufferImpl.java sun/jvmstat/perfdata/monitor/SCCS/s.PerfIntegerMonitor.java sun/jvmstat/perfdata/monitor/SCCS/s.PerfLongMonitor.java sun/jvmstat/perfdata/monitor/SCCS/s.PerfStringConstantMonitor.java sun/jvmstat/perfdata/monitor/SCCS/s.PerfStringMonitor.java sun/jvmstat/perfdata/monitor/SCCS/s.PerfStringVariableMonitor.java sun/jvmstat/perfdata/monitor/SCCS/s.SyntaxException.java sun/jvmstat/perfdata/monitor/protocol sun/jvmstat/perfdata/monitor/protocol/file sun/jvmstat/perfdata/monitor/protocol/file/SCCS sun/jvmstat/perfdata/monitor/protocol/file/SCCS/s.MonitoredHostProvider.java sun/jvmstat/perfdata/monitor/protocol/file/SCCS/s.FileMonitoredVm.java sun/jvmstat/perfdata/monitor/protocol/file/SCCS/s.PerfDataBuffer.java sun/jvmstat/perfdata/monitor/protocol/file/SCCS/s.package.html sun/jvmstat/perfdata/monitor/protocol/file/MonitoredHostProvider.java sun/jvmstat/perfdata/monitor/protocol/file/FileMonitoredVm.java sun/jvmstat/perfdata/monitor/protocol/file/PerfDataBuffer.java sun/jvmstat/perfdata/monitor/protocol/file/package.html sun/jvmstat/perfdata/monitor/protocol/local sun/jvmstat/perfdata/monitor/protocol/local/SCCS sun/jvmstat/perfdata/monitor/protocol/local/SCCS/s.MonitoredHostProvider.java sun/jvmstat/perfdata/monitor/protocol/local/SCCS/s.LocalEventTimer.java sun/jvmstat/perfdata/monitor/protocol/local/SCCS/s.LocalMonitoredVm.java sun/jvmstat/perfdata/monitor/protocol/local/SCCS/s.LocalVmManager.java sun/jvmstat/perfdata/monitor/protocol/local/SCCS/s.PerfDataBuffer.java sun/jvmstat/perfdata/monitor/protocol/local/SCCS/s.PerfDataFile.java sun/jvmstat/perfdata/monitor/protocol/local/SCCS/s.package.html sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostProvider.java sun/jvmstat/perfdata/monitor/protocol/local/LocalEventTimer.java sun/jvmstat/perfdata/monitor/protocol/local/LocalMonitoredVm.java sun/jvmstat/perfdata/monitor/protocol/local/LocalVmManager.java sun/jvmstat/perfdata/monitor/protocol/local/PerfDataBuffer.java sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java sun/jvmstat/perfdata/monitor/protocol/local/package.html sun/jvmstat/perfdata/monitor/protocol/rmi sun/jvmstat/perfdata/monitor/protocol/rmi/SCCS sun/jvmstat/perfdata/monitor/protocol/rmi/SCCS/s.MonitoredHostProvider.java sun/jvmstat/perfdata/monitor/protocol/rmi/SCCS/s.PerfDataBuffer.java sun/jvmstat/perfdata/monitor/protocol/rmi/SCCS/s.RemoteMonitoredVm.java sun/jvmstat/perfdata/monitor/protocol/rmi/SCCS/s.RemoteVmManager.java sun/jvmstat/perfdata/monitor/protocol/rmi/SCCS/s.package.html sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostProvider.java sun/jvmstat/perfdata/monitor/protocol/rmi/PerfDataBuffer.java sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteMonitoredVm.java sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteVmManager.java sun/jvmstat/perfdata/monitor/protocol/rmi/package.html sun/jvmstat/perfdata/monitor/v1_0 sun/jvmstat/perfdata/monitor/v1_0/SCCS sun/jvmstat/perfdata/monitor/v1_0/SCCS/s.PerfDataBuffer.java sun/jvmstat/perfdata/monitor/v1_0/SCCS/s.BasicType.java sun/jvmstat/perfdata/monitor/v1_0/SCCS/s.PerfDataBufferPrologue.java sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java sun/jvmstat/perfdata/monitor/v1_0/BasicType.java sun/jvmstat/perfdata/monitor/v1_0/PerfDataBufferPrologue.java sun/jvmstat/perfdata/monitor/v2_0 sun/jvmstat/perfdata/monitor/v2_0/SCCS sun/jvmstat/perfdata/monitor/v2_0/SCCS/s.PerfDataBufferPrologue.java sun/jvmstat/perfdata/monitor/v2_0/SCCS/s.PerfDataBuffer.java sun/jvmstat/perfdata/monitor/v2_0/SCCS/s.TypeCode.java sun/jvmstat/perfdata/monitor/v2_0/PerfDataBufferPrologue.java sun/jvmstat/perfdata/monitor/v2_0/PerfDataBuffer.java sun/jvmstat/perfdata/monitor/v2_0/TypeCode.java sun/jvmstat/perfdata/monitor/AbstractPerfDataBufferPrologue.java sun/jvmstat/perfdata/monitor/AbstractMonitoredVm.java sun/jvmstat/perfdata/monitor/AbstractPerfDataBuffer.java sun/jvmstat/perfdata/monitor/CountedTimerTaskUtils.java sun/jvmstat/perfdata/monitor/AliasFileParser.java sun/jvmstat/perfdata/monitor/CountedTimerTask.java sun/jvmstat/perfdata/monitor/MonitorDataException.java sun/jvmstat/perfdata/monitor/MonitorStatus.java sun/jvmstat/perfdata/monitor/MonitorStructureException.java sun/jvmstat/perfdata/monitor/MonitorTypeException.java sun/jvmstat/perfdata/monitor/MonitorVersionException.java sun/jvmstat/perfdata/monitor/package.html sun/jvmstat/perfdata/monitor/PerfByteArrayMonitor.java sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java sun/jvmstat/perfdata/monitor/PerfIntegerMonitor.java sun/jvmstat/perfdata/monitor/PerfLongMonitor.java sun/jvmstat/perfdata/monitor/PerfStringConstantMonitor.java sun/jvmstat/perfdata/monitor/PerfStringMonitor.java sun/jvmstat/perfdata/monitor/PerfStringVariableMonitor.java sun/jvmstat/perfdata/monitor/SyntaxException.java sun/jvmstat/perfdata/resources sun/jvmstat/perfdata/resources/SCCS sun/jvmstat/perfdata/resources/SCCS/s.aliasmap sun/jvmstat/perfdata/resources/aliasmap sun/management sun/management/SCCS sun/management/SCCS/s.BooleanFlag.java sun/management/SCCS/s.Agent.java sun/management/SCCS/s.Flag.java sun/management/SCCS/s.AgentConfigurationError.java sun/management/SCCS/s.ClassLoadingImpl.java sun/management/SCCS/s.CompilationImpl.java sun/management/SCCS/s.CompilerThreadStat.java sun/management/SCCS/s.ConnectorAddressLink.java sun/management/SCCS/s.FileSystem.java sun/management/SCCS/s.GarbageCollectorImpl.java sun/management/SCCS/s.GcInfoBuilder.java sun/management/SCCS/s.GcInfoCompositeData.java sun/management/SCCS/s.HotspotClassLoading.java sun/management/SCCS/s.HotspotInternalMBean.java sun/management/SCCS/s.HotspotInternal.java sun/management/SCCS/s.HotspotClassLoadingMBean.java sun/management/SCCS/s.HotspotCompilation.java sun/management/SCCS/s.HotspotCompilationMBean.java sun/management/SCCS/s.HotspotMemoryMBean.java sun/management/SCCS/s.HotspotMemory.java sun/management/SCCS/s.HotspotRuntime.java sun/management/SCCS/s.HotspotRuntimeMBean.java sun/management/SCCS/s.HotspotThread.java sun/management/SCCS/s.HotspotThreadMBean.java sun/management/SCCS/s.LazyCompositeData.java sun/management/SCCS/s.LongFlag.java sun/management/SCCS/s.MXBeanSupport.java sun/management/SCCS/s.ManagementFactory.java sun/management/SCCS/s.OperatingSystemImpl.java sun/management/SCCS/s.MethodInfo.java sun/management/SCCS/s.MappedMXBeanType.java sun/management/SCCS/s.MemoryImpl.java sun/management/SCCS/s.MemoryManagerImpl.java sun/management/SCCS/s.MemoryNotifInfoCompositeData.java sun/management/SCCS/s.MemoryPoolImpl.java sun/management/SCCS/s.MemoryUsageCompositeData.java sun/management/SCCS/s.PlatformMXBeanInvocationHandler.java sun/management/SCCS/s.NotificationEmitterSupport.java sun/management/SCCS/s.ThreadInfoCompositeData.java sun/management/SCCS/s.RuntimeImpl.java sun/management/SCCS/s.Sensor.java sun/management/SCCS/s.StringFlag.java sun/management/SCCS/s.ThreadImpl.java sun/management/SCCS/s.Util.java sun/management/SCCS/s.VMManagement.java sun/management/SCCS/s.VMManagementImpl.java sun/management/counter sun/management/counter/SCCS sun/management/counter/SCCS/s.AbstractCounter.java sun/management/counter/SCCS/s.ByteArrayCounter.java sun/management/counter/SCCS/s.Counter.java sun/management/counter/SCCS/s.LongArrayCounter.java sun/management/counter/SCCS/s.LongCounter.java sun/management/counter/SCCS/s.StringCounter.java sun/management/counter/SCCS/s.Units.java sun/management/counter/SCCS/s.Variability.java sun/management/counter/perf sun/management/counter/perf/SCCS sun/management/counter/perf/SCCS/s.ByteArrayCounterSnapshot.java sun/management/counter/perf/SCCS/s.InstrumentationException.java sun/management/counter/perf/SCCS/s.LongArrayCounterSnapshot.java sun/management/counter/perf/SCCS/s.LongCounterSnapshot.java sun/management/counter/perf/SCCS/s.PerfByteArrayCounter.java sun/management/counter/perf/SCCS/s.PerfDataEntry.java sun/management/counter/perf/SCCS/s.PerfDataType.java sun/management/counter/perf/SCCS/s.PerfInstrumentation.java sun/management/counter/perf/SCCS/s.PerfLongArrayCounter.java sun/management/counter/perf/SCCS/s.PerfLongCounter.java sun/management/counter/perf/SCCS/s.PerfStringCounter.java sun/management/counter/perf/SCCS/s.Prologue.java sun/management/counter/perf/SCCS/s.StringCounterSnapshot.java sun/management/counter/perf/ByteArrayCounterSnapshot.java sun/management/counter/perf/InstrumentationException.java sun/management/counter/perf/LongArrayCounterSnapshot.java sun/management/counter/perf/LongCounterSnapshot.java sun/management/counter/perf/PerfByteArrayCounter.java sun/management/counter/perf/PerfDataEntry.java sun/management/counter/perf/PerfDataType.java sun/management/counter/perf/PerfInstrumentation.java sun/management/counter/perf/PerfLongArrayCounter.java sun/management/counter/perf/PerfLongCounter.java sun/management/counter/perf/PerfStringCounter.java sun/management/counter/perf/Prologue.java sun/management/counter/perf/StringCounterSnapshot.java sun/management/counter/AbstractCounter.java sun/management/counter/ByteArrayCounter.java sun/management/counter/Counter.java sun/management/counter/LongArrayCounter.java sun/management/counter/LongCounter.java sun/management/counter/StringCounter.java sun/management/counter/Units.java sun/management/counter/Variability.java sun/management/jmxremote sun/management/jmxremote/SCCS sun/management/jmxremote/SCCS/s.ConnectorBootstrap.java sun/management/jmxremote/SCCS/s.SingleEntryRegistry.java sun/management/jmxremote/SCCS/s.package.html sun/management/jmxremote/SingleEntryRegistry.java sun/management/jmxremote/ConnectorBootstrap.java sun/management/jmxremote/package.html sun/management/resources sun/management/resources/SCCS sun/management/resources/SCCS/s.agent_de.properties sun/management/resources/SCCS/s.agent.properties sun/management/resources/SCCS/s.agent_es.properties sun/management/resources/SCCS/s.agent_fr.properties sun/management/resources/SCCS/s.agent_it.properties sun/management/resources/SCCS/s.agent_ja.properties sun/management/resources/SCCS/s.agent_ko.properties sun/management/resources/SCCS/s.agent_sv.properties sun/management/resources/SCCS/s.agent_zh_CN.properties sun/management/resources/SCCS/s.agent_zh_TW.properties sun/management/resources/agent_zh_CN.properties sun/management/resources/agent.properties sun/management/resources/agent_de.properties sun/management/resources/agent_es.properties sun/management/resources/agent_fr.properties sun/management/resources/agent_it.properties sun/management/resources/agent_ja.properties sun/management/resources/agent_ko.properties sun/management/resources/agent_sv.properties sun/management/resources/agent_zh_TW.properties sun/management/snmp sun/management/snmp/SCCS sun/management/snmp/SCCS/s.JVM-MANAGEMENT-MIB.mib sun/management/snmp/SCCS/s.AdaptorBootstrap.java sun/management/snmp/SCCS/s.README sun/management/snmp/SCCS/s.mib_core.txt sun/management/snmp/SCCS/s.package.html sun/management/snmp/SCCS/s.mibgen.properties.tiger sun/management/snmp/SCCS/s.rfc2287.txt sun/management/snmp/SCCS/s.rfc2564.txt sun/management/snmp/jvminstr sun/management/snmp/jvminstr/SCCS sun/management/snmp/jvminstr/SCCS/s.JvmMemManagerTableMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.JVM_MANAGEMENT_MIB_IMPL.java sun/management/snmp/jvminstr/SCCS/s.JvmClassLoadingImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmCompilationImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmMemGCEntryImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmMemGCTableMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmMemManagerEntryImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmRTBootClassPathEntryImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmMemMgrPoolRelEntryImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmMemMgrPoolRelTableMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmMemPoolEntryImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmMemPoolTableMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmMemoryImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmMemoryMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmOSImpl.java sun/management/snmp/jvminstr/SCCS/s.README sun/management/snmp/jvminstr/SCCS/s.JvmRTBootClassPathTableMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmRTClassPathEntryImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmRTClassPathTableMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmRTInputArgsEntryImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmRTInputArgsTableMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmRTLibraryPathEntryImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmRTLibraryPathTableMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmRuntimeImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmRuntimeMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmThreadInstanceEntryImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmThreadInstanceTableMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmThreadingImpl.java sun/management/snmp/jvminstr/SCCS/s.JvmThreadingMetaImpl.java sun/management/snmp/jvminstr/SCCS/s.NotificationTarget.java sun/management/snmp/jvminstr/SCCS/s.NotificationTargetImpl.java sun/management/snmp/jvminstr/SCCS/s.package.html sun/management/snmp/jvminstr/JvmMemMgrPoolRelTableMetaImpl.java sun/management/snmp/jvminstr/JVM_MANAGEMENT_MIB_IMPL.java sun/management/snmp/jvminstr/JvmClassLoadingImpl.java sun/management/snmp/jvminstr/JvmCompilationImpl.java sun/management/snmp/jvminstr/JvmMemGCEntryImpl.java sun/management/snmp/jvminstr/JvmMemGCTableMetaImpl.java sun/management/snmp/jvminstr/JvmMemManagerEntryImpl.java sun/management/snmp/jvminstr/JvmMemManagerTableMetaImpl.java sun/management/snmp/jvminstr/JvmMemMgrPoolRelEntryImpl.java sun/management/snmp/jvminstr/JvmMemPoolEntryImpl.java sun/management/snmp/jvminstr/JvmMemPoolTableMetaImpl.java sun/management/snmp/jvminstr/README sun/management/snmp/jvminstr/JvmMemoryImpl.java sun/management/snmp/jvminstr/JvmMemoryMetaImpl.java sun/management/snmp/jvminstr/JvmOSImpl.java sun/management/snmp/jvminstr/JvmRTBootClassPathEntryImpl.java sun/management/snmp/jvminstr/JvmRTBootClassPathTableMetaImpl.java sun/management/snmp/jvminstr/JvmRTClassPathEntryImpl.java sun/management/snmp/jvminstr/JvmRTClassPathTableMetaImpl.java sun/management/snmp/jvminstr/JvmRTInputArgsEntryImpl.java sun/management/snmp/jvminstr/JvmRTInputArgsTableMetaImpl.java sun/management/snmp/jvminstr/JvmRTLibraryPathEntryImpl.java sun/management/snmp/jvminstr/JvmRTLibraryPathTableMetaImpl.java sun/management/snmp/jvminstr/JvmRuntimeImpl.java sun/management/snmp/jvminstr/JvmRuntimeMetaImpl.java sun/management/snmp/jvminstr/package.html sun/management/snmp/jvminstr/JvmThreadInstanceEntryImpl.java sun/management/snmp/jvminstr/JvmThreadInstanceTableMetaImpl.java sun/management/snmp/jvminstr/JvmThreadingImpl.java sun/management/snmp/jvminstr/JvmThreadingMetaImpl.java sun/management/snmp/jvminstr/NotificationTarget.java sun/management/snmp/jvminstr/NotificationTargetImpl.java sun/management/snmp/jvmmib sun/management/snmp/jvmmib/SCCS sun/management/snmp/jvmmib/SCCS/s.EnumJvmJITCompilerTimeMonitoring.java sun/management/snmp/jvmmib/SCCS/s.EnumJvmClassesVerboseLevel.java sun/management/snmp/jvmmib/SCCS/s.EnumJvmMemManagerState.java sun/management/snmp/jvmmib/SCCS/s.EnumJvmMemPoolState.java sun/management/snmp/jvmmib/SCCS/s.EnumJvmMemPoolCollectThreshdSupport.java sun/management/snmp/jvmmib/SCCS/s.EnumJvmMemPoolThreshdSupport.java sun/management/snmp/jvmmib/SCCS/s.EnumJvmMemPoolType.java sun/management/snmp/jvmmib/SCCS/s.EnumJvmMemoryGCCall.java sun/management/snmp/jvmmib/SCCS/s.EnumJvmMemoryGCVerboseLevel.java sun/management/snmp/jvmmib/SCCS/s.EnumJvmRTBootClassPathSupport.java sun/management/snmp/jvmmib/SCCS/s.package.html sun/management/snmp/jvmmib/SCCS/s.JVM_MANAGEMENT_MIB.java sun/management/snmp/jvmmib/SCCS/s.EnumJvmThreadContentionMonitoring.java sun/management/snmp/jvmmib/SCCS/s.EnumJvmThreadCpuTimeMonitoring.java sun/management/snmp/jvmmib/SCCS/s.JVM_MANAGEMENT_MIBOidTable.java sun/management/snmp/jvmmib/SCCS/s.JvmClassLoadingMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmClassLoadingMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmCompilationMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmCompilationMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmMemGCEntryMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmMemGCEntryMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmMemGCTableMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmMemManagerEntryMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmMemManagerEntryMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmMemPoolEntryMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmMemManagerTableMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmMemMgrPoolRelEntryMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmMemMgrPoolRelEntryMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmMemMgrPoolRelTableMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmMemPoolEntryMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmMemPoolTableMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmMemoryMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmMemoryMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmOSMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmOSMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmRTBootClassPathEntryMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmRTBootClassPathEntryMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmRTBootClassPathTableMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmRTClassPathEntryMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmRTClassPathEntryMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmRTClassPathTableMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmRTInputArgsEntryMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmRTInputArgsEntryMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmRTInputArgsTableMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmRTLibraryPathEntryMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmRTLibraryPathEntryMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmRTLibraryPathTableMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmRuntimeMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmRuntimeMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmThreadingMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmThreadInstanceEntryMBean.java sun/management/snmp/jvmmib/SCCS/s.JvmThreadInstanceEntryMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmThreadInstanceTableMeta.java sun/management/snmp/jvmmib/SCCS/s.JvmThreadingMBean.java sun/management/snmp/jvmmib/EnumJvmJITCompilerTimeMonitoring.java sun/management/snmp/jvmmib/EnumJvmClassesVerboseLevel.java sun/management/snmp/jvmmib/EnumJvmMemManagerState.java sun/management/snmp/jvmmib/EnumJvmMemPoolState.java sun/management/snmp/jvmmib/EnumJvmMemPoolCollectThreshdSupport.java sun/management/snmp/jvmmib/EnumJvmMemPoolThreshdSupport.java sun/management/snmp/jvmmib/EnumJvmMemPoolType.java sun/management/snmp/jvmmib/EnumJvmMemoryGCCall.java sun/management/snmp/jvmmib/EnumJvmMemoryGCVerboseLevel.java sun/management/snmp/jvmmib/EnumJvmRTBootClassPathSupport.java sun/management/snmp/jvmmib/JvmRuntimeMBean.java sun/management/snmp/jvmmib/JvmOSMBean.java sun/management/snmp/jvmmib/EnumJvmThreadContentionMonitoring.java sun/management/snmp/jvmmib/EnumJvmThreadCpuTimeMonitoring.java sun/management/snmp/jvmmib/JVM_MANAGEMENT_MIB.java sun/management/snmp/jvmmib/JVM_MANAGEMENT_MIBOidTable.java sun/management/snmp/jvmmib/JvmClassLoadingMBean.java sun/management/snmp/jvmmib/JvmClassLoadingMeta.java sun/management/snmp/jvmmib/JvmCompilationMBean.java sun/management/snmp/jvmmib/JvmCompilationMeta.java sun/management/snmp/jvmmib/JvmMemGCEntryMBean.java sun/management/snmp/jvmmib/JvmMemGCEntryMeta.java sun/management/snmp/jvmmib/JvmMemGCTableMeta.java sun/management/snmp/jvmmib/JvmMemManagerEntryMBean.java sun/management/snmp/jvmmib/JvmMemManagerEntryMeta.java sun/management/snmp/jvmmib/JvmMemManagerTableMeta.java sun/management/snmp/jvmmib/JvmMemMgrPoolRelEntryMBean.java sun/management/snmp/jvmmib/JvmMemMgrPoolRelEntryMeta.java sun/management/snmp/jvmmib/JvmMemMgrPoolRelTableMeta.java sun/management/snmp/jvmmib/JvmMemPoolEntryMBean.java sun/management/snmp/jvmmib/JvmMemPoolEntryMeta.java sun/management/snmp/jvmmib/JvmMemPoolTableMeta.java sun/management/snmp/jvmmib/JvmMemoryMBean.java sun/management/snmp/jvmmib/JvmMemoryMeta.java sun/management/snmp/jvmmib/JvmOSMeta.java sun/management/snmp/jvmmib/JvmRTBootClassPathEntryMBean.java sun/management/snmp/jvmmib/JvmRTBootClassPathEntryMeta.java sun/management/snmp/jvmmib/JvmRTBootClassPathTableMeta.java sun/management/snmp/jvmmib/JvmThreadingMBean.java sun/management/snmp/jvmmib/JvmRTClassPathEntryMBean.java sun/management/snmp/jvmmib/JvmRTClassPathEntryMeta.java sun/management/snmp/jvmmib/JvmRTClassPathTableMeta.java sun/management/snmp/jvmmib/JvmRTInputArgsEntryMBean.java sun/management/snmp/jvmmib/JvmRTInputArgsEntryMeta.java sun/management/snmp/jvmmib/JvmRTInputArgsTableMeta.java sun/management/snmp/jvmmib/JvmRTLibraryPathEntryMBean.java sun/management/snmp/jvmmib/JvmRTLibraryPathEntryMeta.java sun/management/snmp/jvmmib/JvmRTLibraryPathTableMeta.java sun/management/snmp/jvmmib/JvmRuntimeMeta.java sun/management/snmp/jvmmib/JvmThreadInstanceEntryMBean.java sun/management/snmp/jvmmib/JvmThreadInstanceEntryMeta.java sun/management/snmp/jvmmib/JvmThreadInstanceTableMeta.java sun/management/snmp/jvmmib/JvmThreadingMeta.java sun/management/snmp/jvmmib/package.html sun/management/snmp/util sun/management/snmp/util/SCCS sun/management/snmp/util/SCCS/s.SnmpNamedListTableCache.java sun/management/snmp/util/SCCS/s.JvmContextFactory.java sun/management/snmp/util/SCCS/s.MibLogger.java sun/management/snmp/util/SCCS/s.SnmpCachedData.java sun/management/snmp/util/SCCS/s.SnmpListTableCache.java sun/management/snmp/util/SCCS/s.SnmpLoadedClassData.java sun/management/snmp/util/SCCS/s.SnmpTableCache.java sun/management/snmp/util/SCCS/s.SnmpTableHandler.java sun/management/snmp/util/SCCS/s.package.html sun/management/snmp/util/SnmpLoadedClassData.java sun/management/snmp/util/JvmContextFactory.java sun/management/snmp/util/MibLogger.java sun/management/snmp/util/SnmpCachedData.java sun/management/snmp/util/SnmpListTableCache.java sun/management/snmp/util/SnmpNamedListTableCache.java sun/management/snmp/util/SnmpTableCache.java sun/management/snmp/util/SnmpTableHandler.java sun/management/snmp/util/package.html sun/management/snmp/mib_core.txt sun/management/snmp/README sun/management/snmp/AdaptorBootstrap.java sun/management/snmp/JVM-MANAGEMENT-MIB.mib sun/management/snmp/mibgen.properties.tiger sun/management/snmp/package.html sun/management/snmp/rfc2287.txt sun/management/snmp/rfc2564.txt sun/management/BooleanFlag.java sun/management/Agent.java sun/management/GcInfoBuilder.java sun/management/Flag.java sun/management/AgentConfigurationError.java sun/management/ClassLoadingImpl.java sun/management/CompilationImpl.java sun/management/CompilerThreadStat.java sun/management/ConnectorAddressLink.java sun/management/FileSystem.java sun/management/GarbageCollectorImpl.java sun/management/HotspotCompilationMBean.java sun/management/HotspotCompilation.java sun/management/GcInfoCompositeData.java sun/management/HotspotClassLoading.java sun/management/HotspotClassLoadingMBean.java sun/management/HotspotInternalMBean.java sun/management/HotspotInternal.java sun/management/HotspotRuntimeMBean.java sun/management/HotspotMemory.java sun/management/HotspotMemoryMBean.java sun/management/HotspotRuntime.java sun/management/MemoryUsageCompositeData.java sun/management/HotspotThread.java sun/management/HotspotThreadMBean.java sun/management/LazyCompositeData.java sun/management/LongFlag.java sun/management/MXBeanSupport.java sun/management/MemoryImpl.java sun/management/ManagementFactory.java sun/management/MappedMXBeanType.java sun/management/MemoryManagerImpl.java sun/management/MemoryPoolImpl.java sun/management/MethodInfo.java sun/management/MemoryNotifInfoCompositeData.java sun/management/PlatformMXBeanInvocationHandler.java sun/management/NotificationEmitterSupport.java sun/management/OperatingSystemImpl.java sun/management/RuntimeImpl.java sun/management/Sensor.java sun/management/StringFlag.java sun/management/ThreadImpl.java sun/management/Util.java sun/management/ThreadInfoCompositeData.java sun/management/VMManagement.java sun/management/VMManagementImpl.java sun/misc sun/misc/SCCS sun/misc/SCCS/s.CharacterDecoder.java sun/misc/SCCS/s.CRC16.java sun/misc/SCCS/s.ASCIICaseInsensitiveComparator.java sun/misc/SCCS/s.AtomicLong.java sun/misc/SCCS/s.AtomicLongCSImpl.java sun/misc/SCCS/s.AtomicLongLockImpl.java sun/misc/SCCS/s.BASE64Decoder.java sun/misc/SCCS/s.BASE64Encoder.java sun/misc/SCCS/s.CEFormatException.java sun/misc/SCCS/s.CEStreamExhausted.java sun/misc/SCCS/s.Cache.java sun/misc/SCCS/s.ClassFileTransformer.java sun/misc/SCCS/s.CharacterEncoder.java sun/misc/SCCS/s.ConditionLock.java sun/misc/SCCS/s.Cleaner.java sun/misc/SCCS/s.Compare.java sun/misc/SCCS/s.CompoundEnumeration.java sun/misc/SCCS/s.DoubleConsts.java sun/misc/SCCS/s.ExtensionDependency.java sun/misc/SCCS/s.ExtensionInfo.java sun/misc/SCCS/s.FloatConsts.java sun/misc/SCCS/s.FpUtils.java sun/misc/SCCS/s.Lock.java sun/misc/SCCS/s.ExtensionInstallationException.java sun/misc/SCCS/s.ExtensionInstallationProvider.java sun/misc/SCCS/s.FloatingDecimal.java sun/misc/SCCS/s.FormattedFloatingDecimal.java sun/misc/SCCS/s.GC.java sun/misc/SCCS/s.HexDumpEncoder.java sun/misc/SCCS/s.JarFilter.java sun/misc/SCCS/s.NativeSignalHandler.java sun/misc/SCCS/s.InvalidJarIndexException.java sun/misc/SCCS/s.JarIndex.java sun/misc/SCCS/s.JavaLangAccess.java sun/misc/SCCS/s.JavaUtilJarAccess.java sun/misc/SCCS/s.LRUCache.java sun/misc/SCCS/s.Launcher.java sun/misc/SCCS/s.MessageUtils.java sun/misc/SCCS/s.Queue.java sun/misc/SCCS/s.Perf.java sun/misc/SCCS/s.PerformanceLogger.java sun/misc/SCCS/s.ProxyGenerator.java sun/misc/SCCS/s.REException.java sun/misc/SCCS/s.Ref.java sun/misc/SCCS/s.Regexp.java sun/misc/SCCS/s.RegexpPool.java sun/misc/SCCS/s.RegexpTarget.java sun/misc/SCCS/s.Request.java sun/misc/SCCS/s.RequestProcessor.java sun/misc/SCCS/s.Resource.java sun/misc/SCCS/s.SelfTest.java sun/misc/SCCS/s.Service.java sun/misc/SCCS/s.SharedSecrets.java sun/misc/SCCS/s.Sort.java sun/misc/SCCS/s.ServiceConfigurationError.java sun/misc/SCCS/s.Signal.java sun/misc/SCCS/s.SignalHandler.java sun/misc/SCCS/s.SoftCache.java sun/misc/SCCS/s.Timeable.java sun/misc/SCCS/s.Timer.java sun/misc/SCCS/s.UCDecoder.java sun/misc/SCCS/s.UCEncoder.java sun/misc/SCCS/s.URLClassPath.java sun/misc/SCCS/s.UUDecoder.java sun/misc/SCCS/s.UUEncoder.java sun/misc/SCCS/s.Unsafe.java sun/misc/SCCS/s.VM.java sun/misc/SCCS/s.VMNotification.java sun/misc/SCCS/s.Version-template.java sun/misc/resources sun/misc/resources/SCCS sun/misc/resources/SCCS/s.Messages_de.java sun/misc/resources/SCCS/s.Messages.java sun/misc/resources/SCCS/s.Messages_es.java sun/misc/resources/SCCS/s.Messages_fr.java sun/misc/resources/SCCS/s.Messages_it.java sun/misc/resources/SCCS/s.Messages_ja.java sun/misc/resources/SCCS/s.Messages_ko.java sun/misc/resources/SCCS/s.Messages_sv.java sun/misc/resources/SCCS/s.Messages_zh_CN.java sun/misc/resources/SCCS/s.Messages_zh_TW.java sun/misc/resources/Messages_de.java sun/misc/resources/Messages.java sun/misc/resources/Messages_es.java sun/misc/resources/Messages_fr.java sun/misc/resources/Messages_it.java sun/misc/resources/Messages_ja.java sun/misc/resources/Messages_ko.java sun/misc/resources/Messages_sv.java sun/misc/resources/Messages_zh_CN.java sun/misc/resources/Messages_zh_TW.java sun/misc/CRC16.java sun/misc/ASCIICaseInsensitiveComparator.java sun/misc/AtomicLong.java sun/misc/AtomicLongCSImpl.java sun/misc/AtomicLongLockImpl.java sun/misc/BASE64Decoder.java sun/misc/BASE64Encoder.java sun/misc/CEFormatException.java sun/misc/CEStreamExhausted.java sun/misc/Cache.java sun/misc/CharacterDecoder.java sun/misc/CharacterEncoder.java sun/misc/ClassFileTransformer.java sun/misc/Cleaner.java sun/misc/ExtensionDependency.java sun/misc/Compare.java sun/misc/ConditionLock.java sun/misc/CompoundEnumeration.java sun/misc/DoubleConsts.java sun/misc/GC.java sun/misc/ExtensionInfo.java sun/misc/ExtensionInstallationException.java sun/misc/ExtensionInstallationProvider.java sun/misc/FloatConsts.java sun/misc/FloatingDecimal.java sun/misc/FormattedFloatingDecimal.java sun/misc/FpUtils.java sun/misc/HexDumpEncoder.java sun/misc/MessageUtils.java sun/misc/Lock.java sun/misc/InvalidJarIndexException.java sun/misc/JarFilter.java sun/misc/JarIndex.java sun/misc/JavaLangAccess.java sun/misc/JavaUtilJarAccess.java sun/misc/LRUCache.java sun/misc/Launcher.java sun/misc/ServiceConfigurationError.java sun/misc/NativeSignalHandler.java sun/misc/Perf.java sun/misc/PerformanceLogger.java sun/misc/ProxyGenerator.java sun/misc/Queue.java sun/misc/REException.java sun/misc/Ref.java sun/misc/Regexp.java sun/misc/RegexpPool.java sun/misc/RegexpTarget.java sun/misc/Request.java sun/misc/RequestProcessor.java sun/misc/Resource.java sun/misc/SelfTest.java sun/misc/Service.java sun/misc/Version-template.java sun/misc/SharedSecrets.java sun/misc/Signal.java sun/misc/SignalHandler.java sun/misc/SoftCache.java sun/misc/Sort.java sun/misc/Timeable.java sun/misc/Timer.java sun/misc/UCDecoder.java sun/misc/UCEncoder.java sun/misc/URLClassPath.java sun/misc/UUDecoder.java sun/misc/UUEncoder.java sun/misc/Unsafe.java sun/misc/VM.java sun/misc/VMNotification.java sun/net sun/net/SCCS sun/net/SCCS/s.ConnectionResetException.java sun/net/SCCS/s.InetAddressCachePolicy.java sun/net/SCCS/s.NetProperties.java sun/net/SCCS/s.NetworkClient.java sun/net/SCCS/s.NetworkServer.java sun/net/SCCS/s.ProgressEvent.java sun/net/SCCS/s.ProgressListener.java sun/net/SCCS/s.ProgressMeteringPolicy.java sun/net/SCCS/s.ProgressMonitor.java sun/net/SCCS/s.ProgressSource.java sun/net/SCCS/s.TelnetInputStream.java sun/net/SCCS/s.TelnetOutputStream.java sun/net/SCCS/s.TelnetProtocolException.java sun/net/SCCS/s.URLCanonicalizer.java sun/net/SCCS/s.TransferProtocolClient.java sun/net/dns sun/net/dns/SCCS sun/net/dns/SCCS/s.ResolverConfiguration.java sun/net/dns/ResolverConfiguration.java sun/net/ftp sun/net/ftp/SCCS sun/net/ftp/SCCS/s.FtpLoginException.java sun/net/ftp/SCCS/s.FtpClient.java sun/net/ftp/SCCS/s.FtpProtocolException.java sun/net/ftp/FtpLoginException.java sun/net/ftp/FtpClient.java sun/net/ftp/FtpProtocolException.java sun/net/smtp sun/net/smtp/SCCS sun/net/smtp/SCCS/s.SmtpClient.java sun/net/smtp/SCCS/s.SmtpProtocolException.java sun/net/smtp/SmtpClient.java sun/net/smtp/SmtpProtocolException.java sun/net/spi sun/net/spi/SCCS sun/net/spi/SCCS/s.DefaultProxySelector.java sun/net/spi/nameservice sun/net/spi/nameservice/SCCS sun/net/spi/nameservice/SCCS/s.NameService.java sun/net/spi/nameservice/SCCS/s.NameServiceDescriptor.java sun/net/spi/nameservice/dns sun/net/spi/nameservice/dns/META-INF sun/net/spi/nameservice/dns/META-INF/services sun/net/spi/nameservice/dns/META-INF/services/SCCS sun/net/spi/nameservice/dns/META-INF/services/SCCS/s.sun.net.spi.nameservice.NameServiceDescriptor sun/net/spi/nameservice/dns/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor sun/net/spi/nameservice/dns/SCCS sun/net/spi/nameservice/dns/SCCS/s.DNSNameServiceDescriptor.java sun/net/spi/nameservice/dns/SCCS/s.DNSNameService.java sun/net/spi/nameservice/dns/DNSNameService.java sun/net/spi/nameservice/dns/DNSNameServiceDescriptor.java sun/net/spi/nameservice/NameServiceDescriptor.java sun/net/spi/nameservice/NameService.java sun/net/spi/DefaultProxySelector.java sun/net/util sun/net/util/SCCS sun/net/util/SCCS/s.IPAddressUtil.java sun/net/util/IPAddressUtil.java sun/net/www sun/net/www/SCCS sun/net/www/SCCS/s.ApplicationLaunchException.java sun/net/www/SCCS/s.HeaderParser.java sun/net/www/SCCS/s.MessageHeader.java sun/net/www/SCCS/s.MeteredStream.java sun/net/www/SCCS/s.MimeEntry.java sun/net/www/SCCS/s.MimeLauncher.java sun/net/www/SCCS/s.MimeTable.java sun/net/www/SCCS/s.ParseUtil.java sun/net/www/SCCS/s.URLConnection.java sun/net/www/content sun/net/www/content/audio sun/net/www/content/audio/SCCS sun/net/www/content/audio/SCCS/s.basic.java sun/net/www/content/audio/SCCS/s.aiff.java sun/net/www/content/audio/SCCS/s.wav.java sun/net/www/content/audio/SCCS/s.x_aiff.java sun/net/www/content/audio/SCCS/s.x_wav.java sun/net/www/content/audio/aiff.java sun/net/www/content/audio/basic.java sun/net/www/content/audio/wav.java sun/net/www/content/audio/x_aiff.java sun/net/www/content/audio/x_wav.java sun/net/www/content/image sun/net/www/content/image/SCCS sun/net/www/content/image/SCCS/s.x_xbitmap.java sun/net/www/content/image/SCCS/s.gif.java sun/net/www/content/image/SCCS/s.jpeg.java sun/net/www/content/image/SCCS/s.png.java sun/net/www/content/image/SCCS/s.x_xpixmap.java sun/net/www/content/image/x_xbitmap.java sun/net/www/content/image/gif.java sun/net/www/content/image/jpeg.java sun/net/www/content/image/png.java sun/net/www/content/image/x_xpixmap.java sun/net/www/content/text sun/net/www/content/text/SCCS sun/net/www/content/text/SCCS/s.Generic.java sun/net/www/content/text/SCCS/s.plain.java sun/net/www/content/text/SCCS/s.PlainTextInputStream.java sun/net/www/content/text/Generic.java sun/net/www/content/text/plain.java sun/net/www/content/text/PlainTextInputStream.java sun/net/www/http sun/net/www/http/SCCS sun/net/www/http/SCCS/s.ChunkedInputStream.java sun/net/www/http/SCCS/s.ChunkedOutputStream.java sun/net/www/http/SCCS/s.HttpClient.java sun/net/www/http/SCCS/s.Hurryable.java sun/net/www/http/SCCS/s.KeepAliveCache.java sun/net/www/http/SCCS/s.KeepAliveStream.java sun/net/www/http/SCCS/s.PosterOutputStream.java sun/net/www/http/ChunkedOutputStream.java sun/net/www/http/ChunkedInputStream.java sun/net/www/http/KeepAliveStream.java sun/net/www/http/HttpClient.java sun/net/www/http/Hurryable.java sun/net/www/http/KeepAliveCache.java sun/net/www/http/PosterOutputStream.java sun/net/www/protocol sun/net/www/protocol/doc sun/net/www/protocol/doc/SCCS sun/net/www/protocol/doc/SCCS/s.DocURLConnection.java sun/net/www/protocol/doc/SCCS/s.Handler.java sun/net/www/protocol/doc/DocURLConnection.java sun/net/www/protocol/doc/Handler.java sun/net/www/protocol/file sun/net/www/protocol/file/SCCS sun/net/www/protocol/file/SCCS/s.FileURLConnection.java sun/net/www/protocol/file/FileURLConnection.java sun/net/www/protocol/ftp sun/net/www/protocol/ftp/SCCS sun/net/www/protocol/ftp/SCCS/s.FtpURLConnection.java sun/net/www/protocol/ftp/SCCS/s.Handler.java sun/net/www/protocol/ftp/FtpURLConnection.java sun/net/www/protocol/ftp/Handler.java sun/net/www/protocol/gopher sun/net/www/protocol/gopher/SCCS sun/net/www/protocol/gopher/SCCS/s.GopherClient.java sun/net/www/protocol/gopher/SCCS/s.Handler.java sun/net/www/protocol/gopher/GopherClient.java sun/net/www/protocol/gopher/Handler.java sun/net/www/protocol/http sun/net/www/protocol/http/SCCS sun/net/www/protocol/http/SCCS/s.AuthCacheImpl.java sun/net/www/protocol/http/SCCS/s.AuthCache.java sun/net/www/protocol/http/SCCS/s.AuthCacheValue.java sun/net/www/protocol/http/SCCS/s.AuthenticationHeader.java sun/net/www/protocol/http/SCCS/s.AuthenticationInfo.java sun/net/www/protocol/http/SCCS/s.BasicAuthentication.java sun/net/www/protocol/http/SCCS/s.DigestAuthentication.java sun/net/www/protocol/http/SCCS/s.Handler.java sun/net/www/protocol/http/SCCS/s.HttpAuthenticator.java sun/net/www/protocol/http/SCCS/s.HttpURLConnection.java sun/net/www/protocol/http/SCCS/s.NTLMAuthentication.java sun/net/www/protocol/http/AuthCacheImpl.java sun/net/www/protocol/http/AuthCache.java sun/net/www/protocol/http/AuthenticationHeader.java sun/net/www/protocol/http/AuthCacheValue.java sun/net/www/protocol/http/AuthenticationInfo.java sun/net/www/protocol/http/BasicAuthentication.java sun/net/www/protocol/http/DigestAuthentication.java sun/net/www/protocol/http/Handler.java sun/net/www/protocol/http/HttpAuthenticator.java sun/net/www/protocol/http/HttpURLConnection.java sun/net/www/protocol/http/NTLMAuthentication.java sun/net/www/protocol/jar sun/net/www/protocol/jar/SCCS sun/net/www/protocol/jar/SCCS/s.JarURLConnection.java sun/net/www/protocol/jar/SCCS/s.Handler.java sun/net/www/protocol/jar/SCCS/s.URLJarFileCallBack.java sun/net/www/protocol/jar/SCCS/s.URLJarFile.java sun/net/www/protocol/jar/JarURLConnection.java sun/net/www/protocol/jar/Handler.java sun/net/www/protocol/jar/URLJarFileCallBack.java sun/net/www/protocol/jar/URLJarFile.java sun/net/www/protocol/mailto sun/net/www/protocol/mailto/SCCS sun/net/www/protocol/mailto/SCCS/s.Handler.java sun/net/www/protocol/mailto/SCCS/s.MailToURLConnection.java sun/net/www/protocol/mailto/Handler.java sun/net/www/protocol/mailto/MailToURLConnection.java sun/net/www/protocol/netdoc sun/net/www/protocol/netdoc/SCCS sun/net/www/protocol/netdoc/SCCS/s.Handler.java sun/net/www/protocol/netdoc/Handler.java sun/net/www/protocol/systemresource sun/net/www/protocol/systemresource/SCCS sun/net/www/protocol/systemresource/SCCS/s.Handler.java sun/net/www/protocol/systemresource/SCCS/s.SystemResourceURLConnection.java sun/net/www/protocol/systemresource/Handler.java sun/net/www/protocol/systemresource/SystemResourceURLConnection.java sun/net/www/protocol/verbatim sun/net/www/protocol/verbatim/SCCS sun/net/www/protocol/verbatim/SCCS/s.Handler.java sun/net/www/protocol/verbatim/Handler.java sun/net/www/ApplicationLaunchException.java sun/net/www/HeaderParser.java sun/net/www/MessageHeader.java sun/net/www/MeteredStream.java sun/net/www/MimeEntry.java sun/net/www/MimeLauncher.java sun/net/www/MimeTable.java sun/net/www/ParseUtil.java sun/net/www/URLConnection.java sun/net/TelnetProtocolException.java sun/net/ConnectionResetException.java sun/net/InetAddressCachePolicy.java sun/net/NetProperties.java sun/net/NetworkClient.java sun/net/NetworkServer.java sun/net/ProgressEvent.java sun/net/ProgressListener.java sun/net/ProgressMeteringPolicy.java sun/net/ProgressMonitor.java sun/net/ProgressSource.java sun/net/TelnetInputStream.java sun/net/TelnetOutputStream.java sun/net/TransferProtocolClient.java sun/net/URLCanonicalizer.java sun/nio sun/nio/SCCS sun/nio/SCCS/s.ByteBuffered.java sun/nio/ch sun/nio/ch/SCCS sun/nio/ch/SCCS/s.Net.java sun/nio/ch/SCCS/s.AbstractPollArrayWrapper.java sun/nio/ch/SCCS/s.AbstractPollSelectorImpl.java sun/nio/ch/SCCS/s.AllocatedNativeObject.java sun/nio/ch/SCCS/s.ChannelInputStream.java sun/nio/ch/SCCS/s.DatagramChannelImpl.java sun/nio/ch/SCCS/s.DatagramSocketAdaptor.java sun/nio/ch/SCCS/s.DevPollSelectorProvider.java sun/nio/ch/SCCS/s.DirectBuffer.java sun/nio/ch/SCCS/s.FileChannelImpl.java sun/nio/ch/SCCS/s.FileLockImpl.java sun/nio/ch/SCCS/s.IOStatus.java sun/nio/ch/SCCS/s.IOUtil.java sun/nio/ch/SCCS/s.IOVecWrapper.java sun/nio/ch/SCCS/s.SelChImpl.java sun/nio/ch/SCCS/s.Interruptible.java sun/nio/ch/SCCS/s.NativeDispatcher.java sun/nio/ch/SCCS/s.NativeObject.java sun/nio/ch/SCCS/s.NativeThreadSet.java sun/nio/ch/SCCS/s.PollSelectorProvider.java sun/nio/ch/SCCS/s.OptionAdaptor.java sun/nio/ch/SCCS/s.Reflect.java sun/nio/ch/SCCS/s.ServerSocketChannelImpl.java sun/nio/ch/SCCS/s.SelectionKeyImpl.java sun/nio/ch/SCCS/s.SelectorImpl.java sun/nio/ch/SCCS/s.SelectorProviderImpl.java sun/nio/ch/SCCS/s.ServerSocketAdaptor.java sun/nio/ch/SCCS/s.SocketAdaptor.java sun/nio/ch/SCCS/s.SocketChannelImpl.java sun/nio/ch/SCCS/s.SocketOpts.java sun/nio/ch/SCCS/s.Util.java sun/nio/ch/SCCS/s.SocketOptsImpl.java sun/nio/ch/SCCS/s.exceptions sun/nio/ch/IOVecWrapper.java sun/nio/ch/IOUtil.java sun/nio/ch/AbstractPollArrayWrapper.java sun/nio/ch/AbstractPollSelectorImpl.java sun/nio/ch/AllocatedNativeObject.java sun/nio/ch/ChannelInputStream.java sun/nio/ch/DatagramChannelImpl.java sun/nio/ch/DatagramSocketAdaptor.java sun/nio/ch/DevPollSelectorProvider.java sun/nio/ch/DirectBuffer.java sun/nio/ch/FileChannelImpl.java sun/nio/ch/FileLockImpl.java sun/nio/ch/IOStatus.java sun/nio/ch/OptionAdaptor.java sun/nio/ch/Net.java sun/nio/ch/Interruptible.java sun/nio/ch/NativeDispatcher.java sun/nio/ch/NativeObject.java sun/nio/ch/NativeThreadSet.java sun/nio/ch/ServerSocketChannelImpl.java sun/nio/ch/PollSelectorProvider.java sun/nio/ch/Reflect.java sun/nio/ch/SelChImpl.java sun/nio/ch/SelectionKeyImpl.java sun/nio/ch/SelectorImpl.java sun/nio/ch/SelectorProviderImpl.java sun/nio/ch/ServerSocketAdaptor.java sun/nio/ch/SocketAdaptor.java sun/nio/ch/SocketChannelImpl.java sun/nio/ch/SocketOpts.java sun/nio/ch/SocketOptsImpl.java sun/nio/ch/Util.java sun/nio/ch/exceptions sun/nio/cs sun/nio/cs/SCCS sun/nio/cs/SCCS/s.AbstractCharsetProvider.java sun/nio/cs/SCCS/s.FastCharsetProvider.java sun/nio/cs/SCCS/s.HistoricallyNamedCharset.java sun/nio/cs/SCCS/s.ISO_8859_1.java sun/nio/cs/SCCS/s.ISO_8859_13.java sun/nio/cs/SCCS/s.ISO_8859_15.java sun/nio/cs/SCCS/s.ISO_8859_2.java sun/nio/cs/SCCS/s.ISO_8859_4.java sun/nio/cs/SCCS/s.ISO_8859_5.java sun/nio/cs/SCCS/s.ISO_8859_7.java sun/nio/cs/SCCS/s.ISO_8859_9.java sun/nio/cs/SCCS/s.KOI8_R.java sun/nio/cs/SCCS/s.MS1250.java sun/nio/cs/SCCS/s.MS1251.java sun/nio/cs/SCCS/s.MS1252.java sun/nio/cs/SCCS/s.MS1253.java sun/nio/cs/SCCS/s.MS1254.java sun/nio/cs/SCCS/s.MS1257.java sun/nio/cs/SCCS/s.SingleByteDecoder.java sun/nio/cs/SCCS/s.SingleByteEncoder.java sun/nio/cs/SCCS/s.StreamDecoder.java sun/nio/cs/SCCS/s.StreamEncoder.java sun/nio/cs/SCCS/s.Surrogate.java sun/nio/cs/SCCS/s.ThreadLocalCoders.java sun/nio/cs/SCCS/s.US_ASCII.java sun/nio/cs/SCCS/s.UTF_16.java sun/nio/cs/SCCS/s.UTF_16BE.java sun/nio/cs/SCCS/s.UTF_16LE.java sun/nio/cs/SCCS/s.UTF_8.java sun/nio/cs/SCCS/s.UnicodeDecoder.java sun/nio/cs/SCCS/s.UnicodeEncoder.java sun/nio/cs/SCCS/s.standard-charsets sun/nio/cs/SCCS/s.UTF_16LE_BOM.java sun/nio/cs/SCCS/s.Unicode.java sun/nio/cs/ext sun/nio/cs/ext/META-INF sun/nio/cs/ext/META-INF/services sun/nio/cs/ext/META-INF/services/SCCS sun/nio/cs/ext/META-INF/services/SCCS/s.java.nio.charset.spi.CharsetProvider sun/nio/cs/ext/META-INF/services/java.nio.charset.spi.CharsetProvider sun/nio/cs/ext/SCCS sun/nio/cs/ext/SCCS/s.Big5_HKSCS.java sun/nio/cs/ext/SCCS/s.Big5.java sun/nio/cs/ext/SCCS/s.DBCSDecoderMapping.java sun/nio/cs/ext/SCCS/s.Big5_Solaris.java sun/nio/cs/ext/SCCS/s.GBK.java sun/nio/cs/ext/SCCS/s.DBCS_IBM_ASCII_Decoder.java sun/nio/cs/ext/SCCS/s.DBCS_IBM_ASCII_Encoder.java sun/nio/cs/ext/SCCS/s.DBCS_IBM_EBCDIC_Decoder.java sun/nio/cs/ext/SCCS/s.DBCS_IBM_EBCDIC_Encoder.java sun/nio/cs/ext/SCCS/s.DelegatableDecoder.java sun/nio/cs/ext/SCCS/s.DoubleByteDecoder.java sun/nio/cs/ext/SCCS/s.DoubleByteEncoder.java sun/nio/cs/ext/SCCS/s.EUC_CN.java sun/nio/cs/ext/SCCS/s.EUC_JP.java sun/nio/cs/ext/SCCS/s.JIS_X_0208_Decoder.java sun/nio/cs/ext/SCCS/s.EUC_JP_LINUX.java sun/nio/cs/ext/SCCS/s.EUC_JP_Open.java sun/nio/cs/ext/SCCS/s.EUC_KR.java sun/nio/cs/ext/SCCS/s.EUC_TW.java sun/nio/cs/ext/SCCS/s.ExtendedCharsets.java sun/nio/cs/ext/SCCS/s.GB18030.java sun/nio/cs/ext/SCCS/s.HKSCS.java sun/nio/cs/ext/SCCS/s.HKSCS_2001.java sun/nio/cs/ext/SCCS/s.IBM037.java sun/nio/cs/ext/SCCS/s.IBM1006.java sun/nio/cs/ext/SCCS/s.IBM1025.java sun/nio/cs/ext/SCCS/s.IBM1026.java sun/nio/cs/ext/SCCS/s.IBM1046.java sun/nio/cs/ext/SCCS/s.IBM1047.java sun/nio/cs/ext/SCCS/s.IBM1097.java sun/nio/cs/ext/SCCS/s.IBM1098.java sun/nio/cs/ext/SCCS/s.IBM1112.java sun/nio/cs/ext/SCCS/s.IBM1122.java sun/nio/cs/ext/SCCS/s.IBM1123.java sun/nio/cs/ext/SCCS/s.IBM1124.java sun/nio/cs/ext/SCCS/s.IBM1140.java sun/nio/cs/ext/SCCS/s.IBM1141.java sun/nio/cs/ext/SCCS/s.IBM1142.java sun/nio/cs/ext/SCCS/s.IBM1143.java sun/nio/cs/ext/SCCS/s.IBM1144.java sun/nio/cs/ext/SCCS/s.IBM1145.java sun/nio/cs/ext/SCCS/s.IBM1146.java sun/nio/cs/ext/SCCS/s.IBM1147.java sun/nio/cs/ext/SCCS/s.IBM1148.java sun/nio/cs/ext/SCCS/s.IBM1149.java sun/nio/cs/ext/SCCS/s.IBM1381.java sun/nio/cs/ext/SCCS/s.IBM1383.java sun/nio/cs/ext/SCCS/s.IBM273.java sun/nio/cs/ext/SCCS/s.IBM277.java sun/nio/cs/ext/SCCS/s.IBM278.java sun/nio/cs/ext/SCCS/s.IBM280.java sun/nio/cs/ext/SCCS/s.IBM284.java sun/nio/cs/ext/SCCS/s.IBM285.java sun/nio/cs/ext/SCCS/s.IBM297.java sun/nio/cs/ext/SCCS/s.IBM33722.java sun/nio/cs/ext/SCCS/s.IBM420.java sun/nio/cs/ext/SCCS/s.IBM424.java sun/nio/cs/ext/SCCS/s.IBM437.java sun/nio/cs/ext/SCCS/s.IBM500.java sun/nio/cs/ext/SCCS/s.IBM737.java sun/nio/cs/ext/SCCS/s.IBM775.java sun/nio/cs/ext/SCCS/s.IBM838.java sun/nio/cs/ext/SCCS/s.IBM850.java sun/nio/cs/ext/SCCS/s.IBM852.java sun/nio/cs/ext/SCCS/s.IBM855.java sun/nio/cs/ext/SCCS/s.IBM856.java sun/nio/cs/ext/SCCS/s.IBM857.java sun/nio/cs/ext/SCCS/s.IBM858.java sun/nio/cs/ext/SCCS/s.IBM860.java sun/nio/cs/ext/SCCS/s.IBM861.java sun/nio/cs/ext/SCCS/s.IBM862.java sun/nio/cs/ext/SCCS/s.IBM863.java sun/nio/cs/ext/SCCS/s.IBM864.java sun/nio/cs/ext/SCCS/s.IBM865.java sun/nio/cs/ext/SCCS/s.IBM866.java sun/nio/cs/ext/SCCS/s.IBM868.java sun/nio/cs/ext/SCCS/s.IBM869.java sun/nio/cs/ext/SCCS/s.IBM870.java sun/nio/cs/ext/SCCS/s.IBM871.java sun/nio/cs/ext/SCCS/s.IBM874.java sun/nio/cs/ext/SCCS/s.IBM875.java sun/nio/cs/ext/SCCS/s.IBM918.java sun/nio/cs/ext/SCCS/s.IBM921.java sun/nio/cs/ext/SCCS/s.IBM922.java sun/nio/cs/ext/SCCS/s.IBM930.java sun/nio/cs/ext/SCCS/s.IBM933.java sun/nio/cs/ext/SCCS/s.IBM935.java sun/nio/cs/ext/SCCS/s.IBM937.java sun/nio/cs/ext/SCCS/s.IBM939.java sun/nio/cs/ext/SCCS/s.IBM942.java sun/nio/cs/ext/SCCS/s.IBM942C.java sun/nio/cs/ext/SCCS/s.IBM943.java sun/nio/cs/ext/SCCS/s.IBM943C.java sun/nio/cs/ext/SCCS/s.IBM948.java sun/nio/cs/ext/SCCS/s.IBM949.java sun/nio/cs/ext/SCCS/s.IBM949C.java sun/nio/cs/ext/SCCS/s.IBM950.java sun/nio/cs/ext/SCCS/s.IBM964.java sun/nio/cs/ext/SCCS/s.IBM970.java sun/nio/cs/ext/SCCS/s.ISCII91.java sun/nio/cs/ext/SCCS/s.ISO2022.java sun/nio/cs/ext/SCCS/s.ISO2022_CN.java sun/nio/cs/ext/SCCS/s.ISO2022_CN_CNS.java sun/nio/cs/ext/SCCS/s.ISO2022_CN_GB.java sun/nio/cs/ext/SCCS/s.ISO2022_JP.java sun/nio/cs/ext/SCCS/s.ISO2022_KR.java sun/nio/cs/ext/SCCS/s.ISO_8859_11.java sun/nio/cs/ext/SCCS/s.ISO_8859_3.java sun/nio/cs/ext/SCCS/s.ISO_8859_6.java sun/nio/cs/ext/SCCS/s.ISO_8859_8.java sun/nio/cs/ext/SCCS/s.JISAutoDetect.java sun/nio/cs/ext/SCCS/s.JIS_X_0201.java sun/nio/cs/ext/SCCS/s.JIS_X_0208.java sun/nio/cs/ext/SCCS/s.JIS_X_0208_Encoder.java sun/nio/cs/ext/SCCS/s.MS950_HKSCS.java sun/nio/cs/ext/SCCS/s.Johab.java sun/nio/cs/ext/SCCS/s.JIS_X_0208_Solaris_Decoder.java sun/nio/cs/ext/SCCS/s.JIS_X_0208_Solaris_Encoder.java sun/nio/cs/ext/SCCS/s.JIS_X_0212.java sun/nio/cs/ext/SCCS/s.JIS_X_0212_Decoder.java sun/nio/cs/ext/SCCS/s.JIS_X_0212_Encoder.java sun/nio/cs/ext/SCCS/s.JIS_X_0212_Solaris_Decoder.java sun/nio/cs/ext/SCCS/s.JIS_X_0212_Solaris_Encoder.java sun/nio/cs/ext/SCCS/s.MS1255.java sun/nio/cs/ext/SCCS/s.MS1256.java sun/nio/cs/ext/SCCS/s.MS1258.java sun/nio/cs/ext/SCCS/s.MS874.java sun/nio/cs/ext/SCCS/s.MS932.java sun/nio/cs/ext/SCCS/s.MS932DB.java sun/nio/cs/ext/SCCS/s.MS936.java sun/nio/cs/ext/SCCS/s.MS949.java sun/nio/cs/ext/SCCS/s.MS950.java sun/nio/cs/ext/SCCS/s.PCK.java sun/nio/cs/ext/SCCS/s.MacCentralEurope.java sun/nio/cs/ext/SCCS/s.MacArabic.java sun/nio/cs/ext/SCCS/s.MacCroatian.java sun/nio/cs/ext/SCCS/s.MacCyrillic.java sun/nio/cs/ext/SCCS/s.MacDingbat.java sun/nio/cs/ext/SCCS/s.MacGreek.java sun/nio/cs/ext/SCCS/s.MacHebrew.java sun/nio/cs/ext/SCCS/s.MacIceland.java sun/nio/cs/ext/SCCS/s.MacRoman.java sun/nio/cs/ext/SCCS/s.MacRomania.java sun/nio/cs/ext/SCCS/s.MacSymbol.java sun/nio/cs/ext/SCCS/s.MacThai.java sun/nio/cs/ext/SCCS/s.MacTurkish.java sun/nio/cs/ext/SCCS/s.MacUkraine.java sun/nio/cs/ext/SCCS/s.SJIS.java sun/nio/cs/ext/SCCS/s.SimpleEUCDecoder.java sun/nio/cs/ext/SCCS/s.SimpleEUCEncoder.java sun/nio/cs/ext/SCCS/s.TIS_620.java sun/nio/cs/ext/Big5_HKSCS.java sun/nio/cs/ext/Big5.java sun/nio/cs/ext/DBCS_IBM_ASCII_Decoder.java sun/nio/cs/ext/Big5_Solaris.java sun/nio/cs/ext/DBCSDecoderMapping.java sun/nio/cs/ext/EUC_CN.java sun/nio/cs/ext/DBCS_IBM_ASCII_Encoder.java sun/nio/cs/ext/DBCS_IBM_EBCDIC_Decoder.java sun/nio/cs/ext/DBCS_IBM_EBCDIC_Encoder.java sun/nio/cs/ext/DelegatableDecoder.java sun/nio/cs/ext/DoubleByteDecoder.java sun/nio/cs/ext/DoubleByteEncoder.java sun/nio/cs/ext/EUC_JP.java sun/nio/cs/ext/EUC_KR.java sun/nio/cs/ext/JIS_X_0208_Solaris_Decoder.java sun/nio/cs/ext/EUC_JP_LINUX.java sun/nio/cs/ext/EUC_JP_Open.java sun/nio/cs/ext/EUC_TW.java sun/nio/cs/ext/ExtendedCharsets.java sun/nio/cs/ext/GB18030.java sun/nio/cs/ext/GBK.java sun/nio/cs/ext/HKSCS.java sun/nio/cs/ext/HKSCS_2001.java sun/nio/cs/ext/IBM037.java sun/nio/cs/ext/IBM1006.java sun/nio/cs/ext/IBM1025.java sun/nio/cs/ext/IBM1026.java sun/nio/cs/ext/IBM1046.java sun/nio/cs/ext/IBM1047.java sun/nio/cs/ext/IBM1097.java sun/nio/cs/ext/IBM1098.java sun/nio/cs/ext/IBM1112.java sun/nio/cs/ext/IBM1122.java sun/nio/cs/ext/IBM1123.java sun/nio/cs/ext/IBM1124.java sun/nio/cs/ext/IBM1140.java sun/nio/cs/ext/IBM1141.java sun/nio/cs/ext/IBM1142.java sun/nio/cs/ext/IBM1143.java sun/nio/cs/ext/IBM1144.java sun/nio/cs/ext/IBM1145.java sun/nio/cs/ext/IBM1146.java sun/nio/cs/ext/IBM1147.java sun/nio/cs/ext/IBM1148.java sun/nio/cs/ext/IBM1149.java sun/nio/cs/ext/IBM1381.java sun/nio/cs/ext/IBM1383.java sun/nio/cs/ext/IBM273.java sun/nio/cs/ext/IBM277.java sun/nio/cs/ext/IBM278.java sun/nio/cs/ext/IBM280.java sun/nio/cs/ext/IBM284.java sun/nio/cs/ext/IBM285.java sun/nio/cs/ext/IBM297.java sun/nio/cs/ext/IBM33722.java sun/nio/cs/ext/IBM420.java sun/nio/cs/ext/IBM424.java sun/nio/cs/ext/IBM437.java sun/nio/cs/ext/IBM500.java sun/nio/cs/ext/IBM737.java sun/nio/cs/ext/IBM775.java sun/nio/cs/ext/IBM838.java sun/nio/cs/ext/IBM850.java sun/nio/cs/ext/IBM852.java sun/nio/cs/ext/IBM855.java sun/nio/cs/ext/IBM856.java sun/nio/cs/ext/IBM857.java sun/nio/cs/ext/IBM858.java sun/nio/cs/ext/IBM860.java sun/nio/cs/ext/IBM861.java sun/nio/cs/ext/IBM862.java sun/nio/cs/ext/IBM863.java sun/nio/cs/ext/IBM864.java sun/nio/cs/ext/IBM865.java sun/nio/cs/ext/IBM866.java sun/nio/cs/ext/IBM868.java sun/nio/cs/ext/IBM869.java sun/nio/cs/ext/IBM870.java sun/nio/cs/ext/IBM871.java sun/nio/cs/ext/IBM874.java sun/nio/cs/ext/IBM875.java sun/nio/cs/ext/IBM918.java sun/nio/cs/ext/IBM921.java sun/nio/cs/ext/IBM922.java sun/nio/cs/ext/IBM930.java sun/nio/cs/ext/IBM933.java sun/nio/cs/ext/IBM935.java sun/nio/cs/ext/IBM937.java sun/nio/cs/ext/IBM939.java sun/nio/cs/ext/IBM942.java sun/nio/cs/ext/IBM942C.java sun/nio/cs/ext/IBM943.java sun/nio/cs/ext/IBM943C.java sun/nio/cs/ext/IBM948.java sun/nio/cs/ext/IBM949.java sun/nio/cs/ext/IBM949C.java sun/nio/cs/ext/IBM950.java sun/nio/cs/ext/IBM964.java sun/nio/cs/ext/IBM970.java sun/nio/cs/ext/ISCII91.java sun/nio/cs/ext/ISO2022.java sun/nio/cs/ext/ISO2022_CN.java sun/nio/cs/ext/ISO2022_CN_CNS.java sun/nio/cs/ext/ISO2022_CN_GB.java sun/nio/cs/ext/ISO2022_JP.java sun/nio/cs/ext/ISO2022_KR.java sun/nio/cs/ext/ISO_8859_3.java sun/nio/cs/ext/ISO_8859_11.java sun/nio/cs/ext/ISO_8859_6.java sun/nio/cs/ext/ISO_8859_8.java sun/nio/cs/ext/JISAutoDetect.java sun/nio/cs/ext/JIS_X_0201.java sun/nio/cs/ext/JIS_X_0208.java sun/nio/cs/ext/JIS_X_0208_Decoder.java sun/nio/cs/ext/JIS_X_0208_Encoder.java sun/nio/cs/ext/MS932DB.java sun/nio/cs/ext/Johab.java sun/nio/cs/ext/JIS_X_0208_Solaris_Encoder.java sun/nio/cs/ext/JIS_X_0212.java sun/nio/cs/ext/JIS_X_0212_Decoder.java sun/nio/cs/ext/JIS_X_0212_Encoder.java sun/nio/cs/ext/JIS_X_0212_Solaris_Decoder.java sun/nio/cs/ext/JIS_X_0212_Solaris_Encoder.java sun/nio/cs/ext/MS1255.java sun/nio/cs/ext/MS1256.java sun/nio/cs/ext/MS1258.java sun/nio/cs/ext/MS874.java sun/nio/cs/ext/MS932.java sun/nio/cs/ext/MS950_HKSCS.java sun/nio/cs/ext/MS936.java sun/nio/cs/ext/MS949.java sun/nio/cs/ext/MS950.java sun/nio/cs/ext/MacCentralEurope.java sun/nio/cs/ext/MacArabic.java sun/nio/cs/ext/SimpleEUCDecoder.java sun/nio/cs/ext/MacCroatian.java sun/nio/cs/ext/MacCyrillic.java sun/nio/cs/ext/MacDingbat.java sun/nio/cs/ext/MacGreek.java sun/nio/cs/ext/MacHebrew.java sun/nio/cs/ext/MacIceland.java sun/nio/cs/ext/MacRoman.java sun/nio/cs/ext/MacRomania.java sun/nio/cs/ext/MacSymbol.java sun/nio/cs/ext/MacThai.java sun/nio/cs/ext/MacTurkish.java sun/nio/cs/ext/MacUkraine.java sun/nio/cs/ext/PCK.java sun/nio/cs/ext/SJIS.java sun/nio/cs/ext/SimpleEUCEncoder.java sun/nio/cs/ext/TIS_620.java sun/nio/cs/KOI8_R.java sun/nio/cs/AbstractCharsetProvider.java sun/nio/cs/FastCharsetProvider.java sun/nio/cs/HistoricallyNamedCharset.java sun/nio/cs/ISO_8859_1.java sun/nio/cs/ISO_8859_13.java sun/nio/cs/ISO_8859_15.java sun/nio/cs/ISO_8859_2.java sun/nio/cs/ISO_8859_4.java sun/nio/cs/ISO_8859_5.java sun/nio/cs/ISO_8859_7.java sun/nio/cs/ISO_8859_9.java sun/nio/cs/MS1250.java sun/nio/cs/MS1251.java sun/nio/cs/MS1252.java sun/nio/cs/MS1253.java sun/nio/cs/MS1254.java sun/nio/cs/MS1257.java sun/nio/cs/SingleByteDecoder.java sun/nio/cs/SingleByteEncoder.java sun/nio/cs/StreamDecoder.java sun/nio/cs/StreamEncoder.java sun/nio/cs/Surrogate.java sun/nio/cs/ThreadLocalCoders.java sun/nio/cs/US_ASCII.java sun/nio/cs/UTF_16.java sun/nio/cs/UTF_16BE.java sun/nio/cs/UTF_16LE.java sun/nio/cs/UTF_8.java sun/nio/cs/UnicodeDecoder.java sun/nio/cs/UnicodeEncoder.java sun/nio/cs/standard-charsets sun/nio/cs/UTF_16LE_BOM.java sun/nio/cs/Unicode.java sun/nio/ByteBuffered.java sun/print sun/print/SCCS sun/print/SCCS/s.BackgroundLookupListener.java sun/print/SCCS/s.AttributeUpdater.java sun/print/SCCS/s.BackgroundServiceLookup.java sun/print/SCCS/s.CustomMediaSizeName.java sun/print/SCCS/s.CustomMediaTray.java sun/print/SCCS/s.DialogTypeSelection.java sun/print/SCCS/s.ImagePrinter.java sun/print/SCCS/s.OpenBook.java sun/print/SCCS/s.PSPathGraphics.java sun/print/SCCS/s.PSPrinterJob.java sun/print/SCCS/s.PSStreamPrintJob.java sun/print/SCCS/s.PSStreamPrintService.java sun/print/SCCS/s.PSStreamPrinterFactory.java sun/print/SCCS/s.PageableDoc.java sun/print/SCCS/s.PathGraphics.java sun/print/SCCS/s.PeekGraphics.java sun/print/SCCS/s.PeekMetrics.java sun/print/SCCS/s.PrintJob2D.java sun/print/SCCS/s.PrintJobAttributeException.java sun/print/SCCS/s.PrintJobFlavorException.java sun/print/SCCS/s.ProxyGraphics.java sun/print/SCCS/s.ProxyGraphics2D.java sun/print/SCCS/s.ProxyPrintGraphics.java sun/print/SCCS/s.RasterPrinterJob.java sun/print/SCCS/s.ServiceDialog.java sun/print/SCCS/s.ServiceNotifier.java sun/print/SCCS/s.SunAlternateMedia.java sun/print/SCCS/s.SunMinMaxPage.java sun/print/SCCS/s.SunPageSelection.java sun/print/SCCS/s.SunPrinterJobService.java sun/print/SCCS/s.psfont.properties.ja sun/print/SCCS/s.psfontj2d.properties sun/print/SCCS/s.PrinterGraphicsConfig.java sun/print/SCCS/s.PrinterGraphicsDevice.java sun/print/resources sun/print/resources/SCCS sun/print/resources/SCCS/s.orientLandscape.gif sun/print/resources/SCCS/s.duplex.gif sun/print/resources/SCCS/s.oneside.gif sun/print/resources/SCCS/s.orientRevLandscape.gif sun/print/resources/SCCS/s.orientPortrait.gif sun/print/resources/SCCS/s.orientRevPortrait.gif sun/print/resources/SCCS/s.serviceui.properties sun/print/resources/SCCS/s.serviceui_de.properties sun/print/resources/SCCS/s.serviceui_es.properties sun/print/resources/SCCS/s.serviceui_fr.properties sun/print/resources/SCCS/s.serviceui_it.properties sun/print/resources/SCCS/s.serviceui_ja.properties sun/print/resources/SCCS/s.serviceui_ko.properties sun/print/resources/SCCS/s.tumble.gif sun/print/resources/SCCS/s.serviceui_sv.properties sun/print/resources/SCCS/s.serviceui_zh_CN.properties sun/print/resources/SCCS/s.serviceui_zh_TW.properties sun/print/resources/orientLandscape.gif sun/print/resources/duplex.gif sun/print/resources/oneside.gif sun/print/resources/orientRevLandscape.gif sun/print/resources/orientPortrait.gif sun/print/resources/orientRevPortrait.gif sun/print/resources/serviceui.properties sun/print/resources/serviceui_de.properties sun/print/resources/serviceui_es.properties sun/print/resources/serviceui_fr.properties sun/print/resources/serviceui_it.properties sun/print/resources/serviceui_ja.properties sun/print/resources/serviceui_ko.properties sun/print/resources/serviceui_sv.properties sun/print/resources/serviceui_zh_CN.properties sun/print/resources/tumble.gif sun/print/resources/serviceui_zh_TW.properties sun/print/BackgroundLookupListener.java sun/print/AttributeUpdater.java sun/print/BackgroundServiceLookup.java sun/print/CustomMediaSizeName.java sun/print/CustomMediaTray.java sun/print/DialogTypeSelection.java sun/print/ImagePrinter.java sun/print/OpenBook.java sun/print/PSPathGraphics.java sun/print/PSPrinterJob.java sun/print/PSStreamPrintJob.java sun/print/PSStreamPrintService.java sun/print/PSStreamPrinterFactory.java sun/print/PrintJob2D.java sun/print/PageableDoc.java sun/print/PathGraphics.java sun/print/PeekGraphics.java sun/print/PeekMetrics.java sun/print/PrintJobAttributeException.java sun/print/PrintJobFlavorException.java sun/print/ProxyGraphics.java sun/print/ProxyGraphics2D.java sun/print/ProxyPrintGraphics.java sun/print/RasterPrinterJob.java sun/print/ServiceDialog.java sun/print/ServiceNotifier.java sun/print/SunAlternateMedia.java sun/print/SunMinMaxPage.java sun/print/SunPageSelection.java sun/print/SunPrinterJobService.java sun/print/psfont.properties.ja sun/print/psfontj2d.properties sun/print/PrinterGraphicsConfig.java sun/print/PrinterGraphicsDevice.java sun/reflect sun/reflect/SCCS sun/reflect/SCCS/s.ConstructorAccessorImpl.java sun/reflect/SCCS/s.AccessorGenerator.java sun/reflect/SCCS/s.ByteVector.java sun/reflect/SCCS/s.ClassDefiner.java sun/reflect/SCCS/s.BootstrapConstructorAccessorImpl.java sun/reflect/SCCS/s.ByteVectorFactory.java sun/reflect/SCCS/s.ByteVectorImpl.java sun/reflect/SCCS/s.ClassFileAssembler.java sun/reflect/SCCS/s.ClassFileConstants.java sun/reflect/SCCS/s.ConstantPool.java sun/reflect/SCCS/s.ConstructorAccessor.java sun/reflect/SCCS/s.DelegatingMethodAccessorImpl.java sun/reflect/SCCS/s.UTF8.java sun/reflect/SCCS/s.FieldAccessor.java sun/reflect/SCCS/s.DelegatingConstructorAccessorImpl.java sun/reflect/SCCS/s.FieldAccessorImpl.java sun/reflect/SCCS/s.FieldInfo.java sun/reflect/SCCS/s.Label.java sun/reflect/SCCS/s.LangReflectAccess.java sun/reflect/SCCS/s.InstantiationExceptionConstructorAccessorImpl.java sun/reflect/SCCS/s.MagicAccessorImpl.java sun/reflect/SCCS/s.MethodAccessor.java sun/reflect/SCCS/s.MethodAccessorGenerator.java sun/reflect/SCCS/s.MethodAccessorImpl.java sun/reflect/SCCS/s.NativeConstructorAccessorImpl.java sun/reflect/SCCS/s.NativeMethodAccessorImpl.java sun/reflect/SCCS/s.Reflection.java sun/reflect/SCCS/s.ReflectionFactory.java sun/reflect/SCCS/s.SerializationConstructorAccessorImpl.java sun/reflect/SCCS/s.SignatureIterator.java sun/reflect/SCCS/s.UnsafeBooleanFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeByteFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeCharacterFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeDoubleFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeFieldAccessorFactory.java sun/reflect/SCCS/s.UnsafeFieldAccessorImpl.java sun/reflect/SCCS/s.package.html sun/reflect/SCCS/s.UnsafeFloatFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeIntegerFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeLongFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeObjectFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedBooleanFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedByteFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedCharacterFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedDoubleFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedFloatFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedIntegerFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedLongFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedObjectFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedShortFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedStaticBooleanFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedStaticByteFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedStaticCharacterFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedStaticDoubleFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeShortFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedStaticFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedStaticFloatFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedStaticIntegerFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedStaticLongFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedStaticObjectFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeQualifiedStaticShortFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeStaticBooleanFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeStaticByteFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeStaticFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeStaticCharacterFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeStaticDoubleFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeStaticFloatFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeStaticIntegerFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeStaticLongFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeStaticObjectFieldAccessorImpl.java sun/reflect/SCCS/s.UnsafeStaticShortFieldAccessorImpl.java sun/reflect/annotation sun/reflect/annotation/SCCS sun/reflect/annotation/SCCS/s.AnnotationTypeMismatchExceptionProxy.java sun/reflect/annotation/SCCS/s.AnnotationInvocationHandler.java sun/reflect/annotation/SCCS/s.AnnotationParser.java sun/reflect/annotation/SCCS/s.AnnotationType.java sun/reflect/annotation/SCCS/s.EnumConstantNotPresentExceptionProxy.java sun/reflect/annotation/SCCS/s.ExceptionProxy.java sun/reflect/annotation/SCCS/s.TypeNotPresentExceptionProxy.java sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java sun/reflect/annotation/AnnotationInvocationHandler.java sun/reflect/annotation/AnnotationParser.java sun/reflect/annotation/AnnotationType.java sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java sun/reflect/annotation/ExceptionProxy.java sun/reflect/annotation/TypeNotPresentExceptionProxy.java sun/reflect/generics sun/reflect/generics/factory sun/reflect/generics/factory/SCCS sun/reflect/generics/factory/SCCS/s.CoreReflectionFactory.java sun/reflect/generics/factory/SCCS/s.GenericsFactory.java sun/reflect/generics/factory/CoreReflectionFactory.java sun/reflect/generics/factory/GenericsFactory.java sun/reflect/generics/parser sun/reflect/generics/parser/SCCS sun/reflect/generics/parser/SCCS/s.SignatureParser.java sun/reflect/generics/parser/SignatureParser.java sun/reflect/generics/reflectiveObjects sun/reflect/generics/reflectiveObjects/SCCS sun/reflect/generics/reflectiveObjects/SCCS/s.NotImplementedException.java sun/reflect/generics/reflectiveObjects/SCCS/s.GenericArrayTypeImpl.java sun/reflect/generics/reflectiveObjects/SCCS/s.LazyReflectiveObjectGenerator.java sun/reflect/generics/reflectiveObjects/SCCS/s.ParameterizedTypeImpl.java sun/reflect/generics/reflectiveObjects/SCCS/s.TypeVariableImpl.java sun/reflect/generics/reflectiveObjects/SCCS/s.WildcardTypeImpl.java sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java sun/reflect/generics/reflectiveObjects/GenericArrayTypeImpl.java sun/reflect/generics/reflectiveObjects/NotImplementedException.java sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java sun/reflect/generics/reflectiveObjects/WildcardTypeImpl.java sun/reflect/generics/repository sun/reflect/generics/repository/SCCS sun/reflect/generics/repository/SCCS/s.ConstructorRepository.java sun/reflect/generics/repository/SCCS/s.AbstractRepository.java sun/reflect/generics/repository/SCCS/s.ClassRepository.java sun/reflect/generics/repository/SCCS/s.GenericDeclRepository.java sun/reflect/generics/repository/SCCS/s.FieldRepository.java sun/reflect/generics/repository/SCCS/s.MethodRepository.java sun/reflect/generics/repository/ConstructorRepository.java sun/reflect/generics/repository/AbstractRepository.java sun/reflect/generics/repository/ClassRepository.java sun/reflect/generics/repository/FieldRepository.java sun/reflect/generics/repository/GenericDeclRepository.java sun/reflect/generics/repository/MethodRepository.java sun/reflect/generics/scope sun/reflect/generics/scope/SCCS sun/reflect/generics/scope/SCCS/s.AbstractScope.java sun/reflect/generics/scope/SCCS/s.ClassScope.java sun/reflect/generics/scope/SCCS/s.ConstructorScope.java sun/reflect/generics/scope/SCCS/s.DummyScope.java sun/reflect/generics/scope/SCCS/s.MethodScope.java sun/reflect/generics/scope/SCCS/s.Scope.java sun/reflect/generics/scope/ConstructorScope.java sun/reflect/generics/scope/AbstractScope.java sun/reflect/generics/scope/ClassScope.java sun/reflect/generics/scope/DummyScope.java sun/reflect/generics/scope/MethodScope.java sun/reflect/generics/scope/Scope.java sun/reflect/generics/tree sun/reflect/generics/tree/SCCS sun/reflect/generics/tree/SCCS/s.ArrayTypeSignature.java sun/reflect/generics/tree/SCCS/s.BaseType.java sun/reflect/generics/tree/SCCS/s.BooleanSignature.java sun/reflect/generics/tree/SCCS/s.BottomSignature.java sun/reflect/generics/tree/SCCS/s.ByteSignature.java sun/reflect/generics/tree/SCCS/s.CharSignature.java sun/reflect/generics/tree/SCCS/s.ClassSignature.java sun/reflect/generics/tree/SCCS/s.ClassTypeSignature.java sun/reflect/generics/tree/SCCS/s.DoubleSignature.java sun/reflect/generics/tree/SCCS/s.FieldTypeSignature.java sun/reflect/generics/tree/SCCS/s.FloatSignature.java sun/reflect/generics/tree/SCCS/s.FormalTypeParameter.java sun/reflect/generics/tree/SCCS/s.IntSignature.java sun/reflect/generics/tree/SCCS/s.Tree.java sun/reflect/generics/tree/SCCS/s.LongSignature.java sun/reflect/generics/tree/SCCS/s.MethodTypeSignature.java sun/reflect/generics/tree/SCCS/s.ReturnType.java sun/reflect/generics/tree/SCCS/s.ShortSignature.java sun/reflect/generics/tree/SCCS/s.Signature.java sun/reflect/generics/tree/SCCS/s.SimpleClassTypeSignature.java sun/reflect/generics/tree/SCCS/s.TypeArgument.java sun/reflect/generics/tree/SCCS/s.TypeSignature.java sun/reflect/generics/tree/SCCS/s.TypeTree.java sun/reflect/generics/tree/SCCS/s.TypeVariableSignature.java sun/reflect/generics/tree/SCCS/s.VoidDescriptor.java sun/reflect/generics/tree/SCCS/s.Wildcard.java sun/reflect/generics/tree/FormalTypeParameter.java sun/reflect/generics/tree/ArrayTypeSignature.java sun/reflect/generics/tree/BaseType.java sun/reflect/generics/tree/BooleanSignature.java sun/reflect/generics/tree/BottomSignature.java sun/reflect/generics/tree/ByteSignature.java sun/reflect/generics/tree/CharSignature.java sun/reflect/generics/tree/ClassSignature.java sun/reflect/generics/tree/ClassTypeSignature.java sun/reflect/generics/tree/DoubleSignature.java sun/reflect/generics/tree/FieldTypeSignature.java sun/reflect/generics/tree/FloatSignature.java sun/reflect/generics/tree/IntSignature.java sun/reflect/generics/tree/LongSignature.java sun/reflect/generics/tree/TypeArgument.java sun/reflect/generics/tree/Tree.java sun/reflect/generics/tree/MethodTypeSignature.java sun/reflect/generics/tree/ReturnType.java sun/reflect/generics/tree/ShortSignature.java sun/reflect/generics/tree/Signature.java sun/reflect/generics/tree/SimpleClassTypeSignature.java sun/reflect/generics/tree/TypeVariableSignature.java sun/reflect/generics/tree/TypeSignature.java sun/reflect/generics/tree/TypeTree.java sun/reflect/generics/tree/VoidDescriptor.java sun/reflect/generics/tree/Wildcard.java sun/reflect/generics/visitor sun/reflect/generics/visitor/SCCS sun/reflect/generics/visitor/SCCS/s.TypeTreeVisitor.java sun/reflect/generics/visitor/SCCS/s.Reifier.java sun/reflect/generics/visitor/SCCS/s.Visitor.java sun/reflect/generics/visitor/TypeTreeVisitor.java sun/reflect/generics/visitor/Reifier.java sun/reflect/generics/visitor/Visitor.java sun/reflect/ConstructorAccessor.java sun/reflect/AccessorGenerator.java sun/reflect/ByteVector.java sun/reflect/ByteVectorFactory.java sun/reflect/BootstrapConstructorAccessorImpl.java sun/reflect/ByteVectorImpl.java sun/reflect/ClassDefiner.java sun/reflect/ClassFileAssembler.java sun/reflect/ClassFileConstants.java sun/reflect/ConstantPool.java sun/reflect/ConstructorAccessorImpl.java sun/reflect/FieldAccessor.java sun/reflect/MethodAccessorGenerator.java sun/reflect/DelegatingConstructorAccessorImpl.java sun/reflect/DelegatingMethodAccessorImpl.java sun/reflect/FieldAccessorImpl.java sun/reflect/FieldInfo.java sun/reflect/Label.java sun/reflect/LangReflectAccess.java sun/reflect/InstantiationExceptionConstructorAccessorImpl.java sun/reflect/MagicAccessorImpl.java sun/reflect/MethodAccessor.java sun/reflect/Reflection.java sun/reflect/MethodAccessorImpl.java sun/reflect/NativeConstructorAccessorImpl.java sun/reflect/NativeMethodAccessorImpl.java sun/reflect/SerializationConstructorAccessorImpl.java sun/reflect/ReflectionFactory.java sun/reflect/SignatureIterator.java sun/reflect/UTF8.java sun/reflect/UnsafeFieldAccessorFactory.java sun/reflect/UnsafeBooleanFieldAccessorImpl.java sun/reflect/UnsafeByteFieldAccessorImpl.java sun/reflect/UnsafeCharacterFieldAccessorImpl.java sun/reflect/UnsafeDoubleFieldAccessorImpl.java sun/reflect/UnsafeFieldAccessorImpl.java sun/reflect/UnsafeFloatFieldAccessorImpl.java sun/reflect/UnsafeIntegerFieldAccessorImpl.java sun/reflect/package.html sun/reflect/UnsafeLongFieldAccessorImpl.java sun/reflect/UnsafeObjectFieldAccessorImpl.java sun/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java sun/reflect/UnsafeQualifiedByteFieldAccessorImpl.java sun/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java sun/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java sun/reflect/UnsafeQualifiedFieldAccessorImpl.java sun/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java sun/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java sun/reflect/UnsafeQualifiedLongFieldAccessorImpl.java sun/reflect/UnsafeShortFieldAccessorImpl.java sun/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java sun/reflect/UnsafeQualifiedShortFieldAccessorImpl.java sun/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java sun/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java sun/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java sun/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java sun/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java sun/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java sun/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java sun/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java sun/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java sun/reflect/UnsafeStaticBooleanFieldAccessorImpl.java sun/reflect/UnsafeStaticByteFieldAccessorImpl.java sun/reflect/UnsafeStaticCharacterFieldAccessorImpl.java sun/reflect/UnsafeStaticDoubleFieldAccessorImpl.java sun/reflect/UnsafeStaticFieldAccessorImpl.java sun/reflect/UnsafeStaticFloatFieldAccessorImpl.java sun/reflect/UnsafeStaticIntegerFieldAccessorImpl.java sun/reflect/UnsafeStaticLongFieldAccessorImpl.java sun/reflect/UnsafeStaticObjectFieldAccessorImpl.java sun/reflect/UnsafeStaticShortFieldAccessorImpl.java sun/rmi sun/rmi/log sun/rmi/log/SCCS sun/rmi/log/SCCS/s.LogInputStream.java sun/rmi/log/SCCS/s.LogHandler.java sun/rmi/log/SCCS/s.LogOutputStream.java sun/rmi/log/SCCS/s.ReliableLog.java sun/rmi/log/LogInputStream.java sun/rmi/log/LogHandler.java sun/rmi/log/LogOutputStream.java sun/rmi/log/ReliableLog.java sun/rmi/registry sun/rmi/registry/SCCS sun/rmi/registry/SCCS/s.RegistryImpl.java sun/rmi/registry/resources sun/rmi/registry/resources/SCCS sun/rmi/registry/resources/SCCS/s.rmiregistry_zh_CN.properties sun/rmi/registry/resources/SCCS/s.rmiregistry.properties sun/rmi/registry/resources/SCCS/s.rmiregistry_de.properties sun/rmi/registry/resources/SCCS/s.rmiregistry_es.properties sun/rmi/registry/resources/SCCS/s.rmiregistry_fr.properties sun/rmi/registry/resources/SCCS/s.rmiregistry_it.properties sun/rmi/registry/resources/SCCS/s.rmiregistry_ja.properties sun/rmi/registry/resources/SCCS/s.rmiregistry_ko.properties sun/rmi/registry/resources/SCCS/s.rmiregistry_sv.properties sun/rmi/registry/resources/SCCS/s.rmiregistry_zh_TW.properties sun/rmi/registry/resources/rmiregistry_de.properties sun/rmi/registry/resources/rmiregistry.properties sun/rmi/registry/resources/rmiregistry_es.properties sun/rmi/registry/resources/rmiregistry_fr.properties sun/rmi/registry/resources/rmiregistry_it.properties sun/rmi/registry/resources/rmiregistry_ja.properties sun/rmi/registry/resources/rmiregistry_ko.properties sun/rmi/registry/resources/rmiregistry_sv.properties sun/rmi/registry/resources/rmiregistry_zh_CN.properties sun/rmi/registry/resources/rmiregistry_zh_TW.properties sun/rmi/registry/RegistryImpl.java sun/rmi/rmic sun/rmi/rmic/SCCS sun/rmi/rmic/SCCS/s.BatchEnvironment.java sun/rmi/rmic/SCCS/s.Constants.java sun/rmi/rmic/SCCS/s.Generator.java sun/rmi/rmic/SCCS/s.IndentingWriter.java sun/rmi/rmic/SCCS/s.Main.java sun/rmi/rmic/SCCS/s.Names.java sun/rmi/rmic/SCCS/s.RMIConstants.java sun/rmi/rmic/SCCS/s.RMIGenerator.java sun/rmi/rmic/SCCS/s.RemoteClass.java sun/rmi/rmic/SCCS/s.Util.java sun/rmi/rmic/iiop sun/rmi/rmic/iiop/SCCS sun/rmi/rmic/iiop/SCCS/s.BatchEnvironment.java sun/rmi/rmic/iiop/SCCS/s.AbstractType.java sun/rmi/rmic/iiop/SCCS/s.ArrayType.java sun/rmi/rmic/iiop/SCCS/s.ClassPathLoader.java sun/rmi/rmic/iiop/SCCS/s.ClassType.java sun/rmi/rmic/iiop/SCCS/s.CompoundType.java sun/rmi/rmic/iiop/SCCS/s.Constants.java sun/rmi/rmic/iiop/SCCS/s.ContextElement.java sun/rmi/rmic/iiop/SCCS/s.ContextStack.java sun/rmi/rmic/iiop/SCCS/s.DirectoryLoader.java sun/rmi/rmic/iiop/SCCS/s.Generator.java sun/rmi/rmic/iiop/SCCS/s.IDLGenerator.java sun/rmi/rmic/iiop/SCCS/s.IDLNames.java sun/rmi/rmic/iiop/SCCS/s.ImplementationType.java sun/rmi/rmic/iiop/SCCS/s.InterfaceType.java sun/rmi/rmic/iiop/SCCS/s.NCClassType.java sun/rmi/rmic/iiop/SCCS/s.NCInterfaceType.java sun/rmi/rmic/iiop/SCCS/s.NameContext.java sun/rmi/rmic/iiop/SCCS/s.PrimitiveType.java sun/rmi/rmic/iiop/SCCS/s.PrintGenerator.java sun/rmi/rmic/iiop/SCCS/s.RemoteType.java sun/rmi/rmic/iiop/SCCS/s.SpecialClassType.java sun/rmi/rmic/iiop/SCCS/s.SpecialInterfaceType.java sun/rmi/rmic/iiop/SCCS/s.StaticStringsHash.java sun/rmi/rmic/iiop/SCCS/s.StubGenerator.java sun/rmi/rmic/iiop/SCCS/s.Type.java sun/rmi/rmic/iiop/SCCS/s.Util.java sun/rmi/rmic/iiop/SCCS/s.ValueType.java sun/rmi/rmic/iiop/BatchEnvironment.java sun/rmi/rmic/iiop/AbstractType.java sun/rmi/rmic/iiop/ArrayType.java sun/rmi/rmic/iiop/ClassPathLoader.java sun/rmi/rmic/iiop/ClassType.java sun/rmi/rmic/iiop/CompoundType.java sun/rmi/rmic/iiop/Constants.java sun/rmi/rmic/iiop/ContextElement.java sun/rmi/rmic/iiop/ContextStack.java sun/rmi/rmic/iiop/DirectoryLoader.java sun/rmi/rmic/iiop/Generator.java sun/rmi/rmic/iiop/IDLGenerator.java sun/rmi/rmic/iiop/IDLNames.java sun/rmi/rmic/iiop/ImplementationType.java sun/rmi/rmic/iiop/InterfaceType.java sun/rmi/rmic/iiop/NCClassType.java sun/rmi/rmic/iiop/NameContext.java sun/rmi/rmic/iiop/NCInterfaceType.java sun/rmi/rmic/iiop/PrimitiveType.java sun/rmi/rmic/iiop/PrintGenerator.java sun/rmi/rmic/iiop/RemoteType.java sun/rmi/rmic/iiop/SpecialClassType.java sun/rmi/rmic/iiop/SpecialInterfaceType.java sun/rmi/rmic/iiop/StaticStringsHash.java sun/rmi/rmic/iiop/StubGenerator.java sun/rmi/rmic/iiop/Type.java sun/rmi/rmic/iiop/Util.java sun/rmi/rmic/iiop/ValueType.java sun/rmi/rmic/newrmic sun/rmi/rmic/newrmic/SCCS sun/rmi/rmic/newrmic/SCCS/s.BatchEnvironment.java sun/rmi/rmic/newrmic/SCCS/s.Constants.java sun/rmi/rmic/newrmic/SCCS/s.Generator.java sun/rmi/rmic/newrmic/SCCS/s.IndentingWriter.java sun/rmi/rmic/newrmic/SCCS/s.Main.java sun/rmi/rmic/newrmic/SCCS/s.Resources.java sun/rmi/rmic/newrmic/jrmp sun/rmi/rmic/newrmic/jrmp/SCCS sun/rmi/rmic/newrmic/jrmp/SCCS/s.JrmpGenerator.java sun/rmi/rmic/newrmic/jrmp/SCCS/s.Constants.java sun/rmi/rmic/newrmic/jrmp/SCCS/s.StubSkeletonWriter.java sun/rmi/rmic/newrmic/jrmp/SCCS/s.RemoteClass.java sun/rmi/rmic/newrmic/jrmp/SCCS/s.Util.java sun/rmi/rmic/newrmic/jrmp/JrmpGenerator.java sun/rmi/rmic/newrmic/jrmp/Constants.java sun/rmi/rmic/newrmic/jrmp/RemoteClass.java sun/rmi/rmic/newrmic/jrmp/StubSkeletonWriter.java sun/rmi/rmic/newrmic/jrmp/Util.java sun/rmi/rmic/newrmic/BatchEnvironment.java sun/rmi/rmic/newrmic/Constants.java sun/rmi/rmic/newrmic/Generator.java sun/rmi/rmic/newrmic/IndentingWriter.java sun/rmi/rmic/newrmic/Main.java sun/rmi/rmic/newrmic/Resources.java sun/rmi/rmic/resources sun/rmi/rmic/resources/SCCS sun/rmi/rmic/resources/SCCS/s.rmic_ja.properties sun/rmi/rmic/resources/SCCS/s.rmic.properties sun/rmi/rmic/resources/rmic_ja.properties sun/rmi/rmic/resources/rmic.properties sun/rmi/rmic/BatchEnvironment.java sun/rmi/rmic/Constants.java sun/rmi/rmic/Generator.java sun/rmi/rmic/IndentingWriter.java sun/rmi/rmic/Main.java sun/rmi/rmic/Names.java sun/rmi/rmic/RMIConstants.java sun/rmi/rmic/RMIGenerator.java sun/rmi/rmic/RemoteClass.java sun/rmi/rmic/Util.java sun/rmi/runtime sun/rmi/runtime/SCCS sun/rmi/runtime/SCCS/s.Executor.java sun/rmi/runtime/SCCS/s.Log.java sun/rmi/runtime/SCCS/s.WeakKey.java sun/rmi/runtime/SCCS/s.GetThreadPoolAction.java sun/rmi/runtime/SCCS/s.NewThreadAction.java sun/rmi/runtime/SCCS/s.ThreadPool.java sun/rmi/runtime/Executor.java sun/rmi/runtime/Log.java sun/rmi/runtime/ThreadPool.java sun/rmi/runtime/GetThreadPoolAction.java sun/rmi/runtime/NewThreadAction.java sun/rmi/runtime/WeakKey.java sun/rmi/server sun/rmi/server/SCCS sun/rmi/server/SCCS/s.ActivatableServerRef.java sun/rmi/server/SCCS/s.ActivatableRef.java sun/rmi/server/SCCS/s.ActivationGroupImpl.java sun/rmi/server/SCCS/s.Activation.java sun/rmi/server/SCCS/s.Util.java sun/rmi/server/SCCS/s.ActivationGroupInit.java sun/rmi/server/SCCS/s.Dispatcher.java sun/rmi/server/SCCS/s.LoaderHandler.java sun/rmi/server/SCCS/s.MarshalInputStream.java sun/rmi/server/SCCS/s.MarshalOutputStream.java sun/rmi/server/SCCS/s.UnicastRef.java sun/rmi/server/SCCS/s.UnicastRef2.java sun/rmi/server/SCCS/s.UnicastServerRef.java sun/rmi/server/SCCS/s.UnicastServerRef2.java sun/rmi/server/SCCS/s.WeakClassHashMap.java sun/rmi/server/resources sun/rmi/server/resources/SCCS sun/rmi/server/resources/SCCS/s.rmid_de.properties sun/rmi/server/resources/SCCS/s.rmid.properties sun/rmi/server/resources/SCCS/s.rmid_es.properties sun/rmi/server/resources/SCCS/s.rmid_fr.properties sun/rmi/server/resources/SCCS/s.rmid_it.properties sun/rmi/server/resources/SCCS/s.rmid_ja.properties sun/rmi/server/resources/SCCS/s.rmid_ko.properties sun/rmi/server/resources/SCCS/s.rmid_sv.properties sun/rmi/server/resources/SCCS/s.rmid_zh_CN.properties sun/rmi/server/resources/SCCS/s.rmid_zh_TW.properties sun/rmi/server/resources/rmid_de.properties sun/rmi/server/resources/rmid.properties sun/rmi/server/resources/rmid_es.properties sun/rmi/server/resources/rmid_fr.properties sun/rmi/server/resources/rmid_it.properties sun/rmi/server/resources/rmid_ja.properties sun/rmi/server/resources/rmid_ko.properties sun/rmi/server/resources/rmid_sv.properties sun/rmi/server/resources/rmid_zh_CN.properties sun/rmi/server/resources/rmid_zh_TW.properties sun/rmi/server/ActivatableServerRef.java sun/rmi/server/ActivatableRef.java sun/rmi/server/Activation.java sun/rmi/server/Dispatcher.java sun/rmi/server/Util.java sun/rmi/server/ActivationGroupImpl.java sun/rmi/server/ActivationGroupInit.java sun/rmi/server/LoaderHandler.java sun/rmi/server/MarshalInputStream.java sun/rmi/server/MarshalOutputStream.java sun/rmi/server/UnicastRef.java sun/rmi/server/UnicastRef2.java sun/rmi/server/UnicastServerRef.java sun/rmi/server/UnicastServerRef2.java sun/rmi/server/WeakClassHashMap.java sun/rmi/transport sun/rmi/transport/SCCS sun/rmi/transport/SCCS/s.Connection.java sun/rmi/transport/SCCS/s.Channel.java sun/rmi/transport/SCCS/s.ConnectionInputStream.java sun/rmi/transport/SCCS/s.ConnectionOutputStream.java sun/rmi/transport/SCCS/s.DGCAckHandler.java sun/rmi/transport/SCCS/s.DGCClient.java sun/rmi/transport/SCCS/s.DGCImpl.java sun/rmi/transport/SCCS/s.Endpoint.java sun/rmi/transport/SCCS/s.LiveRef.java sun/rmi/transport/SCCS/s.ObjectEndpoint.java sun/rmi/transport/SCCS/s.ObjectTable.java sun/rmi/transport/SCCS/s.StreamRemoteCall.java sun/rmi/transport/SCCS/s.Target.java sun/rmi/transport/SCCS/s.Transport.java sun/rmi/transport/SCCS/s.TransportConstants.java sun/rmi/transport/SCCS/s.WeakRef.java sun/rmi/transport/proxy sun/rmi/transport/proxy/SCCS sun/rmi/transport/proxy/SCCS/s.HttpInputStream.java sun/rmi/transport/proxy/SCCS/s.CGIHandler.java sun/rmi/transport/proxy/SCCS/s.HttpAwareServerSocket.java sun/rmi/transport/proxy/SCCS/s.HttpOutputStream.java sun/rmi/transport/proxy/SCCS/s.HttpReceiveSocket.java sun/rmi/transport/proxy/SCCS/s.HttpSendInputStream.java sun/rmi/transport/proxy/SCCS/s.HttpSendOutputStream.java sun/rmi/transport/proxy/SCCS/s.HttpSendSocket.java sun/rmi/transport/proxy/SCCS/s.RMIDirectSocketFactory.java sun/rmi/transport/proxy/SCCS/s.RMIHttpToCGISocketFactory.java sun/rmi/transport/proxy/SCCS/s.RMIHttpToPortSocketFactory.java sun/rmi/transport/proxy/SCCS/s.RMIMasterSocketFactory.java sun/rmi/transport/proxy/SCCS/s.RMISocketInfo.java sun/rmi/transport/proxy/SCCS/s.WrappedSocket.java sun/rmi/transport/proxy/HttpInputStream.java sun/rmi/transport/proxy/CGIHandler.java sun/rmi/transport/proxy/RMIHttpToCGISocketFactory.java sun/rmi/transport/proxy/HttpAwareServerSocket.java sun/rmi/transport/proxy/HttpOutputStream.java sun/rmi/transport/proxy/HttpReceiveSocket.java sun/rmi/transport/proxy/HttpSendInputStream.java sun/rmi/transport/proxy/HttpSendOutputStream.java sun/rmi/transport/proxy/HttpSendSocket.java sun/rmi/transport/proxy/RMIDirectSocketFactory.java sun/rmi/transport/proxy/RMIHttpToPortSocketFactory.java sun/rmi/transport/proxy/RMIMasterSocketFactory.java sun/rmi/transport/proxy/RMISocketInfo.java sun/rmi/transport/proxy/WrappedSocket.java sun/rmi/transport/tcp sun/rmi/transport/tcp/SCCS sun/rmi/transport/tcp/SCCS/s.ConnectionMultiplexer.java sun/rmi/transport/tcp/SCCS/s.MultiplexConnectionInfo.java sun/rmi/transport/tcp/SCCS/s.MultiplexInputStream.java sun/rmi/transport/tcp/SCCS/s.MultiplexOutputStream.java sun/rmi/transport/tcp/SCCS/s.TCPChannel.java sun/rmi/transport/tcp/SCCS/s.TCPConnection.java sun/rmi/transport/tcp/SCCS/s.TCPEndpoint.java sun/rmi/transport/tcp/SCCS/s.TCPTransport.java sun/rmi/transport/tcp/MultiplexConnectionInfo.java sun/rmi/transport/tcp/ConnectionMultiplexer.java sun/rmi/transport/tcp/MultiplexInputStream.java sun/rmi/transport/tcp/MultiplexOutputStream.java sun/rmi/transport/tcp/TCPChannel.java sun/rmi/transport/tcp/TCPConnection.java sun/rmi/transport/tcp/TCPEndpoint.java sun/rmi/transport/tcp/TCPTransport.java sun/rmi/transport/DGCAckHandler.java sun/rmi/transport/Channel.java sun/rmi/transport/Connection.java sun/rmi/transport/ConnectionInputStream.java sun/rmi/transport/ConnectionOutputStream.java sun/rmi/transport/DGCClient.java sun/rmi/transport/DGCImpl.java sun/rmi/transport/Endpoint.java sun/rmi/transport/LiveRef.java sun/rmi/transport/ObjectEndpoint.java sun/rmi/transport/ObjectTable.java sun/rmi/transport/StreamRemoteCall.java sun/rmi/transport/Target.java sun/rmi/transport/Transport.java sun/rmi/transport/TransportConstants.java sun/rmi/transport/WeakRef.java sun/security sun/security/acl sun/security/acl/SCCS sun/security/acl/SCCS/s.AllPermissionsImpl.java sun/security/acl/SCCS/s.AclEntryImpl.java sun/security/acl/SCCS/s.AclImpl.java sun/security/acl/SCCS/s.PermissionImpl.java sun/security/acl/SCCS/s.GroupImpl.java sun/security/acl/SCCS/s.OwnerImpl.java sun/security/acl/SCCS/s.PrincipalImpl.java sun/security/acl/SCCS/s.WorldGroupImpl.java sun/security/acl/AllPermissionsImpl.java sun/security/acl/AclEntryImpl.java sun/security/acl/AclImpl.java sun/security/acl/GroupImpl.java sun/security/acl/OwnerImpl.java sun/security/acl/PermissionImpl.java sun/security/acl/PrincipalImpl.java sun/security/acl/WorldGroupImpl.java sun/security/action sun/security/action/SCCS sun/security/action/SCCS/s.GetPropertyAction.java sun/security/action/SCCS/s.GetBooleanAction.java sun/security/action/SCCS/s.GetIntegerAction.java sun/security/action/SCCS/s.GetLongAction.java sun/security/action/SCCS/s.OpenFileInputStreamAction.java sun/security/action/SCCS/s.LoadLibraryAction.java sun/security/action/SCCS/s.PutAllAction.java sun/security/action/OpenFileInputStreamAction.java sun/security/action/GetBooleanAction.java sun/security/action/GetIntegerAction.java sun/security/action/GetLongAction.java sun/security/action/GetPropertyAction.java sun/security/action/LoadLibraryAction.java sun/security/action/PutAllAction.java sun/security/jca sun/security/jca/SCCS sun/security/jca/SCCS/s.ProviderConfig.java sun/security/jca/SCCS/s.GetInstance.java sun/security/jca/SCCS/s.JCAUtil.java sun/security/jca/SCCS/s.ProviderList.java sun/security/jca/SCCS/s.Providers.java sun/security/jca/SCCS/s.ServiceId.java sun/security/jca/GetInstance.java sun/security/jca/JCAUtil.java sun/security/jca/ProviderConfig.java sun/security/jca/ProviderList.java sun/security/jca/Providers.java sun/security/jca/ServiceId.java sun/security/jgss sun/security/jgss/SCCS sun/security/jgss/SCCS/s.GSSCredentialImpl.java sun/security/jgss/SCCS/s.GSSContextImpl.java sun/security/jgss/SCCS/s.GSSExceptionImpl.java sun/security/jgss/SCCS/s.GSSHeader.java sun/security/jgss/SCCS/s.GSSManagerImpl.java sun/security/jgss/SCCS/s.GSSNameImpl.java sun/security/jgss/SCCS/s.GSSUtil.java sun/security/jgss/SCCS/s.LoginUtility.java sun/security/jgss/SCCS/s.ProviderList.java sun/security/jgss/SCCS/s.SunProvider.java sun/security/jgss/SCCS/s.TokenTracker.java sun/security/jgss/krb5 sun/security/jgss/krb5/SCCS sun/security/jgss/krb5/SCCS/s.AcceptSecContextToken.java sun/security/jgss/krb5/SCCS/s.CipherHelper.java sun/security/jgss/krb5/SCCS/s.InitSecContextToken.java sun/security/jgss/krb5/SCCS/s.InitialToken.java sun/security/jgss/krb5/SCCS/s.Krb5AcceptCredential.java sun/security/jgss/krb5/SCCS/s.Krb5Context.java sun/security/jgss/krb5/SCCS/s.Krb5CredElement.java sun/security/jgss/krb5/SCCS/s.Krb5InitCredential.java sun/security/jgss/krb5/SCCS/s.Krb5MechFactory.java sun/security/jgss/krb5/SCCS/s.Krb5NameElement.java sun/security/jgss/krb5/SCCS/s.Krb5Token.java sun/security/jgss/krb5/SCCS/s.Krb5Util.java sun/security/jgss/krb5/SCCS/s.MessageToken.java sun/security/jgss/krb5/SCCS/s.MicToken.java sun/security/jgss/krb5/SCCS/s.SubjectComber.java sun/security/jgss/krb5/SCCS/s.WrapToken.java sun/security/jgss/krb5/SCCS/s.MessageToken_v2.java sun/security/jgss/krb5/SCCS/s.MicToken_v2.java sun/security/jgss/krb5/SCCS/s.WrapToken_v2.java sun/security/jgss/krb5/AcceptSecContextToken.java sun/security/jgss/krb5/CipherHelper.java sun/security/jgss/krb5/InitSecContextToken.java sun/security/jgss/krb5/InitialToken.java sun/security/jgss/krb5/Krb5AcceptCredential.java sun/security/jgss/krb5/Krb5Context.java sun/security/jgss/krb5/Krb5CredElement.java sun/security/jgss/krb5/Krb5InitCredential.java sun/security/jgss/krb5/Krb5MechFactory.java sun/security/jgss/krb5/Krb5NameElement.java sun/security/jgss/krb5/Krb5Token.java sun/security/jgss/krb5/Krb5Util.java sun/security/jgss/krb5/MessageToken.java sun/security/jgss/krb5/MicToken.java sun/security/jgss/krb5/SubjectComber.java sun/security/jgss/krb5/WrapToken.java sun/security/jgss/krb5/MessageToken_v2.java sun/security/jgss/krb5/MicToken_v2.java sun/security/jgss/krb5/WrapToken_v2.java sun/security/jgss/spi sun/security/jgss/spi/SCCS sun/security/jgss/spi/SCCS/s.GSSCredentialSpi.java sun/security/jgss/spi/SCCS/s.GSSNameSpi.java sun/security/jgss/spi/SCCS/s.MechanismFactory.java sun/security/jgss/spi/GSSCredentialSpi.java sun/security/jgss/spi/GSSNameSpi.java sun/security/jgss/spi/MechanismFactory.java sun/security/jgss/GSSCredentialImpl.java sun/security/jgss/GSSContextImpl.java sun/security/jgss/GSSExceptionImpl.java sun/security/jgss/GSSHeader.java sun/security/jgss/GSSManagerImpl.java sun/security/jgss/GSSNameImpl.java sun/security/jgss/GSSUtil.java sun/security/jgss/LoginUtility.java sun/security/jgss/ProviderList.java sun/security/jgss/SunProvider.java sun/security/jgss/TokenTracker.java sun/security/pkcs sun/security/pkcs/SCCS sun/security/pkcs/SCCS/s.EncodingException.java sun/security/pkcs/SCCS/s.ContentInfo.java sun/security/pkcs/SCCS/s.EncryptedPrivateKeyInfo.java sun/security/pkcs/SCCS/s.PKCS10.java sun/security/pkcs/SCCS/s.PKCS10Attribute.java sun/security/pkcs/SCCS/s.PKCS10Attributes.java sun/security/pkcs/SCCS/s.PKCS7.java sun/security/pkcs/SCCS/s.PKCS8Key.java sun/security/pkcs/SCCS/s.PKCS9Attribute.java sun/security/pkcs/SCCS/s.PKCS9Attributes.java sun/security/pkcs/SCCS/s.ParsingException.java sun/security/pkcs/SCCS/s.SignerInfo.java sun/security/pkcs/SCCS/s.SigningCertificateInfo.java sun/security/pkcs/EncodingException.java sun/security/pkcs/ContentInfo.java sun/security/pkcs/PKCS10.java sun/security/pkcs/EncryptedPrivateKeyInfo.java sun/security/pkcs/PKCS7.java sun/security/pkcs/PKCS10Attribute.java sun/security/pkcs/PKCS10Attributes.java sun/security/pkcs/PKCS8Key.java sun/security/pkcs/PKCS9Attribute.java sun/security/pkcs/PKCS9Attributes.java sun/security/pkcs/ParsingException.java sun/security/pkcs/SignerInfo.java sun/security/pkcs/SigningCertificateInfo.java sun/security/provider sun/security/provider/SCCS sun/security/provider/SCCS/s.DSA.java sun/security/provider/SCCS/s.DSAPublicKey.java sun/security/provider/SCCS/s.DSAKeyFactory.java sun/security/provider/SCCS/s.DSAKeyPairGenerator.java sun/security/provider/SCCS/s.DSAParameterGenerator.java sun/security/provider/SCCS/s.DSAParameters.java sun/security/provider/SCCS/s.DSAPrivateKey.java sun/security/provider/SCCS/s.DigestBase.java sun/security/provider/SCCS/s.IdentityDatabase.java sun/security/provider/SCCS/s.JavaKeyStore.java sun/security/provider/SCCS/s.KeyProtector.java sun/security/provider/SCCS/s.MD2.java sun/security/provider/SCCS/s.MD5.java sun/security/provider/SCCS/s.ParameterCache.java sun/security/provider/SCCS/s.PolicyFile.java sun/security/provider/SCCS/s.PolicyParser.java sun/security/provider/SCCS/s.SHA.java sun/security/provider/SCCS/s.SHA2.java sun/security/provider/SCCS/s.SHA5.java sun/security/provider/SCCS/s.SecureRandom.java sun/security/provider/SCCS/s.SeedGenerator.java sun/security/provider/SCCS/s.Sun.java sun/security/provider/SCCS/s.SystemIdentity.java sun/security/provider/SCCS/s.SystemSigner.java sun/security/provider/SCCS/s.X509Factory.java sun/security/provider/certpath sun/security/provider/certpath/SCCS sun/security/provider/certpath/SCCS/s.CollectionCertStore.java sun/security/provider/certpath/SCCS/s.AdjacencyList.java sun/security/provider/certpath/SCCS/s.BasicChecker.java sun/security/provider/certpath/SCCS/s.BuildStep.java sun/security/provider/certpath/SCCS/s.Builder.java sun/security/provider/certpath/SCCS/s.CertId.java sun/security/provider/certpath/SCCS/s.CertPathHelper.java sun/security/provider/certpath/SCCS/s.IndexedCollectionCertStore.java sun/security/provider/certpath/SCCS/s.ConstraintsChecker.java sun/security/provider/certpath/SCCS/s.CrlRevocationChecker.java sun/security/provider/certpath/SCCS/s.DistributionPointFetcher.java sun/security/provider/certpath/SCCS/s.ForwardBuilder.java sun/security/provider/certpath/SCCS/s.ForwardState.java sun/security/provider/certpath/SCCS/s.PKIXCertPathValidator.java sun/security/provider/certpath/SCCS/s.KeyChecker.java sun/security/provider/certpath/SCCS/s.LDAPCertStore.java sun/security/provider/certpath/SCCS/s.OCSPChecker.java sun/security/provider/certpath/SCCS/s.OCSPRequest.java sun/security/provider/certpath/SCCS/s.OCSPResponse.java sun/security/provider/certpath/SCCS/s.PKIXMasterCertPathValidator.java sun/security/provider/certpath/SCCS/s.PolicyChecker.java sun/security/provider/certpath/SCCS/s.PolicyNodeImpl.java sun/security/provider/certpath/SCCS/s.ReverseBuilder.java sun/security/provider/certpath/SCCS/s.ReverseState.java sun/security/provider/certpath/SCCS/s.State.java sun/security/provider/certpath/SCCS/s.SunCertPathBuilder.java sun/security/provider/certpath/SCCS/s.SunCertPathBuilderException.java sun/security/provider/certpath/SCCS/s.SunCertPathBuilderParameters.java sun/security/provider/certpath/SCCS/s.Vertex.java sun/security/provider/certpath/SCCS/s.SunCertPathBuilderResult.java sun/security/provider/certpath/SCCS/s.X509CertPath.java sun/security/provider/certpath/SCCS/s.X509CertificatePair.java sun/security/provider/certpath/CollectionCertStore.java sun/security/provider/certpath/AdjacencyList.java sun/security/provider/certpath/BasicChecker.java sun/security/provider/certpath/BuildStep.java sun/security/provider/certpath/Builder.java sun/security/provider/certpath/CertId.java sun/security/provider/certpath/CertPathHelper.java sun/security/provider/certpath/CrlRevocationChecker.java sun/security/provider/certpath/ConstraintsChecker.java sun/security/provider/certpath/State.java sun/security/provider/certpath/DistributionPointFetcher.java sun/security/provider/certpath/ForwardBuilder.java sun/security/provider/certpath/ForwardState.java sun/security/provider/certpath/IndexedCollectionCertStore.java sun/security/provider/certpath/KeyChecker.java sun/security/provider/certpath/X509CertificatePair.java sun/security/provider/certpath/LDAPCertStore.java sun/security/provider/certpath/OCSPChecker.java sun/security/provider/certpath/OCSPRequest.java sun/security/provider/certpath/OCSPResponse.java sun/security/provider/certpath/PKIXCertPathValidator.java sun/security/provider/certpath/PKIXMasterCertPathValidator.java sun/security/provider/certpath/PolicyChecker.java sun/security/provider/certpath/PolicyNodeImpl.java sun/security/provider/certpath/ReverseBuilder.java sun/security/provider/certpath/ReverseState.java sun/security/provider/certpath/SunCertPathBuilder.java sun/security/provider/certpath/Vertex.java sun/security/provider/certpath/X509CertPath.java sun/security/provider/certpath/SunCertPathBuilderException.java sun/security/provider/certpath/SunCertPathBuilderParameters.java sun/security/provider/certpath/SunCertPathBuilderResult.java sun/security/provider/DSAKeyFactory.java sun/security/provider/DSA.java sun/security/provider/DSAKeyPairGenerator.java sun/security/provider/DSAParameterGenerator.java sun/security/provider/DSAParameters.java sun/security/provider/DSAPrivateKey.java sun/security/provider/DSAPublicKey.java sun/security/provider/DigestBase.java sun/security/provider/IdentityDatabase.java sun/security/provider/JavaKeyStore.java sun/security/provider/KeyProtector.java sun/security/provider/MD2.java sun/security/provider/MD5.java sun/security/provider/ParameterCache.java sun/security/provider/PolicyFile.java sun/security/provider/PolicyParser.java sun/security/provider/SHA.java sun/security/provider/SHA2.java sun/security/provider/SHA5.java sun/security/provider/SecureRandom.java sun/security/provider/SeedGenerator.java sun/security/provider/Sun.java sun/security/provider/SystemIdentity.java sun/security/provider/SystemSigner.java sun/security/provider/X509Factory.java sun/security/rsa sun/security/rsa/SCCS sun/security/rsa/SCCS/s.RSAKeyFactory.java sun/security/rsa/SCCS/s.RSACore.java sun/security/rsa/SCCS/s.RSAKeyPairGenerator.java sun/security/rsa/SCCS/s.RSAPadding.java sun/security/rsa/SCCS/s.RSAPrivateCrtKeyImpl.java sun/security/rsa/SCCS/s.RSAPrivateKeyImpl.java sun/security/rsa/SCCS/s.RSAPublicKeyImpl.java sun/security/rsa/SCCS/s.RSASignature.java sun/security/rsa/SCCS/s.SunRsaSign.java sun/security/rsa/RSAKeyFactory.java sun/security/rsa/RSACore.java sun/security/rsa/RSAKeyPairGenerator.java sun/security/rsa/RSAPadding.java sun/security/rsa/RSAPrivateCrtKeyImpl.java sun/security/rsa/RSAPrivateKeyImpl.java sun/security/rsa/RSAPublicKeyImpl.java sun/security/rsa/RSASignature.java sun/security/rsa/SunRsaSign.java sun/security/timestamp sun/security/timestamp/SCCS sun/security/timestamp/SCCS/s.HttpTimestamper.java sun/security/timestamp/SCCS/s.TSRequest.java sun/security/timestamp/SCCS/s.TSResponse.java sun/security/timestamp/SCCS/s.TimestampToken.java sun/security/timestamp/SCCS/s.Timestamper.java sun/security/timestamp/HttpTimestamper.java sun/security/timestamp/TSRequest.java sun/security/timestamp/TSResponse.java sun/security/timestamp/TimestampToken.java sun/security/timestamp/Timestamper.java sun/security/tools sun/security/tools/SCCS sun/security/tools/SCCS/s.JarSignerResources.java sun/security/tools/SCCS/s.JarSigner.java sun/security/tools/SCCS/s.JarSignerResources_ja.java sun/security/tools/SCCS/s.KeyTool.java sun/security/tools/SCCS/s.PolicyTool.java sun/security/tools/SCCS/s.TimestampedSigner.java sun/security/tools/JarSignerResources.java sun/security/tools/JarSigner.java sun/security/tools/JarSignerResources_ja.java sun/security/tools/KeyTool.java sun/security/tools/PolicyTool.java sun/security/tools/TimestampedSigner.java sun/security/util sun/security/util/SCCS sun/security/util/SCCS/s.AuthResources_zh_CN.java sun/security/util/SCCS/s.AuthResources.java sun/security/util/SCCS/s.AuthResources_de.java sun/security/util/SCCS/s.AuthResources_es.java sun/security/util/SCCS/s.AuthResources_fr.java sun/security/util/SCCS/s.AuthResources_it.java sun/security/util/SCCS/s.AuthResources_ja.java sun/security/util/SCCS/s.AuthResources_ko.java sun/security/util/SCCS/s.AuthResources_sv.java sun/security/util/SCCS/s.AuthResources_zh_TW.java sun/security/util/SCCS/s.BigInt.java sun/security/util/SCCS/s.BitArray.java sun/security/util/SCCS/s.ByteArrayLexOrder.java sun/security/util/SCCS/s.Cache.java sun/security/util/SCCS/s.ByteArrayTagOrder.java sun/security/util/SCCS/s.Debug.java sun/security/util/SCCS/s.DerEncoder.java sun/security/util/SCCS/s.DerIndefLenConverter.java sun/security/util/SCCS/s.DerInputBuffer.java sun/security/util/SCCS/s.DerInputStream.java sun/security/util/SCCS/s.DerOutputStream.java sun/security/util/SCCS/s.DerValue.java sun/security/util/SCCS/s.HostnameChecker.java sun/security/util/SCCS/s.ManifestDigester.java sun/security/util/SCCS/s.ManifestEntryVerifier.java sun/security/util/SCCS/s.ObjectIdentifier.java sun/security/util/SCCS/s.Password.java sun/security/util/SCCS/s.PendingException.java sun/security/util/SCCS/s.PropertyExpander.java sun/security/util/SCCS/s.Resources.java sun/security/util/SCCS/s.ResourcesMgr.java sun/security/util/SCCS/s.PathList.java sun/security/util/SCCS/s.Resources_de.java sun/security/util/SCCS/s.Resources_es.java sun/security/util/SCCS/s.Resources_fr.java sun/security/util/SCCS/s.Resources_it.java sun/security/util/SCCS/s.Resources_ja.java sun/security/util/SCCS/s.Resources_ko.java sun/security/util/SCCS/s.Resources_sv.java sun/security/util/SCCS/s.Resources_zh_CN.java sun/security/util/SCCS/s.Resources_zh_TW.java sun/security/util/SCCS/s.SecurityConstants.java sun/security/util/SCCS/s.SignatureFileVerifier.java sun/security/util/SCCS/s.PolicyUtil.java sun/security/util/AuthResources_de.java sun/security/util/AuthResources.java sun/security/util/DerIndefLenConverter.java sun/security/util/AuthResources_es.java sun/security/util/AuthResources_fr.java sun/security/util/AuthResources_it.java sun/security/util/AuthResources_ja.java sun/security/util/AuthResources_ko.java sun/security/util/AuthResources_sv.java sun/security/util/AuthResources_zh_CN.java sun/security/util/AuthResources_zh_TW.java sun/security/util/BigInt.java sun/security/util/BitArray.java sun/security/util/ByteArrayLexOrder.java sun/security/util/ByteArrayTagOrder.java sun/security/util/Cache.java sun/security/util/Debug.java sun/security/util/DerEncoder.java sun/security/util/DerOutputStream.java sun/security/util/DerInputBuffer.java sun/security/util/DerInputStream.java sun/security/util/HostnameChecker.java sun/security/util/DerValue.java sun/security/util/Resources_zh_CN.java sun/security/util/ManifestDigester.java sun/security/util/ManifestEntryVerifier.java sun/security/util/ObjectIdentifier.java sun/security/util/Password.java sun/security/util/PendingException.java sun/security/util/PropertyExpander.java sun/security/util/Resources.java sun/security/util/ResourcesMgr.java sun/security/util/Resources_de.java sun/security/util/Resources_es.java sun/security/util/Resources_fr.java sun/security/util/Resources_it.java sun/security/util/Resources_ja.java sun/security/util/Resources_ko.java sun/security/util/Resources_sv.java sun/security/util/SignatureFileVerifier.java sun/security/util/Resources_zh_TW.java sun/security/util/SecurityConstants.java sun/security/util/PolicyUtil.java sun/security/util/PathList.java sun/security/validator sun/security/validator/SCCS sun/security/validator/SCCS/s.ValidatorException.java sun/security/validator/SCCS/s.EndEntityChecker.java sun/security/validator/SCCS/s.KeyStores.java sun/security/validator/SCCS/s.PKIXValidator.java sun/security/validator/SCCS/s.SimpleValidator.java sun/security/validator/SCCS/s.Validator.java sun/security/validator/EndEntityChecker.java sun/security/validator/KeyStores.java sun/security/validator/PKIXValidator.java sun/security/validator/SimpleValidator.java sun/security/validator/Validator.java sun/security/validator/ValidatorException.java sun/security/x509 sun/security/x509/SCCS sun/security/x509/SCCS/s.AlgIdDSA.java sun/security/x509/SCCS/s.AVA.java sun/security/x509/SCCS/s.AuthorityKeyIdentifierExtension.java sun/security/x509/SCCS/s.AccessDescription.java sun/security/x509/SCCS/s.AlgorithmId.java sun/security/x509/SCCS/s.AttributeNameEnumeration.java sun/security/x509/SCCS/s.CRLDistributionPointsExtension.java sun/security/x509/SCCS/s.BasicConstraintsExtension.java sun/security/x509/SCCS/s.CRLReasonCodeExtension.java sun/security/x509/SCCS/s.CRLExtensions.java sun/security/x509/SCCS/s.CRLNumberExtension.java sun/security/x509/SCCS/s.CertAndKeyGen.java sun/security/x509/SCCS/s.DNSName.java sun/security/x509/SCCS/s.GeneralNameInterface.java sun/security/x509/SCCS/s.CertAttrSet.java sun/security/x509/SCCS/s.CertException.java sun/security/x509/SCCS/s.CertParseError.java sun/security/x509/SCCS/s.CertificateAlgorithmId.java sun/security/x509/SCCS/s.CertificateExtensions.java sun/security/x509/SCCS/s.CertificateIssuerExtension.java sun/security/x509/SCCS/s.CertificateIssuerName.java sun/security/x509/SCCS/s.CertificateIssuerUniqueIdentity.java sun/security/x509/SCCS/s.CertificatePoliciesExtension.java sun/security/x509/SCCS/s.CertificatePolicyId.java sun/security/x509/SCCS/s.CertificatePolicyMap.java sun/security/x509/SCCS/s.CertificatePolicySet.java sun/security/x509/SCCS/s.CertificateSerialNumber.java sun/security/x509/SCCS/s.CertificateSubjectName.java sun/security/x509/SCCS/s.CertificateSubjectUniqueIdentity.java sun/security/x509/SCCS/s.CertificateValidity.java sun/security/x509/SCCS/s.CertificateVersion.java sun/security/x509/SCCS/s.CertificateX509Key.java sun/security/x509/SCCS/s.EDIPartyName.java sun/security/x509/SCCS/s.DistributionPoint.java sun/security/x509/SCCS/s.Extension.java sun/security/x509/SCCS/s.ExtendedKeyUsageExtension.java sun/security/x509/SCCS/s.GeneralName.java sun/security/x509/SCCS/s.GeneralNames.java sun/security/x509/SCCS/s.GeneralSubtree.java sun/security/x509/SCCS/s.GeneralSubtrees.java sun/security/x509/SCCS/s.OIDMap.java sun/security/x509/SCCS/s.PKIXExtensions.java sun/security/x509/SCCS/s.IPAddressName.java sun/security/x509/SCCS/s.InhibitAnyPolicyExtension.java sun/security/x509/SCCS/s.IssuerAlternativeNameExtension.java sun/security/x509/SCCS/s.KeyIdentifier.java sun/security/x509/SCCS/s.KeyUsageExtension.java sun/security/x509/SCCS/s.NameConstraintsExtension.java sun/security/x509/SCCS/s.NetscapeCertTypeExtension.java sun/security/x509/SCCS/s.OIDName.java sun/security/x509/SCCS/s.OtherName.java sun/security/x509/SCCS/s.RDN.java sun/security/x509/SCCS/s.PolicyConstraintsExtension.java sun/security/x509/SCCS/s.PolicyInformation.java sun/security/x509/SCCS/s.PolicyMappingsExtension.java sun/security/x509/SCCS/s.AuthorityInfoAccessExtension.java sun/security/x509/SCCS/s.PrivateKeyUsageExtension.java sun/security/x509/SCCS/s.README sun/security/x509/SCCS/s.RFC822Name.java sun/security/x509/SCCS/s.ReasonFlags.java sun/security/x509/SCCS/s.SerialNumber.java sun/security/x509/SCCS/s.URIName.java sun/security/x509/SCCS/s.UniqueIdentity.java sun/security/x509/SCCS/s.SubjectAlternativeNameExtension.java sun/security/x509/SCCS/s.SubjectKeyIdentifierExtension.java sun/security/x509/SCCS/s.X400Address.java sun/security/x509/SCCS/s.X500Name.java sun/security/x509/SCCS/s.X500Signer.java sun/security/x509/SCCS/s.X509AttributeName.java sun/security/x509/SCCS/s.X509CRLEntryImpl.java sun/security/x509/SCCS/s.X509CRLImpl.java sun/security/x509/SCCS/s.X509Cert.java sun/security/x509/SCCS/s.X509CertImpl.java sun/security/x509/SCCS/s.X509CertInfo.java sun/security/x509/SCCS/s.X509Key.java sun/security/x509/SCCS/s.certAttributes.html sun/security/x509/AlgIdDSA.java sun/security/x509/AVA.java sun/security/x509/AttributeNameEnumeration.java sun/security/x509/AccessDescription.java sun/security/x509/AlgorithmId.java sun/security/x509/AuthorityKeyIdentifierExtension.java sun/security/x509/BasicConstraintsExtension.java sun/security/x509/CRLDistributionPointsExtension.java sun/security/x509/CRLExtensions.java sun/security/x509/CRLNumberExtension.java sun/security/x509/CRLReasonCodeExtension.java sun/security/x509/CertAndKeyGen.java sun/security/x509/CertAttrSet.java sun/security/x509/CertificateIssuerExtension.java sun/security/x509/CertException.java sun/security/x509/CertParseError.java sun/security/x509/CertificateAlgorithmId.java sun/security/x509/CertificateExtensions.java sun/security/x509/CertificatePoliciesExtension.java sun/security/x509/CertificateIssuerName.java sun/security/x509/DNSName.java sun/security/x509/CertificateIssuerUniqueIdentity.java sun/security/x509/CertificatePolicyId.java sun/security/x509/CertificatePolicyMap.java sun/security/x509/CertificatePolicySet.java sun/security/x509/CertificateSerialNumber.java sun/security/x509/CertificateSubjectName.java sun/security/x509/IssuerAlternativeNameExtension.java sun/security/x509/CertificateSubjectUniqueIdentity.java sun/security/x509/CertificateValidity.java sun/security/x509/CertificateVersion.java sun/security/x509/CertificateX509Key.java sun/security/x509/DistributionPoint.java sun/security/x509/EDIPartyName.java sun/security/x509/ExtendedKeyUsageExtension.java sun/security/x509/Extension.java sun/security/x509/GeneralName.java sun/security/x509/GeneralNameInterface.java sun/security/x509/GeneralNames.java sun/security/x509/GeneralSubtree.java sun/security/x509/GeneralSubtrees.java sun/security/x509/IPAddressName.java sun/security/x509/InhibitAnyPolicyExtension.java sun/security/x509/OIDMap.java sun/security/x509/KeyUsageExtension.java sun/security/x509/KeyIdentifier.java sun/security/x509/ReasonFlags.java sun/security/x509/RDN.java sun/security/x509/NameConstraintsExtension.java sun/security/x509/NetscapeCertTypeExtension.java sun/security/x509/OIDName.java sun/security/x509/OtherName.java sun/security/x509/PKIXExtensions.java sun/security/x509/PolicyConstraintsExtension.java sun/security/x509/PolicyInformation.java sun/security/x509/PolicyMappingsExtension.java sun/security/x509/PrivateKeyUsageExtension.java sun/security/x509/README sun/security/x509/RFC822Name.java sun/security/x509/UniqueIdentity.java sun/security/x509/URIName.java sun/security/x509/SerialNumber.java sun/security/x509/SubjectAlternativeNameExtension.java sun/security/x509/SubjectKeyIdentifierExtension.java sun/security/x509/X509AttributeName.java sun/security/x509/X400Address.java sun/security/x509/X500Name.java sun/security/x509/X500Signer.java sun/security/x509/X509CRLEntryImpl.java sun/security/x509/X509CRLImpl.java sun/security/x509/X509Cert.java sun/security/x509/X509CertImpl.java sun/security/x509/X509CertInfo.java sun/security/x509/X509Key.java sun/security/x509/certAttributes.html sun/security/x509/AuthorityInfoAccessExtension.java sun/security/pkcs11 sun/security/pkcs11/SCCS sun/security/pkcs11/SCCS/s.JarVerifierImpl.java sun/security/pkcs11/SCCS/s.Config.java sun/security/pkcs11/SCCS/s.P11Cipher.java sun/security/pkcs11/SCCS/s.KeyCache.java sun/security/pkcs11/SCCS/s.P11DHKeyFactory.java sun/security/pkcs11/SCCS/s.P11DSAKeyFactory.java sun/security/pkcs11/SCCS/s.P11Digest.java sun/security/pkcs11/SCCS/s.P11Key.java sun/security/pkcs11/SCCS/s.P11KeyAgreement.java sun/security/pkcs11/SCCS/s.P11KeyFactory.java sun/security/pkcs11/SCCS/s.P11KeyGenerator.java sun/security/pkcs11/SCCS/s.P11KeyPairGenerator.java sun/security/pkcs11/SCCS/s.P11KeyStore.java sun/security/pkcs11/SCCS/s.P11Mac.java sun/security/pkcs11/SCCS/s.P11RSACipher.java sun/security/pkcs11/SCCS/s.P11RSAKeyFactory.java sun/security/pkcs11/SCCS/s.P11SecretKeyFactory.java sun/security/pkcs11/SCCS/s.P11SecureRandom.java sun/security/pkcs11/SCCS/s.P11Signature.java sun/security/pkcs11/SCCS/s.P11Util.java sun/security/pkcs11/SCCS/s.Session.java sun/security/pkcs11/SCCS/s.SessionManager.java sun/security/pkcs11/SCCS/s.SunPKCS11.java sun/security/pkcs11/SCCS/s.TemplateManager.java sun/security/pkcs11/SCCS/s.Token.java sun/security/pkcs11/wrapper sun/security/pkcs11/wrapper/SCCS sun/security/pkcs11/wrapper/SCCS/s.CK_CREATEMUTEX.java sun/security/pkcs11/wrapper/SCCS/s.CK_ATTRIBUTE.java sun/security/pkcs11/wrapper/SCCS/s.CK_X9_42_DH1_DERIVE_PARAMS.java sun/security/pkcs11/wrapper/SCCS/s.CK_C_INITIALIZE_ARGS.java sun/security/pkcs11/wrapper/SCCS/s.CK_DATE.java sun/security/pkcs11/wrapper/SCCS/s.CK_DESTROYMUTEX.java sun/security/pkcs11/wrapper/SCCS/s.CK_ECDH1_DERIVE_PARAMS.java sun/security/pkcs11/wrapper/SCCS/s.CK_ECDH2_DERIVE_PARAMS.java sun/security/pkcs11/wrapper/SCCS/s.CK_INFO.java sun/security/pkcs11/wrapper/SCCS/s.CK_LOCKMUTEX.java sun/security/pkcs11/wrapper/SCCS/s.CK_MECHANISM.java sun/security/pkcs11/wrapper/SCCS/s.CK_MECHANISM_INFO.java sun/security/pkcs11/wrapper/SCCS/s.CK_NOTIFY.java sun/security/pkcs11/wrapper/SCCS/s.CK_PBE_PARAMS.java sun/security/pkcs11/wrapper/SCCS/s.CK_SESSION_INFO.java sun/security/pkcs11/wrapper/SCCS/s.CK_PKCS5_PBKD2_PARAMS.java sun/security/pkcs11/wrapper/SCCS/s.CK_RSA_PKCS_OAEP_PARAMS.java sun/security/pkcs11/wrapper/SCCS/s.CK_RSA_PKCS_PSS_PARAMS.java sun/security/pkcs11/wrapper/SCCS/s.CK_SLOT_INFO.java sun/security/pkcs11/wrapper/SCCS/s.CK_TOKEN_INFO.java sun/security/pkcs11/wrapper/SCCS/s.CK_UNLOCKMUTEX.java sun/security/pkcs11/wrapper/SCCS/s.CK_VERSION.java sun/security/pkcs11/wrapper/SCCS/s.CK_X9_42_DH2_DERIVE_PARAMS.java sun/security/pkcs11/wrapper/SCCS/s.Constants.java sun/security/pkcs11/wrapper/SCCS/s.Functions.java sun/security/pkcs11/wrapper/SCCS/s.PKCS11.java sun/security/pkcs11/wrapper/SCCS/s.PKCS11Constants.java sun/security/pkcs11/wrapper/SCCS/s.PKCS11Exception.java sun/security/pkcs11/wrapper/SCCS/s.PKCS11RuntimeException.java sun/security/pkcs11/wrapper/CK_C_INITIALIZE_ARGS.java sun/security/pkcs11/wrapper/CK_ATTRIBUTE.java sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java sun/security/pkcs11/wrapper/CK_DESTROYMUTEX.java sun/security/pkcs11/wrapper/CK_DATE.java sun/security/pkcs11/wrapper/CK_ECDH1_DERIVE_PARAMS.java sun/security/pkcs11/wrapper/CK_ECDH2_DERIVE_PARAMS.java sun/security/pkcs11/wrapper/CK_INFO.java sun/security/pkcs11/wrapper/CK_LOCKMUTEX.java sun/security/pkcs11/wrapper/CK_MECHANISM.java sun/security/pkcs11/wrapper/CK_MECHANISM_INFO.java sun/security/pkcs11/wrapper/CK_NOTIFY.java sun/security/pkcs11/wrapper/CK_PBE_PARAMS.java sun/security/pkcs11/wrapper/CK_PKCS5_PBKD2_PARAMS.java sun/security/pkcs11/wrapper/PKCS11.java sun/security/pkcs11/wrapper/CK_SESSION_INFO.java sun/security/pkcs11/wrapper/CK_RSA_PKCS_OAEP_PARAMS.java sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java sun/security/pkcs11/wrapper/CK_SLOT_INFO.java sun/security/pkcs11/wrapper/CK_TOKEN_INFO.java sun/security/pkcs11/wrapper/CK_UNLOCKMUTEX.java sun/security/pkcs11/wrapper/CK_VERSION.java sun/security/pkcs11/wrapper/CK_X9_42_DH1_DERIVE_PARAMS.java sun/security/pkcs11/wrapper/CK_X9_42_DH2_DERIVE_PARAMS.java sun/security/pkcs11/wrapper/Constants.java sun/security/pkcs11/wrapper/Functions.java sun/security/pkcs11/wrapper/PKCS11RuntimeException.java sun/security/pkcs11/wrapper/PKCS11Constants.java sun/security/pkcs11/wrapper/PKCS11Exception.java sun/security/pkcs11/KeyCache.java sun/security/pkcs11/Config.java sun/security/pkcs11/JarVerifierImpl.java sun/security/pkcs11/P11Cipher.java sun/security/pkcs11/P11DHKeyFactory.java sun/security/pkcs11/P11DSAKeyFactory.java sun/security/pkcs11/P11Digest.java sun/security/pkcs11/P11Key.java sun/security/pkcs11/P11KeyAgreement.java sun/security/pkcs11/P11KeyFactory.java sun/security/pkcs11/P11KeyGenerator.java sun/security/pkcs11/P11KeyPairGenerator.java sun/security/pkcs11/P11KeyStore.java sun/security/pkcs11/P11Mac.java sun/security/pkcs11/P11RSACipher.java sun/security/pkcs11/P11RSAKeyFactory.java sun/security/pkcs11/P11SecretKeyFactory.java sun/security/pkcs11/P11SecureRandom.java sun/security/pkcs11/P11Signature.java sun/security/pkcs11/P11Util.java sun/security/pkcs11/Session.java sun/security/pkcs11/SessionManager.java sun/security/pkcs11/SunPKCS11.java sun/security/pkcs11/TemplateManager.java sun/security/pkcs11/Token.java sun/swing sun/swing/SCCS sun/swing/SCCS/s.PrintColorUIResource.java sun/swing/SCCS/s.BakedArrayList.java sun/swing/SCCS/s.DefaultLookup.java sun/swing/SCCS/s.FilePane.java sun/swing/SCCS/s.SwingLazyValue.java sun/swing/SCCS/s.UIAction.java sun/swing/SCCS/s.WindowsPlacesBar.java sun/swing/SCCS/s.CachedPainter.java sun/swing/SCCS/s.ImageIconUIResource.java sun/swing/plaf sun/swing/plaf/synth sun/swing/plaf/synth/SCCS sun/swing/plaf/synth/SCCS/s.SynthFileChooserUIImpl.java sun/swing/plaf/synth/SCCS/s.DefaultSynthStyle.java sun/swing/plaf/synth/SCCS/s.StyleAssociation.java sun/swing/plaf/synth/SCCS/s.SynthFileChooserUI.java sun/swing/plaf/synth/SCCS/s.SynthIcon.java sun/swing/plaf/synth/SCCS/s.SynthUI.java sun/swing/plaf/synth/SCCS/s.Paint9Painter.java sun/swing/plaf/synth/SynthFileChooserUIImpl.java sun/swing/plaf/synth/DefaultSynthStyle.java sun/swing/plaf/synth/StyleAssociation.java sun/swing/plaf/synth/SynthFileChooserUI.java sun/swing/plaf/synth/SynthIcon.java sun/swing/plaf/synth/SynthUI.java sun/swing/plaf/synth/Paint9Painter.java sun/swing/WindowsPlacesBar.java sun/swing/BakedArrayList.java sun/swing/DefaultLookup.java sun/swing/FilePane.java sun/swing/SwingLazyValue.java sun/swing/UIAction.java sun/swing/PrintColorUIResource.java sun/swing/CachedPainter.java sun/swing/ImageIconUIResource.java sun/text sun/text/SCCS sun/text/SCCS/s.CompactByteArray.java sun/text/SCCS/s.CharTrie.java sun/text/SCCS/s.CodePointIterator.java sun/text/SCCS/s.CompactCharArray.java sun/text/SCCS/s.CompactIntArray.java sun/text/SCCS/s.CompactShortArray.java sun/text/SCCS/s.ComposedCharIter.java sun/text/SCCS/s.ICUBinary.java sun/text/SCCS/s.IntHashtable.java sun/text/SCCS/s.IntTrie.java sun/text/SCCS/s.Normalizer.java sun/text/SCCS/s.NormalizerDataReader.java sun/text/SCCS/s.NormalizerImpl.java sun/text/SCCS/s.NormalizerUtilities.java sun/text/SCCS/s.Trie.java sun/text/SCCS/s.Utility.java sun/text/SCCS/s.SupplementaryCharacterData.java sun/text/SCCS/s.UCharacterIterator.java sun/text/SCCS/s.UCompactIntArray.java sun/text/resources sun/text/resources/SCCS sun/text/resources/SCCS/s.BreakIteratorRules_th.java sun/text/resources/SCCS/s.BreakIteratorInfo.java sun/text/resources/SCCS/s.BreakIteratorInfo_th.java sun/text/resources/SCCS/s.BreakIteratorRules.java sun/text/resources/SCCS/s.DateFormatZoneData.java sun/text/resources/SCCS/s.DateFormatZoneData_ar.java sun/text/resources/SCCS/s.DateFormatZoneData_be.java sun/text/resources/SCCS/s.DateFormatZoneData_bg.java sun/text/resources/SCCS/s.DateFormatZoneData_ca.java sun/text/resources/SCCS/s.DateFormatZoneData_cs.java sun/text/resources/SCCS/s.DateFormatZoneData_da.java sun/text/resources/SCCS/s.LocaleElements.java sun/text/resources/SCCS/s.LocaleData.java sun/text/resources/SCCS/s.DateFormatZoneData_de.java sun/text/resources/SCCS/s.DateFormatZoneData_de_AT.java sun/text/resources/SCCS/s.DateFormatZoneData_de_CH.java sun/text/resources/SCCS/s.DateFormatZoneData_el.java sun/text/resources/SCCS/s.DateFormatZoneData_en.java sun/text/resources/SCCS/s.DateFormatZoneData_en_CA.java sun/text/resources/SCCS/s.DateFormatZoneData_en_GB.java sun/text/resources/SCCS/s.DateFormatZoneData_en_IE.java sun/text/resources/SCCS/s.DateFormatZoneData_en_IN.java sun/text/resources/SCCS/s.DateFormatZoneData_es.java sun/text/resources/SCCS/s.DateFormatZoneData_et.java sun/text/resources/SCCS/s.DateFormatZoneData_fi.java sun/text/resources/SCCS/s.thai_dict sun/text/resources/SCCS/s.DateFormatZoneData_fr.java sun/text/resources/SCCS/s.DateFormatZoneData_fr_BE.java sun/text/resources/SCCS/s.DateFormatZoneData_fr_CA.java sun/text/resources/SCCS/s.DateFormatZoneData_fr_CH.java sun/text/resources/SCCS/s.DateFormatZoneData_hi_IN.java sun/text/resources/SCCS/s.DateFormatZoneData_hr.java sun/text/resources/SCCS/s.DateFormatZoneData_hu.java sun/text/resources/SCCS/s.DateFormatZoneData_is.java sun/text/resources/SCCS/s.DateFormatZoneData_it.java sun/text/resources/SCCS/s.DateFormatZoneData_it_CH.java sun/text/resources/SCCS/s.DateFormatZoneData_iw.java sun/text/resources/SCCS/s.DateFormatZoneData_ja.java sun/text/resources/SCCS/s.unorm.icu sun/text/resources/SCCS/s.DateFormatZoneData_ko.java sun/text/resources/SCCS/s.DateFormatZoneData_lt.java sun/text/resources/SCCS/s.DateFormatZoneData_lv.java sun/text/resources/SCCS/s.DateFormatZoneData_mk.java sun/text/resources/SCCS/s.DateFormatZoneData_nl.java sun/text/resources/SCCS/s.DateFormatZoneData_nl_BE.java sun/text/resources/SCCS/s.DateFormatZoneData_no.java sun/text/resources/SCCS/s.DateFormatZoneData_no_NO_NY.java sun/text/resources/SCCS/s.DateFormatZoneData_pl.java sun/text/resources/SCCS/s.DateFormatZoneData_pt.java sun/text/resources/SCCS/s.DateFormatZoneData_ro.java sun/text/resources/SCCS/s.DateFormatZoneData_ru.java sun/text/resources/SCCS/s.DateFormatZoneData_sk.java sun/text/resources/SCCS/s.DateFormatZoneData_sl.java sun/text/resources/SCCS/s.DateFormatZoneData_sq.java sun/text/resources/SCCS/s.DateFormatZoneData_sv.java sun/text/resources/SCCS/s.DateFormatZoneData_th.java sun/text/resources/SCCS/s.DateFormatZoneData_tr.java sun/text/resources/SCCS/s.DateFormatZoneData_uk.java sun/text/resources/SCCS/s.DateFormatZoneData_zh_CN.java sun/text/resources/SCCS/s.DateFormatZoneData_zh_HK.java sun/text/resources/SCCS/s.DateFormatZoneData_zh_TW.java sun/text/resources/SCCS/s.LocaleElements_ar.java sun/text/resources/SCCS/s.LocaleElements_ar_AE.java sun/text/resources/SCCS/s.LocaleElements_ar_BH.java sun/text/resources/SCCS/s.LocaleElements_ar_DZ.java sun/text/resources/SCCS/s.LocaleElements_ar_EG.java sun/text/resources/SCCS/s.LocaleElements_ar_IQ.java sun/text/resources/SCCS/s.LocaleElements_ar_JO.java sun/text/resources/SCCS/s.LocaleElements_ar_KW.java sun/text/resources/SCCS/s.LocaleElements_ar_LB.java sun/text/resources/SCCS/s.LocaleElements_ar_LY.java sun/text/resources/SCCS/s.LocaleElements_ar_MA.java sun/text/resources/SCCS/s.LocaleElements_ar_OM.java sun/text/resources/SCCS/s.LocaleElements_ar_QA.java sun/text/resources/SCCS/s.LocaleElements_ar_SA.java sun/text/resources/SCCS/s.LocaleElements_ar_SD.java sun/text/resources/SCCS/s.LocaleElements_ar_SY.java sun/text/resources/SCCS/s.LocaleElements_ar_TN.java sun/text/resources/SCCS/s.LocaleElements_ar_YE.java sun/text/resources/SCCS/s.LocaleElements_be.java sun/text/resources/SCCS/s.LocaleElements_be_BY.java sun/text/resources/SCCS/s.LocaleElements_bg.java sun/text/resources/SCCS/s.LocaleElements_bg_BG.java sun/text/resources/SCCS/s.LocaleElements_ca.java sun/text/resources/SCCS/s.LocaleElements_ca_ES.java sun/text/resources/SCCS/s.LocaleElements_cs.java sun/text/resources/SCCS/s.LocaleElements_cs_CZ.java sun/text/resources/SCCS/s.LocaleElements_da.java sun/text/resources/SCCS/s.LocaleElements_da_DK.java sun/text/resources/SCCS/s.LocaleElements_de.java sun/text/resources/SCCS/s.LocaleElements_de_AT.java sun/text/resources/SCCS/s.LocaleElements_de_CH.java sun/text/resources/SCCS/s.LocaleElements_de_DE.java sun/text/resources/SCCS/s.LocaleElements_de_LU.java sun/text/resources/SCCS/s.LocaleElements_el.java sun/text/resources/SCCS/s.LocaleElements_el_GR.java sun/text/resources/SCCS/s.LocaleElements_en.java sun/text/resources/SCCS/s.LocaleElements_en_AU.java sun/text/resources/SCCS/s.LocaleElements_en_CA.java sun/text/resources/SCCS/s.LocaleElements_en_GB.java sun/text/resources/SCCS/s.LocaleElements_en_IE.java sun/text/resources/SCCS/s.LocaleElements_en_IN.java sun/text/resources/SCCS/s.LocaleElements_en_NZ.java sun/text/resources/SCCS/s.LocaleElements_en_US.java sun/text/resources/SCCS/s.LocaleElements_en_ZA.java sun/text/resources/SCCS/s.LocaleElements_es.java sun/text/resources/SCCS/s.LocaleElements_es_AR.java sun/text/resources/SCCS/s.LocaleElements_es_BO.java sun/text/resources/SCCS/s.LocaleElements_es_CL.java sun/text/resources/SCCS/s.LocaleElements_es_CO.java sun/text/resources/SCCS/s.LocaleElements_es_CR.java sun/text/resources/SCCS/s.LocaleElements_es_DO.java sun/text/resources/SCCS/s.LocaleElements_es_EC.java sun/text/resources/SCCS/s.LocaleElements_es_ES.java sun/text/resources/SCCS/s.LocaleElements_es_GT.java sun/text/resources/SCCS/s.LocaleElements_es_HN.java sun/text/resources/SCCS/s.LocaleElements_es_MX.java sun/text/resources/SCCS/s.LocaleElements_es_NI.java sun/text/resources/SCCS/s.LocaleElements_es_PA.java sun/text/resources/SCCS/s.LocaleElements_es_PE.java sun/text/resources/SCCS/s.LocaleElements_es_PR.java sun/text/resources/SCCS/s.LocaleElements_es_PY.java sun/text/resources/SCCS/s.LocaleElements_es_SV.java sun/text/resources/SCCS/s.LocaleElements_es_UY.java sun/text/resources/SCCS/s.LocaleElements_es_VE.java sun/text/resources/SCCS/s.LocaleElements_et.java sun/text/resources/SCCS/s.LocaleElements_et_EE.java sun/text/resources/SCCS/s.LocaleElements_fi.java sun/text/resources/SCCS/s.LocaleElements_fi_FI.java sun/text/resources/SCCS/s.LocaleElements_fr.java sun/text/resources/SCCS/s.LocaleElements_fr_BE.java sun/text/resources/SCCS/s.LocaleElements_fr_CA.java sun/text/resources/SCCS/s.LocaleElements_fr_CH.java sun/text/resources/SCCS/s.LocaleElements_fr_FR.java sun/text/resources/SCCS/s.LocaleElements_fr_LU.java sun/text/resources/SCCS/s.LocaleElements_hi_IN.java sun/text/resources/SCCS/s.LocaleElements_hr.java sun/text/resources/SCCS/s.LocaleElements_hr_HR.java sun/text/resources/SCCS/s.LocaleElements_hu.java sun/text/resources/SCCS/s.LocaleElements_hu_HU.java sun/text/resources/SCCS/s.LocaleElements_is.java sun/text/resources/SCCS/s.LocaleElements_is_IS.java sun/text/resources/SCCS/s.LocaleElements_it.java sun/text/resources/SCCS/s.LocaleElements_it_CH.java sun/text/resources/SCCS/s.LocaleElements_it_IT.java sun/text/resources/SCCS/s.LocaleElements_iw.java sun/text/resources/SCCS/s.LocaleElements_iw_IL.java sun/text/resources/SCCS/s.LocaleElements_ja.java sun/text/resources/SCCS/s.LocaleElements_ja_JP.java sun/text/resources/SCCS/s.LocaleElements_ko.java sun/text/resources/SCCS/s.LocaleElements_ko_KR.java sun/text/resources/SCCS/s.LocaleElements_lt.java sun/text/resources/SCCS/s.LocaleElements_lt_LT.java sun/text/resources/SCCS/s.LocaleElements_lv.java sun/text/resources/SCCS/s.LocaleElements_lv_LV.java sun/text/resources/SCCS/s.LocaleElements_mk.java sun/text/resources/SCCS/s.LocaleElements_mk_MK.java sun/text/resources/SCCS/s.LocaleElements_nl.java sun/text/resources/SCCS/s.LocaleElements_nl_BE.java sun/text/resources/SCCS/s.LocaleElements_nl_NL.java sun/text/resources/SCCS/s.LocaleElements_no.java sun/text/resources/SCCS/s.LocaleElements_no_NO.java sun/text/resources/SCCS/s.LocaleElements_no_NO_NY.java sun/text/resources/SCCS/s.LocaleElements_pl.java sun/text/resources/SCCS/s.LocaleElements_pl_PL.java sun/text/resources/SCCS/s.LocaleElements_pt.java sun/text/resources/SCCS/s.LocaleElements_pt_BR.java sun/text/resources/SCCS/s.LocaleElements_pt_PT.java sun/text/resources/SCCS/s.LocaleElements_ro.java sun/text/resources/SCCS/s.LocaleElements_ro_RO.java sun/text/resources/SCCS/s.LocaleElements_ru.java sun/text/resources/SCCS/s.LocaleElements_ru_RU.java sun/text/resources/SCCS/s.LocaleElements_sk.java sun/text/resources/SCCS/s.LocaleElements_sk_SK.java sun/text/resources/SCCS/s.LocaleElements_sl.java sun/text/resources/SCCS/s.LocaleElements_sl_SI.java sun/text/resources/SCCS/s.LocaleElements_sq.java sun/text/resources/SCCS/s.LocaleElements_sq_AL.java sun/text/resources/SCCS/s.LocaleElements_sv.java sun/text/resources/SCCS/s.LocaleElements_sv_SE.java sun/text/resources/SCCS/s.LocaleElements_th.java sun/text/resources/SCCS/s.LocaleElements_th_TH.java sun/text/resources/SCCS/s.LocaleElements_th_TH_TH.java sun/text/resources/SCCS/s.LocaleElements_tr.java sun/text/resources/SCCS/s.LocaleElements_tr_TR.java sun/text/resources/SCCS/s.LocaleElements_uk.java sun/text/resources/SCCS/s.LocaleElements_uk_UA.java sun/text/resources/SCCS/s.LocaleElements_vi.java sun/text/resources/SCCS/s.LocaleElements_vi_VN.java sun/text/resources/SCCS/s.LocaleElements_zh.java sun/text/resources/SCCS/s.LocaleElements_zh_CN.java sun/text/resources/SCCS/s.LocaleElements_zh_HK.java sun/text/resources/SCCS/s.LocaleElements_zh_TW.java sun/text/resources/BreakIteratorInfo_th.java sun/text/resources/BreakIteratorInfo.java sun/text/resources/BreakIteratorRules.java sun/text/resources/BreakIteratorRules_th.java sun/text/resources/DateFormatZoneData.java sun/text/resources/DateFormatZoneData_ar.java sun/text/resources/DateFormatZoneData_be.java sun/text/resources/DateFormatZoneData_bg.java sun/text/resources/DateFormatZoneData_ca.java sun/text/resources/DateFormatZoneData_cs.java sun/text/resources/DateFormatZoneData_da.java sun/text/resources/DateFormatZoneData_de.java sun/text/resources/thai_dict sun/text/resources/LocaleData.java sun/text/resources/DateFormatZoneData_de_AT.java sun/text/resources/DateFormatZoneData_de_CH.java sun/text/resources/DateFormatZoneData_el.java sun/text/resources/DateFormatZoneData_en.java sun/text/resources/DateFormatZoneData_en_CA.java sun/text/resources/DateFormatZoneData_en_GB.java sun/text/resources/DateFormatZoneData_en_IE.java sun/text/resources/DateFormatZoneData_en_IN.java sun/text/resources/DateFormatZoneData_es.java sun/text/resources/DateFormatZoneData_et.java sun/text/resources/DateFormatZoneData_fi.java sun/text/resources/DateFormatZoneData_fr.java sun/text/resources/DateFormatZoneData_fr_BE.java sun/text/resources/DateFormatZoneData_fr_CA.java sun/text/resources/DateFormatZoneData_fr_CH.java sun/text/resources/DateFormatZoneData_hi_IN.java sun/text/resources/DateFormatZoneData_hr.java sun/text/resources/DateFormatZoneData_hu.java sun/text/resources/DateFormatZoneData_is.java sun/text/resources/DateFormatZoneData_it.java sun/text/resources/DateFormatZoneData_it_CH.java sun/text/resources/DateFormatZoneData_iw.java sun/text/resources/DateFormatZoneData_ja.java sun/text/resources/DateFormatZoneData_ko.java sun/text/resources/DateFormatZoneData_lt.java sun/text/resources/DateFormatZoneData_lv.java sun/text/resources/LocaleElements.java sun/text/resources/DateFormatZoneData_mk.java sun/text/resources/DateFormatZoneData_nl.java sun/text/resources/DateFormatZoneData_nl_BE.java sun/text/resources/DateFormatZoneData_no.java sun/text/resources/DateFormatZoneData_no_NO_NY.java sun/text/resources/DateFormatZoneData_pl.java sun/text/resources/DateFormatZoneData_pt.java sun/text/resources/DateFormatZoneData_ro.java sun/text/resources/DateFormatZoneData_ru.java sun/text/resources/DateFormatZoneData_sk.java sun/text/resources/DateFormatZoneData_sl.java sun/text/resources/DateFormatZoneData_sq.java sun/text/resources/DateFormatZoneData_sv.java sun/text/resources/LocaleElements_ar.java sun/text/resources/DateFormatZoneData_th.java sun/text/resources/DateFormatZoneData_tr.java sun/text/resources/DateFormatZoneData_uk.java sun/text/resources/DateFormatZoneData_zh_CN.java sun/text/resources/DateFormatZoneData_zh_HK.java sun/text/resources/DateFormatZoneData_zh_TW.java sun/text/resources/LocaleElements_ar_AE.java sun/text/resources/LocaleElements_ar_BH.java sun/text/resources/LocaleElements_ar_DZ.java sun/text/resources/LocaleElements_ar_EG.java sun/text/resources/LocaleElements_ar_IQ.java sun/text/resources/LocaleElements_ar_JO.java sun/text/resources/LocaleElements_ar_KW.java sun/text/resources/LocaleElements_be.java sun/text/resources/LocaleElements_ar_LB.java sun/text/resources/LocaleElements_ar_LY.java sun/text/resources/LocaleElements_ar_MA.java sun/text/resources/LocaleElements_ar_OM.java sun/text/resources/LocaleElements_ar_QA.java sun/text/resources/LocaleElements_ar_SA.java sun/text/resources/LocaleElements_ar_SD.java sun/text/resources/LocaleElements_ar_SY.java sun/text/resources/LocaleElements_ar_TN.java sun/text/resources/LocaleElements_ar_YE.java sun/text/resources/LocaleElements_be_BY.java sun/text/resources/LocaleElements_bg.java sun/text/resources/LocaleElements_bg_BG.java sun/text/resources/LocaleElements_ca.java sun/text/resources/LocaleElements_ca_ES.java sun/text/resources/LocaleElements_cs.java sun/text/resources/LocaleElements_cs_CZ.java sun/text/resources/LocaleElements_da.java sun/text/resources/LocaleElements_da_DK.java sun/text/resources/LocaleElements_de.java sun/text/resources/LocaleElements_de_AT.java sun/text/resources/LocaleElements_de_CH.java sun/text/resources/LocaleElements_de_DE.java sun/text/resources/LocaleElements_de_LU.java sun/text/resources/LocaleElements_el.java sun/text/resources/LocaleElements_el_GR.java sun/text/resources/LocaleElements_en.java sun/text/resources/LocaleElements_es.java sun/text/resources/LocaleElements_et.java sun/text/resources/LocaleElements_en_AU.java sun/text/resources/LocaleElements_en_CA.java sun/text/resources/LocaleElements_en_GB.java sun/text/resources/LocaleElements_en_IE.java sun/text/resources/LocaleElements_en_IN.java sun/text/resources/LocaleElements_en_NZ.java sun/text/resources/LocaleElements_en_US.java sun/text/resources/LocaleElements_en_ZA.java sun/text/resources/LocaleElements_es_AR.java sun/text/resources/LocaleElements_es_BO.java sun/text/resources/LocaleElements_es_CL.java sun/text/resources/LocaleElements_es_CO.java sun/text/resources/LocaleElements_es_CR.java sun/text/resources/LocaleElements_es_DO.java sun/text/resources/LocaleElements_es_EC.java sun/text/resources/LocaleElements_es_ES.java sun/text/resources/LocaleElements_es_GT.java sun/text/resources/LocaleElements_es_HN.java sun/text/resources/LocaleElements_es_MX.java sun/text/resources/LocaleElements_es_NI.java sun/text/resources/LocaleElements_es_PA.java sun/text/resources/LocaleElements_es_PE.java sun/text/resources/LocaleElements_es_PR.java sun/text/resources/LocaleElements_es_PY.java sun/text/resources/LocaleElements_es_SV.java sun/text/resources/LocaleElements_es_UY.java sun/text/resources/LocaleElements_es_VE.java sun/text/resources/LocaleElements_et_EE.java sun/text/resources/LocaleElements_fi.java sun/text/resources/LocaleElements_fi_FI.java sun/text/resources/LocaleElements_fr.java sun/text/resources/LocaleElements_fr_BE.java sun/text/resources/LocaleElements_fr_CA.java sun/text/resources/LocaleElements_fr_CH.java sun/text/resources/LocaleElements_fr_FR.java sun/text/resources/LocaleElements_fr_LU.java sun/text/resources/LocaleElements_hi_IN.java sun/text/resources/LocaleElements_hr.java sun/text/resources/LocaleElements_hr_HR.java sun/text/resources/LocaleElements_hu.java sun/text/resources/LocaleElements_hu_HU.java sun/text/resources/unorm.icu sun/text/resources/LocaleElements_is.java sun/text/resources/LocaleElements_is_IS.java sun/text/resources/LocaleElements_it.java sun/text/resources/LocaleElements_it_CH.java sun/text/resources/LocaleElements_it_IT.java sun/text/resources/LocaleElements_iw.java sun/text/resources/LocaleElements_iw_IL.java sun/text/resources/LocaleElements_ja.java sun/text/resources/LocaleElements_ja_JP.java sun/text/resources/LocaleElements_ko.java sun/text/resources/LocaleElements_ko_KR.java sun/text/resources/LocaleElements_lt.java sun/text/resources/LocaleElements_lt_LT.java sun/text/resources/LocaleElements_lv.java sun/text/resources/LocaleElements_lv_LV.java sun/text/resources/LocaleElements_mk.java sun/text/resources/LocaleElements_mk_MK.java sun/text/resources/LocaleElements_nl.java sun/text/resources/LocaleElements_nl_BE.java sun/text/resources/LocaleElements_nl_NL.java sun/text/resources/LocaleElements_no.java sun/text/resources/LocaleElements_no_NO.java sun/text/resources/LocaleElements_no_NO_NY.java sun/text/resources/LocaleElements_pl.java sun/text/resources/LocaleElements_pl_PL.java sun/text/resources/LocaleElements_pt.java sun/text/resources/LocaleElements_pt_BR.java sun/text/resources/LocaleElements_pt_PT.java sun/text/resources/LocaleElements_ro.java sun/text/resources/LocaleElements_ro_RO.java sun/text/resources/LocaleElements_ru.java sun/text/resources/LocaleElements_ru_RU.java sun/text/resources/LocaleElements_sk.java sun/text/resources/LocaleElements_sk_SK.java sun/text/resources/LocaleElements_sl.java sun/text/resources/LocaleElements_sl_SI.java sun/text/resources/LocaleElements_sq.java sun/text/resources/LocaleElements_sq_AL.java sun/text/resources/LocaleElements_sv.java sun/text/resources/LocaleElements_sv_SE.java sun/text/resources/LocaleElements_th.java sun/text/resources/LocaleElements_th_TH.java sun/text/resources/LocaleElements_th_TH_TH.java sun/text/resources/LocaleElements_tr.java sun/text/resources/LocaleElements_uk.java sun/text/resources/LocaleElements_tr_TR.java sun/text/resources/LocaleElements_uk_UA.java sun/text/resources/LocaleElements_vi.java sun/text/resources/LocaleElements_vi_VN.java sun/text/resources/LocaleElements_zh.java sun/text/resources/LocaleElements_zh_CN.java sun/text/resources/LocaleElements_zh_HK.java sun/text/resources/LocaleElements_zh_TW.java sun/text/CodePointIterator.java sun/text/CharTrie.java sun/text/NormalizerDataReader.java sun/text/CompactByteArray.java sun/text/CompactCharArray.java sun/text/CompactIntArray.java sun/text/CompactShortArray.java sun/text/ComposedCharIter.java sun/text/ICUBinary.java sun/text/IntHashtable.java sun/text/IntTrie.java sun/text/Normalizer.java sun/text/NormalizerImpl.java sun/text/Trie.java sun/text/NormalizerUtilities.java sun/text/SupplementaryCharacterData.java sun/text/UCharacterIterator.java sun/text/UCompactIntArray.java sun/text/Utility.java sun/tools sun/tools/asm sun/tools/asm/SCCS sun/tools/asm/SCCS/s.ClassConstantData.java sun/tools/asm/SCCS/s.ArrayData.java sun/tools/asm/SCCS/s.Assembler.java sun/tools/asm/SCCS/s.CatchData.java sun/tools/asm/SCCS/s.ConstantPoolData.java sun/tools/asm/SCCS/s.ConstantPool.java sun/tools/asm/SCCS/s.Cover.java sun/tools/asm/SCCS/s.Instruction.java sun/tools/asm/SCCS/s.FieldConstantData.java sun/tools/asm/SCCS/s.Label.java sun/tools/asm/SCCS/s.LocalVariable.java sun/tools/asm/SCCS/s.LocalVariableTable.java sun/tools/asm/SCCS/s.NameAndTypeConstantData.java sun/tools/asm/SCCS/s.NameAndTypeData.java sun/tools/asm/SCCS/s.NumberConstantData.java sun/tools/asm/SCCS/s.StringConstantData.java sun/tools/asm/SCCS/s.StringExpressionConstantData.java sun/tools/asm/SCCS/s.SwitchData.java sun/tools/asm/SCCS/s.TryData.java sun/tools/asm/ClassConstantData.java sun/tools/asm/ArrayData.java sun/tools/asm/Assembler.java sun/tools/asm/CatchData.java sun/tools/asm/ConstantPoolData.java sun/tools/asm/ConstantPool.java sun/tools/asm/Instruction.java sun/tools/asm/Cover.java sun/tools/asm/NameAndTypeConstantData.java sun/tools/asm/FieldConstantData.java sun/tools/asm/Label.java sun/tools/asm/LocalVariable.java sun/tools/asm/LocalVariableTable.java sun/tools/asm/NameAndTypeData.java sun/tools/asm/NumberConstantData.java sun/tools/asm/StringConstantData.java sun/tools/asm/SwitchData.java sun/tools/asm/TryData.java sun/tools/asm/StringExpressionConstantData.java sun/tools/hprof sun/tools/hprof/SCCS sun/tools/hprof/SCCS/s.Tracker.java sun/tools/hprof/Tracker.java sun/tools/jar sun/tools/jar/SCCS sun/tools/jar/SCCS/s.JarImageSource.java sun/tools/jar/SCCS/s.CommandLine.java sun/tools/jar/SCCS/s.JarException.java sun/tools/jar/SCCS/s.JarVerifierStream.java sun/tools/jar/SCCS/s.Main.java sun/tools/jar/SCCS/s.Manifest.java sun/tools/jar/SCCS/s.SignatureFile.java sun/tools/jar/resources sun/tools/jar/resources/SCCS sun/tools/jar/resources/SCCS/s.jar_zh_CN.properties sun/tools/jar/resources/SCCS/s.jar.properties sun/tools/jar/resources/SCCS/s.jar_de.properties sun/tools/jar/resources/SCCS/s.jar_es.properties sun/tools/jar/resources/SCCS/s.jar_fr.properties sun/tools/jar/resources/SCCS/s.jar_it.properties sun/tools/jar/resources/SCCS/s.jar_ja.properties sun/tools/jar/resources/SCCS/s.jar_ko.properties sun/tools/jar/resources/SCCS/s.jar_sv.properties sun/tools/jar/resources/SCCS/s.jar_zh_TW.properties sun/tools/jar/resources/jar_de.properties sun/tools/jar/resources/jar.properties sun/tools/jar/resources/jar_es.properties sun/tools/jar/resources/jar_fr.properties sun/tools/jar/resources/jar_it.properties sun/tools/jar/resources/jar_ja.properties sun/tools/jar/resources/jar_ko.properties sun/tools/jar/resources/jar_sv.properties sun/tools/jar/resources/jar_zh_CN.properties sun/tools/jar/resources/jar_zh_TW.properties sun/tools/jar/JarVerifierStream.java sun/tools/jar/CommandLine.java sun/tools/jar/JarException.java sun/tools/jar/JarImageSource.java sun/tools/jar/SignatureFile.java sun/tools/jar/Main.java sun/tools/jar/Manifest.java sun/tools/java sun/tools/java/SCCS sun/tools/java/SCCS/s.BinaryConstantPool.java sun/tools/java/SCCS/s.AmbiguousClass.java sun/tools/java/SCCS/s.AmbiguousMember.java sun/tools/java/SCCS/s.ArrayType.java sun/tools/java/SCCS/s.BinaryAttribute.java sun/tools/java/SCCS/s.BinaryClass.java sun/tools/java/SCCS/s.BinaryCode.java sun/tools/java/SCCS/s.Type.java sun/tools/java/SCCS/s.BinaryExceptionHandler.java sun/tools/java/SCCS/s.BinaryMember.java sun/tools/java/SCCS/s.ClassDeclaration.java sun/tools/java/SCCS/s.ClassDefinition.java sun/tools/java/SCCS/s.ClassFile.java sun/tools/java/SCCS/s.ClassNotFound.java sun/tools/java/SCCS/s.ClassPath.java sun/tools/java/SCCS/s.ClassType.java sun/tools/java/SCCS/s.CompilerError.java sun/tools/java/SCCS/s.Constants.java sun/tools/java/SCCS/s.Environment.java sun/tools/java/SCCS/s.Identifier.java sun/tools/java/SCCS/s.IdentifierToken.java sun/tools/java/SCCS/s.Imports.java sun/tools/java/SCCS/s.MemberDefinition.java sun/tools/java/SCCS/s.MethodSet.java sun/tools/java/SCCS/s.MethodType.java sun/tools/java/SCCS/s.Package.java sun/tools/java/SCCS/s.Parser.java sun/tools/java/SCCS/s.ParserActions.java sun/tools/java/SCCS/s.RuntimeConstants.java sun/tools/java/SCCS/s.Scanner.java sun/tools/java/SCCS/s.ScannerInputReader.java sun/tools/java/SCCS/s.SyntaxError.java sun/tools/java/AmbiguousMember.java sun/tools/java/AmbiguousClass.java sun/tools/java/BinaryAttribute.java sun/tools/java/ArrayType.java sun/tools/java/BinaryExceptionHandler.java sun/tools/java/BinaryClass.java sun/tools/java/BinaryCode.java sun/tools/java/BinaryConstantPool.java sun/tools/java/BinaryMember.java sun/tools/java/ClassDeclaration.java sun/tools/java/ClassDefinition.java sun/tools/java/ClassFile.java sun/tools/java/ClassNotFound.java sun/tools/java/ClassPath.java sun/tools/java/ClassType.java sun/tools/java/CompilerError.java sun/tools/java/Constants.java sun/tools/java/Environment.java sun/tools/java/Identifier.java sun/tools/java/IdentifierToken.java sun/tools/java/Imports.java sun/tools/java/MemberDefinition.java sun/tools/java/MethodSet.java sun/tools/java/MethodType.java sun/tools/java/Package.java sun/tools/java/Parser.java sun/tools/java/ParserActions.java sun/tools/java/RuntimeConstants.java sun/tools/java/Scanner.java sun/tools/java/ScannerInputReader.java sun/tools/java/SyntaxError.java sun/tools/java/Type.java sun/tools/javac sun/tools/javac/SCCS sun/tools/javac/SCCS/s.BatchEnvironment.java sun/tools/javac/SCCS/s.BatchParser.java sun/tools/javac/SCCS/s.CompilerMember.java sun/tools/javac/SCCS/s.ErrorConsumer.java sun/tools/javac/SCCS/s.ErrorMessage.java sun/tools/javac/SCCS/s.Main.java sun/tools/javac/SCCS/s.SourceClass.java sun/tools/javac/SCCS/s.SourceMember.java sun/tools/javac/resources sun/tools/javac/resources/SCCS sun/tools/javac/resources/SCCS/s.javac_ja.properties sun/tools/javac/resources/SCCS/s.javac.properties sun/tools/javac/resources/javac.properties sun/tools/javac/resources/javac_ja.properties sun/tools/javac/BatchEnvironment.java sun/tools/javac/BatchParser.java sun/tools/javac/CompilerMember.java sun/tools/javac/ErrorConsumer.java sun/tools/javac/ErrorMessage.java sun/tools/javac/Main.java sun/tools/javac/SourceClass.java sun/tools/javac/SourceMember.java sun/tools/javap sun/tools/javap/SCCS sun/tools/javap/SCCS/s.ClassData.java sun/tools/javap/SCCS/s.AttrData.java sun/tools/javap/SCCS/s.CPX.java sun/tools/javap/SCCS/s.CPX2.java sun/tools/javap/SCCS/s.Constants.java sun/tools/javap/SCCS/s.FieldData.java sun/tools/javap/SCCS/s.InnerClassData.java sun/tools/javap/SCCS/s.JavapEnvironment.java sun/tools/javap/SCCS/s.JavapPrinter.java sun/tools/javap/SCCS/s.LineNumData.java sun/tools/javap/SCCS/s.LocVarData.java sun/tools/javap/SCCS/s.Main.java sun/tools/javap/SCCS/s.MethodData.java sun/tools/javap/SCCS/s.RuntimeConstants.java sun/tools/javap/SCCS/s.Tables.java sun/tools/javap/SCCS/s.TrapData.java sun/tools/javap/SCCS/s.TypeSignature.java sun/tools/javap/oldjavap sun/tools/javap/oldjavap/SCCS sun/tools/javap/oldjavap/SCCS/s.JavaPClassPrinter.java sun/tools/javap/oldjavap/SCCS/s.ConstantPrinter.java sun/tools/javap/oldjavap/SCCS/s.JavaP.java sun/tools/javap/oldjavap/SCCS/s.JavaPBinaryCode.java sun/tools/javap/oldjavap/SCCS/s.JavaPEnvironment.java sun/tools/javap/oldjavap/ConstantPrinter.java sun/tools/javap/oldjavap/JavaP.java sun/tools/javap/oldjavap/JavaPBinaryCode.java sun/tools/javap/oldjavap/JavaPClassPrinter.java sun/tools/javap/oldjavap/JavaPEnvironment.java sun/tools/javap/InnerClassData.java sun/tools/javap/AttrData.java sun/tools/javap/CPX.java sun/tools/javap/CPX2.java sun/tools/javap/ClassData.java sun/tools/javap/Constants.java sun/tools/javap/FieldData.java sun/tools/javap/JavapEnvironment.java sun/tools/javap/JavapPrinter.java sun/tools/javap/LineNumData.java sun/tools/javap/LocVarData.java sun/tools/javap/Main.java sun/tools/javap/MethodData.java sun/tools/javap/RuntimeConstants.java sun/tools/javap/Tables.java sun/tools/javap/TrapData.java sun/tools/javap/TypeSignature.java sun/tools/javazic sun/tools/javazic/SCCS sun/tools/javazic/SCCS/s.DayOfWeek.java sun/tools/javazic/SCCS/s.BackEnd.java sun/tools/javazic/SCCS/s.Checksum.java sun/tools/javazic/SCCS/s.Gen.java sun/tools/javazic/SCCS/s.GenDoc.java sun/tools/javazic/SCCS/s.GenSrc.java sun/tools/javazic/SCCS/s.Main.java sun/tools/javazic/SCCS/s.Mappings.java sun/tools/javazic/SCCS/s.Month.java sun/tools/javazic/SCCS/s.Rule.java sun/tools/javazic/SCCS/s.RuleDay.java sun/tools/javazic/SCCS/s.RuleRec.java sun/tools/javazic/SCCS/s.Simple.java sun/tools/javazic/SCCS/s.Time.java sun/tools/javazic/SCCS/s.Timezone.java sun/tools/javazic/SCCS/s.Zone.java sun/tools/javazic/SCCS/s.ZoneRec.java sun/tools/javazic/SCCS/s.Zoneinfo.java sun/tools/javazic/BackEnd.java sun/tools/javazic/Checksum.java sun/tools/javazic/Gen.java sun/tools/javazic/GenDoc.java sun/tools/javazic/GenSrc.java sun/tools/javazic/Main.java sun/tools/javazic/Mappings.java sun/tools/javazic/Month.java sun/tools/javazic/Rule.java sun/tools/javazic/RuleDay.java sun/tools/javazic/RuleRec.java sun/tools/javazic/Simple.java sun/tools/javazic/Time.java sun/tools/javazic/Timezone.java sun/tools/javazic/Zone.java sun/tools/javazic/ZoneRec.java sun/tools/javazic/Zoneinfo.java sun/tools/javazic/DayOfWeek.java sun/tools/jconsole sun/tools/jconsole/SCCS sun/tools/jconsole/SCCS/s.BorderedComponent.java sun/tools/jconsole/SCCS/s.ClassTab.java sun/tools/jconsole/SCCS/s.ConnectDialog.java sun/tools/jconsole/SCCS/s.ConnectionParameters.java sun/tools/jconsole/SCCS/s.CreateMBeanDialog.java sun/tools/jconsole/SCCS/s.Formatter.java sun/tools/jconsole/SCCS/s.JConsole.java sun/tools/jconsole/SCCS/s.LabeledComponent.java sun/tools/jconsole/SCCS/s.MBeansTab.java sun/tools/jconsole/SCCS/s.MemoryPoolProxy.java sun/tools/jconsole/SCCS/s.MemoryPoolStat.java sun/tools/jconsole/SCCS/s.MemoryTab.java sun/tools/jconsole/SCCS/s.Plotter.java sun/tools/jconsole/SCCS/s.PlotterPanel.java sun/tools/jconsole/SCCS/s.ProxyClient.java sun/tools/jconsole/SCCS/s.VariableGridLayout.java sun/tools/jconsole/SCCS/s.Resources.java sun/tools/jconsole/SCCS/s.SummaryTab.java sun/tools/jconsole/SCCS/s.Tab.java sun/tools/jconsole/SCCS/s.ThreadTab.java sun/tools/jconsole/SCCS/s.TimeComboBox.java sun/tools/jconsole/SCCS/s.VMInternalFrame.java sun/tools/jconsole/SCCS/s.VMPanel.java sun/tools/jconsole/SCCS/s.VMTab.java sun/tools/jconsole/SCCS/s.Version-template.java sun/tools/jconsole/SCCS/s.Worker.java sun/tools/jconsole/SCCS/s.manifest sun/tools/jconsole/inspector sun/tools/jconsole/inspector/SCCS sun/tools/jconsole/inspector/SCCS/s.OperationEntry.java sun/tools/jconsole/inspector/SCCS/s.IconManager.java sun/tools/jconsole/inspector/SCCS/s.XJdmkTreeRenderer.java sun/tools/jconsole/inspector/SCCS/s.TableSorter.java sun/tools/jconsole/inspector/SCCS/s.ThreadDialog.java sun/tools/jconsole/inspector/SCCS/s.Utils.java sun/tools/jconsole/inspector/SCCS/s.XArrayDataViewer.java sun/tools/jconsole/inspector/SCCS/s.XDataViewer.java sun/tools/jconsole/inspector/SCCS/s.XMBeanAttributes.java sun/tools/jconsole/inspector/SCCS/s.XMBean.java sun/tools/jconsole/inspector/SCCS/s.XMBeanNotifications.java sun/tools/jconsole/inspector/SCCS/s.XMBeanInfo.java sun/tools/jconsole/inspector/SCCS/s.XMBeanOperations.java sun/tools/jconsole/inspector/SCCS/s.XMBeanTree.java sun/tools/jconsole/inspector/SCCS/s.XObject.java sun/tools/jconsole/inspector/SCCS/s.XOpenTypeViewer.java sun/tools/jconsole/inspector/SCCS/s.XOperations.java sun/tools/jconsole/inspector/SCCS/s.XPane.java sun/tools/jconsole/inspector/SCCS/s.XPlotter.java sun/tools/jconsole/inspector/SCCS/s.XPlottingViewer.java sun/tools/jconsole/inspector/SCCS/s.XSheet.java sun/tools/jconsole/inspector/SCCS/s.XTabbedPane.java sun/tools/jconsole/inspector/SCCS/s.XTable.java sun/tools/jconsole/inspector/SCCS/s.XTextField.java sun/tools/jconsole/inspector/SCCS/s.XTextFieldEditor.java sun/tools/jconsole/inspector/SCCS/s.XTree.java sun/tools/jconsole/inspector/SCCS/s.XTreeRenderer.java sun/tools/jconsole/inspector/XArrayDataViewer.java sun/tools/jconsole/inspector/IconManager.java sun/tools/jconsole/inspector/OperationEntry.java sun/tools/jconsole/inspector/TableSorter.java sun/tools/jconsole/inspector/ThreadDialog.java sun/tools/jconsole/inspector/Utils.java sun/tools/jconsole/inspector/XMBeanNotifications.java sun/tools/jconsole/inspector/XDataViewer.java sun/tools/jconsole/inspector/XJdmkTreeRenderer.java sun/tools/jconsole/inspector/XMBean.java sun/tools/jconsole/inspector/XMBeanAttributes.java sun/tools/jconsole/inspector/XMBeanInfo.java sun/tools/jconsole/inspector/XMBeanOperations.java sun/tools/jconsole/inspector/XMBeanTree.java sun/tools/jconsole/inspector/XObject.java sun/tools/jconsole/inspector/XOpenTypeViewer.java sun/tools/jconsole/inspector/XPane.java sun/tools/jconsole/inspector/XOperations.java sun/tools/jconsole/inspector/XPlotter.java sun/tools/jconsole/inspector/XPlottingViewer.java sun/tools/jconsole/inspector/XSheet.java sun/tools/jconsole/inspector/XTabbedPane.java sun/tools/jconsole/inspector/XTable.java sun/tools/jconsole/inspector/XTextField.java sun/tools/jconsole/inspector/XTextFieldEditor.java sun/tools/jconsole/inspector/XTree.java sun/tools/jconsole/inspector/XTreeRenderer.java sun/tools/jconsole/resources sun/tools/jconsole/resources/SCCS sun/tools/jconsole/resources/SCCS/s.JConsoleResources.java sun/tools/jconsole/resources/SCCS/s.JConsoleResources_ja.java sun/tools/jconsole/resources/SCCS/s.collapse.png sun/tools/jconsole/resources/SCCS/s.expand.png sun/tools/jconsole/resources/SCCS/s.mbeanserverdelegate.gif sun/tools/jconsole/resources/SCCS/s.mbeantree_root.gif sun/tools/jconsole/resources/SCCS/s.modelmbean.gif sun/tools/jconsole/resources/SCCS/s.openmbean.gif sun/tools/jconsole/resources/SCCS/s.standardmbean.gif sun/tools/jconsole/resources/SCCS/s.xobject.gif sun/tools/jconsole/resources/JConsoleResources_ja.java sun/tools/jconsole/resources/JConsoleResources.java sun/tools/jconsole/resources/mbeanserverdelegate.gif sun/tools/jconsole/resources/collapse.png sun/tools/jconsole/resources/expand.png sun/tools/jconsole/resources/mbeantree_root.gif sun/tools/jconsole/resources/modelmbean.gif sun/tools/jconsole/resources/openmbean.gif sun/tools/jconsole/resources/standardmbean.gif sun/tools/jconsole/resources/xobject.gif sun/tools/jconsole/ConnectionParameters.java sun/tools/jconsole/BorderedComponent.java sun/tools/jconsole/ClassTab.java sun/tools/jconsole/ConnectDialog.java sun/tools/jconsole/CreateMBeanDialog.java sun/tools/jconsole/Formatter.java sun/tools/jconsole/JConsole.java sun/tools/jconsole/LabeledComponent.java sun/tools/jconsole/MBeansTab.java sun/tools/jconsole/MemoryPoolProxy.java sun/tools/jconsole/MemoryPoolStat.java sun/tools/jconsole/MemoryTab.java sun/tools/jconsole/Plotter.java sun/tools/jconsole/PlotterPanel.java sun/tools/jconsole/ProxyClient.java sun/tools/jconsole/Resources.java sun/tools/jconsole/SummaryTab.java sun/tools/jconsole/Tab.java sun/tools/jconsole/ThreadTab.java sun/tools/jconsole/TimeComboBox.java sun/tools/jconsole/VMInternalFrame.java sun/tools/jconsole/VMPanel.java sun/tools/jconsole/VMTab.java sun/tools/jconsole/VariableGridLayout.java sun/tools/jconsole/Version-template.java sun/tools/jconsole/Worker.java sun/tools/jconsole/manifest sun/tools/jps sun/tools/jps/SCCS sun/tools/jps/SCCS/s.Arguments.java sun/tools/jps/SCCS/s.Jps.java sun/tools/jps/Arguments.java sun/tools/jps/Jps.java sun/tools/jstat sun/tools/jstat/SCCS sun/tools/jstat/SCCS/s.Alignment.java sun/tools/jstat/SCCS/s.Arguments.java sun/tools/jstat/SCCS/s.Closure.java sun/tools/jstat/SCCS/s.ColumnFormat.java sun/tools/jstat/SCCS/s.AscendingMonitorComparator.java sun/tools/jstat/SCCS/s.Expression.java sun/tools/jstat/SCCS/s.Jstat.java sun/tools/jstat/SCCS/s.DescendingMonitorComparator.java sun/tools/jstat/SCCS/s.ExpressionEvaluator.java sun/tools/jstat/SCCS/s.ExpressionExecuter.java sun/tools/jstat/SCCS/s.ExpressionResolver.java sun/tools/jstat/SCCS/s.HeaderClosure.java sun/tools/jstat/SCCS/s.Identifier.java sun/tools/jstat/SCCS/s.JStatLogger.java sun/tools/jstat/SCCS/s.SymbolResolutionClosure.java sun/tools/jstat/SCCS/s.Literal.java sun/tools/jstat/SCCS/s.Operator.java sun/tools/jstat/SCCS/s.OptionFinder.java sun/tools/jstat/SCCS/s.OptionFormat.java sun/tools/jstat/SCCS/s.OptionLister.java sun/tools/jstat/SCCS/s.OutputFormatter.java sun/tools/jstat/SCCS/s.OptionOutputFormatter.java sun/tools/jstat/SCCS/s.Parser.java sun/tools/jstat/SCCS/s.ParserException.java sun/tools/jstat/SCCS/s.RawOutputFormatter.java sun/tools/jstat/SCCS/s.RowClosure.java sun/tools/jstat/SCCS/s.Scale.java sun/tools/jstat/SCCS/s.SyntaxException.java sun/tools/jstat/SCCS/s.Token.java sun/tools/jstat/resources sun/tools/jstat/resources/SCCS sun/tools/jstat/resources/SCCS/s.jstat_options sun/tools/jstat/resources/jstat_options sun/tools/jstat/Alignment.java sun/tools/jstat/Arguments.java sun/tools/jstat/Closure.java sun/tools/jstat/ExpressionExecuter.java sun/tools/jstat/Expression.java sun/tools/jstat/AscendingMonitorComparator.java sun/tools/jstat/ColumnFormat.java sun/tools/jstat/DescendingMonitorComparator.java sun/tools/jstat/SymbolResolutionClosure.java sun/tools/jstat/ExpressionEvaluator.java sun/tools/jstat/ExpressionResolver.java sun/tools/jstat/HeaderClosure.java sun/tools/jstat/Identifier.java sun/tools/jstat/JStatLogger.java sun/tools/jstat/Jstat.java sun/tools/jstat/Literal.java sun/tools/jstat/Operator.java sun/tools/jstat/OptionFinder.java sun/tools/jstat/OptionFormat.java sun/tools/jstat/OptionLister.java sun/tools/jstat/OptionOutputFormatter.java sun/tools/jstat/OutputFormatter.java sun/tools/jstat/Parser.java sun/tools/jstat/ParserException.java sun/tools/jstat/RawOutputFormatter.java sun/tools/jstat/RowClosure.java sun/tools/jstat/Scale.java sun/tools/jstat/SyntaxException.java sun/tools/jstat/Token.java sun/tools/jstatd sun/tools/jstatd/SCCS sun/tools/jstatd/SCCS/s.RemoteHostImpl.java sun/tools/jstatd/SCCS/s.Jstatd.java sun/tools/jstatd/SCCS/s.RemoteVmImpl.java sun/tools/jstatd/RemoteHostImpl.java sun/tools/jstatd/Jstatd.java sun/tools/jstatd/RemoteVmImpl.java sun/tools/native2ascii sun/tools/native2ascii/SCCS sun/tools/native2ascii/SCCS/s.A2NFilter.java sun/tools/native2ascii/SCCS/s.Main.java sun/tools/native2ascii/SCCS/s.N2AFilter.java sun/tools/native2ascii/resources sun/tools/native2ascii/resources/SCCS sun/tools/native2ascii/resources/SCCS/s.MsgNative2ascii_ja.java sun/tools/native2ascii/resources/SCCS/s.MsgNative2ascii.java sun/tools/native2ascii/resources/MsgNative2ascii.java sun/tools/native2ascii/resources/MsgNative2ascii_ja.java sun/tools/native2ascii/A2NFilter.java sun/tools/native2ascii/Main.java sun/tools/native2ascii/N2AFilter.java sun/tools/serialver sun/tools/serialver/SCCS sun/tools/serialver/SCCS/s.serialver.properties sun/tools/serialver/SCCS/s.SerialVer.java sun/tools/serialver/SCCS/s.serialver_ja.properties sun/tools/serialver/serialver.properties sun/tools/serialver/SerialVer.java sun/tools/serialver/serialver_ja.properties sun/tools/tree sun/tools/tree/SCCS sun/tools/tree/SCCS/s.ArrayAccessExpression.java sun/tools/tree/SCCS/s.AddExpression.java sun/tools/tree/SCCS/s.AndExpression.java sun/tools/tree/SCCS/s.AssignAddExpression.java sun/tools/tree/SCCS/s.ArrayExpression.java sun/tools/tree/SCCS/s.AssignRemainderExpression.java sun/tools/tree/SCCS/s.AssignBitAndExpression.java sun/tools/tree/SCCS/s.AssignBitOrExpression.java sun/tools/tree/SCCS/s.AssignBitXorExpression.java sun/tools/tree/SCCS/s.AssignDivideExpression.java sun/tools/tree/SCCS/s.AssignExpression.java sun/tools/tree/SCCS/s.AssignMultiplyExpression.java sun/tools/tree/SCCS/s.AssignOpExpression.java sun/tools/tree/SCCS/s.AssignUnsignedShiftRightExpression.java sun/tools/tree/SCCS/s.AssignShiftLeftExpression.java sun/tools/tree/SCCS/s.AssignShiftRightExpression.java sun/tools/tree/SCCS/s.AssignSubtractExpression.java sun/tools/tree/SCCS/s.Node.java sun/tools/tree/SCCS/s.BinaryArithmeticExpression.java sun/tools/tree/SCCS/s.BinaryAssignExpression.java sun/tools/tree/SCCS/s.BinaryBitExpression.java sun/tools/tree/SCCS/s.BinaryCompareExpression.java sun/tools/tree/SCCS/s.BinaryEqualityExpression.java sun/tools/tree/SCCS/s.BinaryExpression.java sun/tools/tree/SCCS/s.BinaryLogicalExpression.java sun/tools/tree/SCCS/s.PositiveExpression.java sun/tools/tree/SCCS/s.BinaryShiftExpression.java sun/tools/tree/SCCS/s.BitAndExpression.java sun/tools/tree/SCCS/s.BitNotExpression.java sun/tools/tree/SCCS/s.BitOrExpression.java sun/tools/tree/SCCS/s.BitXorExpression.java sun/tools/tree/SCCS/s.BooleanExpression.java sun/tools/tree/SCCS/s.BreakStatement.java sun/tools/tree/SCCS/s.ByteExpression.java sun/tools/tree/SCCS/s.CaseStatement.java sun/tools/tree/SCCS/s.CastExpression.java sun/tools/tree/SCCS/s.CatchStatement.java sun/tools/tree/SCCS/s.CharExpression.java sun/tools/tree/SCCS/s.CheckContext.java sun/tools/tree/SCCS/s.CodeContext.java sun/tools/tree/SCCS/s.CommaExpression.java sun/tools/tree/SCCS/s.Context.java sun/tools/tree/SCCS/s.CompoundStatement.java sun/tools/tree/SCCS/s.ConditionVars.java sun/tools/tree/SCCS/s.ConditionalExpression.java sun/tools/tree/SCCS/s.ConstantExpression.java sun/tools/tree/SCCS/s.ContinueStatement.java sun/tools/tree/SCCS/s.ConvertExpression.java sun/tools/tree/SCCS/s.DeclarationStatement.java sun/tools/tree/SCCS/s.DivRemExpression.java sun/tools/tree/SCCS/s.DivideExpression.java sun/tools/tree/SCCS/s.DoStatement.java sun/tools/tree/SCCS/s.DoubleExpression.java sun/tools/tree/SCCS/s.EqualExpression.java sun/tools/tree/SCCS/s.ExprExpression.java sun/tools/tree/SCCS/s.Expression.java sun/tools/tree/SCCS/s.ExpressionStatement.java sun/tools/tree/SCCS/s.FieldExpression.java sun/tools/tree/SCCS/s.FieldUpdater.java sun/tools/tree/SCCS/s.FinallyStatement.java sun/tools/tree/SCCS/s.FloatExpression.java sun/tools/tree/SCCS/s.ForStatement.java sun/tools/tree/SCCS/s.GreaterExpression.java sun/tools/tree/SCCS/s.GreaterOrEqualExpression.java sun/tools/tree/SCCS/s.IdentifierExpression.java sun/tools/tree/SCCS/s.IfStatement.java sun/tools/tree/SCCS/s.IncDecExpression.java sun/tools/tree/SCCS/s.InlineMethodExpression.java sun/tools/tree/SCCS/s.InlineNewInstanceExpression.java sun/tools/tree/SCCS/s.InlineReturnStatement.java sun/tools/tree/SCCS/s.InstanceOfExpression.java sun/tools/tree/SCCS/s.LocalMember.java sun/tools/tree/SCCS/s.IntExpression.java sun/tools/tree/SCCS/s.IntegerExpression.java sun/tools/tree/SCCS/s.LengthExpression.java sun/tools/tree/SCCS/s.LessExpression.java sun/tools/tree/SCCS/s.LessOrEqualExpression.java sun/tools/tree/SCCS/s.LongExpression.java sun/tools/tree/SCCS/s.MethodExpression.java sun/tools/tree/SCCS/s.MultiplyExpression.java sun/tools/tree/SCCS/s.NaryExpression.java sun/tools/tree/SCCS/s.NegativeExpression.java sun/tools/tree/SCCS/s.NewArrayExpression.java sun/tools/tree/SCCS/s.NewInstanceExpression.java sun/tools/tree/SCCS/s.NotExpression.java sun/tools/tree/SCCS/s.NotEqualExpression.java sun/tools/tree/SCCS/s.OrExpression.java sun/tools/tree/SCCS/s.NullExpression.java sun/tools/tree/SCCS/s.PostDecExpression.java sun/tools/tree/SCCS/s.PostIncExpression.java sun/tools/tree/SCCS/s.PreDecExpression.java sun/tools/tree/SCCS/s.PreIncExpression.java sun/tools/tree/SCCS/s.RemainderExpression.java sun/tools/tree/SCCS/s.ReturnStatement.java sun/tools/tree/SCCS/s.ShiftLeftExpression.java sun/tools/tree/SCCS/s.ShiftRightExpression.java sun/tools/tree/SCCS/s.ShortExpression.java sun/tools/tree/SCCS/s.Statement.java sun/tools/tree/SCCS/s.StringExpression.java sun/tools/tree/SCCS/s.SubtractExpression.java sun/tools/tree/SCCS/s.UnsignedShiftRightExpression.java sun/tools/tree/SCCS/s.SuperExpression.java sun/tools/tree/SCCS/s.SwitchStatement.java sun/tools/tree/SCCS/s.SynchronizedStatement.java sun/tools/tree/SCCS/s.ThisExpression.java sun/tools/tree/SCCS/s.ThrowStatement.java sun/tools/tree/SCCS/s.TryStatement.java sun/tools/tree/SCCS/s.TypeExpression.java sun/tools/tree/SCCS/s.UnaryExpression.java sun/tools/tree/SCCS/s.VarDeclarationStatement.java sun/tools/tree/SCCS/s.UplevelReference.java sun/tools/tree/SCCS/s.Vset.java sun/tools/tree/SCCS/s.WhileStatement.java sun/tools/tree/ArrayAccessExpression.java sun/tools/tree/AddExpression.java sun/tools/tree/AndExpression.java sun/tools/tree/AssignAddExpression.java sun/tools/tree/ArrayExpression.java sun/tools/tree/AssignBitAndExpression.java sun/tools/tree/AssignBitOrExpression.java sun/tools/tree/AssignBitXorExpression.java sun/tools/tree/AssignDivideExpression.java sun/tools/tree/AssignExpression.java sun/tools/tree/AssignMultiplyExpression.java sun/tools/tree/AssignOpExpression.java sun/tools/tree/CommaExpression.java sun/tools/tree/BreakStatement.java sun/tools/tree/AssignRemainderExpression.java sun/tools/tree/AssignShiftLeftExpression.java sun/tools/tree/AssignShiftRightExpression.java sun/tools/tree/AssignSubtractExpression.java sun/tools/tree/AssignUnsignedShiftRightExpression.java sun/tools/tree/BinaryArithmeticExpression.java sun/tools/tree/BinaryAssignExpression.java sun/tools/tree/BinaryBitExpression.java sun/tools/tree/BinaryCompareExpression.java sun/tools/tree/BinaryEqualityExpression.java sun/tools/tree/BinaryExpression.java sun/tools/tree/BinaryLogicalExpression.java sun/tools/tree/BinaryShiftExpression.java sun/tools/tree/BitAndExpression.java sun/tools/tree/BitNotExpression.java sun/tools/tree/BitOrExpression.java sun/tools/tree/BitXorExpression.java sun/tools/tree/BooleanExpression.java sun/tools/tree/ByteExpression.java sun/tools/tree/CaseStatement.java sun/tools/tree/CastExpression.java sun/tools/tree/CatchStatement.java sun/tools/tree/CharExpression.java sun/tools/tree/CheckContext.java sun/tools/tree/CodeContext.java sun/tools/tree/ConditionalExpression.java sun/tools/tree/CompoundStatement.java sun/tools/tree/ConditionVars.java sun/tools/tree/ContinueStatement.java sun/tools/tree/Context.java sun/tools/tree/ConstantExpression.java sun/tools/tree/DeclarationStatement.java sun/tools/tree/ConvertExpression.java sun/tools/tree/GreaterOrEqualExpression.java sun/tools/tree/DivRemExpression.java sun/tools/tree/DivideExpression.java sun/tools/tree/DoStatement.java sun/tools/tree/DoubleExpression.java sun/tools/tree/EqualExpression.java sun/tools/tree/ExprExpression.java sun/tools/tree/Expression.java sun/tools/tree/ExpressionStatement.java sun/tools/tree/FieldExpression.java sun/tools/tree/FieldUpdater.java sun/tools/tree/FinallyStatement.java sun/tools/tree/FloatExpression.java sun/tools/tree/ForStatement.java sun/tools/tree/GreaterExpression.java sun/tools/tree/InlineNewInstanceExpression.java sun/tools/tree/IdentifierExpression.java sun/tools/tree/IfStatement.java sun/tools/tree/IncDecExpression.java sun/tools/tree/InlineMethodExpression.java sun/tools/tree/UnsignedShiftRightExpression.java sun/tools/tree/InlineReturnStatement.java sun/tools/tree/InstanceOfExpression.java sun/tools/tree/IntExpression.java sun/tools/tree/IntegerExpression.java sun/tools/tree/LengthExpression.java sun/tools/tree/LessExpression.java sun/tools/tree/LessOrEqualExpression.java sun/tools/tree/LocalMember.java sun/tools/tree/LongExpression.java sun/tools/tree/MethodExpression.java sun/tools/tree/MultiplyExpression.java sun/tools/tree/NaryExpression.java sun/tools/tree/NegativeExpression.java sun/tools/tree/NewArrayExpression.java sun/tools/tree/NewInstanceExpression.java sun/tools/tree/Node.java sun/tools/tree/NotEqualExpression.java sun/tools/tree/NotExpression.java sun/tools/tree/NullExpression.java sun/tools/tree/OrExpression.java sun/tools/tree/PositiveExpression.java sun/tools/tree/PostDecExpression.java sun/tools/tree/PostIncExpression.java sun/tools/tree/PreDecExpression.java sun/tools/tree/PreIncExpression.java sun/tools/tree/RemainderExpression.java sun/tools/tree/ReturnStatement.java sun/tools/tree/ShiftLeftExpression.java sun/tools/tree/ShiftRightExpression.java sun/tools/tree/ShortExpression.java sun/tools/tree/Statement.java sun/tools/tree/StringExpression.java sun/tools/tree/SubtractExpression.java sun/tools/tree/SuperExpression.java sun/tools/tree/SwitchStatement.java sun/tools/tree/SynchronizedStatement.java sun/tools/tree/ThisExpression.java sun/tools/tree/ThrowStatement.java sun/tools/tree/TryStatement.java sun/tools/tree/TypeExpression.java sun/tools/tree/UnaryExpression.java sun/tools/tree/VarDeclarationStatement.java sun/tools/tree/UplevelReference.java sun/tools/tree/WhileStatement.java sun/tools/tree/Vset.java sun/tools/util sun/tools/util/SCCS sun/tools/util/SCCS/s.ModifierFilter.java sun/tools/util/SCCS/s.CommandLine.java sun/tools/util/CommandLine.java sun/tools/util/ModifierFilter.java sun/util sun/util/SCCS sun/util/SCCS/s.BuddhistCalendar.java sun/util/SCCS/s.PreHashedMap.java sun/util/calendar sun/util/calendar/SCCS sun/util/calendar/SCCS/s.AbstractCalendar.java sun/util/calendar/SCCS/s.BaseCalendar.java sun/util/calendar/SCCS/s.CalendarDate.java sun/util/calendar/SCCS/s.CalendarSystem.java sun/util/calendar/SCCS/s.CalendarUtils.java sun/util/calendar/SCCS/s.Era.java sun/util/calendar/SCCS/s.Gregorian.java sun/util/calendar/SCCS/s.JulianCalendar.java sun/util/calendar/SCCS/s.ZoneInfo.java sun/util/calendar/SCCS/s.ZoneInfoFile.java sun/util/calendar/AbstractCalendar.java sun/util/calendar/BaseCalendar.java sun/util/calendar/CalendarDate.java sun/util/calendar/CalendarSystem.java sun/util/calendar/CalendarUtils.java sun/util/calendar/Era.java sun/util/calendar/Gregorian.java sun/util/calendar/JulianCalendar.java sun/util/calendar/ZoneInfo.java sun/util/calendar/ZoneInfoFile.java sun/util/logging sun/util/logging/resources sun/util/logging/resources/SCCS sun/util/logging/resources/SCCS/s.logging_zh_CN.properties sun/util/logging/resources/SCCS/s.logging.properties sun/util/logging/resources/SCCS/s.logging_de.properties sun/util/logging/resources/SCCS/s.logging_es.properties sun/util/logging/resources/SCCS/s.logging_fr.properties sun/util/logging/resources/SCCS/s.logging_it.properties sun/util/logging/resources/SCCS/s.logging_ja.properties sun/util/logging/resources/SCCS/s.logging_ko.properties sun/util/logging/resources/SCCS/s.logging_sv.properties sun/util/logging/resources/SCCS/s.logging_zh_TW.properties sun/util/logging/resources/logging_de.properties sun/util/logging/resources/logging.properties sun/util/logging/resources/logging_es.properties sun/util/logging/resources/logging_fr.properties sun/util/logging/resources/logging_it.properties sun/util/logging/resources/logging_ja.properties sun/util/logging/resources/logging_ko.properties sun/util/logging/resources/logging_sv.properties sun/util/logging/resources/logging_zh_CN.properties sun/util/logging/resources/logging_zh_TW.properties sun/util/BuddhistCalendar.java sun/util/PreHashedMap.java sunw sunw/io sunw/io/SCCS sunw/io/SCCS/s.Serializable.java sunw/io/Serializable.java sunw/util sunw/util/SCCS sunw/util/SCCS/s.EventListener.java sunw/util/SCCS/s.EventObject.java sunw/util/EventListener.java sunw/util/EventObject.java overview-bundled.html jdi-overview.html overview-core.html jsr166/src/test/loops/FJJacobi.java0000644000000000000000000001716711537741071014175 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ // Jacobi iteration on a mesh. Based loosely on a Filaments demo import java.util.concurrent.*; public class FJJacobi { static final int DEFAULT_GRANULARITY = 4096; // 1024; /** * The maximum number of matrix cells * at which to stop recursing down and instead directly update. */ static final double EPSILON = 0.0001; // convergence criterion public static void main(String[] args) throws Exception { int n = 2048; int steps = 1000; int granularity = DEFAULT_GRANULARITY; try { if (args.length > 0) n = Integer.parseInt(args[0]); if (args.length > 1) steps = Integer.parseInt(args[1]); if (args.length > 2) granularity = Integer.parseInt(args[2]); } catch (Exception e) { System.out.println("Usage: java FJJacobi []"); return; } ForkJoinPool fjp = new ForkJoinPool(); // allocate enough space for edges int dim = n+2; int ncells = dim * dim; double[][] a = new double[dim][dim]; double[][] b = new double[dim][dim]; // Initialize interiors to small value double smallVal = EPSILON; // 1.0/dim; for (int i = 1; i < dim-1; ++i) { for (int j = 1; j < dim-1; ++j) a[i][j] = smallVal; } // Fill all edges with 1's. for (int k = 0; k < dim; ++k) { a[k][0] = 1.0; a[k][n+1] = 1.0; a[0][k] = 1.0; a[n+1][k] = 1.0; b[k][0] = 1.0; b[k][n+1] = 1.0; b[0][k] = 1.0; b[n+1][k] = 1.0; } int nreps = 10; for (int rep = 0; rep < nreps; ++rep) { Driver driver = new Driver(a, b, 1, n, 1, n, steps, granularity); long startTime = System.currentTimeMillis(); fjp.invoke(driver); long time = System.currentTimeMillis() - startTime; double secs = ((double)time) / 1000.0; System.out.println("Compute Time: " + secs); System.out.println(fjp); } } abstract static class MatrixTree extends RecursiveAction { // maximum difference between old and new values double maxDiff; public final double directCompute() { compute(); return maxDiff; } public final double joinAndReinitialize(double md) { if (tryUnfork()) compute(); else { quietlyJoin(); reinitialize(); } double m = maxDiff; return (md > m) ? md : m; } } static final class LeafNode extends MatrixTree { final double[][] A; // matrix to get old values from final double[][] B; // matrix to put new values into // indices of current submatrix final int loRow; final int hiRow; final int loCol; final int hiCol; int steps = 0; // track even/odd steps LeafNode(double[][] A, double[][] B, int loRow, int hiRow, int loCol, int hiCol) { this.A = A; this.B = B; this.loRow = loRow; this.hiRow = hiRow; this.loCol = loCol; this.hiCol = hiCol; } public void compute() { boolean AtoB = (steps++ & 1) == 0; double[][] a = AtoB ? A : B; double[][] b = AtoB ? B : A; double md = 0.0; // local for computing max diff for (int i = loRow; i <= hiRow; ++i) { for (int j = loCol; j <= hiCol; ++j) { double v = 0.25 * (a[i-1][j] + a[i][j-1] + a[i+1][j] + a[i][j+1]); b[i][j] = v; double diff = v - a[i][j]; if (diff < 0) diff = -diff; if (diff > md) md = diff; } } maxDiff = md; } } static final class FourNode extends MatrixTree { final MatrixTree q1; final MatrixTree q2; final MatrixTree q3; final MatrixTree q4; FourNode(MatrixTree q1, MatrixTree q2, MatrixTree q3, MatrixTree q4) { this.q1 = q1; this.q2 = q2; this.q3 = q3; this.q4 = q4; } public void compute() { q4.fork(); q3.fork(); q2.fork(); double md = q1.directCompute(); md = q2.joinAndReinitialize(md); md = q3.joinAndReinitialize(md); md = q4.joinAndReinitialize(md); maxDiff = md; } } static final class TwoNode extends MatrixTree { final MatrixTree q1; final MatrixTree q2; TwoNode(MatrixTree q1, MatrixTree q2) { this.q1 = q1; this.q2 = q2; } public void compute() { q2.fork(); maxDiff = q2.joinAndReinitialize(q1.directCompute()); } } static final class Driver extends RecursiveAction { MatrixTree mat; double[][] A; double[][] B; int firstRow; int lastRow; int firstCol; int lastCol; final int steps; final int leafs; int nleaf; Driver(double[][] A, double[][] B, int firstRow, int lastRow, int firstCol, int lastCol, int steps, int leafs) { this.A = A; this.B = B; this.firstRow = firstRow; this.firstCol = firstCol; this.lastRow = lastRow; this.lastCol = lastCol; this.steps = steps; this.leafs = leafs; mat = build(A, B, firstRow, lastRow, firstCol, lastCol, leafs); System.out.println("Using " + nleaf + " segments"); } MatrixTree build(double[][] a, double[][] b, int lr, int hr, int lc, int hc, int leafs) { int rows = (hr - lr + 1); int cols = (hc - lc + 1); int mr = (lr + hr) >>> 1; // midpoints int mc = (lc + hc) >>> 1; int hrows = (mr - lr + 1); int hcols = (mc - lc + 1); if (rows * cols <= leafs) { ++nleaf; return new LeafNode(a, b, lr, hr, lc, hc); } else if (hrows * hcols >= leafs) { return new FourNode(build(a, b, lr, mr, lc, mc, leafs), build(a, b, lr, mr, mc+1, hc, leafs), build(a, b, mr+1, hr, lc, mc, leafs), build(a, b, mr+1, hr, mc+1, hc, leafs)); } else if (cols >= rows) { return new TwoNode(build(a, b, lr, hr, lc, mc, leafs), build(a, b, lr, hr, mc+1, hc, leafs)); } else { return new TwoNode(build(a, b, lr, mr, lc, hc, leafs), build(a, b, mr+1, hr, lc, hc, leafs)); } } static void doCompute(MatrixTree m, int s) { for (int i = 0; i < s; ++i) { m.invoke(); m.reinitialize(); } } public void compute() { doCompute(mat, steps); double md = mat.maxDiff; System.out.println("max diff after " + steps + " steps = " + md); } } } jsr166/src/test/loops/Mutex100M.java0000644000000000000000000000434511537741071014220 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.concurrent.locks.*; class Mutex100M { public static void main(String[] args) throws Exception { int x = loop((int) System.nanoTime(), 100000); x = loop(x, 100000); x = loop(x, 100000); long start = System.nanoTime(); x = loop(x, 100000000); if (x == 0) System.out.print(" "); long time = System.nanoTime() - start; double secs = (double) time / 1000000000.0; System.out.println("time: " + secs); start = System.nanoTime(); x = loop(x, 100000000); if (x == 0) System.out.print(" "); time = System.nanoTime() - start; secs = (double) time / 1000000000.0; System.out.println("time: " + secs); } static final Mutex100M.Mutex lock = new Mutex100M.Mutex(); static int loop(int x, int iters) { final Mutex100M.Mutex l = lock; for (int i = iters; i > 0; --i) { l.lock(); x = x * 134775813 + 1; l.unlock(); } return x; } static final class Mutex extends AbstractQueuedSynchronizer { public boolean isHeldExclusively() { return getState() == 1; } public boolean tryAcquire(int acquires) { return getState() == 0 && compareAndSetState(0, 1); } public boolean tryRelease(int releases) { setState(0); return true; } public Condition newCondition() { return new ConditionObject(); } public void lock() { if (!compareAndSetState(0, 1)) acquire(1); } public boolean tryLock() { return tryAcquire(1); } public void lockInterruptibly() throws InterruptedException { acquireInterruptibly(1); } public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException { return tryAcquireNanos(1, unit.toNanos(timeout)); } public void unlock() { release(1); } } } jsr166/src/test/loops/UnboundedQueueFillEmptyLoops.java0000644000000000000000000000412311551700072020335 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.*; public class UnboundedQueueFillEmptyLoops { static int maxSize = 10000; static Random rng = new Random(3153122688L); static volatile int total; static Integer[] numbers; public static void main(String[] args) throws Exception { Class klass = null; if (args.length > 0) { try { klass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } if (args.length > 2) maxSize = Integer.parseInt(args[2]); System.out.print("Class: " + klass.getName()); System.out.println(" size: " + maxSize); numbers = new Integer[maxSize]; for (int i = 0; i < maxSize; ++i) numbers[i] = rng.nextInt(128); oneRun(klass, maxSize); Thread.sleep(100); oneRun(klass, maxSize); Thread.sleep(100); oneRun(klass, maxSize); if (total == 0) System.out.print(" "); } static void oneRun(Class klass, int n) throws Exception { Queue q = (Queue) klass.newInstance(); int sum = total; int m = rng.nextInt(numbers.length); long startTime = System.nanoTime(); for (int k = 0; k < n; ++k) { for (int i = 0; i < k; ++i) { if (m >= numbers.length) m = 0; q.offer(numbers[m++]); } Integer p; while ((p = q.poll()) != null) sum += p.intValue(); } total += sum; long endTime = System.nanoTime(); long time = endTime - startTime; double secs = (double) time / 1000000000.0; System.out.println("Time: " + secs); } } jsr166/src/test/loops/DenseMapMicroBenchmark.java0000644000000000000000000001563111537741071017061 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; public class DenseMapMicroBenchmark { static final int ITERS_PER_TEST = 4; static final long NANOS_PER_JOB = 4L * 1000L*1000L*1000L; // 4 sec static final long NANOS_PER_WARMUP = 500L*1000L*1000L; // 0.5 sec // map operations per iteration -- change if hasher.work changed static final int OPS_PER_ITER = 4; // put + get + iter + remove static int SIZE = 50000; // may be replaced by program arg abstract static class Job { final String name; long nanos; int runs; public Job(String name) { this.name = name; } public String name() { return name; } public abstract void work() throws Throwable; } /** * Runs each job for at least NANOS_PER_JOB seconds. * Returns array of average times per job per run. */ static void time0(long nanos, Job ... jobs) throws Throwable { for (int i = 0; i < jobs.length; i++) { Thread.sleep(50); long t0 = System.nanoTime(); long t; int j = 0; do { j++; jobs[i].work(); } while ((t = System.nanoTime() - t0) < nanos); jobs[i].nanos = t / j; jobs[i].runs = j; } } static void time(Job ... jobs) throws Throwable { time0(NANOS_PER_JOB, jobs); final String nameHeader = "Method"; int nameWidth = nameHeader.length(); for (Job job : jobs) nameWidth = Math.max(nameWidth, job.name().length()); final int itemsPerTest = SIZE * OPS_PER_ITER * ITERS_PER_TEST; final String timeHeader = "Nanos/item"; int timeWidth = timeHeader.length(); final String ratioHeader = "Ratio"; int ratioWidth = ratioHeader.length(); String format = String.format("%%-%ds %%%dd %%.3f%%n", nameWidth, timeWidth); String headerFormat = String.format("%%-%ds %%-%ds %%-%ds%%n", nameWidth, timeWidth, ratioWidth); System.out.printf(headerFormat, "Method", "Nanos/item", "Ratio"); // Print out absolute and relative times, calibrated against first job for (int i = 0; i < jobs.length; i++) { long time = jobs[i].nanos/itemsPerTest; double ratio = (double) jobs[i].nanos / (double) jobs[0].nanos; System.out.printf(format, jobs[i].name(), time, ratio); } } static Long[] toLongs(Integer[] ints) { Long[] longs = new Long[ints.length]; for (int i = 0; i < ints.length; i++) longs[i] = ints[i].longValue(); return longs; } static String[] toStrings(Integer[] ints) { String[] strings = new String[ints.length]; for (int i = 0; i < ints.length; i++) strings[i] = ints[i].toString(); // strings[i] = String.valueOf(ints[i].doubleValue()); return strings; } static Float[] toFloats(Integer[] ints) { Float[] floats = new Float[ints.length]; for (int i = 0; i < ints.length; i++) floats[i] = ints[i].floatValue(); return floats; } static Double[] toDoubles(Integer[] ints) { Double[] doubles = new Double[ints.length]; for (int i = 0; i < ints.length; i++) doubles[i] = ints[i].doubleValue(); return doubles; } static final class Hasher extends Job { final Object[] elts; final Class mapClass; volatile int matches; Hasher(String name, Object[] elts, Class mapClass) { super(name); this.elts = elts; this.mapClass = mapClass; } public void work() { Map m = null; try { m = (Map) mapClass.newInstance(); } catch (Exception e) { throw new RuntimeException("Can't instantiate " + mapClass + ": " + e); } final int len = elts.length; for (int j = 0; j < ITERS_PER_TEST; j++) { for (Object x : elts) { if (m.put(x, x) != null) throw new Error(); } if (m.size() != len) throw new Error(); int ng = 0; for (Object x : elts) { if (m.get(x) == x) ++ng; } matches += ng; for (Object e : m.keySet()) { if (m.get(e) == e) --ng; } if (ng != 0) throw new Error(); for (Object x : elts) { if (m.remove(x) != x) throw new Error(); } if (!m.isEmpty()) throw new Error(); } if (matches != len * ITERS_PER_TEST) throw new Error(); matches = 0; } } public static void main(String[] args) throws Throwable { Class mc = java.util.HashMap.class; if (args.length > 0) mc = Class.forName(args[0]); if (args.length > 1) SIZE = Integer.parseInt(args[1]); System.out.print("Class " + mc.getName()); System.out.print(" size " + SIZE); System.out.println(); final Integer[] seq = new Integer[SIZE]; for (int i = 0; i < SIZE; i++) seq[i] = new Integer(i); final Integer[] shf = seq.clone(); Collections.shuffle(Arrays.asList(shf)); List hashers = new ArrayList(); hashers.add(new Hasher("Integer sequential", seq, mc)); hashers.add(new Hasher("Integer shuffled", shf, mc)); hashers.add(new Hasher("Long sequential", toLongs(seq), mc)); hashers.add(new Hasher("Long shuffled", toLongs(shf), mc)); hashers.add(new Hasher("Float sequential", toFloats(seq), mc)); hashers.add(new Hasher("Float shuffled", toFloats(shf), mc)); hashers.add(new Hasher("Double sequential", toDoubles(seq), mc)); hashers.add(new Hasher("Double shuffled", toDoubles(shf), mc)); hashers.add(new Hasher("String sequential", toStrings(seq), mc)); hashers.add(new Hasher("String shuffled", toStrings(shf), mc)); Hasher[] jobs = hashers.toArray(new Hasher[0]); System.out.print("warmup..."); time0(NANOS_PER_WARMUP, jobs); // Warm up run time0(NANOS_PER_WARMUP, jobs); // Warm up run for (int i = 0; i < 2; i++) { System.gc(); Thread.sleep(50); System.runFinalization(); Thread.sleep(50); } System.out.println("starting"); time(jobs); } } jsr166/src/test/loops/ConcurrentQueueLoops.java0000644000000000000000000001132111551700072016704 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.*; public class ConcurrentQueueLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static boolean print = false; static final Integer zero = new Integer(0); static final Integer one = new Integer(1); static int workMask; static final long RUN_TIME_NANOS = 5 * 1000L * 1000L * 1000L; static final int BATCH_SIZE = 8; public static void main(String[] args) throws Exception { int maxStages = 100; int work = 1024; Class klass = null; if (args.length > 0) { try { klass = Class.forName(args[0]); } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } if (args.length > 1) maxStages = Integer.parseInt(args[1]); if (args.length > 2) work = Integer.parseInt(args[2]); workMask = work - 1; System.out.print("Class: " + klass.getName()); System.out.print(" stages: " + maxStages); System.out.println(" work: " + work); print = false; System.out.println("Warmup..."); // oneRun(klass, 4); // Thread.sleep(100); oneRun(klass, 1); Thread.sleep(100); print = true; int k = 1; for (int i = 1; i <= maxStages;) { oneRun(klass, i); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static final class Stage implements Callable { final Queue queue; final CyclicBarrier barrier; final int nthreads; Stage(Queue q, CyclicBarrier b, int nthreads) { queue = q; barrier = b; this.nthreads = nthreads; } static int compute(int l) { if (l == 0) return (int) System.nanoTime(); int nn = (l >>> 7) & workMask; while (nn-- > 0) l = LoopHelpers.compute6(l); return l; } public Integer call() { try { barrier.await(); long now = System.nanoTime(); long stopTime = now + RUN_TIME_NANOS; int l = (int) now; int takes = 0; int misses = 0; int lmask = 1; for (;;) { l = compute(l); Integer item = queue.poll(); if (item != null) { ++takes; if (item == one) l = LoopHelpers.compute6(l); } else if ((misses++ & 255) == 0 && System.nanoTime() >= stopTime) { return Integer.valueOf(takes); } else { for (int i = 0; i < BATCH_SIZE; ++i) { queue.offer(((l & lmask)== 0) ? zero : one); if ((lmask <<= 1) == 0) lmask = 1; if (i != 0) l = compute(l); } } } } catch (Exception ie) { ie.printStackTrace(); throw new Error("Call loop failed"); } } } static void oneRun(Class klass, int n) throws Exception { Queue q = (Queue) klass.newInstance(); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(n + 1, timer); ArrayList> results = new ArrayList>(n); for (int i = 0; i < n; ++i) results.add(pool.submit(new Stage(q, barrier, n))); if (print) System.out.print("Threads: " + n + "\t:"); barrier.await(); int total = 0; for (int i = 0; i < n; ++i) { Future f = results.get(i); Integer r = f.get(); total += r.intValue(); } long endTime = System.nanoTime(); long time = endTime - timer.startTime; long ips = 1000000000L * total / time; if (print) System.out.print(LoopHelpers.rightJustify(ips) + " items per sec"); if (print) System.out.println(); } } jsr166/src/test/loops/LockLoops.java0000644000000000000000000002626211537741071014467 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /* * A simple test program. Feel free to play. */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class LockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static boolean doBuiltin = true; static boolean doReadWrite = true; static boolean doSemaphore = true; static boolean doFair = true; public static void main(String[] args) throws Exception { int maxThreads = 100; int iters = 1000000; int replications = 1; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); if (args.length > 1) iters = Integer.parseInt(args[1]); if (args.length > 2) replications = Integer.parseInt(args[2]); rng.setSeed(3122688L); print = false; System.out.println("Warmup..."); oneTest(3, 10000); Thread.sleep(1000); oneTest(2, 10000); Thread.sleep(100); oneTest(1, 100000); Thread.sleep(100); oneTest(1, 100000); Thread.sleep(1000); print = true; for (int i = 1; i <= maxThreads; ++i) { for (int j = 0; j < replications; ++j) { System.out.println("Threads:" + i); oneTest(i, iters / i); Thread.sleep(100); } } pool.shutdown(); } static void oneTest(int nthreads, int iters) throws Exception { int v = rng.next(); if (print) System.out.print("No shared vars "); new NoLockLoop().test(v, nthreads, iters * 10); Thread.sleep(10); if (print) System.out.print("No Lock + volatile "); new NoLockVolatileLoop().test(v, nthreads, iters); Thread.sleep(10); if (doBuiltin) { if (print) System.out.print("builtin lock "); new BuiltinLockLoop().test(v, nthreads, iters); Thread.sleep(10); } if (print) System.out.print("ReentrantLock "); new ReentrantLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (doReadWrite) { if (print) System.out.print("ReentrantWriteLock "); new ReentrantWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("ReentrantReadWriteLock"); new ReentrantReadWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); } if (doSemaphore) { if (print) System.out.print("Semaphore "); new SemaphoreLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairSemaphore "); new FairSemaphoreLoop().test(v, nthreads, iters); Thread.sleep(10); } if (doFair) { if (print) System.out.print("FairReentrantLock "); new FairReentrantLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (doReadWrite) { if (print) System.out.print("FairRWriteLock "); new FairReentrantWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); if (print) System.out.print("FairRReadWriteLock "); new FairReentrantReadWriteLockLoop().test(v, nthreads, iters); Thread.sleep(10); } } } abstract static class LockLoop implements Runnable { int v; int iters; volatile int result; final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier; final void test(int initialValue, int nthreads, int iters) throws Exception { v = initialValue; this.iters = iters; barrier = new CyclicBarrier(nthreads+1, timer); for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); long time = timer.getTime(); if (print) { long tpi = time / (iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per update"); // double secs = (double) time / 1000000000.0; // System.out.print("\t " + secs + "s run time"); System.out.println(); } if (result == 0) // avoid overoptimization System.out.println("useless result: " + result); } abstract int loop(int n); public final void run() { try { barrier.await(); result += loop(iters); barrier.await(); } catch (Exception ie) { return; } } } private static class BuiltinLockLoop extends LockLoop { final int loop(int n) { int sum = 0; while (n-- > 0) { synchronized (this) { v = LoopHelpers.compute1(v); } sum += LoopHelpers.compute2(v); } return sum; } } private static class NoLockLoop extends LockLoop { final int loop(int n) { int sum = 0; int y = v; while (n-- > 0) { y = LoopHelpers.compute1(y); sum += LoopHelpers.compute2(y); } return sum; } } private static class NoLockVolatileLoop extends LockLoop { private volatile int vv; final int loop(int n) { int sum = 0; while (n-- > 0) { int y = LoopHelpers.compute1(vv); vv = y; sum += LoopHelpers.compute2(y); } return sum; } } private static class ReentrantLockLoop extends LockLoop { private final ReentrantLock lock = new ReentrantLock(); final int loop(int n) { int sum = 0; while (n-- > 0) { lock.lock(); try { v = LoopHelpers.compute1(v); } finally { lock.unlock(); } sum += LoopHelpers.compute2(v); } return sum; } } private static class FairReentrantLockLoop extends LockLoop { private final ReentrantLock lock = new ReentrantLock(true); final int loop(int n) { int sum = 0; while (n-- > 0) { lock.lock(); try { v = LoopHelpers.compute1(v); } finally { lock.unlock(); } sum += LoopHelpers.compute2(v); } return sum; } } private static class ReentrantWriteLockLoop extends LockLoop { private final Lock lock = new ReentrantReadWriteLock().writeLock(); final int loop(int n) { int sum = 0; while (n-- > 0) { lock.lock(); try { v = LoopHelpers.compute1(v); } finally { lock.unlock(); } sum += LoopHelpers.compute2(v); } return sum; } } private static class ReentrantReadWriteLockLoop extends LockLoop { private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final int loop(int n) { int sum = 0; while (n-- > 0) { int x; lock.readLock().lock(); try { x = LoopHelpers.compute1(v); } finally { lock.readLock().unlock(); } lock.writeLock().lock(); try { v = x; } finally { lock.writeLock().unlock(); } sum += LoopHelpers.compute2(v); } return sum; } } private static class FairReentrantWriteLockLoop extends LockLoop { final Lock lock = new ReentrantReadWriteLock(true).writeLock(); final int loop(int n) { int sum = 0; while (n-- > 0) { lock.lock(); try { v = LoopHelpers.compute1(v); } finally { lock.unlock(); } sum += LoopHelpers.compute2(v); } return sum; } } private static class SemaphoreLoop extends LockLoop { private final Semaphore sem = new Semaphore(1, false); final int loop(int n) { int sum = 0; try { while (n-- > 0) { sem.acquire(); try { v = LoopHelpers.compute1(v); } finally { sem.release(); } sum += LoopHelpers.compute2(v); } } catch (InterruptedException ie) { return sum; } return sum; } } private static class FairSemaphoreLoop extends LockLoop { private final Semaphore sem = new Semaphore(1, true); final int loop(int n) { int sum = 0; try { while (n-- > 0) { sem.acquire(); try { v = LoopHelpers.compute1(v); } finally { sem.release(); } sum += LoopHelpers.compute2(v); } } catch (InterruptedException ie) { return sum; } return sum; } } private static class FairReentrantReadWriteLockLoop extends LockLoop { private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); final int loop(int n) { int sum = 0; while (n-- > 0) { int x; lock.readLock().lock(); try { x = LoopHelpers.compute1(v); } finally { lock.readLock().unlock(); } lock.writeLock().lock(); try { v = x; } finally { lock.writeLock().unlock(); } sum += LoopHelpers.compute2(v); } return sum; } } } jsr166/src/test/loops/NoopNoLockLoops.java0000644000000000000000000000566711537741071015626 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.*; import java.util.*; public final class NoopNoLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 20000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); new ReentrantLockLoop(1).test(); new ReentrantLockLoop(1).test(); print = true; int k = 1; for (int i = 1; i <= maxThreads;) { System.out.print("Threads: " + i); new ReentrantLockLoop(i).test(); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { try { barrier.await(); int sum = v + 1; int x = sum + 1; int n = iters; while (n-- > 0) { x = LoopHelpers.compute4(x); sum += x; if ((x += readBarrier) == 0) ++readBarrier; } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/RLMap.java0000644000000000000000000000453411537741071013533 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; /** * This is an incomplete implementation of a wrapper class * that places read-write locks around unsynchronized Maps. * Exists as a sample input for MapLoops test. */ public class RLMap implements Map { private final Map m; private final ReentrantLock rl = new ReentrantLock(); public RLMap(Map m) { if (m == null) throw new NullPointerException(); this.m = m; } public RLMap() { this(new TreeMap()); // use TreeMap by default } public int size() { rl.lock(); try {return m.size();} finally { rl.unlock(); } } public boolean isEmpty() { rl.lock(); try {return m.isEmpty();} finally { rl.unlock(); } } public Object get(Object key) { rl.lock(); try {return m.get(key);} finally { rl.unlock(); } } public boolean containsKey(Object key) { rl.lock(); try {return m.containsKey(key);} finally { rl.unlock(); } } public boolean containsValue(Object value) { rl.lock(); try {return m.containsValue(value);} finally { rl.unlock(); } } public Set keySet() { // Not implemented return m.keySet(); } public Set entrySet() { // Not implemented return m.entrySet(); } public Collection values() { // Not implemented return m.values(); } public boolean equals(Object o) { rl.lock(); try {return m.equals(o);} finally { rl.unlock(); } } public int hashCode() { rl.lock(); try {return m.hashCode();} finally { rl.unlock(); } } public String toString() { rl.lock(); try {return m.toString();} finally { rl.unlock(); } } public Object put(Object key, Object value) { rl.lock(); try {return m.put(key, value);} finally { rl.unlock(); } } public Object remove(Object key) { rl.lock(); try {return m.remove(key);} finally { rl.unlock(); } } public void putAll(Map map) { rl.lock(); try {m.putAll(map);} finally { rl.unlock(); } } public void clear() { rl.lock(); try {m.clear();} finally { rl.unlock(); } } } jsr166/src/test/loops/SimpleSpinLockLoops.java0000644000000000000000000000663311537741072016474 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.*; import java.util.*; public final class SimpleSpinLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 2000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); new LockLoop(1).test(); new LockLoop(1).test(); print = true; int k = 1; for (int i = 1; i <= maxThreads;) { System.out.print("Threads: " + i); new LockLoop(i).test(); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static final class LockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; private final AtomicInteger spinlock = new AtomicInteger(); LockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { final AtomicInteger lock = this.spinlock; try { barrier.await(); int sum = v + 1; int x = 0; int n = iters; while (n-- > 0) { while (!lock.compareAndSet(0, 1)) ; int k = (sum & 3); if (k > 0) { x = v; while (k-- > 0) x = LoopHelpers.compute6(x); v = x; } else x = sum + 1; lock.set(0); if ((x += readBarrier) == 0) ++readBarrier; for (int l = x & 1; l > 0; --l) sum += LoopHelpers.compute6(sum); } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/NoopMutex.java0000644000000000000000000000075511537741071014517 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.atomic.*; class NoopSpin100M { public static void main(String[] args) throws Exception { AtomicInteger lock = new AtomicInteger(); for (int i = 100000000; i > 0; --i) { lock.compareAndSet(0,1); lock.set(0); } } } jsr166/src/test/loops/SimpleFairReentrantLockLoops.java0000644000000000000000000000662211537741072020325 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.*; public final class SimpleFairReentrantLockLoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 2000000; public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); new ReentrantLockLoop(1).test(); new ReentrantLockLoop(1).test(); print = true; int k = 1; for (int i = 1; i <= maxThreads;) { System.out.print("Threads: " + i); new ReentrantLockLoop(i).test(); Thread.sleep(100); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } pool.shutdown(); } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final ReentrantLock lock = new ReentrantLock(true); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } int r = result; if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); } public final void run() { final ReentrantLock lock = this.lock; try { barrier.await(); int sum = v + 1; int x = 0; int n = iters; while (n-- > 0) { lock.lock(); int k = (sum & 3); if (k > 0) { x = v; while (k-- > 0) x = LoopHelpers.compute6(x); v = x; } else x = sum + 1; lock.unlock(); if ((x += readBarrier) == 0) ++readBarrier; for (int l = x & 7; l > 0; --l) sum += LoopHelpers.compute6(sum); } barrier.await(); result += sum; } catch (Exception ie) { return; } } } } jsr166/src/test/loops/ExchangeLoops.java0000644000000000000000000001115011537741071015307 0ustar /* * Written by Bill Scherer and Doug Lea with assistance from members * of JCP JSR-166 Expert Group and released to the public domain, as * explained at http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.concurrent.locks.*; public class ExchangeLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final int DEFAULT_THREADS = NCPUS + 2; static final long DEFAULT_TRIAL_MILLIS = 10000; public static void main(String[] args) throws Exception { int maxThreads = DEFAULT_THREADS; long trialMillis = DEFAULT_TRIAL_MILLIS; int nReps = 3; // Parse and check args int argc = 0; while (argc < args.length) { String option = args[argc++]; if (option.equals("-t")) trialMillis = Integer.parseInt(args[argc]); else if (option.equals("-r")) nReps = Integer.parseInt(args[argc]); else maxThreads = Integer.parseInt(option); argc++; } // Display runtime parameters System.out.print("ExchangeTest"); System.out.print(" -t " + trialMillis); System.out.print(" -r " + nReps); System.out.print(" max threads " + maxThreads); System.out.println(); long warmupTime = 2000; long sleepTime = 100; int nw = (maxThreads >= 3) ? 3 : 2; System.out.println("Warmups.."); oneRun(3, warmupTime); Thread.sleep(sleepTime); for (int i = maxThreads; i >= 2; i -= 1) { oneRun(i, warmupTime++); // System.gc(); Thread.sleep(sleepTime); } /* for (int i = maxThreads; i >= 2; i -= 1) { oneRun(i, warmupTime++); } */ for (int j = 0; j < nReps; ++j) { System.out.println("Trial: " + j); for (int i = 2; i <= maxThreads; i += 2) { oneRun(i, trialMillis); // System.gc(); Thread.sleep(sleepTime); } for (int i = maxThreads; i >= 2; i -= 2) { oneRun(i, trialMillis); // System.gc(); Thread.sleep(sleepTime); } Thread.sleep(sleepTime); } } static void oneRun(int nThreads, long trialMillis) throws Exception { System.out.printf("%4d threads", nThreads); Exchanger x = new Exchanger(); Runner[] runners = new Runner[nThreads]; Thread[] threads = new Thread[nThreads]; for (int i = 0; i < nThreads; ++i) { runners[i] = new Runner(x); threads[i] = new Thread(runners[i]); // int h = System.identityHashCode(threads[i]); // h ^= h << 1; // h ^= h >>> 3; // h ^= h << 10; // System.out.printf("%10x\n", h); } long startTime = System.nanoTime(); for (int i = 0; i < nThreads; ++i) { threads[i].start(); } Thread.sleep(trialMillis); for (int i = 0; i < nThreads; ++i) threads[i].interrupt(); long elapsed = System.nanoTime() - startTime; for (int i = 0; i < nThreads; ++i) threads[i].join(); int iters = 1; // System.out.println(); for (int i = 0; i < nThreads; ++i) { int ipr = runners[i].iters; // System.out.println(ipr); iters += ipr; } long rate = iters * 1000L * 1000L * 1000L / elapsed; long npt = elapsed / iters; System.out.printf("%9dms", elapsed / (1000L * 1000L)); System.out.printf("%9d it/s ", rate); System.out.printf("%9d ns/it", npt); System.out.println(); // x.printStats(); } static final class Runner implements Runnable { final Exchanger exchanger; final Object mine = new Integer(2688); volatile int iters; Runner(Exchanger x) { this.exchanger = x; } public void run() { Exchanger x = exchanger; Object m = mine; int i = 0; try { for (;;) { Object e = x.exchange(m); if (e == null || e == m) throw new Error(); m = e; ++i; } } catch (InterruptedException ie) { iters = i; } } } } jsr166/src/test/loops/SCollection.java0000644000000000000000000000573511537741071015002 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; /** * This is an incomplete implementation of a wrapper class * that places read-write locks around unsynchronized Collections. * Exists as a sample input for CollectionLoops test. */ public final class SCollection implements Collection { private final Collection c; private final ReentrantLock l = new ReentrantLock(); public SCollection(Collection c) { if (c == null) throw new NullPointerException(); this.c = c; } public SCollection() { this(new ArrayList()); } public final int size() { l.lock(); try { return c.size(); } finally { l.unlock(); } } public final boolean isEmpty() { l.lock(); try { return c.isEmpty(); } finally { l.unlock(); } } public final boolean contains(Object o) { l.lock(); try { return c.contains(o); } finally { l.unlock(); } } public final boolean equals(Object o) { l.lock(); try { return c.equals(o); } finally { l.unlock(); } } public final int hashCode() { l.lock(); try { return c.hashCode(); } finally { l.unlock(); } } public final String toString() { l.lock(); try { return c.toString(); } finally { l.unlock(); } } public final Iterator iterator() { l.lock(); try { return c.iterator(); } finally { l.unlock(); } } public final Object[] toArray() { l.lock(); try { return c.toArray(); } finally { l.unlock(); } } public final T[] toArray(T[] a) { l.lock(); try { return (T[])c.toArray(a); } finally { l.unlock(); } } public final boolean add(E e) { l.lock(); try { return c.add(e); } finally { l.unlock(); } } public final boolean remove(Object o) { l.lock(); try { return c.remove(o); } finally { l.unlock(); } } public final boolean containsAll(Collection coll) { l.lock(); try { return c.containsAll(coll); } finally { l.unlock(); } } public final boolean addAll(Collection coll) { l.lock(); try { return c.addAll(coll); } finally { l.unlock(); } } public final boolean removeAll(Collection coll) { l.lock(); try { return c.removeAll(coll); } finally { l.unlock(); } } public final boolean retainAll(Collection coll) { l.lock(); try { return c.retainAll(coll); } finally { l.unlock(); } } public final void clear() { l.lock(); try { c.clear(); } finally { l.unlock(); } } } jsr166/src/test/tck/0000755000000000000000000000000011652013244011324 5ustar jsr166/src/test/tck/ForkJoinPoolTest.java0000644000000000000000000007412511560754737015434 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ExecutorService; import java.util.concurrent.AbstractExecutorService; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Callable; import java.util.concurrent.Future; import java.util.concurrent.ExecutionException; import java.util.concurrent.CancellationException; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.ForkJoinWorkerThread; import java.util.concurrent.RecursiveTask; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.security.AccessControlException; import java.security.Policy; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; public class ForkJoinPoolTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ForkJoinPoolTest.class); } /** * Testing coverage notes: * * 1. shutdown and related methods are tested via super.joinPool. * * 2. newTaskFor and adapters are tested in submit/invoke tests * * 3. We cannot portably test monitoring methods such as * getStealCount() since they rely ultimately on random task * stealing that may cause tasks not to be stolen/propagated * across threads, especially on uniprocessors. * * 4. There are no independently testable ForkJoinWorkerThread * methods, but they are covered here and in task tests. */ // Some classes to test extension and factory methods static class MyHandler implements Thread.UncaughtExceptionHandler { volatile int catches = 0; public void uncaughtException(Thread t, Throwable e) { ++catches; } } // to test handlers static class FailingFJWSubclass extends ForkJoinWorkerThread { public FailingFJWSubclass(ForkJoinPool p) { super(p) ; } protected void onStart() { super.onStart(); throw new Error(); } } static class FailingThreadFactory implements ForkJoinPool.ForkJoinWorkerThreadFactory { volatile int calls = 0; public ForkJoinWorkerThread newThread(ForkJoinPool p) { if (++calls > 1) return null; return new FailingFJWSubclass(p); } } static class SubFJP extends ForkJoinPool { // to expose protected SubFJP() { super(1); } public int drainTasksTo(Collection> c) { return super.drainTasksTo(c); } public ForkJoinTask pollSubmission() { return super.pollSubmission(); } } static class ManagedLocker implements ForkJoinPool.ManagedBlocker { final ReentrantLock lock; boolean hasLock = false; ManagedLocker(ReentrantLock lock) { this.lock = lock; } public boolean block() { if (!hasLock) lock.lock(); return true; } public boolean isReleasable() { return hasLock || (hasLock = lock.tryLock()); } } // A simple recursive task for testing static final class FibTask extends RecursiveTask { final int number; FibTask(int n) { number = n; } public Integer compute() { int n = number; if (n <= 1) return n; FibTask f1 = new FibTask(n - 1); f1.fork(); return (new FibTask(n - 2)).compute() + f1.join(); } } // A failing task for testing static final class FailingTask extends ForkJoinTask { public final Void getRawResult() { return null; } protected final void setRawResult(Void mustBeNull) { } protected final boolean exec() { throw new Error(); } FailingTask() {} } // Fib needlessly using locking to test ManagedBlockers static final class LockingFibTask extends RecursiveTask { final int number; final ManagedLocker locker; final ReentrantLock lock; LockingFibTask(int n, ManagedLocker locker, ReentrantLock lock) { number = n; this.locker = locker; this.lock = lock; } public Integer compute() { int n; LockingFibTask f1 = null; LockingFibTask f2 = null; locker.block(); n = number; if (n > 1) { f1 = new LockingFibTask(n - 1, locker, lock); f2 = new LockingFibTask(n - 2, locker, lock); } lock.unlock(); if (n <= 1) return n; else { f1.fork(); return f2.compute() + f1.join(); } } } /** * Successfully constructed pool reports default factory, * parallelism and async mode policies, no active threads or * tasks, and quiescent running state. */ public void testDefaultInitialState() { ForkJoinPool p = new ForkJoinPool(1); try { assertSame(ForkJoinPool.defaultForkJoinWorkerThreadFactory, p.getFactory()); assertFalse(p.getAsyncMode()); assertEquals(0, p.getActiveThreadCount()); assertEquals(0, p.getStealCount()); assertEquals(0, p.getQueuedTaskCount()); assertEquals(0, p.getQueuedSubmissionCount()); assertFalse(p.hasQueuedSubmissions()); assertFalse(p.isShutdown()); assertFalse(p.isTerminating()); assertFalse(p.isTerminated()); } finally { joinPool(p); } } /** * Constructor throws if size argument is less than zero */ public void testConstructor1() { try { new ForkJoinPool(-1); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if factory argument is null */ public void testConstructor2() { try { new ForkJoinPool(1, null, null, false); shouldThrow(); } catch (NullPointerException success) {} } /** * getParallelism returns size set in constructor */ public void testGetParallelism() { ForkJoinPool p = new ForkJoinPool(1); try { assertEquals(1, p.getParallelism()); } finally { joinPool(p); } } /** * getPoolSize returns number of started workers. */ public void testGetPoolSize() { ForkJoinPool p = new ForkJoinPool(1); try { assertEquals(0, p.getActiveThreadCount()); Future future = p.submit(new StringTask()); assertEquals(1, p.getPoolSize()); } finally { joinPool(p); } } /** * setUncaughtExceptionHandler changes handler for uncaught exceptions. * * Additionally tests: Overriding ForkJoinWorkerThread.onStart * performs its defined action */ public void testSetUncaughtExceptionHandler() throws InterruptedException { final CountDownLatch uehInvoked = new CountDownLatch(1); final Thread.UncaughtExceptionHandler eh = new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { uehInvoked.countDown(); }}; ForkJoinPool p = new ForkJoinPool(1, new FailingThreadFactory(), eh, false); try { assertSame(eh, p.getUncaughtExceptionHandler()); p.execute(new FibTask(8)); assertTrue(uehInvoked.await(MEDIUM_DELAY_MS, MILLISECONDS)); } finally { p.shutdownNow(); // failure might have prevented processing task joinPool(p); } } /** * After invoking a single task, isQuiescent is true, * queues are empty, threads are not active, and * construction parameters continue to hold */ public void testisQuiescent() throws InterruptedException { ForkJoinPool p = new ForkJoinPool(2); try { assertTrue(p.isQuiescent()); p.invoke(new FibTask(20)); assertSame(ForkJoinPool.defaultForkJoinWorkerThreadFactory, p.getFactory()); delay(SMALL_DELAY_MS); assertTrue(p.isQuiescent()); assertFalse(p.getAsyncMode()); assertEquals(0, p.getActiveThreadCount()); assertEquals(0, p.getQueuedTaskCount()); assertEquals(0, p.getQueuedSubmissionCount()); assertFalse(p.hasQueuedSubmissions()); assertFalse(p.isShutdown()); assertFalse(p.isTerminating()); assertFalse(p.isTerminated()); } finally { joinPool(p); } } /** * Completed submit(ForkJoinTask) returns result */ public void testSubmitForkJoinTask() throws Throwable { ForkJoinPool p = new ForkJoinPool(1); try { ForkJoinTask f = p.submit(new FibTask(8)); assertEquals(21, (int) f.get()); } finally { joinPool(p); } } /** * A task submitted after shutdown is rejected */ public void testSubmitAfterShutdown() { ForkJoinPool p = new ForkJoinPool(1); try { p.shutdown(); assertTrue(p.isShutdown()); try { ForkJoinTask f = p.submit(new FibTask(8)); shouldThrow(); } catch (RejectedExecutionException success) {} } finally { joinPool(p); } } /** * Pool maintains parallelism when using ManagedBlocker */ public void testBlockingForkJoinTask() throws Throwable { ForkJoinPool p = new ForkJoinPool(4); try { ReentrantLock lock = new ReentrantLock(); ManagedLocker locker = new ManagedLocker(lock); ForkJoinTask f = new LockingFibTask(20, locker, lock); p.execute(f); assertEquals(6765, (int) f.get()); } finally { p.shutdownNow(); // don't wait out shutdown } } /** * pollSubmission returns unexecuted submitted task, if present */ public void testPollSubmission() { final CountDownLatch done = new CountDownLatch(1); SubFJP p = new SubFJP(); try { ForkJoinTask a = p.submit(awaiter(done)); ForkJoinTask b = p.submit(awaiter(done)); ForkJoinTask c = p.submit(awaiter(done)); ForkJoinTask r = p.pollSubmission(); assertTrue(r == a || r == b || r == c); assertFalse(r.isDone()); } finally { done.countDown(); joinPool(p); } } /** * drainTasksTo transfers unexecuted submitted tasks, if present */ public void testDrainTasksTo() { final CountDownLatch done = new CountDownLatch(1); SubFJP p = new SubFJP(); try { ForkJoinTask a = p.submit(awaiter(done)); ForkJoinTask b = p.submit(awaiter(done)); ForkJoinTask c = p.submit(awaiter(done)); ArrayList al = new ArrayList(); p.drainTasksTo(al); assertTrue(al.size() > 0); for (ForkJoinTask r : al) { assertTrue(r == a || r == b || r == c); assertFalse(r.isDone()); } } finally { done.countDown(); joinPool(p); } } // FJ Versions of AbstractExecutorService tests /** * execute(runnable) runs it to completion */ public void testExecuteRunnable() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { TrackedRunnable task = trackedRunnable(SHORT_DELAY_MS); assertFalse(task.isDone()); Future future = e.submit(task); assertNull(future.get()); assertNull(future.get(MEDIUM_DELAY_MS, MILLISECONDS)); assertTrue(task.isDone()); assertTrue(future.isDone()); assertFalse(future.isCancelled()); } finally { joinPool(e); } } /** * Completed submit(callable) returns result */ public void testSubmitCallable() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { Future future = e.submit(new StringTask()); assertSame(TEST_STRING, future.get()); assertTrue(future.isDone()); assertFalse(future.isCancelled()); } finally { joinPool(e); } } /** * Completed submit(runnable) returns successfully */ public void testSubmitRunnable() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { Future future = e.submit(new NoOpRunnable()); assertNull(future.get()); assertTrue(future.isDone()); assertFalse(future.isCancelled()); } finally { joinPool(e); } } /** * Completed submit(runnable, result) returns result */ public void testSubmitRunnable2() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { Future future = e.submit(new NoOpRunnable(), TEST_STRING); assertSame(TEST_STRING, future.get()); assertTrue(future.isDone()); assertFalse(future.isCancelled()); } finally { joinPool(e); } } /** * A submitted privileged action runs to completion */ public void testSubmitPrivilegedAction() throws Exception { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { ExecutorService e = new ForkJoinPool(1); Future future = e.submit(Executors.callable(new PrivilegedAction() { public Object run() { return TEST_STRING; }})); assertSame(TEST_STRING, future.get()); }}; runWithPermissions(r, new RuntimePermission("modifyThread")); } /** * A submitted privileged exception action runs to completion */ public void testSubmitPrivilegedExceptionAction() throws Exception { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { ExecutorService e = new ForkJoinPool(1); Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() { public Object run() { return TEST_STRING; }})); assertSame(TEST_STRING, future.get()); }}; runWithPermissions(r, new RuntimePermission("modifyThread")); } /** * A submitted failed privileged exception action reports exception */ public void testSubmitFailedPrivilegedExceptionAction() throws Exception { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { ExecutorService e = new ForkJoinPool(1); Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() { public Object run() throws Exception { throw new IndexOutOfBoundsException(); }})); try { future.get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof IndexOutOfBoundsException); }}}; runWithPermissions(r, new RuntimePermission("modifyThread")); } /** * execute(null runnable) throws NullPointerException */ public void testExecuteNullRunnable() { ExecutorService e = new ForkJoinPool(1); try { Future future = e.submit((Runnable) null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * submit(null callable) throws NullPointerException */ public void testSubmitNullCallable() { ExecutorService e = new ForkJoinPool(1); try { Future future = e.submit((Callable) null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * submit(callable).get() throws InterruptedException if interrupted */ public void testInterruptedSubmit() throws InterruptedException { final CountDownLatch submitted = new CountDownLatch(1); final CountDownLatch quittingTime = new CountDownLatch(1); final ExecutorService p = new ForkJoinPool(1); final Callable awaiter = new CheckedCallable() { public Void realCall() throws InterruptedException { assertTrue(quittingTime.await(MEDIUM_DELAY_MS, MILLISECONDS)); return null; }}; try { Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws Exception { Future future = p.submit(awaiter); submitted.countDown(); future.get(); }}); t.start(); assertTrue(submitted.await(MEDIUM_DELAY_MS, MILLISECONDS)); t.interrupt(); t.join(); } finally { quittingTime.countDown(); joinPool(p); } } /** * get of submit(callable) throws ExecutionException if callable * throws exception */ public void testSubmitEE() throws Throwable { ForkJoinPool p = new ForkJoinPool(1); try { p.submit(new Callable() { public Object call() { int i = 5/0; return Boolean.TRUE; }}).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof ArithmeticException); } finally { joinPool(p); } } /** * invokeAny(null) throws NullPointerException */ public void testInvokeAny1() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { e.invokeAny(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAny(empty collection) throws IllegalArgumentException */ public void testInvokeAny2() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { e.invokeAny(new ArrayList>()); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * invokeAny(c) throws NullPointerException if c has a single null element */ public void testInvokeAny3() throws Throwable { ExecutorService e = new ForkJoinPool(1); List> l = new ArrayList>(); l.add(null); try { e.invokeAny(l); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAny(c) throws NullPointerException if c has null elements */ public void testInvokeAny4() throws Throwable { CountDownLatch latch = new CountDownLatch(1); ExecutorService e = new ForkJoinPool(1); List> l = new ArrayList>(); l.add(latchAwaitingStringTask(latch)); l.add(null); try { e.invokeAny(l); shouldThrow(); } catch (NullPointerException success) { } finally { latch.countDown(); joinPool(e); } } /** * invokeAny(c) throws ExecutionException if no task in c completes */ public void testInvokeAny5() throws Throwable { ExecutorService e = new ForkJoinPool(1); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * invokeAny(c) returns result of some task in c if at least one completes */ public void testInvokeAny6() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * invokeAll(null) throws NullPointerException */ public void testInvokeAll1() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { e.invokeAll(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAll(empty collection) returns empty collection */ public void testInvokeAll2() throws InterruptedException { ExecutorService e = new ForkJoinPool(1); try { List> r = e.invokeAll(new ArrayList>()); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * invokeAll(c) throws NullPointerException if c has null elements */ public void testInvokeAll3() throws InterruptedException { ExecutorService e = new ForkJoinPool(1); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of returned element of invokeAll(c) throws * ExecutionException on failed task */ public void testInvokeAll4() throws Throwable { ExecutorService e = new ForkJoinPool(1); List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * invokeAll(c) returns results of all completed tasks in c */ public void testInvokeAll5() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } /** * timed invokeAny(null) throws NullPointerException */ public void testTimedInvokeAny1() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { e.invokeAny(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(null time unit) throws NullPointerException */ public void testTimedInvokeAnyNullTimeUnit() throws Throwable { ExecutorService e = new ForkJoinPool(1); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(empty collection) throws IllegalArgumentException */ public void testTimedInvokeAny2() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { e.invokeAny(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * timed invokeAny(c) throws NullPointerException if c has null elements */ public void testTimedInvokeAny3() throws Throwable { CountDownLatch latch = new CountDownLatch(1); ExecutorService e = new ForkJoinPool(1); List> l = new ArrayList>(); l.add(latchAwaitingStringTask(latch)); l.add(null); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { latch.countDown(); joinPool(e); } } /** * timed invokeAny(c) throws ExecutionException if no task completes */ public void testTimedInvokeAny4() throws Throwable { ExecutorService e = new ForkJoinPool(1); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * timed invokeAny(c) returns result of some task in c */ public void testTimedInvokeAny5() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * timed invokeAll(null) throws NullPointerException */ public void testTimedInvokeAll1() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { e.invokeAll(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(null time unit) throws NullPointerException */ public void testTimedInvokeAllNullTimeUnit() throws Throwable { ExecutorService e = new ForkJoinPool(1); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAll(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(empty collection) returns empty collection */ public void testTimedInvokeAll2() throws InterruptedException { ExecutorService e = new ForkJoinPool(1); try { List> r = e.invokeAll(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * timed invokeAll(c) throws NullPointerException if c has null elements */ public void testTimedInvokeAll3() throws InterruptedException { ExecutorService e = new ForkJoinPool(1); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of returned element of invokeAll(c) throws exception on failed task */ public void testTimedInvokeAll4() throws Throwable { ExecutorService e = new ForkJoinPool(1); List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * timed invokeAll(c) returns results of all completed tasks in c */ public void testTimedInvokeAll5() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } } jsr166/src/test/tck/TreeSubMapTest.java0000644000000000000000000007761111537741073015064 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class TreeSubMapTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(TreeSubMapTest.class); } /** * Create a map from Integers 1-5 to Strings "A"-"E". */ private static NavigableMap map5() { TreeMap map = new TreeMap(); assertTrue(map.isEmpty()); map.put(zero, "Z"); map.put(one, "A"); map.put(five, "E"); map.put(three, "C"); map.put(two, "B"); map.put(four, "D"); map.put(seven, "F"); assertFalse(map.isEmpty()); assertEquals(7, map.size()); return map.subMap(one, true, seven, false); } private static NavigableMap map0() { TreeMap map = new TreeMap(); assertTrue(map.isEmpty()); return map.tailMap(one, true); } /** * Create a map from Integers -5 to -1 to Strings "A"-"E". */ private static NavigableMap dmap5() { TreeMap map = new TreeMap(); assertTrue(map.isEmpty()); map.put(m1, "A"); map.put(m5, "E"); map.put(m3, "C"); map.put(m2, "B"); map.put(m4, "D"); assertFalse(map.isEmpty()); assertEquals(5, map.size()); return map.descendingMap(); } private static NavigableMap dmap0() { TreeMap map = new TreeMap(); assertTrue(map.isEmpty()); return map; } /** * clear removes all pairs */ public void testClear() { NavigableMap map = map5(); map.clear(); assertEquals(map.size(), 0); } /** * Maps with same contents are equal */ public void testEquals() { NavigableMap map1 = map5(); NavigableMap map2 = map5(); assertEquals(map1, map2); assertEquals(map2, map1); map1.clear(); assertFalse(map1.equals(map2)); assertFalse(map2.equals(map1)); } /** * containsKey returns true for contained key */ public void testContainsKey() { NavigableMap map = map5(); assertTrue(map.containsKey(one)); assertFalse(map.containsKey(zero)); } /** * containsValue returns true for held values */ public void testContainsValue() { NavigableMap map = map5(); assertTrue(map.containsValue("A")); assertFalse(map.containsValue("Z")); } /** * get returns the correct element at the given key, * or null if not present */ public void testGet() { NavigableMap map = map5(); assertEquals("A", (String)map.get(one)); NavigableMap empty = map0(); assertNull(empty.get(one)); } /** * isEmpty is true of empty map and false for non-empty */ public void testIsEmpty() { NavigableMap empty = map0(); NavigableMap map = map5(); assertTrue(empty.isEmpty()); assertFalse(map.isEmpty()); } /** * firstKey returns first key */ public void testFirstKey() { NavigableMap map = map5(); assertEquals(one, map.firstKey()); } /** * lastKey returns last key */ public void testLastKey() { NavigableMap map = map5(); assertEquals(five, map.lastKey()); } /** * keySet returns a Set containing all the keys */ public void testKeySet() { NavigableMap map = map5(); Set s = map.keySet(); assertEquals(5, s.size()); assertTrue(s.contains(one)); assertTrue(s.contains(two)); assertTrue(s.contains(three)); assertTrue(s.contains(four)); assertTrue(s.contains(five)); } /** * keySet is ordered */ public void testKeySetOrder() { NavigableMap map = map5(); Set s = map.keySet(); Iterator i = s.iterator(); Integer last = (Integer)i.next(); assertEquals(last, one); while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) < 0); last = k; } } /** * values collection contains all values */ public void testValues() { NavigableMap map = map5(); Collection s = map.values(); assertEquals(5, s.size()); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * entrySet contains all pairs */ public void testEntrySet() { NavigableMap map = map5(); Set s = map.entrySet(); assertEquals(5, s.size()); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); assertTrue( (e.getKey().equals(one) && e.getValue().equals("A")) || (e.getKey().equals(two) && e.getValue().equals("B")) || (e.getKey().equals(three) && e.getValue().equals("C")) || (e.getKey().equals(four) && e.getValue().equals("D")) || (e.getKey().equals(five) && e.getValue().equals("E"))); } } /** * putAll adds all key-value pairs from the given map */ public void testPutAll() { NavigableMap empty = map0(); NavigableMap map = map5(); empty.putAll(map); assertEquals(5, empty.size()); assertTrue(empty.containsKey(one)); assertTrue(empty.containsKey(two)); assertTrue(empty.containsKey(three)); assertTrue(empty.containsKey(four)); assertTrue(empty.containsKey(five)); } /** * remove removes the correct key-value pair from the map */ public void testRemove() { NavigableMap map = map5(); map.remove(five); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); } /** * lowerEntry returns preceding entry. */ public void testLowerEntry() { NavigableMap map = map5(); Map.Entry e1 = map.lowerEntry(three); assertEquals(two, e1.getKey()); Map.Entry e2 = map.lowerEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.lowerEntry(one); assertNull(e3); Map.Entry e4 = map.lowerEntry(zero); assertNull(e4); } /** * higherEntry returns next entry. */ public void testHigherEntry() { NavigableMap map = map5(); Map.Entry e1 = map.higherEntry(three); assertEquals(four, e1.getKey()); Map.Entry e2 = map.higherEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.higherEntry(five); assertNull(e3); Map.Entry e4 = map.higherEntry(six); assertNull(e4); } /** * floorEntry returns preceding entry. */ public void testFloorEntry() { NavigableMap map = map5(); Map.Entry e1 = map.floorEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.floorEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.floorEntry(one); assertEquals(one, e3.getKey()); Map.Entry e4 = map.floorEntry(zero); assertNull(e4); } /** * ceilingEntry returns next entry. */ public void testCeilingEntry() { NavigableMap map = map5(); Map.Entry e1 = map.ceilingEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.ceilingEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.ceilingEntry(five); assertEquals(five, e3.getKey()); Map.Entry e4 = map.ceilingEntry(six); assertNull(e4); } /** * pollFirstEntry returns entries in order */ public void testPollFirstEntry() { NavigableMap map = map5(); Map.Entry e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(two, e.getKey()); map.put(one, "A"); e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(three, e.getKey()); map.remove(four); e = map.pollFirstEntry(); assertEquals(five, e.getKey()); try { e.setValue("A"); shouldThrow(); } catch (UnsupportedOperationException success) {} assertTrue(map.isEmpty()); Map.Entry f = map.firstEntry(); assertNull(f); e = map.pollFirstEntry(); assertNull(e); } /** * pollLastEntry returns entries in order */ public void testPollLastEntry() { NavigableMap map = map5(); Map.Entry e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(four, e.getKey()); map.put(five, "E"); e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(three, e.getKey()); map.remove(two); e = map.pollLastEntry(); assertEquals(one, e.getKey()); try { e.setValue("E"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollLastEntry(); assertNull(e); } /** * size returns the correct values */ public void testSize() { NavigableMap map = map5(); NavigableMap empty = map0(); assertEquals(0, empty.size()); assertEquals(5, map.size()); } /** * toString contains toString of elements */ public void testToString() { NavigableMap map = map5(); String s = map.toString(); for (int i = 1; i <= 5; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } // Exception tests /** * get(null) of nonempty map throws NPE */ public void testGet_NullPointerException() { try { NavigableMap c = map5(); c.get(null); shouldThrow(); } catch (NullPointerException success) {} } /** * containsKey(null) of nonempty map throws NPE */ public void testContainsKey_NullPointerException() { try { NavigableMap c = map5(); c.containsKey(null); shouldThrow(); } catch (NullPointerException success) {} } /** * put(null,x) throws NPE */ public void testPut1_NullPointerException() { try { NavigableMap c = map5(); c.put(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(null) throws NPE */ public void testRemove1_NullPointerException() { try { NavigableMap c = map5(); c.remove(null); shouldThrow(); } catch (NullPointerException success) {} } /** * A deserialized map equals original */ public void testSerialization() throws Exception { NavigableMap q = map5(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); NavigableMap r = (NavigableMap)in.readObject(); assertFalse(r.isEmpty()); assertEquals(q.size(), r.size()); assertTrue(q.equals(r)); assertTrue(r.equals(q)); } /** * subMap returns map with keys in requested range */ public void testSubMapContents() { NavigableMap map = map5(); SortedMap sm = map.subMap(two, four); assertEquals(two, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals(2, sm.size()); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(two)); assertEquals(4, map.size()); assertEquals(1, sm.size()); assertEquals(three, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals("C", sm.remove(three)); assertTrue(sm.isEmpty()); assertEquals(3, map.size()); } public void testSubMapContents2() { NavigableMap map = map5(); SortedMap sm = map.subMap(two, three); assertEquals(1, sm.size()); assertEquals(two, sm.firstKey()); assertEquals(two, sm.lastKey()); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertFalse(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); assertFalse(i.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(two)); assertEquals(4, map.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertSame(sm.remove(three), null); assertEquals(4, map.size()); } /** * headMap returns map with keys in requested range */ public void testHeadMapContents() { NavigableMap map = map5(); SortedMap sm = map.headMap(four); assertTrue(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(one, k); k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, map.size()); assertEquals(four, map.firstKey()); } /** * headMap returns map with keys in requested range */ public void testTailMapContents() { NavigableMap map = map5(); SortedMap sm = map.tailMap(two); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertTrue(sm.containsKey(four)); assertTrue(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); k = (Integer)(i.next()); assertEquals(four, k); k = (Integer)(i.next()); assertEquals(five, k); assertFalse(i.hasNext()); Iterator ei = sm.entrySet().iterator(); Map.Entry e; e = (Map.Entry)(ei.next()); assertEquals(two, e.getKey()); assertEquals("B", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(three, e.getKey()); assertEquals("C", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(four, e.getKey()); assertEquals("D", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); assertFalse(i.hasNext()); SortedMap ssm = sm.tailMap(four); assertEquals(four, ssm.firstKey()); assertEquals(five, ssm.lastKey()); assertEquals("D", ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, map.size()); } /** * clear removes all pairs */ public void testDescendingClear() { NavigableMap map = dmap5(); map.clear(); assertEquals(map.size(), 0); } /** * Maps with same contents are equal */ public void testDescendingEquals() { NavigableMap map1 = dmap5(); NavigableMap map2 = dmap5(); assertEquals(map1, map2); assertEquals(map2, map1); map1.clear(); assertFalse(map1.equals(map2)); assertFalse(map2.equals(map1)); } /** * containsKey returns true for contained key */ public void testDescendingContainsKey() { NavigableMap map = dmap5(); assertTrue(map.containsKey(m1)); assertFalse(map.containsKey(zero)); } /** * containsValue returns true for held values */ public void testDescendingContainsValue() { NavigableMap map = dmap5(); assertTrue(map.containsValue("A")); assertFalse(map.containsValue("Z")); } /** * get returns the correct element at the given key, * or null if not present */ public void testDescendingGet() { NavigableMap map = dmap5(); assertEquals("A", (String)map.get(m1)); NavigableMap empty = dmap0(); assertNull(empty.get(m1)); } /** * isEmpty is true of empty map and false for non-empty */ public void testDescendingIsEmpty() { NavigableMap empty = dmap0(); NavigableMap map = dmap5(); assertTrue(empty.isEmpty()); assertFalse(map.isEmpty()); } /** * firstKey returns first key */ public void testDescendingFirstKey() { NavigableMap map = dmap5(); assertEquals(m1, map.firstKey()); } /** * lastKey returns last key */ public void testDescendingLastKey() { NavigableMap map = dmap5(); assertEquals(m5, map.lastKey()); } /** * keySet returns a Set containing all the keys */ public void testDescendingKeySet() { NavigableMap map = dmap5(); Set s = map.keySet(); assertEquals(5, s.size()); assertTrue(s.contains(m1)); assertTrue(s.contains(m2)); assertTrue(s.contains(m3)); assertTrue(s.contains(m4)); assertTrue(s.contains(m5)); } /** * keySet is ordered */ public void testDescendingKeySetOrder() { NavigableMap map = dmap5(); Set s = map.keySet(); Iterator i = s.iterator(); Integer last = (Integer)i.next(); assertEquals(last, m1); while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) > 0); last = k; } } /** * values collection contains all values */ public void testDescendingValues() { NavigableMap map = dmap5(); Collection s = map.values(); assertEquals(5, s.size()); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * keySet.toArray returns contains all keys */ public void testDescendingAscendingKeySetToArray() { NavigableMap map = dmap5(); Set s = map.keySet(); Object[] ar = s.toArray(); assertTrue(s.containsAll(Arrays.asList(ar))); assertEquals(5, ar.length); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); } /** * descendingkeySet.toArray returns contains all keys */ public void testDescendingDescendingKeySetToArray() { NavigableMap map = dmap5(); Set s = map.descendingKeySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); assertTrue(s.containsAll(Arrays.asList(ar))); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); } /** * Values.toArray contains all values */ public void testDescendingValuesToArray() { NavigableMap map = dmap5(); Collection v = map.values(); Object[] ar = v.toArray(); ArrayList s = new ArrayList(Arrays.asList(ar)); assertEquals(5, ar.length); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * entrySet contains all pairs */ public void testDescendingEntrySet() { NavigableMap map = dmap5(); Set s = map.entrySet(); assertEquals(5, s.size()); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); assertTrue( (e.getKey().equals(m1) && e.getValue().equals("A")) || (e.getKey().equals(m2) && e.getValue().equals("B")) || (e.getKey().equals(m3) && e.getValue().equals("C")) || (e.getKey().equals(m4) && e.getValue().equals("D")) || (e.getKey().equals(m5) && e.getValue().equals("E"))); } } /** * putAll adds all key-value pairs from the given map */ public void testDescendingPutAll() { NavigableMap empty = dmap0(); NavigableMap map = dmap5(); empty.putAll(map); assertEquals(5, empty.size()); assertTrue(empty.containsKey(m1)); assertTrue(empty.containsKey(m2)); assertTrue(empty.containsKey(m3)); assertTrue(empty.containsKey(m4)); assertTrue(empty.containsKey(m5)); } /** * remove removes the correct key-value pair from the map */ public void testDescendingRemove() { NavigableMap map = dmap5(); map.remove(m5); assertEquals(4, map.size()); assertFalse(map.containsKey(m5)); } /** * lowerEntry returns preceding entry. */ public void testDescendingLowerEntry() { NavigableMap map = dmap5(); Map.Entry e1 = map.lowerEntry(m3); assertEquals(m2, e1.getKey()); Map.Entry e2 = map.lowerEntry(m6); assertEquals(m5, e2.getKey()); Map.Entry e3 = map.lowerEntry(m1); assertNull(e3); Map.Entry e4 = map.lowerEntry(zero); assertNull(e4); } /** * higherEntry returns next entry. */ public void testDescendingHigherEntry() { NavigableMap map = dmap5(); Map.Entry e1 = map.higherEntry(m3); assertEquals(m4, e1.getKey()); Map.Entry e2 = map.higherEntry(zero); assertEquals(m1, e2.getKey()); Map.Entry e3 = map.higherEntry(m5); assertNull(e3); Map.Entry e4 = map.higherEntry(m6); assertNull(e4); } /** * floorEntry returns preceding entry. */ public void testDescendingFloorEntry() { NavigableMap map = dmap5(); Map.Entry e1 = map.floorEntry(m3); assertEquals(m3, e1.getKey()); Map.Entry e2 = map.floorEntry(m6); assertEquals(m5, e2.getKey()); Map.Entry e3 = map.floorEntry(m1); assertEquals(m1, e3.getKey()); Map.Entry e4 = map.floorEntry(zero); assertNull(e4); } /** * ceilingEntry returns next entry. */ public void testDescendingCeilingEntry() { NavigableMap map = dmap5(); Map.Entry e1 = map.ceilingEntry(m3); assertEquals(m3, e1.getKey()); Map.Entry e2 = map.ceilingEntry(zero); assertEquals(m1, e2.getKey()); Map.Entry e3 = map.ceilingEntry(m5); assertEquals(m5, e3.getKey()); Map.Entry e4 = map.ceilingEntry(m6); assertNull(e4); } /** * pollFirstEntry returns entries in order */ public void testDescendingPollFirstEntry() { NavigableMap map = dmap5(); Map.Entry e = map.pollFirstEntry(); assertEquals(m1, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(m2, e.getKey()); map.put(m1, "A"); e = map.pollFirstEntry(); assertEquals(m1, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(m3, e.getKey()); map.remove(m4); e = map.pollFirstEntry(); assertEquals(m5, e.getKey()); try { e.setValue("A"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollFirstEntry(); assertNull(e); } /** * pollLastEntry returns entries in order */ public void testDescendingPollLastEntry() { NavigableMap map = dmap5(); Map.Entry e = map.pollLastEntry(); assertEquals(m5, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(m4, e.getKey()); map.put(m5, "E"); e = map.pollLastEntry(); assertEquals(m5, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(m3, e.getKey()); map.remove(m2); e = map.pollLastEntry(); assertEquals(m1, e.getKey()); try { e.setValue("E"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollLastEntry(); assertNull(e); } /** * size returns the correct values */ public void testDescendingSize() { NavigableMap map = dmap5(); NavigableMap empty = dmap0(); assertEquals(0, empty.size()); assertEquals(5, map.size()); } /** * toString contains toString of elements */ public void testDescendingToString() { NavigableMap map = dmap5(); String s = map.toString(); for (int i = 1; i <= 5; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } // Exception testDescendings /** * get(null) of nonempty map throws NPE */ public void testDescendingGet_NullPointerException() { try { NavigableMap c = dmap5(); c.get(null); shouldThrow(); } catch (NullPointerException success) {} } /** * put(null,x) throws NPE */ public void testDescendingPut1_NullPointerException() { try { NavigableMap c = dmap5(); c.put(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * A deserialized map equals original */ public void testDescendingSerialization() throws Exception { NavigableMap q = dmap5(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); NavigableMap r = (NavigableMap)in.readObject(); assertEquals(q.size(), r.size()); assertTrue(q.equals(r)); assertTrue(r.equals(q)); } /** * subMap returns map with keys in requested range */ public void testDescendingSubMapContents() { NavigableMap map = dmap5(); SortedMap sm = map.subMap(m2, m4); assertEquals(m2, sm.firstKey()); assertEquals(m3, sm.lastKey()); assertEquals(2, sm.size()); assertFalse(sm.containsKey(m1)); assertTrue(sm.containsKey(m2)); assertTrue(sm.containsKey(m3)); assertFalse(sm.containsKey(m4)); assertFalse(sm.containsKey(m5)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); assertFalse(i.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(m2)); assertEquals(4, map.size()); assertEquals(1, sm.size()); assertEquals(m3, sm.firstKey()); assertEquals(m3, sm.lastKey()); assertEquals("C", sm.remove(m3)); assertTrue(sm.isEmpty()); assertEquals(3, map.size()); } public void testDescendingSubMapContents2() { NavigableMap map = dmap5(); SortedMap sm = map.subMap(m2, m3); assertEquals(1, sm.size()); assertEquals(m2, sm.firstKey()); assertEquals(m2, sm.lastKey()); assertFalse(sm.containsKey(m1)); assertTrue(sm.containsKey(m2)); assertFalse(sm.containsKey(m3)); assertFalse(sm.containsKey(m4)); assertFalse(sm.containsKey(m5)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); assertFalse(i.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(m2)); assertEquals(4, map.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertSame(sm.remove(m3), null); assertEquals(4, map.size()); } /** * headMap returns map with keys in requested range */ public void testDescendingHeadMapContents() { NavigableMap map = dmap5(); SortedMap sm = map.headMap(m4); assertTrue(sm.containsKey(m1)); assertTrue(sm.containsKey(m2)); assertTrue(sm.containsKey(m3)); assertFalse(sm.containsKey(m4)); assertFalse(sm.containsKey(m5)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(m1, k); k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, map.size()); assertEquals(m4, map.firstKey()); } /** * headMap returns map with keys in requested range */ public void testDescendingTailMapContents() { NavigableMap map = dmap5(); SortedMap sm = map.tailMap(m2); assertFalse(sm.containsKey(m1)); assertTrue(sm.containsKey(m2)); assertTrue(sm.containsKey(m3)); assertTrue(sm.containsKey(m4)); assertTrue(sm.containsKey(m5)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); k = (Integer)(i.next()); assertEquals(m4, k); k = (Integer)(i.next()); assertEquals(m5, k); assertFalse(i.hasNext()); Iterator ei = sm.entrySet().iterator(); Map.Entry e; e = (Map.Entry)(ei.next()); assertEquals(m2, e.getKey()); assertEquals("B", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(m3, e.getKey()); assertEquals("C", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(m4, e.getKey()); assertEquals("D", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(m5, e.getKey()); assertEquals("E", e.getValue()); assertFalse(i.hasNext()); SortedMap ssm = sm.tailMap(m4); assertEquals(m4, ssm.firstKey()); assertEquals(m5, ssm.lastKey()); assertEquals("D", ssm.remove(m4)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, map.size()); } } jsr166/src/test/tck/FutureTaskTest.java0000644000000000000000000004032311560754737015147 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; import java.util.*; public class FutureTaskTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(FutureTaskTest.class); } void checkNotDone(Future f) { assertFalse(f.isDone()); assertFalse(f.isCancelled()); } void checkCompletedNormally(Future f, T expected) { assertTrue(f.isDone()); assertFalse(f.isCancelled()); try { assertSame(expected, f.get()); } catch (Throwable fail) { threadUnexpectedException(fail); } try { assertSame(expected, f.get(5L, SECONDS)); } catch (Throwable fail) { threadUnexpectedException(fail); } assertFalse(f.cancel(false)); assertFalse(f.cancel(true)); } void checkCancelled(Future f) { assertTrue(f.isDone()); assertTrue(f.isCancelled()); try { f.get(); shouldThrow(); } catch (CancellationException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } try { f.get(5L, SECONDS); shouldThrow(); } catch (CancellationException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } assertFalse(f.cancel(false)); assertFalse(f.cancel(true)); } void checkCompletedAbnormally(Future f, Throwable t) { assertTrue(f.isDone()); assertFalse(f.isCancelled()); try { f.get(); shouldThrow(); } catch (ExecutionException success) { assertSame(t, success.getCause()); } catch (Throwable fail) { threadUnexpectedException(fail); } try { f.get(5L, SECONDS); shouldThrow(); } catch (ExecutionException success) { assertSame(t, success.getCause()); } catch (Throwable fail) { threadUnexpectedException(fail); } assertFalse(f.cancel(false)); assertFalse(f.cancel(true)); } /** * Subclass to expose protected methods */ static class PublicFutureTask extends FutureTask { public PublicFutureTask(Callable r) { super(r); } public boolean runAndReset() { return super.runAndReset(); } public void set(Object x) { super.set(x); } public void setException(Throwable t) { super.setException(t); } } /** * Creating a future with a null callable throws NPE */ public void testConstructor() { try { FutureTask task = new FutureTask(null); shouldThrow(); } catch (NullPointerException success) {} } /** * creating a future with null runnable fails */ public void testConstructor2() { try { FutureTask task = new FutureTask(null, Boolean.TRUE); shouldThrow(); } catch (NullPointerException success) {} } /** * isDone is true when a task completes */ public void testIsDone() { FutureTask task = new FutureTask(new NoOpCallable()); task.run(); assertTrue(task.isDone()); checkCompletedNormally(task, Boolean.TRUE); } /** * runAndReset of a non-cancelled task succeeds */ public void testRunAndReset() { PublicFutureTask task = new PublicFutureTask(new NoOpCallable()); assertTrue(task.runAndReset()); checkNotDone(task); } /** * runAndReset after cancellation fails */ public void testResetAfterCancel() { PublicFutureTask task = new PublicFutureTask(new NoOpCallable()); assertTrue(task.cancel(false)); assertFalse(task.runAndReset()); checkCancelled(task); } /** * setting value causes get to return it */ public void testSet() throws Exception { PublicFutureTask task = new PublicFutureTask(new NoOpCallable()); task.set(one); assertSame(task.get(), one); checkCompletedNormally(task, one); } /** * setException causes get to throw ExecutionException */ public void testSetException() throws Exception { Exception nse = new NoSuchElementException(); PublicFutureTask task = new PublicFutureTask(new NoOpCallable()); task.setException(nse); try { Object x = task.get(); shouldThrow(); } catch (ExecutionException success) { assertSame(success.getCause(), nse); checkCompletedAbnormally(task, nse); } } /** * Cancelling before running succeeds */ public void testCancelBeforeRun() { FutureTask task = new FutureTask(new NoOpCallable()); assertTrue(task.cancel(false)); task.run(); checkCancelled(task); } /** * Cancel(true) before run succeeds */ public void testCancelBeforeRun2() { FutureTask task = new FutureTask(new NoOpCallable()); assertTrue(task.cancel(true)); task.run(); checkCancelled(task); } /** * cancel of a completed task fails */ public void testCancelAfterRun() { FutureTask task = new FutureTask(new NoOpCallable()); task.run(); assertFalse(task.cancel(false)); checkCompletedNormally(task, Boolean.TRUE); } /** * cancel(true) interrupts a running task */ public void testCancelInterrupt() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); final FutureTask task = new FutureTask(new CheckedCallable() { public Object realCall() { threadStarted.countDown(); long t0 = System.nanoTime(); for (;;) { if (Thread.interrupted()) return Boolean.TRUE; if (millisElapsedSince(t0) > MEDIUM_DELAY_MS) fail("interrupt not delivered"); Thread.yield(); } }}); Thread t = newStartedThread(task); threadStarted.await(); assertTrue(task.cancel(true)); checkCancelled(task); awaitTermination(t, MEDIUM_DELAY_MS); checkCancelled(task); } /** * cancel(false) does not interrupt a running task */ public void testCancelNoInterrupt() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch cancelled = new CountDownLatch(1); final FutureTask task = new FutureTask(new CheckedCallable() { public Boolean realCall() throws InterruptedException { threadStarted.countDown(); cancelled.await(MEDIUM_DELAY_MS, MILLISECONDS); assertFalse(Thread.interrupted()); return Boolean.TRUE; }}); Thread t = newStartedThread(task); threadStarted.await(); assertTrue(task.cancel(false)); checkCancelled(task); cancelled.countDown(); awaitTermination(t, MEDIUM_DELAY_MS); checkCancelled(task); } /** * run in one thread causes get in another thread to retrieve value */ public void testGetRun() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); final FutureTask task = new FutureTask(new CheckedCallable() { public Object realCall() throws InterruptedException { return Boolean.TRUE; }}); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); assertSame(Boolean.TRUE, task.get()); }}); threadStarted.await(); checkNotDone(task); assertTrue(t.isAlive()); task.run(); checkCompletedNormally(task, Boolean.TRUE); awaitTermination(t, MEDIUM_DELAY_MS); } /** * set in one thread causes get in another thread to retrieve value */ public void testGetSet() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); final PublicFutureTask task = new PublicFutureTask(new CheckedCallable() { public Object realCall() throws InterruptedException { return Boolean.TRUE; }}); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); assertSame(Boolean.FALSE, task.get()); }}); threadStarted.await(); checkNotDone(task); assertTrue(t.isAlive()); task.set(Boolean.FALSE); checkCompletedNormally(task, Boolean.FALSE); awaitTermination(t, MEDIUM_DELAY_MS); } /** * run in one thread causes timed get in another thread to retrieve value */ public void testTimedGetRun() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); final FutureTask task = new FutureTask(new CheckedCallable() { public Object realCall() throws InterruptedException { return Boolean.TRUE; }}); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); assertSame(Boolean.TRUE, task.get(MEDIUM_DELAY_MS, MILLISECONDS)); }}); threadStarted.await(); checkNotDone(task); assertTrue(t.isAlive()); task.run(); checkCompletedNormally(task, Boolean.TRUE); awaitTermination(t, MEDIUM_DELAY_MS); } /** * set in one thread causes timed get in another thread to retrieve value */ public void testTimedGetSet() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); final PublicFutureTask task = new PublicFutureTask(new CheckedCallable() { public Object realCall() throws InterruptedException { return Boolean.TRUE; }}); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); assertSame(Boolean.FALSE, task.get(MEDIUM_DELAY_MS, MILLISECONDS)); }}); threadStarted.await(); checkNotDone(task); assertTrue(t.isAlive()); task.set(Boolean.FALSE); checkCompletedNormally(task, Boolean.FALSE); awaitTermination(t, MEDIUM_DELAY_MS); } /** * Cancelling a task causes timed get in another thread to throw * CancellationException */ public void testTimedGet_Cancellation() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(2); final FutureTask task = new FutureTask(new CheckedInterruptedCallable() { public Object realCall() throws InterruptedException { threadStarted.countDown(); delay(LONG_DELAY_MS); return Boolean.TRUE; }}); Thread t1 = new ThreadShouldThrow(CancellationException.class) { public void realRun() throws Exception { threadStarted.countDown(); task.get(MEDIUM_DELAY_MS, MILLISECONDS); }}; Thread t2 = new Thread(task); t1.start(); t2.start(); threadStarted.await(); task.cancel(true); awaitTermination(t1, MEDIUM_DELAY_MS); awaitTermination(t2, MEDIUM_DELAY_MS); checkCancelled(task); } /** * Cancelling a task causes get in another thread to throw * CancellationException */ public void testGet_Cancellation() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(2); final FutureTask task = new FutureTask(new CheckedInterruptedCallable() { public Object realCall() throws InterruptedException { threadStarted.countDown(); delay(LONG_DELAY_MS); return Boolean.TRUE; }}); Thread t1 = new ThreadShouldThrow(CancellationException.class) { public void realRun() throws Exception { threadStarted.countDown(); task.get(); }}; Thread t2 = new Thread(task); t1.start(); t2.start(); threadStarted.await(); task.cancel(true); awaitTermination(t1, MEDIUM_DELAY_MS); awaitTermination(t2, MEDIUM_DELAY_MS); checkCancelled(task); } /** * A runtime exception in task causes get to throw ExecutionException */ public void testGet_ExecutionException() throws InterruptedException { final FutureTask task = new FutureTask(new Callable() { public Object call() { return 5/0; }}); task.run(); try { task.get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof ArithmeticException); checkCompletedAbnormally(task, success.getCause()); } } /** * A runtime exception in task causes timed get to throw ExecutionException */ public void testTimedGet_ExecutionException2() throws Exception { final FutureTask task = new FutureTask(new Callable() { public Object call() { return 5/0; }}); task.run(); try { task.get(SHORT_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof ArithmeticException); checkCompletedAbnormally(task, success.getCause()); } } /** * Interrupting a waiting get causes it to throw InterruptedException */ public void testGet_InterruptedException() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); final FutureTask task = new FutureTask(new NoOpCallable()); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); task.get(); }}); threadStarted.await(); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); checkNotDone(task); } /** * Interrupting a waiting timed get causes it to throw InterruptedException */ public void testTimedGet_InterruptedException2() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); final FutureTask task = new FutureTask(new NoOpCallable()); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); task.get(LONG_DELAY_MS, MILLISECONDS); }}); threadStarted.await(); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); checkNotDone(task); } /** * A timed out timed get throws TimeoutException */ public void testGet_TimeoutException() throws Exception { try { FutureTask task = new FutureTask(new NoOpCallable()); task.get(1, MILLISECONDS); shouldThrow(); } catch (TimeoutException success) {} } } jsr166/src/test/tck/ConcurrentHashMapTest.java0000644000000000000000000004110311537741072016423 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.util.Enumeration; import java.io.*; public class ConcurrentHashMapTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ConcurrentHashMapTest.class); } /** * Create a map from Integers 1-5 to Strings "A"-"E". */ private static ConcurrentHashMap map5() { ConcurrentHashMap map = new ConcurrentHashMap(5); assertTrue(map.isEmpty()); map.put(one, "A"); map.put(two, "B"); map.put(three, "C"); map.put(four, "D"); map.put(five, "E"); assertFalse(map.isEmpty()); assertEquals(5, map.size()); return map; } /** * clear removes all pairs */ public void testClear() { ConcurrentHashMap map = map5(); map.clear(); assertEquals(map.size(), 0); } /** * Maps with same contents are equal */ public void testEquals() { ConcurrentHashMap map1 = map5(); ConcurrentHashMap map2 = map5(); assertEquals(map1, map2); assertEquals(map2, map1); map1.clear(); assertFalse(map1.equals(map2)); assertFalse(map2.equals(map1)); } /** * contains returns true for contained value */ public void testContains() { ConcurrentHashMap map = map5(); assertTrue(map.contains("A")); assertFalse(map.contains("Z")); } /** * containsKey returns true for contained key */ public void testContainsKey() { ConcurrentHashMap map = map5(); assertTrue(map.containsKey(one)); assertFalse(map.containsKey(zero)); } /** * containsValue returns true for held values */ public void testContainsValue() { ConcurrentHashMap map = map5(); assertTrue(map.containsValue("A")); assertFalse(map.containsValue("Z")); } /** * enumeration returns an enumeration containing the correct * elements */ public void testEnumeration() { ConcurrentHashMap map = map5(); Enumeration e = map.elements(); int count = 0; while (e.hasMoreElements()) { count++; e.nextElement(); } assertEquals(5, count); } /** * get returns the correct element at the given key, * or null if not present */ public void testGet() { ConcurrentHashMap map = map5(); assertEquals("A", (String)map.get(one)); ConcurrentHashMap empty = new ConcurrentHashMap(); assertNull(map.get("anything")); } /** * isEmpty is true of empty map and false for non-empty */ public void testIsEmpty() { ConcurrentHashMap empty = new ConcurrentHashMap(); ConcurrentHashMap map = map5(); assertTrue(empty.isEmpty()); assertFalse(map.isEmpty()); } /** * keys returns an enumeration containing all the keys from the map */ public void testKeys() { ConcurrentHashMap map = map5(); Enumeration e = map.keys(); int count = 0; while (e.hasMoreElements()) { count++; e.nextElement(); } assertEquals(5, count); } /** * keySet returns a Set containing all the keys */ public void testKeySet() { ConcurrentHashMap map = map5(); Set s = map.keySet(); assertEquals(5, s.size()); assertTrue(s.contains(one)); assertTrue(s.contains(two)); assertTrue(s.contains(three)); assertTrue(s.contains(four)); assertTrue(s.contains(five)); } /** * keySet.toArray returns contains all keys */ public void testKeySetToArray() { ConcurrentHashMap map = map5(); Set s = map.keySet(); Object[] ar = s.toArray(); assertTrue(s.containsAll(Arrays.asList(ar))); assertEquals(5, ar.length); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); } /** * Values.toArray contains all values */ public void testValuesToArray() { ConcurrentHashMap map = map5(); Collection v = map.values(); Object[] ar = v.toArray(); ArrayList s = new ArrayList(Arrays.asList(ar)); assertEquals(5, ar.length); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * entrySet.toArray contains all entries */ public void testEntrySetToArray() { ConcurrentHashMap map = map5(); Set s = map.entrySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); for (int i = 0; i < 5; ++i) { assertTrue(map.containsKey(((Map.Entry)(ar[i])).getKey())); assertTrue(map.containsValue(((Map.Entry)(ar[i])).getValue())); } } /** * values collection contains all values */ public void testValues() { ConcurrentHashMap map = map5(); Collection s = map.values(); assertEquals(5, s.size()); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * entrySet contains all pairs */ public void testEntrySet() { ConcurrentHashMap map = map5(); Set s = map.entrySet(); assertEquals(5, s.size()); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); assertTrue( (e.getKey().equals(one) && e.getValue().equals("A")) || (e.getKey().equals(two) && e.getValue().equals("B")) || (e.getKey().equals(three) && e.getValue().equals("C")) || (e.getKey().equals(four) && e.getValue().equals("D")) || (e.getKey().equals(five) && e.getValue().equals("E"))); } } /** * putAll adds all key-value pairs from the given map */ public void testPutAll() { ConcurrentHashMap empty = new ConcurrentHashMap(); ConcurrentHashMap map = map5(); empty.putAll(map); assertEquals(5, empty.size()); assertTrue(empty.containsKey(one)); assertTrue(empty.containsKey(two)); assertTrue(empty.containsKey(three)); assertTrue(empty.containsKey(four)); assertTrue(empty.containsKey(five)); } /** * putIfAbsent works when the given key is not present */ public void testPutIfAbsent() { ConcurrentHashMap map = map5(); map.putIfAbsent(six, "Z"); assertTrue(map.containsKey(six)); } /** * putIfAbsent does not add the pair if the key is already present */ public void testPutIfAbsent2() { ConcurrentHashMap map = map5(); assertEquals("A", map.putIfAbsent(one, "Z")); } /** * replace fails when the given key is not present */ public void testReplace() { ConcurrentHashMap map = map5(); assertNull(map.replace(six, "Z")); assertFalse(map.containsKey(six)); } /** * replace succeeds if the key is already present */ public void testReplace2() { ConcurrentHashMap map = map5(); assertNotNull(map.replace(one, "Z")); assertEquals("Z", map.get(one)); } /** * replace value fails when the given key not mapped to expected value */ public void testReplaceValue() { ConcurrentHashMap map = map5(); assertEquals("A", map.get(one)); assertFalse(map.replace(one, "Z", "Z")); assertEquals("A", map.get(one)); } /** * replace value succeeds when the given key mapped to expected value */ public void testReplaceValue2() { ConcurrentHashMap map = map5(); assertEquals("A", map.get(one)); assertTrue(map.replace(one, "A", "Z")); assertEquals("Z", map.get(one)); } /** * remove removes the correct key-value pair from the map */ public void testRemove() { ConcurrentHashMap map = map5(); map.remove(five); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); } /** * remove(key,value) removes only if pair present */ public void testRemove2() { ConcurrentHashMap map = map5(); map.remove(five, "E"); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); map.remove(four, "A"); assertEquals(4, map.size()); assertTrue(map.containsKey(four)); } /** * size returns the correct values */ public void testSize() { ConcurrentHashMap map = map5(); ConcurrentHashMap empty = new ConcurrentHashMap(); assertEquals(0, empty.size()); assertEquals(5, map.size()); } /** * toString contains toString of elements */ public void testToString() { ConcurrentHashMap map = map5(); String s = map.toString(); for (int i = 1; i <= 5; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } // Exception tests /** * Cannot create with negative capacity */ public void testConstructor1() { try { new ConcurrentHashMap(-1,0,1); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Cannot create with negative concurrency level */ public void testConstructor2() { try { new ConcurrentHashMap(1,0,-1); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Cannot create with only negative capacity */ public void testConstructor3() { try { new ConcurrentHashMap(-1); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * get(null) throws NPE */ public void testGet_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.get(null); shouldThrow(); } catch (NullPointerException success) {} } /** * containsKey(null) throws NPE */ public void testContainsKey_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.containsKey(null); shouldThrow(); } catch (NullPointerException success) {} } /** * containsValue(null) throws NPE */ public void testContainsValue_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.containsValue(null); shouldThrow(); } catch (NullPointerException success) {} } /** * contains(null) throws NPE */ public void testContains_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.contains(null); shouldThrow(); } catch (NullPointerException success) {} } /** * put(null,x) throws NPE */ public void testPut1_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.put(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * put(x, null) throws NPE */ public void testPut2_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.put("whatever", null); shouldThrow(); } catch (NullPointerException success) {} } /** * putIfAbsent(null, x) throws NPE */ public void testPutIfAbsent1_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.putIfAbsent(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * replace(null, x) throws NPE */ public void testReplace_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.replace(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * replace(null, x, y) throws NPE */ public void testReplaceValue_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.replace(null, one, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * putIfAbsent(x, null) throws NPE */ public void testPutIfAbsent2_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.putIfAbsent("whatever", null); shouldThrow(); } catch (NullPointerException success) {} } /** * replace(x, null) throws NPE */ public void testReplace2_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.replace("whatever", null); shouldThrow(); } catch (NullPointerException success) {} } /** * replace(x, null, y) throws NPE */ public void testReplaceValue2_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.replace("whatever", null, "A"); shouldThrow(); } catch (NullPointerException success) {} } /** * replace(x, y, null) throws NPE */ public void testReplaceValue3_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.replace("whatever", one, null); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(null) throws NPE */ public void testRemove1_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.put("sadsdf", "asdads"); c.remove(null); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(null, x) throws NPE */ public void testRemove2_NullPointerException() { try { ConcurrentHashMap c = new ConcurrentHashMap(5); c.put("sadsdf", "asdads"); c.remove(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(x, null) returns false */ public void testRemove3() { ConcurrentHashMap c = new ConcurrentHashMap(5); c.put("sadsdf", "asdads"); assertFalse(c.remove("sadsdf", null)); } /** * A deserialized map equals original */ public void testSerialization() throws Exception { ConcurrentHashMap q = map5(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); ConcurrentHashMap r = (ConcurrentHashMap)in.readObject(); assertEquals(q.size(), r.size()); assertTrue(q.equals(r)); assertTrue(r.equals(q)); } /** * SetValue of an EntrySet entry sets value in the map. */ public void testSetValueWriteThrough() { // Adapted from a bug report by Eric Zoerner ConcurrentHashMap map = new ConcurrentHashMap(2, 5.0f, 1); assertTrue(map.isEmpty()); for (int i = 0; i < 20; i++) map.put(new Integer(i), new Integer(i)); assertFalse(map.isEmpty()); Map.Entry entry1 = (Map.Entry)map.entrySet().iterator().next(); // assert that entry1 is not 16 assertTrue("entry is 16, test not valid", !entry1.getKey().equals(new Integer(16))); // remove 16 (a different key) from map // which just happens to cause entry1 to be cloned in map map.remove(new Integer(16)); entry1.setValue("XYZ"); assertTrue(map.containsValue("XYZ")); // fails } } jsr166/src/test/tck/AtomicReferenceTest.java0000644000000000000000000001050311537741072016072 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.atomic.*; import java.io.*; public class AtomicReferenceTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicReferenceTest.class); } /** * constructor initializes to given value */ public void testConstructor() { AtomicReference ai = new AtomicReference(one); assertSame(one,ai.get()); } /** * default constructed initializes to null */ public void testConstructor2() { AtomicReference ai = new AtomicReference(); assertNull(ai.get()); } /** * get returns the last value set */ public void testGetSet() { AtomicReference ai = new AtomicReference(one); assertSame(one,ai.get()); ai.set(two); assertSame(two,ai.get()); ai.set(m3); assertSame(m3,ai.get()); } /** * get returns the last value lazySet in same thread */ public void testGetLazySet() { AtomicReference ai = new AtomicReference(one); assertSame(one,ai.get()); ai.lazySet(two); assertSame(two,ai.get()); ai.lazySet(m3); assertSame(m3,ai.get()); } /** * compareAndSet succeeds in changing value if equal to expected else fails */ public void testCompareAndSet() { AtomicReference ai = new AtomicReference(one); assertTrue(ai.compareAndSet(one,two)); assertTrue(ai.compareAndSet(two,m4)); assertSame(m4,ai.get()); assertFalse(ai.compareAndSet(m5,seven)); assertSame(m4,ai.get()); assertTrue(ai.compareAndSet(m4,seven)); assertSame(seven,ai.get()); } /** * compareAndSet in one thread enables another waiting for value * to succeed */ public void testCompareAndSetInMultipleThreads() throws Exception { final AtomicReference ai = new AtomicReference(one); Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!ai.compareAndSet(two, three)) Thread.yield(); }}); t.start(); assertTrue(ai.compareAndSet(one, two)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertSame(ai.get(), three); } /** * repeated weakCompareAndSet succeeds in changing value when equal * to expected */ public void testWeakCompareAndSet() { AtomicReference ai = new AtomicReference(one); while (!ai.weakCompareAndSet(one,two)); while (!ai.weakCompareAndSet(two,m4)); assertSame(m4,ai.get()); while (!ai.weakCompareAndSet(m4,seven)); assertSame(seven,ai.get()); } /** * getAndSet returns previous value and sets to given value */ public void testGetAndSet() { AtomicReference ai = new AtomicReference(one); assertSame(one,ai.getAndSet(zero)); assertSame(zero,ai.getAndSet(m10)); assertSame(m10,ai.getAndSet(one)); } /** * a deserialized serialized atomic holds same value */ public void testSerialization() throws Exception { AtomicReference l = new AtomicReference(); l.set(one); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); AtomicReference r = (AtomicReference) in.readObject(); assertEquals(l.get(), r.get()); } /** * toString returns current value. */ public void testToString() { AtomicReference ai = new AtomicReference(one); assertEquals(ai.toString(), one.toString()); ai.set(two); assertEquals(ai.toString(), two.toString()); } } jsr166/src/test/tck/ConcurrentSkipListMapTest.java0000644000000000000000000011507111551675514017313 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class ConcurrentSkipListMapTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ConcurrentSkipListMapTest.class); } /** * Create a map from Integers 1-5 to Strings "A"-"E". */ private static ConcurrentSkipListMap map5() { ConcurrentSkipListMap map = new ConcurrentSkipListMap(); assertTrue(map.isEmpty()); map.put(one, "A"); map.put(five, "E"); map.put(three, "C"); map.put(two, "B"); map.put(four, "D"); assertFalse(map.isEmpty()); assertEquals(5, map.size()); return map; } /** * clear removes all pairs */ public void testClear() { ConcurrentSkipListMap map = map5(); map.clear(); assertEquals(map.size(), 0); } /** * */ public void testConstructFromSorted() { ConcurrentSkipListMap map = map5(); ConcurrentSkipListMap map2 = new ConcurrentSkipListMap(map); assertEquals(map, map2); } /** * Maps with same contents are equal */ public void testEquals() { ConcurrentSkipListMap map1 = map5(); ConcurrentSkipListMap map2 = map5(); assertEquals(map1, map2); assertEquals(map2, map1); map1.clear(); assertFalse(map1.equals(map2)); assertFalse(map2.equals(map1)); } /** * containsKey returns true for contained key */ public void testContainsKey() { ConcurrentSkipListMap map = map5(); assertTrue(map.containsKey(one)); assertFalse(map.containsKey(zero)); } /** * containsValue returns true for held values */ public void testContainsValue() { ConcurrentSkipListMap map = map5(); assertTrue(map.containsValue("A")); assertFalse(map.containsValue("Z")); } /** * get returns the correct element at the given key, * or null if not present */ public void testGet() { ConcurrentSkipListMap map = map5(); assertEquals("A", (String)map.get(one)); ConcurrentSkipListMap empty = new ConcurrentSkipListMap(); assertNull(empty.get(one)); } /** * isEmpty is true of empty map and false for non-empty */ public void testIsEmpty() { ConcurrentSkipListMap empty = new ConcurrentSkipListMap(); ConcurrentSkipListMap map = map5(); assertTrue(empty.isEmpty()); assertFalse(map.isEmpty()); } /** * firstKey returns first key */ public void testFirstKey() { ConcurrentSkipListMap map = map5(); assertEquals(one, map.firstKey()); } /** * lastKey returns last key */ public void testLastKey() { ConcurrentSkipListMap map = map5(); assertEquals(five, map.lastKey()); } /** * keySet.toArray returns contains all keys */ public void testKeySetToArray() { ConcurrentSkipListMap map = map5(); Set s = map.keySet(); Object[] ar = s.toArray(); assertTrue(s.containsAll(Arrays.asList(ar))); assertEquals(5, ar.length); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); } /** * descendingkeySet.toArray returns contains all keys */ public void testDescendingKeySetToArray() { ConcurrentSkipListMap map = map5(); Set s = map.descendingKeySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); assertTrue(s.containsAll(Arrays.asList(ar))); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); } /** * keySet returns a Set containing all the keys */ public void testKeySet() { ConcurrentSkipListMap map = map5(); Set s = map.keySet(); assertEquals(5, s.size()); assertTrue(s.contains(one)); assertTrue(s.contains(two)); assertTrue(s.contains(three)); assertTrue(s.contains(four)); assertTrue(s.contains(five)); } /** * keySet is ordered */ public void testKeySetOrder() { ConcurrentSkipListMap map = map5(); Set s = map.keySet(); Iterator i = s.iterator(); Integer last = (Integer)i.next(); assertEquals(last, one); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) < 0); last = k; ++count; } assertEquals(count ,5); } /** * descending iterator of key set is inverse ordered */ public void testKeySetDescendingIteratorOrder() { ConcurrentSkipListMap map = map5(); NavigableSet s = map.navigableKeySet(); Iterator i = s.descendingIterator(); Integer last = (Integer)i.next(); assertEquals(last, five); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) > 0); last = k; ++count; } assertEquals(count ,5); } /** * descendingKeySet is ordered */ public void testDescendingKeySetOrder() { ConcurrentSkipListMap map = map5(); Set s = map.descendingKeySet(); Iterator i = s.iterator(); Integer last = (Integer)i.next(); assertEquals(last, five); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) > 0); last = k; ++count; } assertEquals(count, 5); } /** * descending iterator of descendingKeySet is ordered */ public void testDescendingKeySetDescendingIteratorOrder() { ConcurrentSkipListMap map = map5(); NavigableSet s = map.descendingKeySet(); Iterator i = s.descendingIterator(); Integer last = (Integer)i.next(); assertEquals(last, one); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) < 0); last = k; ++count; } assertEquals(count, 5); } /** * Values.toArray contains all values */ public void testValuesToArray() { ConcurrentSkipListMap map = map5(); Collection v = map.values(); Object[] ar = v.toArray(); ArrayList s = new ArrayList(Arrays.asList(ar)); assertEquals(5, ar.length); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * values collection contains all values */ public void testValues() { ConcurrentSkipListMap map = map5(); Collection s = map.values(); assertEquals(5, s.size()); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * entrySet contains all pairs */ public void testEntrySet() { ConcurrentSkipListMap map = map5(); Set s = map.entrySet(); assertEquals(5, s.size()); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); assertTrue( (e.getKey().equals(one) && e.getValue().equals("A")) || (e.getKey().equals(two) && e.getValue().equals("B")) || (e.getKey().equals(three) && e.getValue().equals("C")) || (e.getKey().equals(four) && e.getValue().equals("D")) || (e.getKey().equals(five) && e.getValue().equals("E"))); } } /** * descendingEntrySet contains all pairs */ public void testDescendingEntrySet() { ConcurrentSkipListMap map = map5(); Set s = map.descendingMap().entrySet(); assertEquals(5, s.size()); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); assertTrue( (e.getKey().equals(one) && e.getValue().equals("A")) || (e.getKey().equals(two) && e.getValue().equals("B")) || (e.getKey().equals(three) && e.getValue().equals("C")) || (e.getKey().equals(four) && e.getValue().equals("D")) || (e.getKey().equals(five) && e.getValue().equals("E"))); } } /** * entrySet.toArray contains all entries */ public void testEntrySetToArray() { ConcurrentSkipListMap map = map5(); Set s = map.entrySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); for (int i = 0; i < 5; ++i) { assertTrue(map.containsKey(((Map.Entry)(ar[i])).getKey())); assertTrue(map.containsValue(((Map.Entry)(ar[i])).getValue())); } } /** * descendingEntrySet.toArray contains all entries */ public void testDescendingEntrySetToArray() { ConcurrentSkipListMap map = map5(); Set s = map.descendingMap().entrySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); for (int i = 0; i < 5; ++i) { assertTrue(map.containsKey(((Map.Entry)(ar[i])).getKey())); assertTrue(map.containsValue(((Map.Entry)(ar[i])).getValue())); } } /** * putAll adds all key-value pairs from the given map */ public void testPutAll() { ConcurrentSkipListMap empty = new ConcurrentSkipListMap(); ConcurrentSkipListMap map = map5(); empty.putAll(map); assertEquals(5, empty.size()); assertTrue(empty.containsKey(one)); assertTrue(empty.containsKey(two)); assertTrue(empty.containsKey(three)); assertTrue(empty.containsKey(four)); assertTrue(empty.containsKey(five)); } /** * putIfAbsent works when the given key is not present */ public void testPutIfAbsent() { ConcurrentSkipListMap map = map5(); map.putIfAbsent(six, "Z"); assertTrue(map.containsKey(six)); } /** * putIfAbsent does not add the pair if the key is already present */ public void testPutIfAbsent2() { ConcurrentSkipListMap map = map5(); assertEquals("A", map.putIfAbsent(one, "Z")); } /** * replace fails when the given key is not present */ public void testReplace() { ConcurrentSkipListMap map = map5(); assertNull(map.replace(six, "Z")); assertFalse(map.containsKey(six)); } /** * replace succeeds if the key is already present */ public void testReplace2() { ConcurrentSkipListMap map = map5(); assertNotNull(map.replace(one, "Z")); assertEquals("Z", map.get(one)); } /** * replace value fails when the given key not mapped to expected value */ public void testReplaceValue() { ConcurrentSkipListMap map = map5(); assertEquals("A", map.get(one)); assertFalse(map.replace(one, "Z", "Z")); assertEquals("A", map.get(one)); } /** * replace value succeeds when the given key mapped to expected value */ public void testReplaceValue2() { ConcurrentSkipListMap map = map5(); assertEquals("A", map.get(one)); assertTrue(map.replace(one, "A", "Z")); assertEquals("Z", map.get(one)); } /** * remove removes the correct key-value pair from the map */ public void testRemove() { ConcurrentSkipListMap map = map5(); map.remove(five); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); } /** * remove(key,value) removes only if pair present */ public void testRemove2() { ConcurrentSkipListMap map = map5(); assertTrue(map.containsKey(five)); assertEquals("E", map.get(five)); map.remove(five, "E"); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); map.remove(four, "A"); assertEquals(4, map.size()); assertTrue(map.containsKey(four)); } /** * lowerEntry returns preceding entry. */ public void testLowerEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e1 = map.lowerEntry(three); assertEquals(two, e1.getKey()); Map.Entry e2 = map.lowerEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.lowerEntry(one); assertNull(e3); Map.Entry e4 = map.lowerEntry(zero); assertNull(e4); } /** * higherEntry returns next entry. */ public void testHigherEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e1 = map.higherEntry(three); assertEquals(four, e1.getKey()); Map.Entry e2 = map.higherEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.higherEntry(five); assertNull(e3); Map.Entry e4 = map.higherEntry(six); assertNull(e4); } /** * floorEntry returns preceding entry. */ public void testFloorEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e1 = map.floorEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.floorEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.floorEntry(one); assertEquals(one, e3.getKey()); Map.Entry e4 = map.floorEntry(zero); assertNull(e4); } /** * ceilingEntry returns next entry. */ public void testCeilingEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e1 = map.ceilingEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.ceilingEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.ceilingEntry(five); assertEquals(five, e3.getKey()); Map.Entry e4 = map.ceilingEntry(six); assertNull(e4); } /** * lowerEntry, higherEntry, ceilingEntry, and floorEntry return * immutable entries */ public void testEntryImmutablity() { ConcurrentSkipListMap map = map5(); Map.Entry e = map.lowerEntry(three); assertEquals(two, e.getKey()); try { e.setValue("X"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.higherEntry(zero); assertEquals(one, e.getKey()); try { e.setValue("X"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.floorEntry(one); assertEquals(one, e.getKey()); try { e.setValue("X"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.ceilingEntry(five); assertEquals(five, e.getKey()); try { e.setValue("X"); shouldThrow(); } catch (UnsupportedOperationException success) {} } /** * lowerKey returns preceding element */ public void testLowerKey() { ConcurrentSkipListMap q = map5(); Object e1 = q.lowerKey(three); assertEquals(two, e1); Object e2 = q.lowerKey(six); assertEquals(five, e2); Object e3 = q.lowerKey(one); assertNull(e3); Object e4 = q.lowerKey(zero); assertNull(e4); } /** * higherKey returns next element */ public void testHigherKey() { ConcurrentSkipListMap q = map5(); Object e1 = q.higherKey(three); assertEquals(four, e1); Object e2 = q.higherKey(zero); assertEquals(one, e2); Object e3 = q.higherKey(five); assertNull(e3); Object e4 = q.higherKey(six); assertNull(e4); } /** * floorKey returns preceding element */ public void testFloorKey() { ConcurrentSkipListMap q = map5(); Object e1 = q.floorKey(three); assertEquals(three, e1); Object e2 = q.floorKey(six); assertEquals(five, e2); Object e3 = q.floorKey(one); assertEquals(one, e3); Object e4 = q.floorKey(zero); assertNull(e4); } /** * ceilingKey returns next element */ public void testCeilingKey() { ConcurrentSkipListMap q = map5(); Object e1 = q.ceilingKey(three); assertEquals(three, e1); Object e2 = q.ceilingKey(zero); assertEquals(one, e2); Object e3 = q.ceilingKey(five); assertEquals(five, e3); Object e4 = q.ceilingKey(six); assertNull(e4); } /** * pollFirstEntry returns entries in order */ public void testPollFirstEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(two, e.getKey()); map.put(one, "A"); e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(three, e.getKey()); map.remove(four); e = map.pollFirstEntry(); assertEquals(five, e.getKey()); try { e.setValue("A"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollFirstEntry(); assertNull(e); } /** * pollLastEntry returns entries in order */ public void testPollLastEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(four, e.getKey()); map.put(five, "E"); e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(three, e.getKey()); map.remove(two); e = map.pollLastEntry(); assertEquals(one, e.getKey()); try { e.setValue("E"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollLastEntry(); assertNull(e); } /** * size returns the correct values */ public void testSize() { ConcurrentSkipListMap map = map5(); ConcurrentSkipListMap empty = new ConcurrentSkipListMap(); assertEquals(0, empty.size()); assertEquals(5, map.size()); } /** * toString contains toString of elements */ public void testToString() { ConcurrentSkipListMap map = map5(); String s = map.toString(); for (int i = 1; i <= 5; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } // Exception tests /** * get(null) of nonempty map throws NPE */ public void testGet_NullPointerException() { try { ConcurrentSkipListMap c = map5(); c.get(null); shouldThrow(); } catch (NullPointerException success) {} } /** * containsKey(null) of nonempty map throws NPE */ public void testContainsKey_NullPointerException() { try { ConcurrentSkipListMap c = map5(); c.containsKey(null); shouldThrow(); } catch (NullPointerException success) {} } /** * containsValue(null) throws NPE */ public void testContainsValue_NullPointerException() { try { ConcurrentSkipListMap c = new ConcurrentSkipListMap(); c.containsValue(null); shouldThrow(); } catch (NullPointerException success) {} } /** * put(null,x) throws NPE */ public void testPut1_NullPointerException() { try { ConcurrentSkipListMap c = map5(); c.put(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * putIfAbsent(null, x) throws NPE */ public void testPutIfAbsent1_NullPointerException() { try { ConcurrentSkipListMap c = map5(); c.putIfAbsent(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * replace(null, x) throws NPE */ public void testReplace_NullPointerException() { try { ConcurrentSkipListMap c = map5(); c.replace(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * replace(null, x, y) throws NPE */ public void testReplaceValue_NullPointerException() { try { ConcurrentSkipListMap c = map5(); c.replace(null, one, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(null) throws NPE */ public void testRemove1_NullPointerException() { try { ConcurrentSkipListMap c = new ConcurrentSkipListMap(); c.put("sadsdf", "asdads"); c.remove(null); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(null, x) throws NPE */ public void testRemove2_NullPointerException() { try { ConcurrentSkipListMap c = new ConcurrentSkipListMap(); c.put("sadsdf", "asdads"); c.remove(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(x, null) returns false */ public void testRemove3() { ConcurrentSkipListMap c = new ConcurrentSkipListMap(); c.put("sadsdf", "asdads"); assertFalse(c.remove("sadsdf", null)); } /** * A deserialized map equals original */ public void testSerialization() throws Exception { ConcurrentSkipListMap q = map5(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); ConcurrentSkipListMap r = (ConcurrentSkipListMap)in.readObject(); assertEquals(q.size(), r.size()); assertTrue(q.equals(r)); assertTrue(r.equals(q)); } /** * subMap returns map with keys in requested range */ public void testSubMapContents() { ConcurrentSkipListMap map = map5(); NavigableMap sm = map.subMap(two, true, four, false); assertEquals(two, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals(2, sm.size()); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); Iterator r = sm.descendingKeySet().iterator(); k = (Integer)(r.next()); assertEquals(three, k); k = (Integer)(r.next()); assertEquals(two, k); assertFalse(r.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(two)); assertEquals(4, map.size()); assertEquals(1, sm.size()); assertEquals(three, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals("C", sm.remove(three)); assertTrue(sm.isEmpty()); assertEquals(3, map.size()); } public void testSubMapContents2() { ConcurrentSkipListMap map = map5(); NavigableMap sm = map.subMap(two, true, three, false); assertEquals(1, sm.size()); assertEquals(two, sm.firstKey()); assertEquals(two, sm.lastKey()); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertFalse(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); assertFalse(i.hasNext()); Iterator r = sm.descendingKeySet().iterator(); k = (Integer)(r.next()); assertEquals(two, k); assertFalse(r.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(two)); assertEquals(4, map.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertSame(sm.remove(three), null); assertEquals(4, map.size()); } /** * headMap returns map with keys in requested range */ public void testHeadMapContents() { ConcurrentSkipListMap map = map5(); NavigableMap sm = map.headMap(four, false); assertTrue(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(one, k); k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, map.size()); assertEquals(four, map.firstKey()); } /** * tailMap returns map with keys in requested range */ public void testTailMapContents() { ConcurrentSkipListMap map = map5(); NavigableMap sm = map.tailMap(two, true); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertTrue(sm.containsKey(four)); assertTrue(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); k = (Integer)(i.next()); assertEquals(four, k); k = (Integer)(i.next()); assertEquals(five, k); assertFalse(i.hasNext()); Iterator r = sm.descendingKeySet().iterator(); k = (Integer)(r.next()); assertEquals(five, k); k = (Integer)(r.next()); assertEquals(four, k); k = (Integer)(r.next()); assertEquals(three, k); k = (Integer)(r.next()); assertEquals(two, k); assertFalse(r.hasNext()); Iterator ei = sm.entrySet().iterator(); Map.Entry e; e = (Map.Entry)(ei.next()); assertEquals(two, e.getKey()); assertEquals("B", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(three, e.getKey()); assertEquals("C", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(four, e.getKey()); assertEquals("D", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); assertFalse(i.hasNext()); NavigableMap ssm = sm.tailMap(four, true); assertEquals(four, ssm.firstKey()); assertEquals(five, ssm.lastKey()); assertEquals("D", ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, map.size()); } Random rnd = new Random(666); BitSet bs; /** * Submaps of submaps subdivide correctly */ public void testRecursiveSubMaps() throws Exception { int mapSize = expensiveTests ? 1000 : 100; Class cl = ConcurrentSkipListMap.class; NavigableMap map = newMap(cl); bs = new BitSet(mapSize); populate(map, mapSize); check(map, 0, mapSize - 1, true); check(map.descendingMap(), 0, mapSize - 1, false); mutateMap(map, 0, mapSize - 1); check(map, 0, mapSize - 1, true); check(map.descendingMap(), 0, mapSize - 1, false); bashSubMap(map.subMap(0, true, mapSize, false), 0, mapSize - 1, true); } static NavigableMap newMap(Class cl) throws Exception { NavigableMap result = (NavigableMap) cl.newInstance(); assertEquals(result.size(), 0); assertFalse(result.keySet().iterator().hasNext()); return result; } void populate(NavigableMap map, int limit) { for (int i = 0, n = 2 * limit / 3; i < n; i++) { int key = rnd.nextInt(limit); put(map, key); } } void mutateMap(NavigableMap map, int min, int max) { int size = map.size(); int rangeSize = max - min + 1; // Remove a bunch of entries directly for (int i = 0, n = rangeSize / 2; i < n; i++) { remove(map, min - 5 + rnd.nextInt(rangeSize + 10)); } // Remove a bunch of entries with iterator for (Iterator it = map.keySet().iterator(); it.hasNext(); ) { if (rnd.nextBoolean()) { bs.clear(it.next()); it.remove(); } } // Add entries till we're back to original size while (map.size() < size) { int key = min + rnd.nextInt(rangeSize); assertTrue(key >= min && key<= max); put(map, key); } } void mutateSubMap(NavigableMap map, int min, int max) { int size = map.size(); int rangeSize = max - min + 1; // Remove a bunch of entries directly for (int i = 0, n = rangeSize / 2; i < n; i++) { remove(map, min - 5 + rnd.nextInt(rangeSize + 10)); } // Remove a bunch of entries with iterator for (Iterator it = map.keySet().iterator(); it.hasNext(); ) { if (rnd.nextBoolean()) { bs.clear(it.next()); it.remove(); } } // Add entries till we're back to original size while (map.size() < size) { int key = min - 5 + rnd.nextInt(rangeSize + 10); if (key >= min && key<= max) { put(map, key); } else { try { map.put(key, 2 * key); shouldThrow(); } catch (IllegalArgumentException success) {} } } } void put(NavigableMap map, int key) { if (map.put(key, 2 * key) == null) bs.set(key); } void remove(NavigableMap map, int key) { if (map.remove(key) != null) bs.clear(key); } void bashSubMap(NavigableMap map, int min, int max, boolean ascending) { check(map, min, max, ascending); check(map.descendingMap(), min, max, !ascending); mutateSubMap(map, min, max); check(map, min, max, ascending); check(map.descendingMap(), min, max, !ascending); // Recurse if (max - min < 2) return; int midPoint = (min + max) / 2; // headMap - pick direction and endpoint inclusion randomly boolean incl = rnd.nextBoolean(); NavigableMap hm = map.headMap(midPoint, incl); if (ascending) { if (rnd.nextBoolean()) bashSubMap(hm, min, midPoint - (incl ? 0 : 1), true); else bashSubMap(hm.descendingMap(), min, midPoint - (incl ? 0 : 1), false); } else { if (rnd.nextBoolean()) bashSubMap(hm, midPoint + (incl ? 0 : 1), max, false); else bashSubMap(hm.descendingMap(), midPoint + (incl ? 0 : 1), max, true); } // tailMap - pick direction and endpoint inclusion randomly incl = rnd.nextBoolean(); NavigableMap tm = map.tailMap(midPoint,incl); if (ascending) { if (rnd.nextBoolean()) bashSubMap(tm, midPoint + (incl ? 0 : 1), max, true); else bashSubMap(tm.descendingMap(), midPoint + (incl ? 0 : 1), max, false); } else { if (rnd.nextBoolean()) { bashSubMap(tm, min, midPoint - (incl ? 0 : 1), false); } else { bashSubMap(tm.descendingMap(), min, midPoint - (incl ? 0 : 1), true); } } // subMap - pick direction and endpoint inclusion randomly int rangeSize = max - min + 1; int[] endpoints = new int[2]; endpoints[0] = min + rnd.nextInt(rangeSize); endpoints[1] = min + rnd.nextInt(rangeSize); Arrays.sort(endpoints); boolean lowIncl = rnd.nextBoolean(); boolean highIncl = rnd.nextBoolean(); if (ascending) { NavigableMap sm = map.subMap( endpoints[0], lowIncl, endpoints[1], highIncl); if (rnd.nextBoolean()) bashSubMap(sm, endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), true); else bashSubMap(sm.descendingMap(), endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), false); } else { NavigableMap sm = map.subMap( endpoints[1], highIncl, endpoints[0], lowIncl); if (rnd.nextBoolean()) bashSubMap(sm, endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), false); else bashSubMap(sm.descendingMap(), endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), true); } } /** * min and max are both inclusive. If max < min, interval is empty. */ void check(NavigableMap map, final int min, final int max, final boolean ascending) { class ReferenceSet { int lower(int key) { return ascending ? lowerAscending(key) : higherAscending(key); } int floor(int key) { return ascending ? floorAscending(key) : ceilingAscending(key); } int ceiling(int key) { return ascending ? ceilingAscending(key) : floorAscending(key); } int higher(int key) { return ascending ? higherAscending(key) : lowerAscending(key); } int first() { return ascending ? firstAscending() : lastAscending(); } int last() { return ascending ? lastAscending() : firstAscending(); } int lowerAscending(int key) { return floorAscending(key - 1); } int floorAscending(int key) { if (key < min) return -1; else if (key > max) key = max; // BitSet should support this! Test would run much faster while (key >= min) { if (bs.get(key)) return key; key--; } return -1; } int ceilingAscending(int key) { if (key < min) key = min; else if (key > max) return -1; int result = bs.nextSetBit(key); return result > max ? -1 : result; } int higherAscending(int key) { return ceilingAscending(key + 1); } private int firstAscending() { int result = ceilingAscending(min); return result > max ? -1 : result; } private int lastAscending() { int result = floorAscending(max); return result < min ? -1 : result; } } ReferenceSet rs = new ReferenceSet(); // Test contents using containsKey int size = 0; for (int i = min; i <= max; i++) { boolean bsContainsI = bs.get(i); assertEquals(bsContainsI, map.containsKey(i)); if (bsContainsI) size++; } assertEquals(map.size(), size); // Test contents using contains keySet iterator int size2 = 0; int previousKey = -1; for (int key : map.keySet()) { assertTrue(bs.get(key)); size2++; assertTrue(previousKey < 0 || (ascending ? key - previousKey > 0 : key - previousKey < 0)); previousKey = key; } assertEquals(size2, size); // Test navigation ops for (int key = min - 1; key <= max + 1; key++) { assertEq(map.lowerKey(key), rs.lower(key)); assertEq(map.floorKey(key), rs.floor(key)); assertEq(map.higherKey(key), rs.higher(key)); assertEq(map.ceilingKey(key), rs.ceiling(key)); } // Test extrema if (map.size() != 0) { assertEq(map.firstKey(), rs.first()); assertEq(map.lastKey(), rs.last()); } else { assertEq(rs.first(), -1); assertEq(rs.last(), -1); try { map.firstKey(); shouldThrow(); } catch (NoSuchElementException success) {} try { map.lastKey(); shouldThrow(); } catch (NoSuchElementException success) {} } } static void assertEq(Integer i, int j) { if (i == null) assertEquals(j, -1); else assertEquals((int) i, j); } static boolean eq(Integer i, int j) { return i == null ? j == -1 : i == j; } } jsr166/src/test/tck/ThreadLocalTest.java0000644000000000000000000000552111537741073015226 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.Semaphore; public class ThreadLocalTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ThreadLocalTest.class); } static ThreadLocal tl = new ThreadLocal() { public Integer initialValue() { return one; } }; static InheritableThreadLocal itl = new InheritableThreadLocal() { protected Integer initialValue() { return zero; } protected Integer childValue(Integer parentValue) { return new Integer(parentValue.intValue() + 1); } }; /** * remove causes next access to return initial value */ public void testRemove() { assertSame(tl.get(), one); tl.set(two); assertSame(tl.get(), two); tl.remove(); assertSame(tl.get(), one); } /** * remove in InheritableThreadLocal causes next access to return * initial value */ public void testRemoveITL() { assertSame(itl.get(), zero); itl.set(two); assertSame(itl.get(), two); itl.remove(); assertSame(itl.get(), zero); } private class ITLThread extends Thread { final int[] x; ITLThread(int[] array) { x = array; } public void run() { Thread child = null; if (itl.get().intValue() < x.length - 1) { child = new ITLThread(x); child.start(); } Thread.currentThread().yield(); int threadId = itl.get().intValue(); for (int j = 0; j < threadId; j++) { x[threadId]++; Thread.currentThread().yield(); } if (child != null) { // Wait for child (if any) try { child.join(); } catch (InterruptedException e) { threadUnexpectedException(e); } } } } /** * InheritableThreadLocal propagates generic values. */ public void testGenericITL() throws InterruptedException { final int threadCount = 10; final int x[] = new int[threadCount]; Thread progenitor = new ITLThread(x); progenitor.start(); progenitor.join(); for (int i = 0; i < threadCount; i++) { assertEquals(i, x[i]); } } } jsr166/src/test/tck/LinkedBlockingQueueTest.java0000644000000000000000000006677011561022501016726 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.io.*; public class LinkedBlockingQueueTest extends JSR166TestCase { public static class Unbounded extends BlockingQueueTest { protected BlockingQueue emptyCollection() { return new LinkedBlockingQueue(); } } public static class Bounded extends BlockingQueueTest { protected BlockingQueue emptyCollection() { return new LinkedBlockingQueue(20); } } public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return newTestSuite(LinkedBlockingQueueTest.class, new Unbounded().testSuite(), new Bounded().testSuite()); } /** * Create a queue of given size containing consecutive * Integers 0 ... n. */ private LinkedBlockingQueue populatedQueue(int n) { LinkedBlockingQueue q = new LinkedBlockingQueue(n); assertTrue(q.isEmpty()); for (int i = 0; i < n; i++) assertTrue(q.offer(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(0, q.remainingCapacity()); assertEquals(n, q.size()); return q; } /** * A new queue has the indicated capacity, or Integer.MAX_VALUE if * none given */ public void testConstructor1() { assertEquals(SIZE, new LinkedBlockingQueue(SIZE).remainingCapacity()); assertEquals(Integer.MAX_VALUE, new LinkedBlockingQueue().remainingCapacity()); } /** * Constructor throws IAE if capacity argument nonpositive */ public void testConstructor2() { try { LinkedBlockingQueue q = new LinkedBlockingQueue(0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { LinkedBlockingQueue q = new LinkedBlockingQueue(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws NPE */ public void testConstructor4() { try { Integer[] ints = new Integer[SIZE]; LinkedBlockingQueue q = new LinkedBlockingQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection with some null elements throws NPE */ public void testConstructor5() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); LinkedBlockingQueue q = new LinkedBlockingQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements of collection used to initialize */ public void testConstructor6() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); LinkedBlockingQueue q = new LinkedBlockingQueue(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * Queue transitions from empty to full when elements added */ public void testEmptyFull() { LinkedBlockingQueue q = new LinkedBlockingQueue(2); assertTrue(q.isEmpty()); assertEquals("should have room for 2", 2, q.remainingCapacity()); q.add(one); assertFalse(q.isEmpty()); q.add(two); assertFalse(q.isEmpty()); assertEquals(0, q.remainingCapacity()); assertFalse(q.offer(three)); } /** * remainingCapacity decreases on add, increases on remove */ public void testRemainingCapacity() { LinkedBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remainingCapacity()); assertEquals(SIZE-i, q.size()); q.remove(); } for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.remainingCapacity()); assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * offer(null) throws NPE */ public void testOfferNull() { try { LinkedBlockingQueue q = new LinkedBlockingQueue(1); q.offer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * add(null) throws NPE */ public void testAddNull() { try { LinkedBlockingQueue q = new LinkedBlockingQueue(1); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Offer succeeds if not full; fails if full */ public void testOffer() { LinkedBlockingQueue q = new LinkedBlockingQueue(1); assertTrue(q.offer(zero)); assertFalse(q.offer(one)); } /** * add succeeds if not full; throws ISE if full */ public void testAdd() { try { LinkedBlockingQueue q = new LinkedBlockingQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.add(new Integer(i))); } assertEquals(0, q.remainingCapacity()); q.add(new Integer(SIZE)); shouldThrow(); } catch (IllegalStateException success) {} } /** * addAll(null) throws NPE */ public void testAddAll1() { try { LinkedBlockingQueue q = new LinkedBlockingQueue(1); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll(this) throws IAE */ public void testAddAllSelf() { try { LinkedBlockingQueue q = populatedQueue(SIZE); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { LinkedBlockingQueue q = new LinkedBlockingQueue(SIZE); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { LinkedBlockingQueue q = new LinkedBlockingQueue(SIZE); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll throws ISE if not enough room */ public void testAddAll4() { try { LinkedBlockingQueue q = new LinkedBlockingQueue(1); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (IllegalStateException success) {} } /** * Queue contains all elements, in traversal order, of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); LinkedBlockingQueue q = new LinkedBlockingQueue(SIZE); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * put(null) throws NPE */ public void testPutNull() throws InterruptedException { try { LinkedBlockingQueue q = new LinkedBlockingQueue(SIZE); q.put(null); shouldThrow(); } catch (NullPointerException success) {} } /** * all elements successfully put are contained */ public void testPut() throws InterruptedException { LinkedBlockingQueue q = new LinkedBlockingQueue(SIZE); for (int i = 0; i < SIZE; ++i) { Integer I = new Integer(i); q.put(I); assertTrue(q.contains(I)); } assertEquals(0, q.remainingCapacity()); } /** * put blocks interruptibly if full */ public void testBlockingPut() throws InterruptedException { final LinkedBlockingQueue q = new LinkedBlockingQueue(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) q.put(i); assertEquals(SIZE, q.size()); assertEquals(0, q.remainingCapacity()); try { q.put(99); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(SIZE, q.size()); assertEquals(0, q.remainingCapacity()); } /** * put blocks waiting for take when full */ public void testPutWithTake() throws InterruptedException { final int capacity = 2; final LinkedBlockingQueue q = new LinkedBlockingQueue(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < capacity + 1; i++) q.put(i); try { q.put(99); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); assertEquals(q.remainingCapacity(), 0); assertEquals(0, q.take()); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(q.remainingCapacity(), 0); } /** * timed offer times out if full and elements not taken */ public void testTimedOffer() throws InterruptedException { final LinkedBlockingQueue q = new LinkedBlockingQueue(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.put(new Object()); q.put(new Object()); assertFalse(q.offer(new Object(), SHORT_DELAY_MS, MILLISECONDS)); try { q.offer(new Object(), LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SMALL_DELAY_MS); t.interrupt(); t.join(); } /** * take retrieves elements in FIFO order */ public void testTake() throws InterruptedException { LinkedBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } } /** * Take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { final LinkedBlockingQueue q = populatedQueue(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } try { q.take(); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * poll succeeds unless empty */ public void testPoll() { LinkedBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll()); } assertNull(q.poll()); } /** * timed poll with zero timeout succeeds when non-empty, else times out */ public void testTimedPoll0() throws InterruptedException { LinkedBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll(0, MILLISECONDS)); } assertNull(q.poll(0, MILLISECONDS)); } /** * timed poll with nonzero timeout succeeds when non-empty, else times out */ public void testTimedPoll() throws InterruptedException { LinkedBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll(SHORT_DELAY_MS, MILLISECONDS)); } assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); } /** * Interrupted timed poll throws InterruptedException instead of * returning timeout status */ public void testInterruptedTimedPoll() throws InterruptedException { final BlockingQueue q = populatedQueue(SIZE); final CountDownLatch aboutToWait = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { long t0 = System.nanoTime(); assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); } long t0 = System.nanoTime(); aboutToWait.countDown(); try { q.poll(MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); } }}); aboutToWait.await(); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); checkEmpty(q); } /** * peek returns next element, or null if empty */ public void testPeek() { LinkedBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peek()); assertEquals(i, q.poll()); assertTrue(q.peek() == null || !q.peek().equals(i)); } assertNull(q.peek()); } /** * element returns next element, or throws NSEE if empty */ public void testElement() { LinkedBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.element()); assertEquals(i, q.poll()); } try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove removes next element, or throws NSEE if empty */ public void testRemove() { LinkedBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remove()); } try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { LinkedBlockingQueue q = populatedQueue(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * An add following remove(x) succeeds */ public void testRemoveElementAndAdd() throws InterruptedException { LinkedBlockingQueue q = new LinkedBlockingQueue(); assertTrue(q.add(new Integer(1))); assertTrue(q.add(new Integer(2))); assertTrue(q.remove(new Integer(1))); assertTrue(q.remove(new Integer(2))); assertTrue(q.add(new Integer(3))); assertTrue(q.take() != null); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { LinkedBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.poll(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { LinkedBlockingQueue q = populatedQueue(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); assertEquals(SIZE, q.remainingCapacity()); q.add(one); assertFalse(q.isEmpty()); assertTrue(q.contains(one)); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { LinkedBlockingQueue q = populatedQueue(SIZE); LinkedBlockingQueue p = new LinkedBlockingQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { LinkedBlockingQueue q = populatedQueue(SIZE); LinkedBlockingQueue p = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.remove(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { LinkedBlockingQueue q = populatedQueue(SIZE); LinkedBlockingQueue p = populatedQueue(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.remove()); assertFalse(q.contains(I)); } } } /** * toArray contains all elements in FIFO order */ public void testToArray() { LinkedBlockingQueue q = populatedQueue(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) assertSame(o[i], q.poll()); } /** * toArray(a) contains all elements in FIFO order */ public void testToArray2() throws InterruptedException { LinkedBlockingQueue q = populatedQueue(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.poll()); } /** * toArray(null) throws NullPointerException */ public void testToArray_NullArg() { LinkedBlockingQueue q = populatedQueue(SIZE); try { q.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { LinkedBlockingQueue q = populatedQueue(SIZE); try { q.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * iterator iterates through all elements */ public void testIterator() throws InterruptedException { LinkedBlockingQueue q = populatedQueue(SIZE); Iterator it = q.iterator(); while (it.hasNext()) { assertEquals(it.next(), q.take()); } } /** * iterator.remove removes current element */ public void testIteratorRemove() { final LinkedBlockingQueue q = new LinkedBlockingQueue(3); q.add(two); q.add(one); q.add(three); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertSame(it.next(), one); assertSame(it.next(), three); assertFalse(it.hasNext()); } /** * iterator ordering is FIFO */ public void testIteratorOrdering() { final LinkedBlockingQueue q = new LinkedBlockingQueue(3); q.add(one); q.add(two); q.add(three); assertEquals(0, q.remainingCapacity()); int k = 0; for (Iterator it = q.iterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); } /** * Modifications do not cause iterators to fail */ public void testWeaklyConsistentIteration() { final LinkedBlockingQueue q = new LinkedBlockingQueue(3); q.add(one); q.add(two); q.add(three); for (Iterator it = q.iterator(); it.hasNext();) { q.remove(); it.next(); } assertEquals(0, q.size()); } /** * toString contains toStrings of elements */ public void testToString() { LinkedBlockingQueue q = populatedQueue(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * offer transfers elements across Executor tasks */ public void testOfferInExecutor() { final LinkedBlockingQueue q = new LinkedBlockingQueue(2); q.add(one); q.add(two); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(q.offer(three)); assertTrue(q.offer(three, MEDIUM_DELAY_MS, MILLISECONDS)); assertEquals(0, q.remainingCapacity()); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { delay(SMALL_DELAY_MS); assertSame(one, q.take()); }}); joinPool(executor); } /** * poll retrieves elements across Executor threads */ public void testPollInExecutor() { final LinkedBlockingQueue q = new LinkedBlockingQueue(2); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertNull(q.poll()); assertSame(one, q.poll(MEDIUM_DELAY_MS, MILLISECONDS)); assertTrue(q.isEmpty()); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { delay(SMALL_DELAY_MS); q.put(one); }}); joinPool(executor); } /** * A deserialized serialized queue has same elements in same order */ public void testSerialization() throws Exception { LinkedBlockingQueue q = populatedQueue(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); LinkedBlockingQueue r = (LinkedBlockingQueue)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.remove(), r.remove()); } /** * drainTo(null) throws NPE */ public void testDrainToNull() { LinkedBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(null); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this) throws IAE */ public void testDrainToSelf() { LinkedBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c) empties queue into another collection c */ public void testDrainTo() { LinkedBlockingQueue q = populatedQueue(SIZE); ArrayList l = new ArrayList(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), SIZE); for (int i = 0; i < SIZE; ++i) assertEquals(l.get(i), new Integer(i)); q.add(zero); q.add(one); assertFalse(q.isEmpty()); assertTrue(q.contains(zero)); assertTrue(q.contains(one)); l.clear(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), 2); for (int i = 0; i < 2; ++i) assertEquals(l.get(i), new Integer(i)); } /** * drainTo empties full queue, unblocking a waiting put. */ public void testDrainToWithActivePut() throws InterruptedException { final LinkedBlockingQueue q = populatedQueue(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.put(new Integer(SIZE+1)); }}); t.start(); ArrayList l = new ArrayList(); q.drainTo(l); assertTrue(l.size() >= SIZE); for (int i = 0; i < SIZE; ++i) assertEquals(l.get(i), new Integer(i)); t.join(); assertTrue(q.size() + l.size() >= SIZE); } /** * drainTo(null, n) throws NPE */ public void testDrainToNullN() { LinkedBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(null, 0); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this, n) throws IAE */ public void testDrainToSelfN() { LinkedBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(q, 0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c, n) empties first min(n, size) elements of queue into c */ public void testDrainToN() { LinkedBlockingQueue q = new LinkedBlockingQueue(); for (int i = 0; i < SIZE + 2; ++i) { for (int j = 0; j < SIZE; j++) assertTrue(q.offer(new Integer(j))); ArrayList l = new ArrayList(); q.drainTo(l, i); int k = (i < SIZE) ? i : SIZE; assertEquals(l.size(), k); assertEquals(q.size(), SIZE-k); for (int j = 0; j < k; ++j) assertEquals(l.get(j), new Integer(j)); while (q.poll() != null) ; } } } jsr166/src/test/tck/EntryTest.java0000644000000000000000000001011611537741072014140 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class EntryTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(EntryTest.class); } static final String k1 = "1"; static final String v1 = "a"; static final String k2 = "2"; static final String v2 = "b"; /** * A new SimpleEntry(k, v) holds k, v. */ public void testConstructor1() { Map.Entry e = new AbstractMap.SimpleEntry(k1, v1); assertEquals(k1, e.getKey()); assertEquals(v1, e.getValue()); } /** * A new SimpleImmutableEntry(k, v) holds k, v. */ public void testConstructor2() { Map.Entry s = new AbstractMap.SimpleImmutableEntry(k1, v1); assertEquals(k1, s.getKey()); assertEquals(v1, s.getValue()); } /** * A new SimpleEntry(entry(k, v)) holds k, v. */ public void testConstructor3() { Map.Entry e2 = new AbstractMap.SimpleEntry(k1, v1); Map.Entry e = new AbstractMap.SimpleEntry(e2); assertEquals(k1, e.getKey()); assertEquals(v1, e.getValue()); } /** * A new SimpleImmutableEntry(entry(k, v)) holds k, v. */ public void testConstructor4() { Map.Entry s2 = new AbstractMap.SimpleImmutableEntry(k1, v1); Map.Entry s = new AbstractMap.SimpleImmutableEntry(s2); assertEquals(k1, s.getKey()); assertEquals(v1, s.getValue()); } /** * Entries with same key-value pairs are equal and have same * hashcodes */ public void testEquals() { Map.Entry e2 = new AbstractMap.SimpleEntry(k1, v1); Map.Entry e = new AbstractMap.SimpleEntry(e2); Map.Entry s2 = new AbstractMap.SimpleImmutableEntry(k1, v1); Map.Entry s = new AbstractMap.SimpleImmutableEntry(s2); assertEquals(e2, e); assertEquals(e2.hashCode(), e.hashCode()); assertEquals(s2, s); assertEquals(s2.hashCode(), s.hashCode()); assertEquals(e2, s2); assertEquals(e2.hashCode(), s2.hashCode()); assertEquals(e, s); assertEquals(e.hashCode(), s.hashCode()); } /** * Entries with different key-value pairs are not equal */ public void testNotEquals() { Map.Entry e2 = new AbstractMap.SimpleEntry(k1, v1); Map.Entry e = new AbstractMap.SimpleEntry(k2, v1); assertFalse(e2.equals(e)); e = new AbstractMap.SimpleEntry(k1, v2); assertFalse(e2.equals(e)); e = new AbstractMap.SimpleEntry(k2, v2); assertFalse(e2.equals(e)); Map.Entry s2 = new AbstractMap.SimpleImmutableEntry(k1, v1); Map.Entry s = new AbstractMap.SimpleImmutableEntry(k2, v1); assertFalse(s2.equals(s)); s = new AbstractMap.SimpleImmutableEntry(k1, v2); assertFalse(s2.equals(s)); s = new AbstractMap.SimpleImmutableEntry(k2, v2); assertFalse(s2.equals(s)); } /** * getValue returns last setValue for SimpleEntry */ public void testSetValue1() { Map.Entry e2 = new AbstractMap.SimpleEntry(k1, v1); Map.Entry e = new AbstractMap.SimpleEntry(e2); assertEquals(k1, e.getKey()); assertEquals(v1, e.getValue()); e.setValue(k2); assertEquals(k2, e.getValue()); assertFalse(e2.equals(e)); } /** * setValue for SimpleImmutableEntry throws UnsupportedOperationException */ public void testsetValue2() { Map.Entry s2 = new AbstractMap.SimpleImmutableEntry(k1, v1); Map.Entry s = new AbstractMap.SimpleImmutableEntry(s2); assertEquals(k1, s.getKey()); assertEquals(v1, s.getValue()); try { s.setValue(k2); shouldThrow(); } catch (UnsupportedOperationException success) {} } } jsr166/src/test/tck/ConcurrentLinkedQueueTest.java0000644000000000000000000003476411537741072017334 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class ConcurrentLinkedQueueTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ConcurrentLinkedQueueTest.class); } /** * Create a queue of given size containing consecutive * Integers 0 ... n. */ private ConcurrentLinkedQueue populatedQueue(int n) { ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); assertTrue(q.isEmpty()); for (int i = 0; i < n; ++i) assertTrue(q.offer(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(n, q.size()); return q; } /** * new queue is empty */ public void testConstructor1() { assertEquals(0, new ConcurrentLinkedQueue().size()); } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { ConcurrentLinkedQueue q = new ConcurrentLinkedQueue((Collection)null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws NPE */ public void testConstructor4() { try { Integer[] ints = new Integer[SIZE]; ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection with some null elements throws NPE */ public void testConstructor5() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements of collection used to initialize */ public void testConstructor6() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * isEmpty is true before add, false after */ public void testEmpty() { ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); assertTrue(q.isEmpty()); q.add(one); assertFalse(q.isEmpty()); q.add(two); q.remove(); q.remove(); assertTrue(q.isEmpty()); } /** * size changes when elements added and removed */ public void testSize() { ConcurrentLinkedQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.remove(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * offer(null) throws NPE */ public void testOfferNull() { try { ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); q.offer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * add(null) throws NPE */ public void testAddNull() { try { ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Offer returns true */ public void testOffer() { ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); assertTrue(q.offer(zero)); assertTrue(q.offer(one)); } /** * add returns true */ public void testAdd() { ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); assertTrue(q.add(new Integer(i))); } } /** * addAll(null) throws NPE */ public void testAddAll1() { try { ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll(this) throws IAE */ public void testAddAllSelf() { try { ConcurrentLinkedQueue q = populatedQueue(SIZE); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements, in traversal order, of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * poll succeeds unless empty */ public void testPoll() { ConcurrentLinkedQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll()); } assertNull(q.poll()); } /** * peek returns next element, or null if empty */ public void testPeek() { ConcurrentLinkedQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peek()); assertEquals(i, q.poll()); assertTrue(q.peek() == null || !q.peek().equals(i)); } assertNull(q.peek()); } /** * element returns next element, or throws NSEE if empty */ public void testElement() { ConcurrentLinkedQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.element()); assertEquals(i, q.poll()); } try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove removes next element, or throws NSEE if empty */ public void testRemove() { ConcurrentLinkedQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remove()); } try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { ConcurrentLinkedQueue q = populatedQueue(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { ConcurrentLinkedQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.poll(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { ConcurrentLinkedQueue q = populatedQueue(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); q.add(one); assertFalse(q.isEmpty()); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { ConcurrentLinkedQueue q = populatedQueue(SIZE); ConcurrentLinkedQueue p = new ConcurrentLinkedQueue(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if change */ public void testRetainAll() { ConcurrentLinkedQueue q = populatedQueue(SIZE); ConcurrentLinkedQueue p = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.remove(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { ConcurrentLinkedQueue q = populatedQueue(SIZE); ConcurrentLinkedQueue p = populatedQueue(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.remove()); assertFalse(q.contains(I)); } } } /** * toArray contains all elements in FIFO order */ public void testToArray() { ConcurrentLinkedQueue q = populatedQueue(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) assertSame(o[i], q.poll()); } /** * toArray(a) contains all elements in FIFO order */ public void testToArray2() { ConcurrentLinkedQueue q = populatedQueue(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.poll()); } /** * toArray(null) throws NullPointerException */ public void testToArray_NullArg() { ConcurrentLinkedQueue q = populatedQueue(SIZE); try { q.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { ConcurrentLinkedQueue q = populatedQueue(SIZE); try { q.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * iterator iterates through all elements */ public void testIterator() { ConcurrentLinkedQueue q = populatedQueue(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * iterator ordering is FIFO */ public void testIteratorOrdering() { final ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); q.add(one); q.add(two); q.add(three); int k = 0; for (Iterator it = q.iterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); } /** * Modifications do not cause iterators to fail */ public void testWeaklyConsistentIteration() { final ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); q.add(one); q.add(two); q.add(three); for (Iterator it = q.iterator(); it.hasNext();) { q.remove(); it.next(); } assertEquals("queue should be empty again", 0, q.size()); } /** * iterator.remove removes current element */ public void testIteratorRemove() { final ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); q.add(one); q.add(two); q.add(three); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertSame(it.next(), two); assertSame(it.next(), three); assertFalse(it.hasNext()); } /** * toString contains toStrings of elements */ public void testToString() { ConcurrentLinkedQueue q = populatedQueue(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * A deserialized serialized queue has same elements in same order */ public void testSerialization() throws Exception { ConcurrentLinkedQueue q = populatedQueue(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); ConcurrentLinkedQueue r = (ConcurrentLinkedQueue)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.remove(), r.remove()); } } jsr166/src/test/tck/SemaphoreTest.java0000644000000000000000000005751011560754737015003 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.io.*; public class SemaphoreTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(SemaphoreTest.class); } /** * Subclass to expose protected methods */ static class PublicSemaphore extends Semaphore { PublicSemaphore(int p, boolean f) { super(p, f); } public Collection getQueuedThreads() { return super.getQueuedThreads(); } public void reducePermits(int p) { super.reducePermits(p); } } /** * A runnable calling acquire */ class InterruptibleLockRunnable extends CheckedRunnable { final Semaphore lock; InterruptibleLockRunnable(Semaphore l) { lock = l; } public void realRun() { try { lock.acquire(); } catch (InterruptedException ignored) {} } } /** * A runnable calling acquire that expects to be interrupted */ class InterruptedLockRunnable extends CheckedInterruptedRunnable { final Semaphore lock; InterruptedLockRunnable(Semaphore l) { lock = l; } public void realRun() throws InterruptedException { lock.acquire(); } } /** * Zero, negative, and positive initial values are allowed in constructor */ public void testConstructor() { for (int permits : new int[] { -1, 0, 1 }) { for (boolean fair : new boolean[] { false, true }) { Semaphore s = new Semaphore(permits, fair); assertEquals(permits, s.availablePermits()); assertEquals(fair, s.isFair()); } } } /** * Constructor without fairness argument behaves as nonfair */ public void testConstructor2() { for (int permits : new int[] { -1, 0, 1 }) { Semaphore s = new Semaphore(permits); assertEquals(permits, s.availablePermits()); assertFalse(s.isFair()); } } /** * tryAcquire succeeds when sufficient permits, else fails */ public void testTryAcquireInSameThread() { Semaphore s = new Semaphore(2, false); assertEquals(2, s.availablePermits()); assertTrue(s.tryAcquire()); assertTrue(s.tryAcquire()); assertEquals(0, s.availablePermits()); assertFalse(s.tryAcquire()); } /** * Acquire and release of semaphore succeed if initially available */ public void testAcquireReleaseInSameThread() throws InterruptedException { Semaphore s = new Semaphore(1, false); s.acquire(); s.release(); s.acquire(); s.release(); s.acquire(); s.release(); s.acquire(); s.release(); s.acquire(); s.release(); assertEquals(1, s.availablePermits()); } /** * Uninterruptible acquire and release of semaphore succeed if * initially available */ public void testAcquireUninterruptiblyReleaseInSameThread() throws InterruptedException { Semaphore s = new Semaphore(1, false); s.acquireUninterruptibly(); s.release(); s.acquireUninterruptibly(); s.release(); s.acquireUninterruptibly(); s.release(); s.acquireUninterruptibly(); s.release(); s.acquireUninterruptibly(); s.release(); assertEquals(1, s.availablePermits()); } /** * Timed Acquire and release of semaphore succeed if * initially available */ public void testTimedAcquireReleaseInSameThread() throws InterruptedException { Semaphore s = new Semaphore(1, false); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertEquals(1, s.availablePermits()); } /** * A release in one thread enables an acquire in another thread */ public void testAcquireReleaseInDifferentThreads() throws InterruptedException { final Semaphore s = new Semaphore(0, false); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { s.acquire(); s.release(); s.release(); s.acquire(); }}); t.start(); delay(SHORT_DELAY_MS); s.release(); s.release(); s.acquire(); s.acquire(); s.release(); t.join(); } /** * A release in one thread enables an uninterruptible acquire in another thread */ public void testUninterruptibleAcquireReleaseInDifferentThreads() throws InterruptedException { final Semaphore s = new Semaphore(0, false); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { s.acquireUninterruptibly(); s.release(); s.release(); s.acquireUninterruptibly(); }}); t.start(); delay(SHORT_DELAY_MS); s.release(); s.release(); s.acquireUninterruptibly(); s.acquireUninterruptibly(); s.release(); t.join(); } /** * A release in one thread enables a timed acquire in another thread */ public void testTimedAcquireReleaseInDifferentThreads() throws InterruptedException { final Semaphore s = new Semaphore(1, false); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { s.release(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); }}); t.start(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); s.release(); t.join(); } /** * A waiting acquire blocks interruptibly */ public void testAcquire_InterruptedException() throws InterruptedException { final Semaphore s = new Semaphore(0, false); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { s.acquire(); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * A waiting timed acquire blocks interruptibly */ public void testTryAcquire_InterruptedException() throws InterruptedException { final Semaphore s = new Semaphore(0, false); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { s.tryAcquire(MEDIUM_DELAY_MS, MILLISECONDS); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * hasQueuedThreads reports whether there are waiting threads */ public void testHasQueuedThreads() throws InterruptedException { final Semaphore lock = new Semaphore(1, false); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertFalse(lock.hasQueuedThreads()); lock.acquireUninterruptibly(); t1.start(); delay(SHORT_DELAY_MS); assertTrue(lock.hasQueuedThreads()); t2.start(); delay(SHORT_DELAY_MS); assertTrue(lock.hasQueuedThreads()); t1.interrupt(); delay(SHORT_DELAY_MS); assertTrue(lock.hasQueuedThreads()); lock.release(); delay(SHORT_DELAY_MS); assertFalse(lock.hasQueuedThreads()); t1.join(); t2.join(); } /** * getQueueLength reports number of waiting threads */ public void testGetQueueLength() throws InterruptedException { final Semaphore lock = new Semaphore(1, false); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertEquals(0, lock.getQueueLength()); lock.acquireUninterruptibly(); t1.start(); delay(SHORT_DELAY_MS); assertEquals(1, lock.getQueueLength()); t2.start(); delay(SHORT_DELAY_MS); assertEquals(2, lock.getQueueLength()); t1.interrupt(); delay(SHORT_DELAY_MS); assertEquals(1, lock.getQueueLength()); lock.release(); delay(SHORT_DELAY_MS); assertEquals(0, lock.getQueueLength()); t1.join(); t2.join(); } /** * getQueuedThreads includes waiting threads */ public void testGetQueuedThreads() throws InterruptedException { final PublicSemaphore lock = new PublicSemaphore(1, false); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertTrue(lock.getQueuedThreads().isEmpty()); lock.acquireUninterruptibly(); assertTrue(lock.getQueuedThreads().isEmpty()); t1.start(); delay(SHORT_DELAY_MS); assertTrue(lock.getQueuedThreads().contains(t1)); t2.start(); delay(SHORT_DELAY_MS); assertTrue(lock.getQueuedThreads().contains(t1)); assertTrue(lock.getQueuedThreads().contains(t2)); t1.interrupt(); delay(SHORT_DELAY_MS); assertFalse(lock.getQueuedThreads().contains(t1)); assertTrue(lock.getQueuedThreads().contains(t2)); lock.release(); delay(SHORT_DELAY_MS); assertTrue(lock.getQueuedThreads().isEmpty()); t1.join(); t2.join(); } /** * drainPermits reports and removes given number of permits */ public void testDrainPermits() { Semaphore s = new Semaphore(0, false); assertEquals(0, s.availablePermits()); assertEquals(0, s.drainPermits()); s.release(10); assertEquals(10, s.availablePermits()); assertEquals(10, s.drainPermits()); assertEquals(0, s.availablePermits()); assertEquals(0, s.drainPermits()); } /** * reducePermits reduces number of permits */ public void testReducePermits() { PublicSemaphore s = new PublicSemaphore(10, false); assertEquals(10, s.availablePermits()); s.reducePermits(1); assertEquals(9, s.availablePermits()); s.reducePermits(10); assertEquals(-1, s.availablePermits()); } /** * a deserialized serialized semaphore has same number of permits */ public void testSerialization() throws Exception { Semaphore l = new Semaphore(3, false); l.acquire(); l.release(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); Semaphore r = (Semaphore) in.readObject(); assertEquals(3, r.availablePermits()); assertFalse(r.isFair()); r.acquire(); r.release(); } /** * Zero, negative, and positive initial values are allowed in constructor */ public void testConstructor_fair() { Semaphore s0 = new Semaphore(0, true); assertEquals(0, s0.availablePermits()); assertTrue(s0.isFair()); Semaphore s1 = new Semaphore(-1, true); assertEquals(-1, s1.availablePermits()); Semaphore s2 = new Semaphore(-1, true); assertEquals(-1, s2.availablePermits()); } /** * tryAcquire succeeds when sufficient permits, else fails */ public void testTryAcquireInSameThread_fair() { Semaphore s = new Semaphore(2, true); assertEquals(2, s.availablePermits()); assertTrue(s.tryAcquire()); assertTrue(s.tryAcquire()); assertEquals(0, s.availablePermits()); assertFalse(s.tryAcquire()); } /** * tryAcquire(n) succeeds when sufficient permits, else fails */ public void testTryAcquireNInSameThread_fair() { Semaphore s = new Semaphore(2, true); assertEquals(2, s.availablePermits()); assertTrue(s.tryAcquire(2)); assertEquals(0, s.availablePermits()); assertFalse(s.tryAcquire()); } /** * Acquire and release of semaphore succeed if initially available */ public void testAcquireReleaseInSameThread_fair() throws InterruptedException { Semaphore s = new Semaphore(1, true); s.acquire(); s.release(); s.acquire(); s.release(); s.acquire(); s.release(); s.acquire(); s.release(); s.acquire(); s.release(); assertEquals(1, s.availablePermits()); } /** * Acquire(n) and release(n) of semaphore succeed if initially available */ public void testAcquireReleaseNInSameThread_fair() throws InterruptedException { Semaphore s = new Semaphore(1, true); s.release(1); s.acquire(1); s.release(2); s.acquire(2); s.release(3); s.acquire(3); s.release(4); s.acquire(4); s.release(5); s.acquire(5); assertEquals(1, s.availablePermits()); } /** * Acquire(n) and release(n) of semaphore succeed if initially available */ public void testAcquireUninterruptiblyReleaseNInSameThread_fair() { Semaphore s = new Semaphore(1, true); s.release(1); s.acquireUninterruptibly(1); s.release(2); s.acquireUninterruptibly(2); s.release(3); s.acquireUninterruptibly(3); s.release(4); s.acquireUninterruptibly(4); s.release(5); s.acquireUninterruptibly(5); assertEquals(1, s.availablePermits()); } /** * release(n) in one thread enables timed acquire(n) in another thread */ public void testTimedAcquireReleaseNInSameThread_fair() throws InterruptedException { Semaphore s = new Semaphore(1, true); s.release(1); assertTrue(s.tryAcquire(1, SHORT_DELAY_MS, MILLISECONDS)); s.release(2); assertTrue(s.tryAcquire(2, SHORT_DELAY_MS, MILLISECONDS)); s.release(3); assertTrue(s.tryAcquire(3, SHORT_DELAY_MS, MILLISECONDS)); s.release(4); assertTrue(s.tryAcquire(4, SHORT_DELAY_MS, MILLISECONDS)); s.release(5); assertTrue(s.tryAcquire(5, SHORT_DELAY_MS, MILLISECONDS)); assertEquals(1, s.availablePermits()); } /** * release in one thread enables timed acquire in another thread */ public void testTimedAcquireReleaseInSameThread_fair() throws InterruptedException { Semaphore s = new Semaphore(1, true); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); s.release(); assertEquals(1, s.availablePermits()); } /** * A release in one thread enables an acquire in another thread */ public void testAcquireReleaseInDifferentThreads_fair() throws InterruptedException { final Semaphore s = new Semaphore(0, true); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { s.acquire(); s.acquire(); s.acquire(); s.acquire(); }}); t.start(); delay(SHORT_DELAY_MS); s.release(); s.release(); s.release(); s.release(); s.release(); s.release(); t.join(); assertEquals(2, s.availablePermits()); } /** * release(n) in one thread enables acquire(n) in another thread */ public void testAcquireReleaseNInDifferentThreads_fair() throws InterruptedException { final Semaphore s = new Semaphore(0, true); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { s.acquire(); s.release(2); s.acquire(); }}); t.start(); delay(SHORT_DELAY_MS); s.release(2); s.acquire(2); s.release(1); t.join(); } /** * release(n) in one thread enables acquire(n) in another thread */ public void testAcquireReleaseNInDifferentThreads_fair2() throws InterruptedException { final Semaphore s = new Semaphore(0, true); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { s.acquire(2); s.acquire(2); s.release(4); }}); t.start(); delay(SHORT_DELAY_MS); s.release(6); s.acquire(2); s.acquire(2); s.release(2); t.join(); } /** * release in one thread enables timed acquire in another thread */ public void testTimedAcquireReleaseInDifferentThreads_fair() throws InterruptedException { final Semaphore s = new Semaphore(1, true); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); assertTrue(s.tryAcquire(SHORT_DELAY_MS, MILLISECONDS)); }}); t.start(); s.release(); s.release(); s.release(); s.release(); s.release(); t.join(); } /** * release(n) in one thread enables timed acquire(n) in another thread */ public void testTimedAcquireReleaseNInDifferentThreads_fair() throws InterruptedException { final Semaphore s = new Semaphore(2, true); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertTrue(s.tryAcquire(2, SHORT_DELAY_MS, MILLISECONDS)); s.release(2); assertTrue(s.tryAcquire(2, SHORT_DELAY_MS, MILLISECONDS)); s.release(2); }}); t.start(); assertTrue(s.tryAcquire(2, SHORT_DELAY_MS, MILLISECONDS)); s.release(2); assertTrue(s.tryAcquire(2, SHORT_DELAY_MS, MILLISECONDS)); s.release(2); t.join(); } /** * A waiting acquire blocks interruptibly */ public void testAcquire_InterruptedException_fair() throws InterruptedException { final Semaphore s = new Semaphore(0, true); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { s.acquire(); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * A waiting acquire(n) blocks interruptibly */ public void testAcquireN_InterruptedException_fair() throws InterruptedException { final Semaphore s = new Semaphore(2, true); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { s.acquire(3); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * A waiting tryAcquire blocks interruptibly */ public void testTryAcquire_InterruptedException_fair() throws InterruptedException { final Semaphore s = new Semaphore(0, true); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { s.tryAcquire(MEDIUM_DELAY_MS, MILLISECONDS); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * A waiting tryAcquire(n) blocks interruptibly */ public void testTryAcquireN_InterruptedException_fair() throws InterruptedException { final Semaphore s = new Semaphore(1, true); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { s.tryAcquire(4, MEDIUM_DELAY_MS, MILLISECONDS); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * getQueueLength reports number of waiting threads */ public void testGetQueueLength_fair() throws InterruptedException { final Semaphore lock = new Semaphore(1, true); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertEquals(0, lock.getQueueLength()); lock.acquireUninterruptibly(); t1.start(); delay(SHORT_DELAY_MS); assertEquals(1, lock.getQueueLength()); t2.start(); delay(SHORT_DELAY_MS); assertEquals(2, lock.getQueueLength()); t1.interrupt(); delay(SHORT_DELAY_MS); assertEquals(1, lock.getQueueLength()); lock.release(); delay(SHORT_DELAY_MS); assertEquals(0, lock.getQueueLength()); t1.join(); t2.join(); } /** * a deserialized serialized semaphore has same number of permits */ public void testSerialization_fair() throws Exception { Semaphore l = new Semaphore(3, true); l.acquire(); l.release(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); Semaphore r = (Semaphore) in.readObject(); assertEquals(3, r.availablePermits()); assertTrue(r.isFair()); r.acquire(); r.release(); } /** * toString indicates current number of permits */ public void testToString() { Semaphore s = new Semaphore(0); String us = s.toString(); assertTrue(us.indexOf("Permits = 0") >= 0); s.release(); String s1 = s.toString(); assertTrue(s1.indexOf("Permits = 1") >= 0); s.release(); String s2 = s.toString(); assertTrue(s2.indexOf("Permits = 2") >= 0); } } jsr166/src/test/tck/JSR166TestCase.java0000644000000000000000000010707711561313576014544 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.Arrays; import java.util.NoSuchElementException; import java.util.PropertyPermission; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicReference; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.NANOSECONDS; import java.security.CodeSource; import java.security.Permission; import java.security.PermissionCollection; import java.security.Permissions; import java.security.Policy; import java.security.ProtectionDomain; import java.security.SecurityPermission; /** * Base class for JSR166 Junit TCK tests. Defines some constants, * utility methods and classes, as well as a simple framework for * helping to make sure that assertions failing in generated threads * cause the associated test that generated them to itself fail (which * JUnit does not otherwise arrange). The rules for creating such * tests are: * *
    * *
  1. All assertions in code running in generated threads must use * the forms {@link #threadFail}, {@link #threadAssertTrue}, {@link * #threadAssertEquals}, or {@link #threadAssertNull}, (not * {@code fail}, {@code assertTrue}, etc.) It is OK (but not * particularly recommended) for other code to use these forms too. * Only the most typically used JUnit assertion methods are defined * this way, but enough to live with.
  2. * *
  3. If you override {@link #setUp} or {@link #tearDown}, make sure * to invoke {@code super.setUp} and {@code super.tearDown} within * them. These methods are used to clear and check for thread * assertion failures.
  4. * *
  5. All delays and timeouts must use one of the constants {@code * SHORT_DELAY_MS}, {@code SMALL_DELAY_MS}, {@code MEDIUM_DELAY_MS}, * {@code LONG_DELAY_MS}. The idea here is that a SHORT is always * discriminable from zero time, and always allows enough time for the * small amounts of computation (creating a thread, calling a few * methods, etc) needed to reach a timeout point. Similarly, a SMALL * is always discriminable as larger than SHORT and smaller than * MEDIUM. And so on. These constants are set to conservative values, * but even so, if there is ever any doubt, they can all be increased * in one spot to rerun tests on slower platforms.
  6. * *
  7. All threads generated must be joined inside each test case * method (or {@code fail} to do so) before returning from the * method. The {@code joinPool} method can be used to do this when * using Executors.
  8. * *
* *

Other notes *

    * *
  • Usually, there is one testcase method per JSR166 method * covering "normal" operation, and then as many exception-testing * methods as there are exceptions the method can throw. Sometimes * there are multiple tests per JSR166 method when the different * "normal" behaviors differ significantly. And sometimes testcases * cover multiple methods when they cannot be tested in * isolation.
  • * *
  • The documentation style for testcases is to provide as javadoc * a simple sentence or two describing the property that the testcase * method purports to test. The javadocs do not say anything about how * the property is tested. To find out, read the code.
  • * *
  • These tests are "conformance tests", and do not attempt to * test throughput, latency, scalability or other performance factors * (see the separate "jtreg" tests for a set intended to check these * for the most central aspects of functionality.) So, most tests use * the smallest sensible numbers of threads, collection sizes, etc * needed to check basic conformance.
  • * *
  • The test classes currently do not declare inclusion in * any particular package to simplify things for people integrating * them in TCK test suites.
  • * *
  • As a convenience, the {@code main} of this class (JSR166TestCase) * runs all JSR166 unit tests.
  • * *
*/ public class JSR166TestCase extends TestCase { private static final boolean useSecurityManager = Boolean.getBoolean("jsr166.useSecurityManager"); protected static final boolean expensiveTests = Boolean.getBoolean("jsr166.expensiveTests"); /** * If true, report on stdout all "slow" tests, that is, ones that * take more than profileThreshold milliseconds to execute. */ private static final boolean profileTests = Boolean.getBoolean("jsr166.profileTests"); /** * The number of milliseconds that tests are permitted for * execution without being reported, when profileTests is set. */ private static final long profileThreshold = Long.getLong("jsr166.profileThreshold", 100); protected void runTest() throws Throwable { if (profileTests) runTestProfiled(); else super.runTest(); } protected void runTestProfiled() throws Throwable { long t0 = System.nanoTime(); try { super.runTest(); } finally { long elapsedMillis = (System.nanoTime() - t0) / (1000L * 1000L); if (elapsedMillis >= profileThreshold) System.out.printf("%n%s: %d%n", toString(), elapsedMillis); } } /** * Runs all JSR166 unit tests using junit.textui.TestRunner */ public static void main(String[] args) { if (useSecurityManager) { System.err.println("Setting a permissive security manager"); Policy.setPolicy(permissivePolicy()); System.setSecurityManager(new SecurityManager()); } int iters = (args.length == 0) ? 1 : Integer.parseInt(args[0]); Test s = suite(); for (int i = 0; i < iters; ++i) { junit.textui.TestRunner.run(s); System.gc(); System.runFinalization(); } System.exit(0); } public static TestSuite newTestSuite(Object... suiteOrClasses) { TestSuite suite = new TestSuite(); for (Object suiteOrClass : suiteOrClasses) { if (suiteOrClass instanceof TestSuite) suite.addTest((TestSuite) suiteOrClass); else if (suiteOrClass instanceof Class) suite.addTest(new TestSuite((Class) suiteOrClass)); else throw new ClassCastException("not a test suite or class"); } return suite; } /** * Collects all JSR166 unit tests as one suite. */ public static Test suite() { return newTestSuite( ForkJoinPoolTest.suite(), ForkJoinTaskTest.suite(), RecursiveActionTest.suite(), RecursiveTaskTest.suite(), LinkedTransferQueueTest.suite(), PhaserTest.suite(), ThreadLocalRandomTest.suite(), AbstractExecutorServiceTest.suite(), AbstractQueueTest.suite(), AbstractQueuedSynchronizerTest.suite(), AbstractQueuedLongSynchronizerTest.suite(), ArrayBlockingQueueTest.suite(), ArrayDequeTest.suite(), AtomicBooleanTest.suite(), AtomicIntegerArrayTest.suite(), AtomicIntegerFieldUpdaterTest.suite(), AtomicIntegerTest.suite(), AtomicLongArrayTest.suite(), AtomicLongFieldUpdaterTest.suite(), AtomicLongTest.suite(), AtomicMarkableReferenceTest.suite(), AtomicReferenceArrayTest.suite(), AtomicReferenceFieldUpdaterTest.suite(), AtomicReferenceTest.suite(), AtomicStampedReferenceTest.suite(), ConcurrentHashMapTest.suite(), ConcurrentLinkedDequeTest.suite(), ConcurrentLinkedQueueTest.suite(), ConcurrentSkipListMapTest.suite(), ConcurrentSkipListSubMapTest.suite(), ConcurrentSkipListSetTest.suite(), ConcurrentSkipListSubSetTest.suite(), CopyOnWriteArrayListTest.suite(), CopyOnWriteArraySetTest.suite(), CountDownLatchTest.suite(), CyclicBarrierTest.suite(), DelayQueueTest.suite(), EntryTest.suite(), ExchangerTest.suite(), ExecutorsTest.suite(), ExecutorCompletionServiceTest.suite(), FutureTaskTest.suite(), LinkedBlockingDequeTest.suite(), LinkedBlockingQueueTest.suite(), LinkedListTest.suite(), LockSupportTest.suite(), PriorityBlockingQueueTest.suite(), PriorityQueueTest.suite(), ReentrantLockTest.suite(), ReentrantReadWriteLockTest.suite(), ScheduledExecutorTest.suite(), ScheduledExecutorSubclassTest.suite(), SemaphoreTest.suite(), SynchronousQueueTest.suite(), SystemTest.suite(), ThreadLocalTest.suite(), ThreadPoolExecutorTest.suite(), ThreadPoolExecutorSubclassTest.suite(), ThreadTest.suite(), TimeUnitTest.suite(), TreeMapTest.suite(), TreeSetTest.suite(), TreeSubMapTest.suite(), TreeSubSetTest.suite()); } public static long SHORT_DELAY_MS; public static long SMALL_DELAY_MS; public static long MEDIUM_DELAY_MS; public static long LONG_DELAY_MS; /** * Returns the shortest timed delay. This could * be reimplemented to use for example a Property. */ protected long getShortDelay() { return 50; } /** * Sets delays as multiples of SHORT_DELAY. */ protected void setDelays() { SHORT_DELAY_MS = getShortDelay(); SMALL_DELAY_MS = SHORT_DELAY_MS * 5; MEDIUM_DELAY_MS = SHORT_DELAY_MS * 10; LONG_DELAY_MS = SHORT_DELAY_MS * 200; } /** * The first exception encountered if any threadAssertXXX method fails. */ private final AtomicReference threadFailure = new AtomicReference(null); /** * Records an exception so that it can be rethrown later in the test * harness thread, triggering a test case failure. Only the first * failure is recorded; subsequent calls to this method from within * the same test have no effect. */ public void threadRecordFailure(Throwable t) { threadFailure.compareAndSet(null, t); } public void setUp() { setDelays(); } /** * Triggers test case failure if any thread assertions have failed, * by rethrowing, in the test harness thread, any exception recorded * earlier by threadRecordFailure. */ public void tearDown() throws Exception { Throwable t = threadFailure.getAndSet(null); if (t != null) { if (t instanceof Error) throw (Error) t; else if (t instanceof RuntimeException) throw (RuntimeException) t; else if (t instanceof Exception) throw (Exception) t; else { AssertionFailedError afe = new AssertionFailedError(t.toString()); afe.initCause(t); throw afe; } } } /** * Just like fail(reason), but additionally recording (using * threadRecordFailure) any AssertionFailedError thrown, so that * the current testcase will fail. */ public void threadFail(String reason) { try { fail(reason); } catch (AssertionFailedError t) { threadRecordFailure(t); fail(reason); } } /** * Just like assertTrue(b), but additionally recording (using * threadRecordFailure) any AssertionFailedError thrown, so that * the current testcase will fail. */ public void threadAssertTrue(boolean b) { try { assertTrue(b); } catch (AssertionFailedError t) { threadRecordFailure(t); throw t; } } /** * Just like assertFalse(b), but additionally recording (using * threadRecordFailure) any AssertionFailedError thrown, so that * the current testcase will fail. */ public void threadAssertFalse(boolean b) { try { assertFalse(b); } catch (AssertionFailedError t) { threadRecordFailure(t); throw t; } } /** * Just like assertNull(x), but additionally recording (using * threadRecordFailure) any AssertionFailedError thrown, so that * the current testcase will fail. */ public void threadAssertNull(Object x) { try { assertNull(x); } catch (AssertionFailedError t) { threadRecordFailure(t); throw t; } } /** * Just like assertEquals(x, y), but additionally recording (using * threadRecordFailure) any AssertionFailedError thrown, so that * the current testcase will fail. */ public void threadAssertEquals(long x, long y) { try { assertEquals(x, y); } catch (AssertionFailedError t) { threadRecordFailure(t); throw t; } } /** * Just like assertEquals(x, y), but additionally recording (using * threadRecordFailure) any AssertionFailedError thrown, so that * the current testcase will fail. */ public void threadAssertEquals(Object x, Object y) { try { assertEquals(x, y); } catch (AssertionFailedError t) { threadRecordFailure(t); throw t; } catch (Throwable t) { threadUnexpectedException(t); } } /** * Just like assertSame(x, y), but additionally recording (using * threadRecordFailure) any AssertionFailedError thrown, so that * the current testcase will fail. */ public void threadAssertSame(Object x, Object y) { try { assertSame(x, y); } catch (AssertionFailedError t) { threadRecordFailure(t); throw t; } } /** * Calls threadFail with message "should throw exception". */ public void threadShouldThrow() { threadFail("should throw exception"); } /** * Calls threadFail with message "should throw" + exceptionName. */ public void threadShouldThrow(String exceptionName) { threadFail("should throw " + exceptionName); } /** * Records the given exception using {@link #threadRecordFailure}, * then rethrows the exception, wrapping it in an * AssertionFailedError if necessary. */ public void threadUnexpectedException(Throwable t) { threadRecordFailure(t); t.printStackTrace(); if (t instanceof RuntimeException) throw (RuntimeException) t; else if (t instanceof Error) throw (Error) t; else { AssertionFailedError afe = new AssertionFailedError("unexpected exception: " + t); t.initCause(t); throw afe; } } /** * Delays, via Thread.sleep for the given millisecond delay, but * if the sleep is shorter than specified, may re-sleep or yield * until time elapses. */ public static void delay(long ms) throws InterruptedException { long startTime = System.nanoTime(); long ns = ms * 1000 * 1000; for (;;) { if (ms > 0L) Thread.sleep(ms); else // too short to sleep Thread.yield(); long d = ns - (System.nanoTime() - startTime); if (d > 0L) ms = d / (1000 * 1000); else break; } } /** * Waits out termination of a thread pool or fails doing so. */ public void joinPool(ExecutorService exec) { try { exec.shutdown(); assertTrue("ExecutorService did not terminate in a timely manner", exec.awaitTermination(2 * LONG_DELAY_MS, MILLISECONDS)); } catch (SecurityException ok) { // Allowed in case test doesn't have privs } catch (InterruptedException ie) { fail("Unexpected InterruptedException"); } } /** * Checks that thread does not terminate within timeoutMillis * milliseconds (that is, Thread.join times out). */ public void assertThreadJoinTimesOut(Thread thread, long timeoutMillis) { try { long startTime = System.nanoTime(); thread.join(timeoutMillis); assertTrue(thread.isAlive()); assertTrue(millisElapsedSince(startTime) >= timeoutMillis); } catch (InterruptedException ie) { fail("Unexpected InterruptedException"); } } /** * Fails with message "should throw exception". */ public void shouldThrow() { fail("Should throw exception"); } /** * Fails with message "should throw " + exceptionName. */ public void shouldThrow(String exceptionName) { fail("Should throw " + exceptionName); } /** * The number of elements to place in collections, arrays, etc. */ public static final int SIZE = 20; // Some convenient Integer constants public static final Integer zero = new Integer(0); public static final Integer one = new Integer(1); public static final Integer two = new Integer(2); public static final Integer three = new Integer(3); public static final Integer four = new Integer(4); public static final Integer five = new Integer(5); public static final Integer six = new Integer(6); public static final Integer seven = new Integer(7); public static final Integer eight = new Integer(8); public static final Integer nine = new Integer(9); public static final Integer m1 = new Integer(-1); public static final Integer m2 = new Integer(-2); public static final Integer m3 = new Integer(-3); public static final Integer m4 = new Integer(-4); public static final Integer m5 = new Integer(-5); public static final Integer m6 = new Integer(-6); public static final Integer m10 = new Integer(-10); /** * Runs Runnable r with a security policy that permits precisely * the specified permissions. If there is no current security * manager, the runnable is run twice, both with and without a * security manager. We require that any security manager permit * getPolicy/setPolicy. */ public void runWithPermissions(Runnable r, Permission... permissions) { SecurityManager sm = System.getSecurityManager(); if (sm == null) { r.run(); Policy savedPolicy = Policy.getPolicy(); try { Policy.setPolicy(permissivePolicy()); System.setSecurityManager(new SecurityManager()); runWithPermissions(r, permissions); } finally { System.setSecurityManager(null); Policy.setPolicy(savedPolicy); } } else { Policy savedPolicy = Policy.getPolicy(); AdjustablePolicy policy = new AdjustablePolicy(permissions); Policy.setPolicy(policy); try { r.run(); } finally { policy.addPermission(new SecurityPermission("setPolicy")); Policy.setPolicy(savedPolicy); } } } /** * Runs a runnable without any permissions. */ public void runWithoutPermissions(Runnable r) { runWithPermissions(r); } /** * A security policy where new permissions can be dynamically added * or all cleared. */ public static class AdjustablePolicy extends java.security.Policy { Permissions perms = new Permissions(); AdjustablePolicy(Permission... permissions) { for (Permission permission : permissions) perms.add(permission); } void addPermission(Permission perm) { perms.add(perm); } void clearPermissions() { perms = new Permissions(); } public PermissionCollection getPermissions(CodeSource cs) { return perms; } public PermissionCollection getPermissions(ProtectionDomain pd) { return perms; } public boolean implies(ProtectionDomain pd, Permission p) { return perms.implies(p); } public void refresh() {} } /** * Returns a policy containing all the permissions we ever need. */ public static Policy permissivePolicy() { return new AdjustablePolicy // Permissions j.u.c. needs directly (new RuntimePermission("modifyThread"), new RuntimePermission("getClassLoader"), new RuntimePermission("setContextClassLoader"), // Permissions needed to change permissions! new SecurityPermission("getPolicy"), new SecurityPermission("setPolicy"), new RuntimePermission("setSecurityManager"), // Permissions needed by the junit test harness new RuntimePermission("accessDeclaredMembers"), new PropertyPermission("*", "read"), new java.io.FilePermission("<>", "read")); } /** * Sleeps until the given time has elapsed. * Throws AssertionFailedError if interrupted. */ void sleep(long millis) { try { delay(millis); } catch (InterruptedException ie) { AssertionFailedError afe = new AssertionFailedError("Unexpected InterruptedException"); afe.initCause(ie); throw afe; } } /** * Sleeps until the timeout has elapsed, or interrupted. * Does NOT throw InterruptedException. */ void sleepTillInterrupted(long timeoutMillis) { try { Thread.sleep(timeoutMillis); } catch (InterruptedException wakeup) {} } /** * Waits up to the specified number of milliseconds for the given * thread to enter a wait state: BLOCKED, WAITING, or TIMED_WAITING. */ void waitForThreadToEnterWaitState(Thread thread, long timeoutMillis) { long timeoutNanos = timeoutMillis * 1000L * 1000L; long t0 = System.nanoTime(); for (;;) { Thread.State s = thread.getState(); if (s == Thread.State.BLOCKED || s == Thread.State.WAITING || s == Thread.State.TIMED_WAITING) return; else if (s == Thread.State.TERMINATED) fail("Unexpected thread termination"); else if (System.nanoTime() - t0 > timeoutNanos) { threadAssertTrue(thread.isAlive()); return; } Thread.yield(); } } /** * Waits up to LONG_DELAY_MS for the given thread to enter a wait * state: BLOCKED, WAITING, or TIMED_WAITING. */ void waitForThreadToEnterWaitState(Thread thread) { waitForThreadToEnterWaitState(thread, LONG_DELAY_MS); } /** * Returns the number of milliseconds since time given by * startNanoTime, which must have been previously returned from a * call to {@link System.nanoTime()}. */ long millisElapsedSince(long startNanoTime) { return NANOSECONDS.toMillis(System.nanoTime() - startNanoTime); } /** * Returns a new started daemon Thread running the given runnable. */ Thread newStartedThread(Runnable runnable) { Thread t = new Thread(runnable); t.setDaemon(true); t.start(); return t; } /** * Waits for the specified time (in milliseconds) for the thread * to terminate (using {@link Thread#join(long)}), else interrupts * the thread (in the hope that it may terminate later) and fails. */ void awaitTermination(Thread t, long timeoutMillis) { try { t.join(timeoutMillis); } catch (InterruptedException ie) { threadUnexpectedException(ie); } finally { if (t.isAlive()) { t.interrupt(); fail("Test timed out"); } } } /** * Waits for LONG_DELAY_MS milliseconds for the thread to * terminate (using {@link Thread#join(long)}), else interrupts * the thread (in the hope that it may terminate later) and fails. */ void awaitTermination(Thread t) { awaitTermination(t, LONG_DELAY_MS); } // Some convenient Runnable classes public abstract class CheckedRunnable implements Runnable { protected abstract void realRun() throws Throwable; public final void run() { try { realRun(); } catch (Throwable t) { threadUnexpectedException(t); } } } public abstract class RunnableShouldThrow implements Runnable { protected abstract void realRun() throws Throwable; final Class exceptionClass; RunnableShouldThrow(Class exceptionClass) { this.exceptionClass = exceptionClass; } public final void run() { try { realRun(); threadShouldThrow(exceptionClass.getSimpleName()); } catch (Throwable t) { if (! exceptionClass.isInstance(t)) threadUnexpectedException(t); } } } public abstract class ThreadShouldThrow extends Thread { protected abstract void realRun() throws Throwable; final Class exceptionClass; ThreadShouldThrow(Class exceptionClass) { this.exceptionClass = exceptionClass; } public final void run() { try { realRun(); threadShouldThrow(exceptionClass.getSimpleName()); } catch (Throwable t) { if (! exceptionClass.isInstance(t)) threadUnexpectedException(t); } } } public abstract class CheckedInterruptedRunnable implements Runnable { protected abstract void realRun() throws Throwable; public final void run() { try { realRun(); threadShouldThrow("InterruptedException"); } catch (InterruptedException success) { } catch (Throwable t) { threadUnexpectedException(t); } } } public abstract class CheckedCallable implements Callable { protected abstract T realCall() throws Throwable; public final T call() { try { return realCall(); } catch (Throwable t) { threadUnexpectedException(t); return null; } } } public abstract class CheckedInterruptedCallable implements Callable { protected abstract T realCall() throws Throwable; public final T call() { try { T result = realCall(); threadShouldThrow("InterruptedException"); return result; } catch (InterruptedException success) { } catch (Throwable t) { threadUnexpectedException(t); } return null; } } public static class NoOpRunnable implements Runnable { public void run() {} } public static class NoOpCallable implements Callable { public Object call() { return Boolean.TRUE; } } public static final String TEST_STRING = "a test string"; public static class StringTask implements Callable { public String call() { return TEST_STRING; } } public Callable latchAwaitingStringTask(final CountDownLatch latch) { return new CheckedCallable() { protected String realCall() { try { latch.await(); } catch (InterruptedException quittingTime) {} return TEST_STRING; }}; } public Runnable awaiter(final CountDownLatch latch) { return new CheckedRunnable() { public void realRun() throws InterruptedException { latch.await(); }}; } public static class NPETask implements Callable { public String call() { throw new NullPointerException(); } } public static class CallableOne implements Callable { public Integer call() { return one; } } public class ShortRunnable extends CheckedRunnable { protected void realRun() throws Throwable { delay(SHORT_DELAY_MS); } } public class ShortInterruptedRunnable extends CheckedInterruptedRunnable { protected void realRun() throws InterruptedException { delay(SHORT_DELAY_MS); } } public class SmallRunnable extends CheckedRunnable { protected void realRun() throws Throwable { delay(SMALL_DELAY_MS); } } public class SmallPossiblyInterruptedRunnable extends CheckedRunnable { protected void realRun() { try { delay(SMALL_DELAY_MS); } catch (InterruptedException ok) {} } } public class SmallCallable extends CheckedCallable { protected Object realCall() throws InterruptedException { delay(SMALL_DELAY_MS); return Boolean.TRUE; } } public class MediumRunnable extends CheckedRunnable { protected void realRun() throws Throwable { delay(MEDIUM_DELAY_MS); } } public class MediumInterruptedRunnable extends CheckedInterruptedRunnable { protected void realRun() throws InterruptedException { delay(MEDIUM_DELAY_MS); } } public Runnable possiblyInterruptedRunnable(final long timeoutMillis) { return new CheckedRunnable() { protected void realRun() { try { delay(timeoutMillis); } catch (InterruptedException ok) {} }}; } public class MediumPossiblyInterruptedRunnable extends CheckedRunnable { protected void realRun() { try { delay(MEDIUM_DELAY_MS); } catch (InterruptedException ok) {} } } public class LongPossiblyInterruptedRunnable extends CheckedRunnable { protected void realRun() { try { delay(LONG_DELAY_MS); } catch (InterruptedException ok) {} } } /** * For use as ThreadFactory in constructors */ public static class SimpleThreadFactory implements ThreadFactory { public Thread newThread(Runnable r) { return new Thread(r); } } public interface TrackedRunnable extends Runnable { boolean isDone(); } public static TrackedRunnable trackedRunnable(final long timeoutMillis) { return new TrackedRunnable() { private volatile boolean done = false; public boolean isDone() { return done; } public void run() { try { delay(timeoutMillis); done = true; } catch (InterruptedException ok) {} } }; } public static class TrackedShortRunnable implements Runnable { public volatile boolean done = false; public void run() { try { delay(SHORT_DELAY_MS); done = true; } catch (InterruptedException ok) {} } } public static class TrackedSmallRunnable implements Runnable { public volatile boolean done = false; public void run() { try { delay(SMALL_DELAY_MS); done = true; } catch (InterruptedException ok) {} } } public static class TrackedMediumRunnable implements Runnable { public volatile boolean done = false; public void run() { try { delay(MEDIUM_DELAY_MS); done = true; } catch (InterruptedException ok) {} } } public static class TrackedLongRunnable implements Runnable { public volatile boolean done = false; public void run() { try { delay(LONG_DELAY_MS); done = true; } catch (InterruptedException ok) {} } } public static class TrackedNoOpRunnable implements Runnable { public volatile boolean done = false; public void run() { done = true; } } public static class TrackedCallable implements Callable { public volatile boolean done = false; public Object call() { try { delay(SMALL_DELAY_MS); done = true; } catch (InterruptedException ok) {} return Boolean.TRUE; } } /** * Analog of CheckedRunnable for RecursiveAction */ public abstract class CheckedRecursiveAction extends RecursiveAction { protected abstract void realCompute() throws Throwable; public final void compute() { try { realCompute(); } catch (Throwable t) { threadUnexpectedException(t); } } } /** * Analog of CheckedCallable for RecursiveTask */ public abstract class CheckedRecursiveTask extends RecursiveTask { protected abstract T realCompute() throws Throwable; public final T compute() { try { return realCompute(); } catch (Throwable t) { threadUnexpectedException(t); return null; } } } /** * For use as RejectedExecutionHandler in constructors */ public static class NoOpREHandler implements RejectedExecutionHandler { public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {} } /** * A CyclicBarrier that fails with AssertionFailedErrors instead * of throwing checked exceptions. */ public class CheckedBarrier extends CyclicBarrier { public CheckedBarrier(int parties) { super(parties); } public int await() { try { return super.await(); } catch (Exception e) { AssertionFailedError afe = new AssertionFailedError("Unexpected exception: " + e); afe.initCause(e); throw afe; } } } public void checkEmpty(BlockingQueue q) { try { assertTrue(q.isEmpty()); assertEquals(0, q.size()); assertNull(q.peek()); assertNull(q.poll()); assertNull(q.poll(0, MILLISECONDS)); assertEquals(q.toString(), "[]"); assertTrue(Arrays.equals(q.toArray(), new Object[0])); assertFalse(q.iterator().hasNext()); try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} try { q.iterator().next(); shouldThrow(); } catch (NoSuchElementException success) {} try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } catch (InterruptedException ie) { threadUnexpectedException(ie); } } } jsr166/src/test/tck/ThreadPoolExecutorTest.java0000644000000000000000000021250411561321121016606 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.concurrent.atomic.*; import junit.framework.*; import java.util.*; public class ThreadPoolExecutorTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ThreadPoolExecutorTest.class); } static class ExtendedTPE extends ThreadPoolExecutor { volatile boolean beforeCalled = false; volatile boolean afterCalled = false; volatile boolean terminatedCalled = false; public ExtendedTPE() { super(1, 1, LONG_DELAY_MS, MILLISECONDS, new SynchronousQueue()); } protected void beforeExecute(Thread t, Runnable r) { beforeCalled = true; } protected void afterExecute(Runnable r, Throwable t) { afterCalled = true; } protected void terminated() { terminatedCalled = true; } } static class FailingThreadFactory implements ThreadFactory { int calls = 0; public Thread newThread(Runnable r) { if (++calls > 1) return null; return new Thread(r); } } /** * execute successfully executes a runnable */ public void testExecute() throws InterruptedException { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch done = new CountDownLatch(1); final Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); }}; try { p.execute(task); assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS)); } finally { joinPool(p); } } /** * getActiveCount increases but doesn't overestimate, when a * thread becomes active */ public void testGetActiveCount() throws InterruptedException { final ThreadPoolExecutor p = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getActiveCount()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getActiveCount()); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(1, p.getActiveCount()); } finally { done.countDown(); joinPool(p); } } /** * prestartCoreThread starts a thread if under corePoolSize, else doesn't */ public void testPrestartCoreThread() { final ThreadPoolExecutor p = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertEquals(0, p.getPoolSize()); assertTrue(p.prestartCoreThread()); assertEquals(1, p.getPoolSize()); assertTrue(p.prestartCoreThread()); assertEquals(2, p.getPoolSize()); assertFalse(p.prestartCoreThread()); assertEquals(2, p.getPoolSize()); joinPool(p); } /** * prestartAllCoreThreads starts all corePoolSize threads */ public void testPrestartAllCoreThreads() { final ThreadPoolExecutor p = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertEquals(0, p.getPoolSize()); p.prestartAllCoreThreads(); assertEquals(2, p.getPoolSize()); p.prestartAllCoreThreads(); assertEquals(2, p.getPoolSize()); joinPool(p); } /** * getCompletedTaskCount increases, but doesn't overestimate, * when tasks complete */ public void testGetCompletedTaskCount() throws InterruptedException { final ThreadPoolExecutor p = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch threadProceed = new CountDownLatch(1); final CountDownLatch threadDone = new CountDownLatch(1); try { assertEquals(0, p.getCompletedTaskCount()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(0, p.getCompletedTaskCount()); threadProceed.await(); threadDone.countDown(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(0, p.getCompletedTaskCount()); threadProceed.countDown(); threadDone.await(); delay(SHORT_DELAY_MS); assertEquals(1, p.getCompletedTaskCount()); } finally { joinPool(p); } } /** * getCorePoolSize returns size given in constructor if not otherwise set */ public void testGetCorePoolSize() { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertEquals(1, p.getCorePoolSize()); joinPool(p); } /** * getKeepAliveTime returns value given in constructor if not otherwise set */ public void testGetKeepAliveTime() { final ThreadPoolExecutor p = new ThreadPoolExecutor(2, 2, 1000, MILLISECONDS, new ArrayBlockingQueue(10)); assertEquals(1, p.getKeepAliveTime(TimeUnit.SECONDS)); joinPool(p); } /** * getThreadFactory returns factory in constructor if not set */ public void testGetThreadFactory() { ThreadFactory tf = new SimpleThreadFactory(); final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), tf, new NoOpREHandler()); assertSame(tf, p.getThreadFactory()); joinPool(p); } /** * setThreadFactory sets the thread factory returned by getThreadFactory */ public void testSetThreadFactory() { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); ThreadFactory tf = new SimpleThreadFactory(); p.setThreadFactory(tf); assertSame(tf, p.getThreadFactory()); joinPool(p); } /** * setThreadFactory(null) throws NPE */ public void testSetThreadFactoryNull() { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { p.setThreadFactory(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(p); } } /** * getRejectedExecutionHandler returns handler in constructor if not set */ public void testGetRejectedExecutionHandler() { final RejectedExecutionHandler h = new NoOpREHandler(); final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), h); assertSame(h, p.getRejectedExecutionHandler()); joinPool(p); } /** * setRejectedExecutionHandler sets the handler returned by * getRejectedExecutionHandler */ public void testSetRejectedExecutionHandler() { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); RejectedExecutionHandler h = new NoOpREHandler(); p.setRejectedExecutionHandler(h); assertSame(h, p.getRejectedExecutionHandler()); joinPool(p); } /** * setRejectedExecutionHandler(null) throws NPE */ public void testSetRejectedExecutionHandlerNull() { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { p.setRejectedExecutionHandler(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(p); } } /** * getLargestPoolSize increases, but doesn't overestimate, when * multiple threads active */ public void testGetLargestPoolSize() throws InterruptedException { final int THREADS = 3; final ThreadPoolExecutor p = new ThreadPoolExecutor(THREADS, THREADS, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadsStarted = new CountDownLatch(THREADS); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getLargestPoolSize()); for (int i = 0; i < THREADS; i++) p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadsStarted.countDown(); done.await(); assertEquals(THREADS, p.getLargestPoolSize()); }}); assertTrue(threadsStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(THREADS, p.getLargestPoolSize()); } finally { done.countDown(); joinPool(p); assertEquals(THREADS, p.getLargestPoolSize()); } } /** * getMaximumPoolSize returns value given in constructor if not * otherwise set */ public void testGetMaximumPoolSize() { final ThreadPoolExecutor p = new ThreadPoolExecutor(2, 3, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertEquals(3, p.getMaximumPoolSize()); joinPool(p); } /** * getPoolSize increases, but doesn't overestimate, when threads * become active */ public void testGetPoolSize() throws InterruptedException { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getPoolSize()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getPoolSize()); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(1, p.getPoolSize()); } finally { done.countDown(); joinPool(p); } } /** * getTaskCount increases, but doesn't overestimate, when tasks submitted */ public void testGetTaskCount() throws InterruptedException { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getTaskCount()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getTaskCount()); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(1, p.getTaskCount()); } finally { done.countDown(); joinPool(p); } } /** * isShutdown is false before shutdown, true after */ public void testIsShutdown() { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertFalse(p.isShutdown()); try { p.shutdown(); } catch (SecurityException ok) { return; } assertTrue(p.isShutdown()); joinPool(p); } /** * isTerminated is false before termination, true after */ public void testIsTerminated() throws InterruptedException { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); assertFalse(p.isTerminated()); try { p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(p.isTerminated()); threadStarted.countDown(); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(p.isTerminating()); done.countDown(); } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); } /** * isTerminating is not true when running or when terminated */ public void testIsTerminating() throws InterruptedException { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertFalse(p.isTerminating()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(p.isTerminating()); threadStarted.countDown(); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(p.isTerminating()); done.countDown(); } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); assertFalse(p.isTerminating()); } /** * getQueue returns the work queue, which contains queued tasks */ public void testGetQueue() throws InterruptedException { final BlockingQueue q = new ArrayBlockingQueue(10); final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, q); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { FutureTask[] tasks = new FutureTask[5]; for (int i = 0; i < tasks.length; i++) { Callable task = new CheckedCallable() { public Boolean realCall() throws InterruptedException { threadStarted.countDown(); assertSame(q, p.getQueue()); done.await(); return Boolean.TRUE; }}; tasks[i] = new FutureTask(task); p.execute(tasks[i]); } assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertSame(q, p.getQueue()); assertFalse(q.contains(tasks[0])); assertTrue(q.contains(tasks[tasks.length - 1])); assertEquals(tasks.length - 1, q.size()); } finally { done.countDown(); joinPool(p); } } /** * remove(task) removes queued task, and fails to remove active task */ public void testRemove() throws InterruptedException { BlockingQueue q = new ArrayBlockingQueue(10); final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, q); Runnable[] tasks = new Runnable[5]; final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { for (int i = 0; i < tasks.length; i++) { tasks[i] = new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); done.await(); }}; p.execute(tasks[i]); } assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(p.remove(tasks[0])); assertTrue(q.contains(tasks[4])); assertTrue(q.contains(tasks[3])); assertTrue(p.remove(tasks[4])); assertFalse(p.remove(tasks[4])); assertFalse(q.contains(tasks[4])); assertTrue(q.contains(tasks[3])); assertTrue(p.remove(tasks[3])); assertFalse(q.contains(tasks[3])); } finally { done.countDown(); joinPool(p); } } /** * purge removes cancelled tasks from the queue */ public void testPurge() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); final BlockingQueue q = new ArrayBlockingQueue(10); final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, q); FutureTask[] tasks = new FutureTask[5]; try { for (int i = 0; i < tasks.length; i++) { Callable task = new CheckedCallable() { public Boolean realCall() throws InterruptedException { threadStarted.countDown(); done.await(); return Boolean.TRUE; }}; tasks[i] = new FutureTask(task); p.execute(tasks[i]); } assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(tasks.length, p.getTaskCount()); assertEquals(tasks.length - 1, q.size()); assertEquals(1L, p.getActiveCount()); assertEquals(0L, p.getCompletedTaskCount()); tasks[4].cancel(true); tasks[3].cancel(false); p.purge(); assertEquals(tasks.length - 3, q.size()); assertEquals(tasks.length - 2, p.getTaskCount()); p.purge(); // Nothing to do assertEquals(tasks.length - 3, q.size()); assertEquals(tasks.length - 2, p.getTaskCount()); } finally { done.countDown(); joinPool(p); } } /** * shutdownNow returns a list containing tasks that were not run */ public void testShutdownNow() { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List l; try { for (int i = 0; i < 5; i++) p.execute(new MediumPossiblyInterruptedRunnable()); } finally { try { l = p.shutdownNow(); } catch (SecurityException ok) { return; } } assertTrue(p.isShutdown()); assertTrue(l.size() <= 4); } // Exception Tests /** * Constructor throws if corePoolSize argument is less than zero */ public void testConstructor1() { try { new ThreadPoolExecutor(-1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is less than zero */ public void testConstructor2() { try { new ThreadPoolExecutor(1, -1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is equal to zero */ public void testConstructor3() { try { new ThreadPoolExecutor(1, 0, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if keepAliveTime is less than zero */ public void testConstructor4() { try { new ThreadPoolExecutor(1, 2, -1L, MILLISECONDS, new ArrayBlockingQueue(10)); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if corePoolSize is greater than the maximumPoolSize */ public void testConstructor5() { try { new ThreadPoolExecutor(2, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if workQueue is set to null */ public void testConstructorNullPointerException() { try { new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, (BlockingQueue) null); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if corePoolSize argument is less than zero */ public void testConstructor6() { try { new ThreadPoolExecutor(-1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new SimpleThreadFactory()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is less than zero */ public void testConstructor7() { try { new ThreadPoolExecutor(1, -1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new SimpleThreadFactory()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is equal to zero */ public void testConstructor8() { try { new ThreadPoolExecutor(1, 0, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new SimpleThreadFactory()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if keepAliveTime is less than zero */ public void testConstructor9() { try { new ThreadPoolExecutor(1, 2, -1L, MILLISECONDS, new ArrayBlockingQueue(10), new SimpleThreadFactory()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if corePoolSize is greater than the maximumPoolSize */ public void testConstructor10() { try { new ThreadPoolExecutor(2, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new SimpleThreadFactory()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if workQueue is set to null */ public void testConstructorNullPointerException2() { try { new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, (BlockingQueue) null, new SimpleThreadFactory()); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if threadFactory is set to null */ public void testConstructorNullPointerException3() { try { new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), (ThreadFactory) null); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if corePoolSize argument is less than zero */ public void testConstructor11() { try { new ThreadPoolExecutor(-1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is less than zero */ public void testConstructor12() { try { new ThreadPoolExecutor(1, -1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is equal to zero */ public void testConstructor13() { try { new ThreadPoolExecutor(1, 0, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if keepAliveTime is less than zero */ public void testConstructor14() { try { new ThreadPoolExecutor(1, 2, -1L, MILLISECONDS, new ArrayBlockingQueue(10), new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if corePoolSize is greater than the maximumPoolSize */ public void testConstructor15() { try { new ThreadPoolExecutor(2, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if workQueue is set to null */ public void testConstructorNullPointerException4() { try { new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, (BlockingQueue) null, new NoOpREHandler()); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if handler is set to null */ public void testConstructorNullPointerException5() { try { new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), (RejectedExecutionHandler) null); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if corePoolSize argument is less than zero */ public void testConstructor16() { try { new ThreadPoolExecutor(-1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new SimpleThreadFactory(), new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is less than zero */ public void testConstructor17() { try { new ThreadPoolExecutor(1, -1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new SimpleThreadFactory(), new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is equal to zero */ public void testConstructor18() { try { new ThreadPoolExecutor(1, 0, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new SimpleThreadFactory(), new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if keepAliveTime is less than zero */ public void testConstructor19() { try { new ThreadPoolExecutor(1, 2, -1L, MILLISECONDS, new ArrayBlockingQueue(10), new SimpleThreadFactory(), new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if corePoolSize is greater than the maximumPoolSize */ public void testConstructor20() { try { new ThreadPoolExecutor(2, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new SimpleThreadFactory(), new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if workQueue is null */ public void testConstructorNullPointerException6() { try { new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, (BlockingQueue) null, new SimpleThreadFactory(), new NoOpREHandler()); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if handler is null */ public void testConstructorNullPointerException7() { try { new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), new SimpleThreadFactory(), (RejectedExecutionHandler) null); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if ThreadFactory is null */ public void testConstructorNullPointerException8() { try { new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), (ThreadFactory) null, new NoOpREHandler()); shouldThrow(); } catch (NullPointerException success) {} } /** * get of submitted callable throws InterruptedException if interrupted */ public void testInterruptedSubmit() throws InterruptedException { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws Exception { Callable task = new CheckedCallable() { public Boolean realCall() throws InterruptedException { threadStarted.countDown(); done.await(); return Boolean.TRUE; }}; p.submit(task).get(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); } finally { done.countDown(); joinPool(p); } } /** * execute throws RejectedExecutionException if saturated. */ public void testSaturatedExecute() { ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1)); final CountDownLatch done = new CountDownLatch(1); try { Runnable task = new CheckedRunnable() { public void realRun() throws InterruptedException { done.await(); }}; for (int i = 0; i < 2; ++i) p.execute(task); for (int i = 0; i < 2; ++i) { try { p.execute(task); shouldThrow(); } catch (RejectedExecutionException success) {} assertTrue(p.getTaskCount() <= 2); } } finally { done.countDown(); joinPool(p); } } /** * submit(runnable) throws RejectedExecutionException if saturated. */ public void testSaturatedSubmitRunnable() { ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1)); final CountDownLatch done = new CountDownLatch(1); try { Runnable task = new CheckedRunnable() { public void realRun() throws InterruptedException { done.await(); }}; for (int i = 0; i < 2; ++i) p.submit(task); for (int i = 0; i < 2; ++i) { try { p.execute(task); shouldThrow(); } catch (RejectedExecutionException success) {} assertTrue(p.getTaskCount() <= 2); } } finally { done.countDown(); joinPool(p); } } /** * submit(callable) throws RejectedExecutionException if saturated. */ public void testSaturatedSubmitCallable() { ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1)); final CountDownLatch done = new CountDownLatch(1); try { Runnable task = new CheckedRunnable() { public void realRun() throws InterruptedException { done.await(); }}; for (int i = 0; i < 2; ++i) p.submit(Executors.callable(task)); for (int i = 0; i < 2; ++i) { try { p.execute(task); shouldThrow(); } catch (RejectedExecutionException success) {} assertTrue(p.getTaskCount() <= 2); } } finally { done.countDown(); joinPool(p); } } /** * executor using CallerRunsPolicy runs task if saturated. */ public void testSaturatedExecute2() { RejectedExecutionHandler h = new ThreadPoolExecutor.CallerRunsPolicy(); final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { TrackedNoOpRunnable[] tasks = new TrackedNoOpRunnable[5]; for (int i = 0; i < tasks.length; ++i) tasks[i] = new TrackedNoOpRunnable(); TrackedLongRunnable mr = new TrackedLongRunnable(); p.execute(mr); for (int i = 0; i < tasks.length; ++i) p.execute(tasks[i]); for (int i = 1; i < tasks.length; ++i) assertTrue(tasks[i].done); try { p.shutdownNow(); } catch (SecurityException ok) { return; } } finally { joinPool(p); } } /** * executor using DiscardPolicy drops task if saturated. */ public void testSaturatedExecute3() { RejectedExecutionHandler h = new ThreadPoolExecutor.DiscardPolicy(); final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { TrackedNoOpRunnable[] tasks = new TrackedNoOpRunnable[5]; for (int i = 0; i < tasks.length; ++i) tasks[i] = new TrackedNoOpRunnable(); p.execute(new TrackedLongRunnable()); for (TrackedNoOpRunnable task : tasks) p.execute(task); for (TrackedNoOpRunnable task : tasks) assertFalse(task.done); try { p.shutdownNow(); } catch (SecurityException ok) { return; } } finally { joinPool(p); } } /** * executor using DiscardOldestPolicy drops oldest task if saturated. */ public void testSaturatedExecute4() { RejectedExecutionHandler h = new ThreadPoolExecutor.DiscardOldestPolicy(); final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { p.execute(new TrackedLongRunnable()); TrackedLongRunnable r2 = new TrackedLongRunnable(); p.execute(r2); assertTrue(p.getQueue().contains(r2)); TrackedNoOpRunnable r3 = new TrackedNoOpRunnable(); p.execute(r3); assertFalse(p.getQueue().contains(r2)); assertTrue(p.getQueue().contains(r3)); try { p.shutdownNow(); } catch (SecurityException ok) { return; } } finally { joinPool(p); } } /** * execute throws RejectedExecutionException if shutdown */ public void testRejectedExecutionExceptionOnShutdown() { ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1)); try { p.shutdown(); } catch (SecurityException ok) { return; } try { p.execute(new NoOpRunnable()); shouldThrow(); } catch (RejectedExecutionException success) {} joinPool(p); } /** * execute using CallerRunsPolicy drops task on shutdown */ public void testCallerRunsOnShutdown() { RejectedExecutionHandler h = new ThreadPoolExecutor.CallerRunsPolicy(); final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { p.shutdown(); } catch (SecurityException ok) { return; } try { TrackedNoOpRunnable r = new TrackedNoOpRunnable(); p.execute(r); assertFalse(r.done); } finally { joinPool(p); } } /** * execute using DiscardPolicy drops task on shutdown */ public void testDiscardOnShutdown() { RejectedExecutionHandler h = new ThreadPoolExecutor.DiscardPolicy(); ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { p.shutdown(); } catch (SecurityException ok) { return; } try { TrackedNoOpRunnable r = new TrackedNoOpRunnable(); p.execute(r); assertFalse(r.done); } finally { joinPool(p); } } /** * execute using DiscardOldestPolicy drops task on shutdown */ public void testDiscardOldestOnShutdown() { RejectedExecutionHandler h = new ThreadPoolExecutor.DiscardOldestPolicy(); ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { p.shutdown(); } catch (SecurityException ok) { return; } try { TrackedNoOpRunnable r = new TrackedNoOpRunnable(); p.execute(r); assertFalse(r.done); } finally { joinPool(p); } } /** * execute(null) throws NPE */ public void testExecuteNull() { ThreadPoolExecutor p = new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { p.execute(null); shouldThrow(); } catch (NullPointerException success) {} joinPool(p); } /** * setCorePoolSize of negative value throws IllegalArgumentException */ public void testCorePoolSizeIllegalArgumentException() { ThreadPoolExecutor p = new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { p.setCorePoolSize(-1); shouldThrow(); } catch (IllegalArgumentException success) { } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } joinPool(p); } /** * setMaximumPoolSize(int) throws IllegalArgumentException if * given a value less the core pool size */ public void testMaximumPoolSizeIllegalArgumentException() { ThreadPoolExecutor p = new ThreadPoolExecutor(2, 3, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { p.setMaximumPoolSize(1); shouldThrow(); } catch (IllegalArgumentException success) { } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } joinPool(p); } /** * setMaximumPoolSize throws IllegalArgumentException * if given a negative value */ public void testMaximumPoolSizeIllegalArgumentException2() { ThreadPoolExecutor p = new ThreadPoolExecutor(2, 3, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { p.setMaximumPoolSize(-1); shouldThrow(); } catch (IllegalArgumentException success) { } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } joinPool(p); } /** * setKeepAliveTime throws IllegalArgumentException * when given a negative value */ public void testKeepAliveTimeIllegalArgumentException() { ThreadPoolExecutor p = new ThreadPoolExecutor(2, 3, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { p.setKeepAliveTime(-1,MILLISECONDS); shouldThrow(); } catch (IllegalArgumentException success) { } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } joinPool(p); } /** * terminated() is called on termination */ public void testTerminated() { ExtendedTPE p = new ExtendedTPE(); try { p.shutdown(); } catch (SecurityException ok) { return; } assertTrue(p.terminatedCalled); joinPool(p); } /** * beforeExecute and afterExecute are called when executing task */ public void testBeforeAfter() throws InterruptedException { ExtendedTPE p = new ExtendedTPE(); try { TrackedNoOpRunnable r = new TrackedNoOpRunnable(); p.execute(r); delay(SHORT_DELAY_MS); assertTrue(r.done); assertTrue(p.beforeCalled); assertTrue(p.afterCalled); try { p.shutdown(); } catch (SecurityException ok) { return; } } finally { joinPool(p); } } /** * completed submit of callable returns result */ public void testSubmitCallable() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { Future future = e.submit(new StringTask()); String result = future.get(); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * completed submit of runnable returns successfully */ public void testSubmitRunnable() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { Future future = e.submit(new NoOpRunnable()); future.get(); assertTrue(future.isDone()); } finally { joinPool(e); } } /** * completed submit of (runnable, result) returns result */ public void testSubmitRunnable2() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { Future future = e.submit(new NoOpRunnable(), TEST_STRING); String result = future.get(); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * invokeAny(null) throws NPE */ public void testInvokeAny1() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAny(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAny(empty collection) throws IAE */ public void testInvokeAny2() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAny(new ArrayList>()); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * invokeAny(c) throws NPE if c has null elements */ public void testInvokeAny3() throws Exception { final CountDownLatch latch = new CountDownLatch(1); final ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(latchAwaitingStringTask(latch)); l.add(null); try { e.invokeAny(l); shouldThrow(); } catch (NullPointerException success) { } finally { latch.countDown(); joinPool(e); } } /** * invokeAny(c) throws ExecutionException if no task completes */ public void testInvokeAny4() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * invokeAny(c) returns result of some task */ public void testInvokeAny5() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * invokeAll(null) throws NPE */ public void testInvokeAll1() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAll(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAll(empty collection) returns empty collection */ public void testInvokeAll2() throws InterruptedException { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> r = e.invokeAll(new ArrayList>()); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * invokeAll(c) throws NPE if c has null elements */ public void testInvokeAll3() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of element of invokeAll(c) throws exception on failed task */ public void testInvokeAll4() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } } finally { joinPool(e); } } /** * invokeAll(c) returns results of all completed tasks */ public void testInvokeAll5() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } /** * timed invokeAny(null) throws NPE */ public void testTimedInvokeAny1() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAny(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(,,null) throws NPE */ public void testTimedInvokeAnyNullTimeUnit() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(empty collection) throws IAE */ public void testTimedInvokeAny2() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAny(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * timed invokeAny(c) throws NPE if c has null elements */ public void testTimedInvokeAny3() throws Exception { final CountDownLatch latch = new CountDownLatch(1); final ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(latchAwaitingStringTask(latch)); l.add(null); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { latch.countDown(); joinPool(e); } } /** * timed invokeAny(c) throws ExecutionException if no task completes */ public void testTimedInvokeAny4() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * timed invokeAny(c) returns result of some task */ public void testTimedInvokeAny5() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * timed invokeAll(null) throws NPE */ public void testTimedInvokeAll1() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAll(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(,,null) throws NPE */ public void testTimedInvokeAllNullTimeUnit() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAll(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(empty collection) returns empty collection */ public void testTimedInvokeAll2() throws InterruptedException { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> r = e.invokeAll(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * timed invokeAll(c) throws NPE if c has null elements */ public void testTimedInvokeAll3() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of element of invokeAll(c) throws exception on failed task */ public void testTimedInvokeAll4() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * timed invokeAll(c) returns results of all completed tasks */ public void testTimedInvokeAll5() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } /** * timed invokeAll(c) cancels tasks not completed by timeout */ public void testTimedInvokeAll6() throws Exception { ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(Executors.callable(new MediumPossiblyInterruptedRunnable(), TEST_STRING)); l.add(new StringTask()); List> futures = e.invokeAll(l, SHORT_DELAY_MS, MILLISECONDS); assertEquals(3, futures.size()); Iterator> it = futures.iterator(); Future f1 = it.next(); Future f2 = it.next(); Future f3 = it.next(); assertTrue(f1.isDone()); assertTrue(f2.isDone()); assertTrue(f3.isDone()); assertFalse(f1.isCancelled()); assertTrue(f2.isCancelled()); } finally { joinPool(e); } } /** * Execution continues if there is at least one thread even if * thread factory fails to create more */ public void testFailingThreadFactory() throws InterruptedException { final ExecutorService e = new ThreadPoolExecutor(100, 100, LONG_DELAY_MS, MILLISECONDS, new LinkedBlockingQueue(), new FailingThreadFactory()); try { final int TASKS = 100; final CountDownLatch done = new CountDownLatch(TASKS); for (int k = 0; k < TASKS; ++k) e.execute(new CheckedRunnable() { public void realRun() { done.countDown(); }}); assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS)); } finally { joinPool(e); } } /** * allowsCoreThreadTimeOut is by default false. */ public void testAllowsCoreThreadTimeOut() { final ThreadPoolExecutor p = new ThreadPoolExecutor(2, 2, 1000, MILLISECONDS, new ArrayBlockingQueue(10)); assertFalse(p.allowsCoreThreadTimeOut()); joinPool(p); } /** * allowCoreThreadTimeOut(true) causes idle threads to time out */ public void testAllowCoreThreadTimeOut_true() throws Exception { final ThreadPoolExecutor p = new ThreadPoolExecutor(2, 10, SHORT_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); try { p.allowCoreThreadTimeOut(true); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getPoolSize()); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); for (int i = 0; i < (MEDIUM_DELAY_MS/10); i++) { if (p.getPoolSize() == 0) break; delay(10); } assertEquals(0, p.getPoolSize()); } finally { joinPool(p); } } /** * allowCoreThreadTimeOut(false) causes idle threads not to time out */ public void testAllowCoreThreadTimeOut_false() throws Exception { final ThreadPoolExecutor p = new ThreadPoolExecutor(2, 10, SHORT_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); try { p.allowCoreThreadTimeOut(false); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertTrue(p.getPoolSize() >= 1); }}); delay(SMALL_DELAY_MS); assertTrue(p.getPoolSize() >= 1); } finally { joinPool(p); } } /** * execute allows the same task to be submitted multiple times, even * if rejected */ public void testRejectedRecycledTask() throws InterruptedException { final int nTasks = 1000; final CountDownLatch done = new CountDownLatch(nTasks); final Runnable recycledTask = new Runnable() { public void run() { done.countDown(); }}; final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 30, 60, TimeUnit.SECONDS, new ArrayBlockingQueue(30)); try { for (int i = 0; i < nTasks; ++i) { for (;;) { try { p.execute(recycledTask); break; } catch (RejectedExecutionException ignore) {} } } // enough time to run all tasks assertTrue(done.await(nTasks * SHORT_DELAY_MS, MILLISECONDS)); } finally { p.shutdown(); } } } jsr166/src/test/tck/AtomicBooleanTest.java0000644000000000000000000001053111537741072015554 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.atomic.*; import java.io.*; public class AtomicBooleanTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicBooleanTest.class); } /** * constructor initializes to given value */ public void testConstructor() { assertTrue(new AtomicBoolean(true).get()); assertFalse(new AtomicBoolean(false).get()); } /** * default constructed initializes to false */ public void testConstructor2() { AtomicBoolean ai = new AtomicBoolean(); assertFalse(ai.get()); } /** * get returns the last value set */ public void testGetSet() { AtomicBoolean ai = new AtomicBoolean(true); assertTrue(ai.get()); ai.set(false); assertFalse(ai.get()); ai.set(true); assertTrue(ai.get()); } /** * get returns the last value lazySet in same thread */ public void testGetLazySet() { AtomicBoolean ai = new AtomicBoolean(true); assertTrue(ai.get()); ai.lazySet(false); assertFalse(ai.get()); ai.lazySet(true); assertTrue(ai.get()); } /** * compareAndSet succeeds in changing value if equal to expected else fails */ public void testCompareAndSet() { AtomicBoolean ai = new AtomicBoolean(true); assertTrue(ai.compareAndSet(true,false)); assertFalse(ai.get()); assertTrue(ai.compareAndSet(false,false)); assertFalse(ai.get()); assertFalse(ai.compareAndSet(true,false)); assertFalse(ai.get()); assertTrue(ai.compareAndSet(false,true)); assertTrue(ai.get()); } /** * compareAndSet in one thread enables another waiting for value * to succeed */ public void testCompareAndSetInMultipleThreads() throws Exception { final AtomicBoolean ai = new AtomicBoolean(true); Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!ai.compareAndSet(false, true)) Thread.yield(); }}); t.start(); assertTrue(ai.compareAndSet(true, false)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); } /** * repeated weakCompareAndSet succeeds in changing value when equal * to expected */ public void testWeakCompareAndSet() { AtomicBoolean ai = new AtomicBoolean(true); while (!ai.weakCompareAndSet(true,false)); assertFalse(ai.get()); while (!ai.weakCompareAndSet(false,false)); assertFalse(ai.get()); while (!ai.weakCompareAndSet(false,true)); assertTrue(ai.get()); } /** * getAndSet returns previous value and sets to given value */ public void testGetAndSet() { AtomicBoolean ai = new AtomicBoolean(true); assertEquals(true,ai.getAndSet(false)); assertEquals(false,ai.getAndSet(false)); assertEquals(false,ai.getAndSet(true)); assertTrue(ai.get()); } /** * a deserialized serialized atomic holds same value */ public void testSerialization() throws Exception { AtomicBoolean l = new AtomicBoolean(); l.set(true); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); AtomicBoolean r = (AtomicBoolean) in.readObject(); assertEquals(l.get(), r.get()); } /** * toString returns current value. */ public void testToString() { AtomicBoolean ai = new AtomicBoolean(); assertEquals(ai.toString(), Boolean.toString(false)); ai.set(true); assertEquals(ai.toString(), Boolean.toString(true)); } } jsr166/src/test/tck/AtomicMarkableReferenceTest.java0000644000000000000000000001164411537741072017540 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.atomic.*; public class AtomicMarkableReferenceTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicMarkableReferenceTest.class); } /** * constructor initializes to given reference and mark */ public void testConstructor() { AtomicMarkableReference ai = new AtomicMarkableReference(one, false); assertSame(one,ai.getReference()); assertFalse(ai.isMarked()); AtomicMarkableReference a2 = new AtomicMarkableReference(null, true); assertNull(a2.getReference()); assertTrue(a2.isMarked()); } /** * get returns the last values of reference and mark set */ public void testGetSet() { boolean[] mark = new boolean[1]; AtomicMarkableReference ai = new AtomicMarkableReference(one, false); assertSame(one,ai.getReference()); assertFalse(ai.isMarked()); assertSame(one, ai.get(mark)); assertFalse(mark[0]); ai.set(two, false); assertSame(two,ai.getReference()); assertFalse(ai.isMarked()); assertSame(two, ai.get(mark)); assertFalse(mark[0]); ai.set(one, true); assertSame(one,ai.getReference()); assertTrue(ai.isMarked()); assertSame(one, ai.get(mark)); assertTrue(mark[0]); } /** * attemptMark succeeds in single thread */ public void testAttemptMark() { boolean[] mark = new boolean[1]; AtomicMarkableReference ai = new AtomicMarkableReference(one, false); assertFalse(ai.isMarked()); assertTrue(ai.attemptMark(one, true)); assertTrue(ai.isMarked()); assertSame(one, ai.get(mark)); assertTrue(mark[0]); } /** * compareAndSet succeeds in changing values if equal to expected reference * and mark else fails */ public void testCompareAndSet() { boolean[] mark = new boolean[1]; AtomicMarkableReference ai = new AtomicMarkableReference(one, false); assertSame(one, ai.get(mark)); assertFalse(ai.isMarked()); assertFalse(mark[0]); assertTrue(ai.compareAndSet(one, two, false, false)); assertSame(two, ai.get(mark)); assertFalse(mark[0]); assertTrue(ai.compareAndSet(two, m3, false, true)); assertSame(m3, ai.get(mark)); assertTrue(mark[0]); assertFalse(ai.compareAndSet(two, m3, true, true)); assertSame(m3, ai.get(mark)); assertTrue(mark[0]); } /** * compareAndSet in one thread enables another waiting for reference value * to succeed */ public void testCompareAndSetInMultipleThreads() throws Exception { final AtomicMarkableReference ai = new AtomicMarkableReference(one, false); Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!ai.compareAndSet(two, three, false, false)) Thread.yield(); }}); t.start(); assertTrue(ai.compareAndSet(one, two, false, false)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertSame(ai.getReference(), three); assertFalse(ai.isMarked()); } /** * compareAndSet in one thread enables another waiting for mark value * to succeed */ public void testCompareAndSetInMultipleThreads2() throws Exception { final AtomicMarkableReference ai = new AtomicMarkableReference(one, false); Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!ai.compareAndSet(one, one, true, false)) Thread.yield(); }}); t.start(); assertTrue(ai.compareAndSet(one, one, false, true)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertSame(ai.getReference(), one); assertFalse(ai.isMarked()); } /** * repeated weakCompareAndSet succeeds in changing values when equal * to expected */ public void testWeakCompareAndSet() { boolean[] mark = new boolean[1]; AtomicMarkableReference ai = new AtomicMarkableReference(one, false); assertSame(one, ai.get(mark)); assertFalse(ai.isMarked()); assertFalse(mark[0]); while (!ai.weakCompareAndSet(one, two, false, false)); assertSame(two, ai.get(mark)); assertFalse(mark[0]); while (!ai.weakCompareAndSet(two, m3, false, true)); assertSame(m3, ai.get(mark)); assertTrue(mark[0]); } } jsr166/src/test/tck/ConcurrentLinkedDequeTest.java0000644000000000000000000006124611537741072017306 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class ConcurrentLinkedDequeTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ConcurrentLinkedDequeTest.class); } /** * Create a deque of given size containing consecutive * Integers 0 ... n. */ private ConcurrentLinkedDeque populatedDeque(int n) { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); assertTrue(q.isEmpty()); for (int i = 0; i < n; ++i) assertTrue(q.offer(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(n, q.size()); return q; } /** * new deque is empty */ public void testConstructor1() { assertTrue(new ConcurrentLinkedDeque().isEmpty()); assertEquals(0, new ConcurrentLinkedDeque().size()); } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque((Collection)null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws NPE */ public void testConstructor4() { try { Integer[] ints = new Integer[SIZE]; ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection with some null elements throws NPE */ public void testConstructor5() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Deque contains all elements of collection used to initialize */ public void testConstructor6() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * isEmpty is true before add, false after */ public void testEmpty() { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); assertTrue(q.isEmpty()); q.add(one); assertFalse(q.isEmpty()); q.add(two); q.remove(); q.remove(); assertTrue(q.isEmpty()); } /** * size() changes when elements added and removed */ public void testSize() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.remove(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * push(null) throws NPE */ public void testPushNull() { try { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.push(null); shouldThrow(); } catch (NullPointerException success) {} } /** * peekFirst() returns element inserted with push */ public void testPush() { ConcurrentLinkedDeque q = populatedDeque(3); q.pollLast(); q.push(four); assertSame(four, q.peekFirst()); } /** * pop() removes first element, or throws NSEE if empty */ public void testPop() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pop()); } try { q.pop(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * offer(null) throws NPE */ public void testOfferNull() { try { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.offer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * offerFirst(null) throws NPE */ public void testOfferFirstNull() { try { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.offerFirst(null); shouldThrow(); } catch (NullPointerException success) {} } /** * offerLast(null) throws NPE */ public void testOfferLastNull() { try { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.offerLast(null); shouldThrow(); } catch (NullPointerException success) {} } /** * offer(x) succeeds */ public void testOffer() { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); assertTrue(q.offer(zero)); assertTrue(q.offer(one)); assertSame(zero, q.peekFirst()); assertSame(one, q.peekLast()); } /** * offerFirst(x) succeeds */ public void testOfferFirst() { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); assertTrue(q.offerFirst(zero)); assertTrue(q.offerFirst(one)); assertSame(one, q.peekFirst()); assertSame(zero, q.peekLast()); } /** * offerLast(x) succeeds */ public void testOfferLast() { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); assertTrue(q.offerLast(zero)); assertTrue(q.offerLast(one)); assertSame(zero, q.peekFirst()); assertSame(one, q.peekLast()); } /** * add(null) throws NPE */ public void testAddNull() { try { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addFirst(null) throws NPE */ public void testAddFirstNull() { try { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.addFirst(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addLast(null) throws NPE */ public void testAddLastNull() { try { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.addLast(null); shouldThrow(); } catch (NullPointerException success) {} } /** * add(x) succeeds */ public void testAdd() { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); assertTrue(q.add(zero)); assertTrue(q.add(one)); assertSame(zero, q.peekFirst()); assertSame(one, q.peekLast()); } /** * addFirst(x) succeeds */ public void testAddFirst() { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.addFirst(zero); q.addFirst(one); assertSame(one, q.peekFirst()); assertSame(zero, q.peekLast()); } /** * addLast(x) succeeds */ public void testAddLast() { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.addLast(zero); q.addLast(one); assertSame(zero, q.peekFirst()); assertSame(one, q.peekLast()); } /** * addAll(null) throws NPE */ public void testAddAll1() { try { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll(this) throws IAE */ public void testAddAllSelf() { try { ConcurrentLinkedDeque q = populatedDeque(SIZE); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Deque contains all elements, in traversal order, of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * pollFirst() succeeds unless empty */ public void testPollFirst() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst()); } assertNull(q.pollFirst()); } /** * pollLast() succeeds unless empty */ public void testPollLast() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.pollLast()); } assertNull(q.pollLast()); } /** * poll() succeeds unless empty */ public void testPoll() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll()); } assertNull(q.poll()); } /** * peek() returns next element, or null if empty */ public void testPeek() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peek()); assertEquals(i, q.poll()); assertTrue(q.peek() == null || !q.peek().equals(i)); } assertNull(q.peek()); } /** * element() returns first element, or throws NSEE if empty */ public void testElement() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.element()); assertEquals(i, q.poll()); } try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove() removes next element, or throws NSEE if empty */ public void testRemove() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remove()); } try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * peekFirst() returns next element, or null if empty */ public void testPeekFirst() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peekFirst()); assertEquals(i, q.pollFirst()); assertTrue(q.peekFirst() == null || !q.peekFirst().equals(i)); } assertNull(q.peekFirst()); } /** * peekLast() returns next element, or null if empty */ public void testPeekLast() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.peekLast()); assertEquals(i, q.pollLast()); assertTrue(q.peekLast() == null || !q.peekLast().equals(i)); } assertNull(q.peekLast()); } /** * getFirst() returns first element, or throws NSEE if empty */ public void testFirstElement() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.getFirst()); assertEquals(i, q.pollFirst()); } try { q.getFirst(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * getLast() returns last element, or throws NSEE if empty */ public void testLastElement() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.getLast()); assertEquals(i, q.pollLast()); } try { q.getLast(); shouldThrow(); } catch (NoSuchElementException success) {} assertNull(q.peekLast()); } /** * removeFirst() removes first element, or throws NSEE if empty */ public void testRemoveFirst() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.removeFirst()); } try { q.removeFirst(); shouldThrow(); } catch (NoSuchElementException success) {} assertNull(q.peekFirst()); } /** * removeLast() removes last element, or throws NSEE if empty */ public void testRemoveLast() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = SIZE - 1; i >= 0; --i) { assertEquals(i, q.removeLast()); } try { q.removeLast(); shouldThrow(); } catch (NoSuchElementException success) {} assertNull(q.peekLast()); } /** * removeFirstOccurrence(x) removes x and returns true if present */ public void testRemoveFirstOccurrence() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.removeFirstOccurrence(new Integer(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.removeFirstOccurrence(new Integer(i))); assertFalse(q.removeFirstOccurrence(new Integer(i+1))); } assertTrue(q.isEmpty()); } /** * removeLastOccurrence(x) removes x and returns true if present */ public void testRemoveLastOccurrence() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.removeLastOccurrence(new Integer(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.removeLastOccurrence(new Integer(i))); assertFalse(q.removeLastOccurrence(new Integer(i+1))); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { ConcurrentLinkedDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.poll(); assertFalse(q.contains(new Integer(i))); } } /** * clear() removes all elements */ public void testClear() { ConcurrentLinkedDeque q = populatedDeque(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); q.add(one); assertFalse(q.isEmpty()); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { ConcurrentLinkedDeque q = populatedDeque(SIZE); ConcurrentLinkedDeque p = new ConcurrentLinkedDeque(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if change */ public void testRetainAll() { ConcurrentLinkedDeque q = populatedDeque(SIZE); ConcurrentLinkedDeque p = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.remove(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { ConcurrentLinkedDeque q = populatedDeque(SIZE); ConcurrentLinkedDeque p = populatedDeque(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.remove()); assertFalse(q.contains(I)); } } } /** * toArray() contains all elements in FIFO order */ public void testToArray() { ConcurrentLinkedDeque q = populatedDeque(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) assertSame(o[i], q.poll()); } /** * toArray(a) contains all elements in FIFO order */ public void testToArray2() { ConcurrentLinkedDeque q = populatedDeque(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.poll()); } /** * toArray(null) throws NullPointerException */ public void testToArray_NullArg() { ConcurrentLinkedDeque q = populatedDeque(SIZE); try { q.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { ConcurrentLinkedDeque q = populatedDeque(SIZE); try { q.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * Iterator iterates through all elements */ public void testIterator() { ConcurrentLinkedDeque q = populatedDeque(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * Iterator ordering is FIFO */ public void testIteratorOrdering() { final ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.add(one); q.add(two); q.add(three); int k = 0; for (Iterator it = q.iterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); } /** * Modifications do not cause iterators to fail */ public void testWeaklyConsistentIteration() { final ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.add(one); q.add(two); q.add(three); for (Iterator it = q.iterator(); it.hasNext();) { q.remove(); it.next(); } assertEquals("deque should be empty again", 0, q.size()); } /** * iterator.remove() removes current element */ public void testIteratorRemove() { final ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); final Random rng = new Random(); for (int iters = 0; iters < 100; ++iters) { int max = rng.nextInt(5) + 2; int split = rng.nextInt(max-1) + 1; for (int j = 1; j <= max; ++j) q.add(new Integer(j)); Iterator it = q.iterator(); for (int j = 1; j <= split; ++j) assertEquals(it.next(), new Integer(j)); it.remove(); assertEquals(it.next(), new Integer(split+1)); for (int j = 1; j <= split; ++j) q.remove(new Integer(j)); it = q.iterator(); for (int j = split+1; j <= max; ++j) { assertEquals(it.next(), new Integer(j)); it.remove(); } assertFalse(it.hasNext()); assertTrue(q.isEmpty()); } } /** * Descending iterator iterates through all elements */ public void testDescendingIterator() { ConcurrentLinkedDeque q = populatedDeque(SIZE); int i = 0; Iterator it = q.descendingIterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); assertFalse(it.hasNext()); try { it.next(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * Descending iterator ordering is reverse FIFO */ public void testDescendingIteratorOrdering() { final ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); for (int iters = 0; iters < 100; ++iters) { q.add(new Integer(3)); q.add(new Integer(2)); q.add(new Integer(1)); int k = 0; for (Iterator it = q.descendingIterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); q.remove(); q.remove(); q.remove(); } } /** * descendingIterator.remove() removes current element */ public void testDescendingIteratorRemove() { final ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); final Random rng = new Random(); for (int iters = 0; iters < 100; ++iters) { int max = rng.nextInt(5) + 2; int split = rng.nextInt(max-1) + 1; for (int j = max; j >= 1; --j) q.add(new Integer(j)); Iterator it = q.descendingIterator(); for (int j = 1; j <= split; ++j) assertEquals(it.next(), new Integer(j)); it.remove(); assertEquals(it.next(), new Integer(split+1)); for (int j = 1; j <= split; ++j) q.remove(new Integer(j)); it = q.descendingIterator(); for (int j = split+1; j <= max; ++j) { assertEquals(it.next(), new Integer(j)); it.remove(); } assertFalse(it.hasNext()); assertTrue(q.isEmpty()); } } /** * toString() contains toStrings of elements */ public void testToString() { ConcurrentLinkedDeque q = populatedDeque(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * A deserialized serialized deque has same elements in same order */ public void testSerialization() throws Exception { ConcurrentLinkedDeque q = populatedDeque(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); ConcurrentLinkedDeque r = (ConcurrentLinkedDeque)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.remove(), r.remove()); } } jsr166/src/test/tck/AbstractExecutorServiceTest.java0000644000000000000000000004707411537741072017657 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.math.BigInteger; import java.security.*; public class AbstractExecutorServiceTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AbstractExecutorServiceTest.class); } /** * A no-frills implementation of AbstractExecutorService, designed * to test the submit methods only. */ static class DirectExecutorService extends AbstractExecutorService { public void execute(Runnable r) { r.run(); } public void shutdown() { shutdown = true; } public List shutdownNow() { shutdown = true; return Collections.EMPTY_LIST; } public boolean isShutdown() { return shutdown; } public boolean isTerminated() { return isShutdown(); } public boolean awaitTermination(long timeout, TimeUnit unit) { return isShutdown(); } private volatile boolean shutdown = false; } /** * execute(runnable) runs it to completion */ public void testExecuteRunnable() throws Exception { ExecutorService e = new DirectExecutorService(); TrackedShortRunnable task = new TrackedShortRunnable(); assertFalse(task.done); Future future = e.submit(task); future.get(); assertTrue(task.done); } /** * Completed submit(callable) returns result */ public void testSubmitCallable() throws Exception { ExecutorService e = new DirectExecutorService(); Future future = e.submit(new StringTask()); String result = future.get(); assertSame(TEST_STRING, result); } /** * Completed submit(runnable) returns successfully */ public void testSubmitRunnable() throws Exception { ExecutorService e = new DirectExecutorService(); Future future = e.submit(new NoOpRunnable()); future.get(); assertTrue(future.isDone()); } /** * Completed submit(runnable, result) returns result */ public void testSubmitRunnable2() throws Exception { ExecutorService e = new DirectExecutorService(); Future future = e.submit(new NoOpRunnable(), TEST_STRING); String result = future.get(); assertSame(TEST_STRING, result); } /** * A submitted privileged action runs to completion */ public void testSubmitPrivilegedAction() throws Exception { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { ExecutorService e = new DirectExecutorService(); Future future = e.submit(Executors.callable(new PrivilegedAction() { public Object run() { return TEST_STRING; }})); assertSame(TEST_STRING, future.get()); }}; runWithPermissions(r, new RuntimePermission("getClassLoader"), new RuntimePermission("setContextClassLoader"), new RuntimePermission("modifyThread")); } /** * A submitted privileged exception action runs to completion */ public void testSubmitPrivilegedExceptionAction() throws Exception { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { ExecutorService e = new DirectExecutorService(); Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() { public Object run() { return TEST_STRING; }})); assertSame(TEST_STRING, future.get()); }}; runWithPermissions(r); } /** * A submitted failed privileged exception action reports exception */ public void testSubmitFailedPrivilegedExceptionAction() throws Exception { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { ExecutorService e = new DirectExecutorService(); Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() { public Object run() throws Exception { throw new IndexOutOfBoundsException(); }})); try { future.get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof IndexOutOfBoundsException); }}}; runWithPermissions(r); } /** * execute(null runnable) throws NPE */ public void testExecuteNullRunnable() { try { ExecutorService e = new DirectExecutorService(); e.submit((Runnable) null); shouldThrow(); } catch (NullPointerException success) {} } /** * submit(null callable) throws NPE */ public void testSubmitNullCallable() { try { ExecutorService e = new DirectExecutorService(); e.submit((Callable) null); shouldThrow(); } catch (NullPointerException success) {} } /** * submit(callable).get() throws InterruptedException if interrupted */ public void testInterruptedSubmit() throws InterruptedException { final CountDownLatch submitted = new CountDownLatch(1); final CountDownLatch quittingTime = new CountDownLatch(1); final ExecutorService p = new ThreadPoolExecutor(1,1,60, TimeUnit.SECONDS, new ArrayBlockingQueue(10)); final Callable awaiter = new CheckedCallable() { public Void realCall() throws InterruptedException { quittingTime.await(); return null; }}; try { Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws Exception { Future future = p.submit(awaiter); submitted.countDown(); future.get(); }}); t.start(); submitted.await(); t.interrupt(); t.join(); } finally { quittingTime.countDown(); joinPool(p); } } /** * get of submit(callable) throws ExecutionException if callable * throws exception */ public void testSubmitEE() throws InterruptedException { ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, new ArrayBlockingQueue(10)); Callable c = new Callable() { public Object call() { return 5/0; }}; try { p.submit(c).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof ArithmeticException); } joinPool(p); } /** * invokeAny(null) throws NPE */ public void testInvokeAny1() throws Exception { ExecutorService e = new DirectExecutorService(); try { e.invokeAny(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAny(empty collection) throws IAE */ public void testInvokeAny2() throws Exception { ExecutorService e = new DirectExecutorService(); try { e.invokeAny(new ArrayList>()); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * invokeAny(c) throws NPE if c has null elements */ public void testInvokeAny3() throws Exception { ExecutorService e = new DirectExecutorService(); List> l = new ArrayList>(); l.add(new Callable() { public Integer call() { return 5/0; }}); l.add(null); try { e.invokeAny(l); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAny(c) throws ExecutionException if no task in c completes */ public void testInvokeAny4() throws InterruptedException { ExecutorService e = new DirectExecutorService(); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * invokeAny(c) returns result of some task in c if at least one completes */ public void testInvokeAny5() throws Exception { ExecutorService e = new DirectExecutorService(); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * invokeAll(null) throws NPE */ public void testInvokeAll1() throws InterruptedException { ExecutorService e = new DirectExecutorService(); try { e.invokeAll(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAll(empty collection) returns empty collection */ public void testInvokeAll2() throws InterruptedException { ExecutorService e = new DirectExecutorService(); try { List> r = e.invokeAll(new ArrayList>()); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * invokeAll(c) throws NPE if c has null elements */ public void testInvokeAll3() throws InterruptedException { ExecutorService e = new DirectExecutorService(); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of returned element of invokeAll(c) throws exception on failed task */ public void testInvokeAll4() throws Exception { ExecutorService e = new DirectExecutorService(); try { List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } } finally { joinPool(e); } } /** * invokeAll(c) returns results of all completed tasks in c */ public void testInvokeAll5() throws Exception { ExecutorService e = new DirectExecutorService(); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } /** * timed invokeAny(null) throws NPE */ public void testTimedInvokeAny1() throws Exception { ExecutorService e = new DirectExecutorService(); try { e.invokeAny(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(null time unit) throws NPE */ public void testTimedInvokeAnyNullTimeUnit() throws Exception { ExecutorService e = new DirectExecutorService(); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(empty collection) throws IAE */ public void testTimedInvokeAny2() throws Exception { ExecutorService e = new DirectExecutorService(); try { e.invokeAny(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * timed invokeAny(c) throws NPE if c has null elements */ public void testTimedInvokeAny3() throws Exception { ExecutorService e = new DirectExecutorService(); List> l = new ArrayList>(); l.add(new Callable() { public Integer call() { return 5/0; }}); l.add(null); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(c) throws ExecutionException if no task completes */ public void testTimedInvokeAny4() throws Exception { ExecutorService e = new DirectExecutorService(); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * timed invokeAny(c) returns result of some task in c */ public void testTimedInvokeAny5() throws Exception { ExecutorService e = new DirectExecutorService(); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * timed invokeAll(null) throws NPE */ public void testTimedInvokeAll1() throws InterruptedException { ExecutorService e = new DirectExecutorService(); try { e.invokeAll(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(null time unit) throws NPE */ public void testTimedInvokeAllNullTimeUnit() throws InterruptedException { ExecutorService e = new DirectExecutorService(); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAll(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(empty collection) returns empty collection */ public void testTimedInvokeAll2() throws InterruptedException { ExecutorService e = new DirectExecutorService(); try { List> r = e.invokeAll(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * timed invokeAll(c) throws NPE if c has null elements */ public void testTimedInvokeAll3() throws InterruptedException { ExecutorService e = new DirectExecutorService(); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of returned element of invokeAll(c) throws exception on failed task */ public void testTimedInvokeAll4() throws Exception { ExecutorService e = new DirectExecutorService(); try { List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } } finally { joinPool(e); } } /** * timed invokeAll(c) returns results of all completed tasks in c */ public void testTimedInvokeAll5() throws Exception { ExecutorService e = new DirectExecutorService(); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } /** * timed invokeAll cancels tasks not completed by timeout */ public void testTimedInvokeAll6() throws InterruptedException { ExecutorService e = new DirectExecutorService(); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(Executors.callable(possiblyInterruptedRunnable(2 * SHORT_DELAY_MS), TEST_STRING)); l.add(new StringTask()); List> futures = e.invokeAll(l, SHORT_DELAY_MS, MILLISECONDS); assertEquals(3, futures.size()); Iterator> it = futures.iterator(); Future f1 = it.next(); Future f2 = it.next(); Future f3 = it.next(); assertTrue(f1.isDone()); assertFalse(f1.isCancelled()); assertTrue(f2.isDone()); assertFalse(f2.isCancelled()); assertTrue(f3.isDone()); assertTrue(f3.isCancelled()); } finally { joinPool(e); } } } jsr166/src/test/tck/SystemTest.java0000644000000000000000000000421011537741073014322 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; public class SystemTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(SystemTest.class); } /** * Worst case rounding for millisecs; set for 60 cycle millis clock. * This value might need to be changed on JVMs with coarser * System.currentTimeMillis clocks. */ static final long MILLIS_ROUND = 17; /** * Nanos between readings of millis is no longer than millis (plus * possible rounding). * This shows only that nano timing not (much) worse than milli. */ public void testNanoTime1() throws InterruptedException { long m1 = System.currentTimeMillis(); Thread.sleep(1); long n1 = System.nanoTime(); Thread.sleep(SHORT_DELAY_MS); long n2 = System.nanoTime(); Thread.sleep(1); long m2 = System.currentTimeMillis(); long millis = m2 - m1; long nanos = n2 - n1; assertTrue(nanos >= 0); long nanosAsMillis = nanos / 1000000; assertTrue(nanosAsMillis <= millis + MILLIS_ROUND); } /** * Millis between readings of nanos is less than nanos, adjusting * for rounding. * This shows only that nano timing not (much) worse than milli. */ public void testNanoTime2() throws InterruptedException { long n1 = System.nanoTime(); Thread.sleep(1); long m1 = System.currentTimeMillis(); Thread.sleep(SHORT_DELAY_MS); long m2 = System.currentTimeMillis(); Thread.sleep(1); long n2 = System.nanoTime(); long millis = m2 - m1; long nanos = n2 - n1; assertTrue(nanos >= 0); long nanosAsMillis = nanos / 1000000; assertTrue(millis <= nanosAsMillis + MILLIS_ROUND); } } jsr166/src/test/tck/ArrayBlockingQueueTest.java0000644000000000000000000006614411560754737016617 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.io.*; public class ArrayBlockingQueueTest extends JSR166TestCase { public static class Fair extends BlockingQueueTest { protected BlockingQueue emptyCollection() { return new ArrayBlockingQueue(20, true); } } public static class NonFair extends BlockingQueueTest { protected BlockingQueue emptyCollection() { return new ArrayBlockingQueue(20, false); } } public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return newTestSuite(ArrayBlockingQueueTest.class, new Fair().testSuite(), new NonFair().testSuite()); } /** * Create a queue of given size containing consecutive * Integers 0 ... n. */ private ArrayBlockingQueue populatedQueue(int n) { ArrayBlockingQueue q = new ArrayBlockingQueue(n); assertTrue(q.isEmpty()); for (int i = 0; i < n; i++) assertTrue(q.offer(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(0, q.remainingCapacity()); assertEquals(n, q.size()); return q; } /** * A new queue has the indicated capacity */ public void testConstructor1() { assertEquals(SIZE, new ArrayBlockingQueue(SIZE).remainingCapacity()); } /** * Constructor throws IAE if capacity argument nonpositive */ public void testConstructor2() { try { ArrayBlockingQueue q = new ArrayBlockingQueue(0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { ArrayBlockingQueue q = new ArrayBlockingQueue(1, true, null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws NPE */ public void testConstructor4() { try { Integer[] ints = new Integer[SIZE]; ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE, false, Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection with some null elements throws NPE */ public void testConstructor5() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE, false, Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from too large collection throws IAE */ public void testConstructor6() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ArrayBlockingQueue q = new ArrayBlockingQueue(1, false, Arrays.asList(ints)); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Queue contains all elements of collection used to initialize */ public void testConstructor7() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE, true, Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * Queue transitions from empty to full when elements added */ public void testEmptyFull() { ArrayBlockingQueue q = new ArrayBlockingQueue(2); assertTrue(q.isEmpty()); assertEquals(2, q.remainingCapacity()); q.add(one); assertFalse(q.isEmpty()); q.add(two); assertFalse(q.isEmpty()); assertEquals(0, q.remainingCapacity()); assertFalse(q.offer(three)); } /** * remainingCapacity decreases on add, increases on remove */ public void testRemainingCapacity() { ArrayBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remainingCapacity()); assertEquals(SIZE-i, q.size()); q.remove(); } for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.remainingCapacity()); assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * offer(null) throws NPE */ public void testOfferNull() { try { ArrayBlockingQueue q = new ArrayBlockingQueue(1); q.offer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * add(null) throws NPE */ public void testAddNull() { try { ArrayBlockingQueue q = new ArrayBlockingQueue(1); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Offer succeeds if not full; fails if full */ public void testOffer() { ArrayBlockingQueue q = new ArrayBlockingQueue(1); assertTrue(q.offer(zero)); assertFalse(q.offer(one)); } /** * add succeeds if not full; throws ISE if full */ public void testAdd() { try { ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.add(new Integer(i))); } assertEquals(0, q.remainingCapacity()); q.add(new Integer(SIZE)); shouldThrow(); } catch (IllegalStateException success) {} } /** * addAll(null) throws NPE */ public void testAddAll1() { try { ArrayBlockingQueue q = new ArrayBlockingQueue(1); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll(this) throws IAE */ public void testAddAllSelf() { try { ArrayBlockingQueue q = populatedQueue(SIZE); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll throws ISE if not enough room */ public void testAddAll4() { try { ArrayBlockingQueue q = new ArrayBlockingQueue(1); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (IllegalStateException success) {} } /** * Queue contains all elements, in traversal order, of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * put(null) throws NPE */ public void testPutNull() throws InterruptedException { try { ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE); q.put(null); shouldThrow(); } catch (NullPointerException success) {} } /** * all elements successfully put are contained */ public void testPut() throws InterruptedException { ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE); for (int i = 0; i < SIZE; ++i) { Integer I = new Integer(i); q.put(I); assertTrue(q.contains(I)); } assertEquals(0, q.remainingCapacity()); } /** * put blocks interruptibly if full */ public void testBlockingPut() throws InterruptedException { final ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) q.put(i); assertEquals(SIZE, q.size()); assertEquals(0, q.remainingCapacity()); try { q.put(99); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(SIZE, q.size()); assertEquals(0, q.remainingCapacity()); } /** * put blocks waiting for take when full */ public void testPutWithTake() throws InterruptedException { final int capacity = 2; final ArrayBlockingQueue q = new ArrayBlockingQueue(capacity); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < capacity + 1; i++) q.put(i); try { q.put(99); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); assertEquals(q.remainingCapacity(), 0); assertEquals(0, q.take()); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(q.remainingCapacity(), 0); } /** * timed offer times out if full and elements not taken */ public void testTimedOffer() throws InterruptedException { final ArrayBlockingQueue q = new ArrayBlockingQueue(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.put(new Object()); q.put(new Object()); assertFalse(q.offer(new Object(), SHORT_DELAY_MS/2, MILLISECONDS)); try { q.offer(new Object(), LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * take retrieves elements in FIFO order */ public void testTake() throws InterruptedException { ArrayBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } } /** * Take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { final ArrayBlockingQueue q = populatedQueue(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } try { q.take(); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * poll succeeds unless empty */ public void testPoll() { ArrayBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll()); } assertNull(q.poll()); } /** * timed poll with zero timeout succeeds when non-empty, else times out */ public void testTimedPoll0() throws InterruptedException { ArrayBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll(0, MILLISECONDS)); } assertNull(q.poll(0, MILLISECONDS)); } /** * timed poll with nonzero timeout succeeds when non-empty, else times out */ public void testTimedPoll() throws InterruptedException { ArrayBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll(SHORT_DELAY_MS, MILLISECONDS)); } assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); } /** * Interrupted timed poll throws InterruptedException instead of * returning timeout status */ public void testInterruptedTimedPoll() throws InterruptedException { final BlockingQueue q = populatedQueue(SIZE); final CountDownLatch aboutToWait = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { long t0 = System.nanoTime(); assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); } long t0 = System.nanoTime(); aboutToWait.countDown(); try { q.poll(MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); } }}); aboutToWait.await(); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); checkEmpty(q); } /** * peek returns next element, or null if empty */ public void testPeek() { ArrayBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peek()); assertEquals(i, q.poll()); assertTrue(q.peek() == null || !q.peek().equals(i)); } assertNull(q.peek()); } /** * element returns next element, or throws NSEE if empty */ public void testElement() { ArrayBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.element()); assertEquals(i, q.poll()); } try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove removes next element, or throws NSEE if empty */ public void testRemove() { ArrayBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remove()); } try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { ArrayBlockingQueue q = populatedQueue(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.remove(new Integer(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.remove(new Integer(i))); assertFalse(q.remove(new Integer(i+1))); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { ArrayBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); assertEquals(i, q.poll()); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { ArrayBlockingQueue q = populatedQueue(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); assertEquals(SIZE, q.remainingCapacity()); q.add(one); assertFalse(q.isEmpty()); assertTrue(q.contains(one)); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { ArrayBlockingQueue q = populatedQueue(SIZE); ArrayBlockingQueue p = new ArrayBlockingQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { ArrayBlockingQueue q = populatedQueue(SIZE); ArrayBlockingQueue p = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.remove(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { ArrayBlockingQueue q = populatedQueue(SIZE); ArrayBlockingQueue p = populatedQueue(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.remove()); assertFalse(q.contains(I)); } } } /** * toArray contains all elements in FIFO order */ public void testToArray() { ArrayBlockingQueue q = populatedQueue(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) assertSame(o[i], q.poll()); } /** * toArray(a) contains all elements in FIFO order */ public void testToArray2() { ArrayBlockingQueue q = populatedQueue(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.poll()); } /** * toArray(null) throws NullPointerException */ public void testToArray_NullArg() { ArrayBlockingQueue q = populatedQueue(SIZE); try { q.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { ArrayBlockingQueue q = populatedQueue(SIZE); try { q.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * iterator iterates through all elements */ public void testIterator() throws InterruptedException { ArrayBlockingQueue q = populatedQueue(SIZE); Iterator it = q.iterator(); while (it.hasNext()) { assertEquals(it.next(), q.take()); } } /** * iterator.remove removes current element */ public void testIteratorRemove() { final ArrayBlockingQueue q = new ArrayBlockingQueue(3); q.add(two); q.add(one); q.add(three); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertSame(it.next(), one); assertSame(it.next(), three); assertFalse(it.hasNext()); } /** * iterator ordering is FIFO */ public void testIteratorOrdering() { final ArrayBlockingQueue q = new ArrayBlockingQueue(3); q.add(one); q.add(two); q.add(three); assertEquals("queue should be full", 0, q.remainingCapacity()); int k = 0; for (Iterator it = q.iterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); } /** * Modifications do not cause iterators to fail */ public void testWeaklyConsistentIteration() { final ArrayBlockingQueue q = new ArrayBlockingQueue(3); q.add(one); q.add(two); q.add(three); for (Iterator it = q.iterator(); it.hasNext();) { q.remove(); it.next(); } assertEquals(0, q.size()); } /** * toString contains toStrings of elements */ public void testToString() { ArrayBlockingQueue q = populatedQueue(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * offer transfers elements across Executor tasks */ public void testOfferInExecutor() { final ArrayBlockingQueue q = new ArrayBlockingQueue(2); q.add(one); q.add(two); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(q.offer(three)); assertTrue(q.offer(three, MEDIUM_DELAY_MS, MILLISECONDS)); assertEquals(0, q.remainingCapacity()); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { delay(SMALL_DELAY_MS); assertSame(one, q.take()); }}); joinPool(executor); } /** * poll retrieves elements across Executor threads */ public void testPollInExecutor() { final ArrayBlockingQueue q = new ArrayBlockingQueue(2); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertNull(q.poll()); assertSame(one, q.poll(MEDIUM_DELAY_MS, MILLISECONDS)); assertTrue(q.isEmpty()); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { delay(SMALL_DELAY_MS); q.put(one); }}); joinPool(executor); } /** * A deserialized serialized queue has same elements in same order */ public void testSerialization() throws Exception { ArrayBlockingQueue q = populatedQueue(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); ArrayBlockingQueue r = (ArrayBlockingQueue)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.remove(), r.remove()); } /** * drainTo(null) throws NPE */ public void testDrainToNull() { ArrayBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(null); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this) throws IAE */ public void testDrainToSelf() { ArrayBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c) empties queue into another collection c */ public void testDrainTo() { ArrayBlockingQueue q = populatedQueue(SIZE); ArrayList l = new ArrayList(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), SIZE); for (int i = 0; i < SIZE; ++i) assertEquals(l.get(i), new Integer(i)); q.add(zero); q.add(one); assertFalse(q.isEmpty()); assertTrue(q.contains(zero)); assertTrue(q.contains(one)); l.clear(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), 2); for (int i = 0; i < 2; ++i) assertEquals(l.get(i), new Integer(i)); } /** * drainTo empties full queue, unblocking a waiting put. */ public void testDrainToWithActivePut() throws InterruptedException { final ArrayBlockingQueue q = populatedQueue(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.put(new Integer(SIZE+1)); }}); t.start(); ArrayList l = new ArrayList(); q.drainTo(l); assertTrue(l.size() >= SIZE); for (int i = 0; i < SIZE; ++i) assertEquals(l.get(i), new Integer(i)); t.join(); assertTrue(q.size() + l.size() >= SIZE); } /** * drainTo(null, n) throws NPE */ public void testDrainToNullN() { ArrayBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(null, 0); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this, n) throws IAE */ public void testDrainToSelfN() { ArrayBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(q, 0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c, n) empties first min(n, size) elements of queue into c */ public void testDrainToN() { ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE*2); for (int i = 0; i < SIZE + 2; ++i) { for (int j = 0; j < SIZE; j++) assertTrue(q.offer(new Integer(j))); ArrayList l = new ArrayList(); q.drainTo(l, i); int k = (i < SIZE) ? i : SIZE; assertEquals(l.size(), k); assertEquals(q.size(), SIZE-k); for (int j = 0; j < k; ++j) assertEquals(l.get(j), new Integer(j)); while (q.poll() != null) ; } } } jsr166/src/test/tck/DelayQueueTest.java0000644000000000000000000006465611560754737015134 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.concurrent.*; public class DelayQueueTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(DelayQueueTest.class); } private static final int NOCAP = Integer.MAX_VALUE; /** * A delayed implementation for testing. * Most tests use Pseudodelays, where delays are all elapsed * (so, no blocking solely for delays) but are still ordered */ static class PDelay implements Delayed { int pseudodelay; PDelay(int i) { pseudodelay = Integer.MIN_VALUE + i; } public int compareTo(PDelay y) { int i = pseudodelay; int j = y.pseudodelay; if (i < j) return -1; if (i > j) return 1; return 0; } public int compareTo(Delayed y) { return compareTo((PDelay)y); } public boolean equals(Object other) { return equals((PDelay)other); } public boolean equals(PDelay other) { return other.pseudodelay == pseudodelay; } public long getDelay(TimeUnit ignore) { return pseudodelay; } public int intValue() { return pseudodelay; } public String toString() { return String.valueOf(pseudodelay); } } /** * Delayed implementation that actually delays */ static class NanoDelay implements Delayed { long trigger; NanoDelay(long i) { trigger = System.nanoTime() + i; } public int compareTo(NanoDelay y) { long i = trigger; long j = y.trigger; if (i < j) return -1; if (i > j) return 1; return 0; } public int compareTo(Delayed y) { return compareTo((NanoDelay)y); } public boolean equals(Object other) { return equals((NanoDelay)other); } public boolean equals(NanoDelay other) { return other.trigger == trigger; } public long getDelay(TimeUnit unit) { long n = trigger - System.nanoTime(); return unit.convert(n, TimeUnit.NANOSECONDS); } public long getTriggerTime() { return trigger; } public String toString() { return String.valueOf(trigger); } } /** * Create a queue of given size containing consecutive * PDelays 0 ... n. */ private DelayQueue populatedQueue(int n) { DelayQueue q = new DelayQueue(); assertTrue(q.isEmpty()); for (int i = n-1; i >= 0; i-=2) assertTrue(q.offer(new PDelay(i))); for (int i = (n & 1); i < n; i+=2) assertTrue(q.offer(new PDelay(i))); assertFalse(q.isEmpty()); assertEquals(NOCAP, q.remainingCapacity()); assertEquals(n, q.size()); return q; } /** * A new queue has unbounded capacity */ public void testConstructor1() { assertEquals(NOCAP, new DelayQueue().remainingCapacity()); } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { DelayQueue q = new DelayQueue(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws NPE */ public void testConstructor4() { try { PDelay[] ints = new PDelay[SIZE]; DelayQueue q = new DelayQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection with some null elements throws NPE */ public void testConstructor5() { try { PDelay[] ints = new PDelay[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new PDelay(i); DelayQueue q = new DelayQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements of collection used to initialize */ public void testConstructor6() { PDelay[] ints = new PDelay[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new PDelay(i); DelayQueue q = new DelayQueue(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * isEmpty is true before add, false after */ public void testEmpty() { DelayQueue q = new DelayQueue(); assertTrue(q.isEmpty()); assertEquals(NOCAP, q.remainingCapacity()); q.add(new PDelay(1)); assertFalse(q.isEmpty()); q.add(new PDelay(2)); q.remove(); q.remove(); assertTrue(q.isEmpty()); } /** * remainingCapacity does not change when elements added or removed, * but size does */ public void testRemainingCapacity() { DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(NOCAP, q.remainingCapacity()); assertEquals(SIZE-i, q.size()); q.remove(); } for (int i = 0; i < SIZE; ++i) { assertEquals(NOCAP, q.remainingCapacity()); assertEquals(i, q.size()); q.add(new PDelay(i)); } } /** * offer(null) throws NPE */ public void testOfferNull() { try { DelayQueue q = new DelayQueue(); q.offer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * add(null) throws NPE */ public void testAddNull() { try { DelayQueue q = new DelayQueue(); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * offer non-null succeeds */ public void testOffer() { DelayQueue q = new DelayQueue(); assertTrue(q.offer(new PDelay(0))); assertTrue(q.offer(new PDelay(1))); } /** * add succeeds */ public void testAdd() { DelayQueue q = new DelayQueue(); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); assertTrue(q.add(new PDelay(i))); } } /** * addAll(null) throws NPE */ public void testAddAll1() { try { DelayQueue q = new DelayQueue(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll(this) throws IAE */ public void testAddAllSelf() { try { DelayQueue q = populatedQueue(SIZE); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { DelayQueue q = new DelayQueue(); PDelay[] ints = new PDelay[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { DelayQueue q = new DelayQueue(); PDelay[] ints = new PDelay[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new PDelay(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements of successful addAll */ public void testAddAll5() { PDelay[] empty = new PDelay[0]; PDelay[] ints = new PDelay[SIZE]; for (int i = SIZE-1; i >= 0; --i) ints[i] = new PDelay(i); DelayQueue q = new DelayQueue(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * put(null) throws NPE */ public void testPutNull() { try { DelayQueue q = new DelayQueue(); q.put(null); shouldThrow(); } catch (NullPointerException success) {} } /** * all elements successfully put are contained */ public void testPut() { DelayQueue q = new DelayQueue(); for (int i = 0; i < SIZE; ++i) { PDelay I = new PDelay(i); q.put(I); assertTrue(q.contains(I)); } assertEquals(SIZE, q.size()); } /** * put doesn't block waiting for take */ public void testPutWithTake() throws InterruptedException { final DelayQueue q = new DelayQueue(); Thread t = new Thread(new CheckedRunnable() { public void realRun() { q.put(new PDelay(0)); q.put(new PDelay(0)); q.put(new PDelay(0)); q.put(new PDelay(0)); }}); t.start(); delay(SHORT_DELAY_MS); q.take(); t.interrupt(); t.join(); } /** * timed offer does not time out */ public void testTimedOffer() throws InterruptedException { final DelayQueue q = new DelayQueue(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.put(new PDelay(0)); q.put(new PDelay(0)); assertTrue(q.offer(new PDelay(0), SHORT_DELAY_MS, MILLISECONDS)); assertTrue(q.offer(new PDelay(0), LONG_DELAY_MS, MILLISECONDS)); }}); t.start(); delay(SMALL_DELAY_MS); t.interrupt(); t.join(); } /** * take retrieves elements in priority order */ public void testTake() throws InterruptedException { DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(new PDelay(i), ((PDelay)q.take())); } } /** * take blocks interruptibly when empty */ public void testTakeFromEmptyBlocksInterruptibly() throws InterruptedException { final BlockingQueue q = new DelayQueue(); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { long t0 = System.nanoTime(); threadStarted.countDown(); try { q.take(); shouldThrow(); } catch (InterruptedException success) {} assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); }}); threadStarted.await(); delay(SHORT_DELAY_MS); assertTrue(t.isAlive()); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); assertFalse(t.isAlive()); } /** * Take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { final DelayQueue q = populatedQueue(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { assertEquals(new PDelay(i), ((PDelay)q.take())); } try { q.take(); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * poll succeeds unless empty */ public void testPoll() { DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(new PDelay(i), ((PDelay)q.poll())); } assertNull(q.poll()); } /** * timed poll with zero timeout succeeds when non-empty, else times out */ public void testTimedPoll0() throws InterruptedException { DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(new PDelay(i), ((PDelay)q.poll(0, MILLISECONDS))); } assertNull(q.poll(0, MILLISECONDS)); } /** * timed poll with nonzero timeout succeeds when non-empty, else times out */ public void testTimedPoll() throws InterruptedException { DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(new PDelay(i), ((PDelay)q.poll(SHORT_DELAY_MS, MILLISECONDS))); } assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); } /** * Interrupted timed poll throws InterruptedException instead of * returning timeout status */ public void testInterruptedTimedPoll() throws InterruptedException { Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(new PDelay(i), ((PDelay)q.poll(SHORT_DELAY_MS, MILLISECONDS))); } try { q.poll(SMALL_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * timed poll before a delayed offer fails; after offer succeeds; * on interruption throws */ public void testTimedPollWithOffer() throws InterruptedException { final DelayQueue q = new DelayQueue(); final PDelay pdelay = new PDelay(0); final CheckedBarrier barrier = new CheckedBarrier(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); barrier.await(); assertSame(pdelay, q.poll(MEDIUM_DELAY_MS, MILLISECONDS)); Thread.currentThread().interrupt(); try { q.poll(SHORT_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} barrier.await(); try { q.poll(MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); barrier.await(); assertTrue(q.offer(pdelay, SHORT_DELAY_MS, MILLISECONDS)); barrier.await(); sleep(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * peek returns next element, or null if empty */ public void testPeek() { DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(new PDelay(i), ((PDelay)q.peek())); assertEquals(new PDelay(i), ((PDelay)q.poll())); if (q.isEmpty()) assertNull(q.peek()); else assertFalse(new PDelay(i).equals(q.peek())); } assertNull(q.peek()); } /** * element returns next element, or throws NSEE if empty */ public void testElement() { DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(new PDelay(i), ((PDelay)q.element())); q.poll(); } try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove removes next element, or throws NSEE if empty */ public void testRemove() { DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(new PDelay(i), ((PDelay)q.remove())); } try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { DelayQueue q = populatedQueue(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.remove(new PDelay(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.remove(new PDelay(i))); assertFalse(q.remove(new PDelay(i+1))); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new PDelay(i))); q.poll(); assertFalse(q.contains(new PDelay(i))); } } /** * clear removes all elements */ public void testClear() { DelayQueue q = populatedQueue(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); assertEquals(NOCAP, q.remainingCapacity()); PDelay x = new PDelay(1); q.add(x); assertFalse(q.isEmpty()); assertTrue(q.contains(x)); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { DelayQueue q = populatedQueue(SIZE); DelayQueue p = new DelayQueue(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new PDelay(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { DelayQueue q = populatedQueue(SIZE); DelayQueue p = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.remove(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { DelayQueue q = populatedQueue(SIZE); DelayQueue p = populatedQueue(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { PDelay I = (PDelay)(p.remove()); assertFalse(q.contains(I)); } } } /** * toArray contains all elements */ public void testToArray() throws InterruptedException { DelayQueue q = populatedQueue(SIZE); Object[] o = q.toArray(); Arrays.sort(o); for (int i = 0; i < o.length; i++) assertSame(o[i], q.take()); } /** * toArray(a) contains all elements */ public void testToArray2() { DelayQueue q = populatedQueue(SIZE); PDelay[] ints = new PDelay[SIZE]; PDelay[] array = q.toArray(ints); assertSame(ints, array); Arrays.sort(ints); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.remove()); } /** * toArray(null) throws NullPointerException */ public void testToArray_NullArg() { DelayQueue q = populatedQueue(SIZE); try { q.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { DelayQueue q = populatedQueue(SIZE); try { q.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * iterator iterates through all elements */ public void testIterator() { DelayQueue q = populatedQueue(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * iterator.remove removes current element */ public void testIteratorRemove() { final DelayQueue q = new DelayQueue(); q.add(new PDelay(2)); q.add(new PDelay(1)); q.add(new PDelay(3)); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertEquals(it.next(), new PDelay(2)); assertEquals(it.next(), new PDelay(3)); assertFalse(it.hasNext()); } /** * toString contains toStrings of elements */ public void testToString() { DelayQueue q = populatedQueue(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(Integer.MIN_VALUE+i)) >= 0); } } /** * offer transfers elements across Executor tasks */ public void testPollInExecutor() { final DelayQueue q = new DelayQueue(); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertNull(q.poll()); assertTrue(null != q.poll(MEDIUM_DELAY_MS, MILLISECONDS)); assertTrue(q.isEmpty()); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { delay(SHORT_DELAY_MS); q.put(new PDelay(1)); }}); joinPool(executor); } /** * Delayed actions do not occur until their delay elapses */ public void testDelay() throws InterruptedException { DelayQueue q = new DelayQueue(); for (int i = 0; i < SIZE; ++i) q.add(new NanoDelay(1000000L * (SIZE - i))); long last = 0; for (int i = 0; i < SIZE; ++i) { NanoDelay e = q.take(); long tt = e.getTriggerTime(); assertTrue(System.nanoTime() - tt >= 0); if (i != 0) assertTrue(tt >= last); last = tt; } assertTrue(q.isEmpty()); } /** * peek of a non-empty queue returns non-null even if not expired */ public void testPeekDelayed() { DelayQueue q = new DelayQueue(); q.add(new NanoDelay(Long.MAX_VALUE)); assertNotNull(q.peek()); } /** * poll of a non-empty queue returns null if no expired elements. */ public void testPollDelayed() { DelayQueue q = new DelayQueue(); q.add(new NanoDelay(Long.MAX_VALUE)); assertNull(q.poll()); } /** * timed poll of a non-empty queue returns null if no expired elements. */ public void testTimedPollDelayed() throws InterruptedException { DelayQueue q = new DelayQueue(); q.add(new NanoDelay(LONG_DELAY_MS * 1000000L)); assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); } /** * drainTo(null) throws NPE */ public void testDrainToNull() { DelayQueue q = populatedQueue(SIZE); try { q.drainTo(null); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this) throws IAE */ public void testDrainToSelf() { DelayQueue q = populatedQueue(SIZE); try { q.drainTo(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c) empties queue into another collection c */ public void testDrainTo() { DelayQueue q = new DelayQueue(); PDelay[] elems = new PDelay[SIZE]; for (int i = 0; i < SIZE; ++i) { elems[i] = new PDelay(i); q.add(elems[i]); } ArrayList l = new ArrayList(); q.drainTo(l); assertEquals(q.size(), 0); for (int i = 0; i < SIZE; ++i) assertEquals(l.get(i), elems[i]); q.add(elems[0]); q.add(elems[1]); assertFalse(q.isEmpty()); assertTrue(q.contains(elems[0])); assertTrue(q.contains(elems[1])); l.clear(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), 2); for (int i = 0; i < 2; ++i) assertEquals(l.get(i), elems[i]); } /** * drainTo empties queue */ public void testDrainToWithActivePut() throws InterruptedException { final DelayQueue q = populatedQueue(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() { q.put(new PDelay(SIZE+1)); }}); t.start(); ArrayList l = new ArrayList(); q.drainTo(l); assertTrue(l.size() >= SIZE); t.join(); assertTrue(q.size() + l.size() >= SIZE); } /** * drainTo(null, n) throws NPE */ public void testDrainToNullN() { DelayQueue q = populatedQueue(SIZE); try { q.drainTo(null, 0); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this, n) throws IAE */ public void testDrainToSelfN() { DelayQueue q = populatedQueue(SIZE); try { q.drainTo(q, 0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c, n) empties first min(n, size) elements of queue into c */ public void testDrainToN() { for (int i = 0; i < SIZE + 2; ++i) { DelayQueue q = populatedQueue(SIZE); ArrayList l = new ArrayList(); q.drainTo(l, i); int k = (i < SIZE) ? i : SIZE; assertEquals(q.size(), SIZE-k); assertEquals(l.size(), k); } } } jsr166/src/test/tck/AtomicLongTest.java0000644000000000000000000001714311537741072015102 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.atomic.*; import java.io.*; public class AtomicLongTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicLongTest.class); } final long[] VALUES = { Long.MIN_VALUE, Integer.MIN_VALUE, -1, 0, 1, 42, Integer.MAX_VALUE, Long.MAX_VALUE, }; /** * constructor initializes to given value */ public void testConstructor() { AtomicLong ai = new AtomicLong(1); assertEquals(1,ai.get()); } /** * default constructed initializes to zero */ public void testConstructor2() { AtomicLong ai = new AtomicLong(); assertEquals(0,ai.get()); } /** * get returns the last value set */ public void testGetSet() { AtomicLong ai = new AtomicLong(1); assertEquals(1,ai.get()); ai.set(2); assertEquals(2,ai.get()); ai.set(-3); assertEquals(-3,ai.get()); } /** * get returns the last value lazySet in same thread */ public void testGetLazySet() { AtomicLong ai = new AtomicLong(1); assertEquals(1,ai.get()); ai.lazySet(2); assertEquals(2,ai.get()); ai.lazySet(-3); assertEquals(-3,ai.get()); } /** * compareAndSet succeeds in changing value if equal to expected else fails */ public void testCompareAndSet() { AtomicLong ai = new AtomicLong(1); assertTrue(ai.compareAndSet(1,2)); assertTrue(ai.compareAndSet(2,-4)); assertEquals(-4,ai.get()); assertFalse(ai.compareAndSet(-5,7)); assertEquals(-4,ai.get()); assertTrue(ai.compareAndSet(-4,7)); assertEquals(7,ai.get()); } /** * compareAndSet in one thread enables another waiting for value * to succeed */ public void testCompareAndSetInMultipleThreads() throws Exception { final AtomicLong ai = new AtomicLong(1); Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!ai.compareAndSet(2, 3)) Thread.yield(); }}); t.start(); assertTrue(ai.compareAndSet(1, 2)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertEquals(ai.get(), 3); } /** * repeated weakCompareAndSet succeeds in changing value when equal * to expected */ public void testWeakCompareAndSet() { AtomicLong ai = new AtomicLong(1); while (!ai.weakCompareAndSet(1,2)); while (!ai.weakCompareAndSet(2,-4)); assertEquals(-4,ai.get()); while (!ai.weakCompareAndSet(-4,7)); assertEquals(7,ai.get()); } /** * getAndSet returns previous value and sets to given value */ public void testGetAndSet() { AtomicLong ai = new AtomicLong(1); assertEquals(1,ai.getAndSet(0)); assertEquals(0,ai.getAndSet(-10)); assertEquals(-10,ai.getAndSet(1)); } /** * getAndAdd returns previous value and adds given value */ public void testGetAndAdd() { AtomicLong ai = new AtomicLong(1); assertEquals(1,ai.getAndAdd(2)); assertEquals(3,ai.get()); assertEquals(3,ai.getAndAdd(-4)); assertEquals(-1,ai.get()); } /** * getAndDecrement returns previous value and decrements */ public void testGetAndDecrement() { AtomicLong ai = new AtomicLong(1); assertEquals(1,ai.getAndDecrement()); assertEquals(0,ai.getAndDecrement()); assertEquals(-1,ai.getAndDecrement()); } /** * getAndIncrement returns previous value and increments */ public void testGetAndIncrement() { AtomicLong ai = new AtomicLong(1); assertEquals(1,ai.getAndIncrement()); assertEquals(2,ai.get()); ai.set(-2); assertEquals(-2,ai.getAndIncrement()); assertEquals(-1,ai.getAndIncrement()); assertEquals(0,ai.getAndIncrement()); assertEquals(1,ai.get()); } /** * addAndGet adds given value to current, and returns current value */ public void testAddAndGet() { AtomicLong ai = new AtomicLong(1); assertEquals(3,ai.addAndGet(2)); assertEquals(3,ai.get()); assertEquals(-1,ai.addAndGet(-4)); assertEquals(-1,ai.get()); } /** * decrementAndGet decrements and returns current value */ public void testDecrementAndGet() { AtomicLong ai = new AtomicLong(1); assertEquals(0,ai.decrementAndGet()); assertEquals(-1,ai.decrementAndGet()); assertEquals(-2,ai.decrementAndGet()); assertEquals(-2,ai.get()); } /** * incrementAndGet increments and returns current value */ public void testIncrementAndGet() { AtomicLong ai = new AtomicLong(1); assertEquals(2,ai.incrementAndGet()); assertEquals(2,ai.get()); ai.set(-2); assertEquals(-1,ai.incrementAndGet()); assertEquals(0,ai.incrementAndGet()); assertEquals(1,ai.incrementAndGet()); assertEquals(1,ai.get()); } /** * a deserialized serialized atomic holds same value */ public void testSerialization() throws Exception { AtomicLong l = new AtomicLong(); l.set(-22); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); AtomicLong r = (AtomicLong) in.readObject(); assertEquals(l.get(), r.get()); } /** * toString returns current value. */ public void testToString() { AtomicLong ai = new AtomicLong(); assertEquals("0", ai.toString()); for (long i : VALUES) { ai.set(i); assertEquals(ai.toString(), Long.toString(i)); } } /** * intValue returns current value. */ public void testIntValue() { AtomicLong ai = new AtomicLong(); assertEquals(0, ai.intValue()); for (long x : VALUES) { ai.set(x); assertEquals((int)x, ai.intValue()); } } /** * longValue returns current value. */ public void testLongValue() { AtomicLong ai = new AtomicLong(); assertEquals(0L, ai.longValue()); for (long x : VALUES) { ai.set(x); assertEquals((long)x, ai.longValue()); } } /** * floatValue returns current value. */ public void testFloatValue() { AtomicLong ai = new AtomicLong(); assertEquals(0.0f, ai.floatValue()); for (long x : VALUES) { ai.set(x); assertEquals((float)x, ai.floatValue()); } } /** * doubleValue returns current value. */ public void testDoubleValue() { AtomicLong ai = new AtomicLong(); assertEquals(0.0d, ai.doubleValue()); for (long x : VALUES) { ai.set(x); assertEquals((double)x, ai.doubleValue()); } } } jsr166/src/test/tck/AtomicReferenceArrayTest.java0000644000000000000000000001505111537741072017074 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.atomic.*; import java.io.*; import java.util.*; public class AtomicReferenceArrayTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicReferenceArrayTest.class); } /** * constructor creates array of given size with all elements null */ public void testConstructor() { AtomicReferenceArray ai = new AtomicReferenceArray(SIZE); for (int i = 0; i < SIZE; ++i) { assertNull(ai.get(i)); } } /** * constructor with null array throws NPE */ public void testConstructor2NPE() { try { Integer[] a = null; AtomicReferenceArray ai = new AtomicReferenceArray(a); shouldThrow(); } catch (NullPointerException success) {} } /** * constructor with array is of same size and has all elements */ public void testConstructor2() { Integer[] a = { two, one, three, four, seven}; AtomicReferenceArray ai = new AtomicReferenceArray(a); assertEquals(a.length, ai.length()); for (int i = 0; i < a.length; ++i) assertEquals(a[i], ai.get(i)); } /** * get and set for out of bound indices throw IndexOutOfBoundsException */ public void testIndexing() { AtomicReferenceArray ai = new AtomicReferenceArray(SIZE); try { ai.get(SIZE); shouldThrow(); } catch (IndexOutOfBoundsException success) { } try { ai.get(-1); shouldThrow(); } catch (IndexOutOfBoundsException success) { } try { ai.set(SIZE, null); shouldThrow(); } catch (IndexOutOfBoundsException success) { } try { ai.set(-1, null); shouldThrow(); } catch (IndexOutOfBoundsException success) { } } /** * get returns the last value set at index */ public void testGetSet() { AtomicReferenceArray ai = new AtomicReferenceArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, one); assertSame(one,ai.get(i)); ai.set(i, two); assertSame(two,ai.get(i)); ai.set(i, m3); assertSame(m3,ai.get(i)); } } /** * get returns the last value lazySet at index by same thread */ public void testGetLazySet() { AtomicReferenceArray ai = new AtomicReferenceArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.lazySet(i, one); assertSame(one,ai.get(i)); ai.lazySet(i, two); assertSame(two,ai.get(i)); ai.lazySet(i, m3); assertSame(m3,ai.get(i)); } } /** * compareAndSet succeeds in changing value if equal to expected else fails */ public void testCompareAndSet() { AtomicReferenceArray ai = new AtomicReferenceArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, one); assertTrue(ai.compareAndSet(i, one,two)); assertTrue(ai.compareAndSet(i, two,m4)); assertSame(m4,ai.get(i)); assertFalse(ai.compareAndSet(i, m5,seven)); assertSame(m4,ai.get(i)); assertTrue(ai.compareAndSet(i, m4,seven)); assertSame(seven,ai.get(i)); } } /** * compareAndSet in one thread enables another waiting for value * to succeed */ public void testCompareAndSetInMultipleThreads() throws InterruptedException { final AtomicReferenceArray a = new AtomicReferenceArray(1); a.set(0, one); Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!a.compareAndSet(0, two, three)) Thread.yield(); }}); t.start(); assertTrue(a.compareAndSet(0, one, two)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertSame(a.get(0), three); } /** * repeated weakCompareAndSet succeeds in changing value when equal * to expected */ public void testWeakCompareAndSet() { AtomicReferenceArray ai = new AtomicReferenceArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, one); while (!ai.weakCompareAndSet(i, one,two)); while (!ai.weakCompareAndSet(i, two,m4)); assertSame(m4,ai.get(i)); while (!ai.weakCompareAndSet(i, m4,seven)); assertSame(seven,ai.get(i)); } } /** * getAndSet returns previous value and sets to given value at given index */ public void testGetAndSet() { AtomicReferenceArray ai = new AtomicReferenceArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, one); assertSame(one,ai.getAndSet(i,zero)); assertSame(zero,ai.getAndSet(i,m10)); assertSame(m10,ai.getAndSet(i,one)); } } /** * a deserialized serialized array holds same values */ public void testSerialization() throws Exception { AtomicReferenceArray l = new AtomicReferenceArray(SIZE); for (int i = 0; i < SIZE; ++i) { l.set(i, new Integer(-i)); } ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); AtomicReferenceArray r = (AtomicReferenceArray) in.readObject(); assertEquals(l.length(), r.length()); for (int i = 0; i < SIZE; ++i) { assertEquals(r.get(i), l.get(i)); } } /** * toString returns current value. */ public void testToString() { Integer[] a = { two, one, three, four, seven}; AtomicReferenceArray ai = new AtomicReferenceArray(a); assertEquals(Arrays.toString(a), ai.toString()); } } jsr166/src/test/tck/AtomicIntegerArrayTest.java0000644000000000000000000002461511537741072016601 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.atomic.*; import java.io.*; import java.util.*; public class AtomicIntegerArrayTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicIntegerArrayTest.class); } /** * constructor creates array of given size with all elements zero */ public void testConstructor() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) assertEquals(0,ai.get(i)); } /** * constructor with null array throws NPE */ public void testConstructor2NPE() { try { int[] a = null; AtomicIntegerArray ai = new AtomicIntegerArray(a); shouldThrow(); } catch (NullPointerException success) {} } /** * constructor with array is of same size and has all elements */ public void testConstructor2() { int[] a = { 17, 3, -42, 99, -7}; AtomicIntegerArray ai = new AtomicIntegerArray(a); assertEquals(a.length, ai.length()); for (int i = 0; i < a.length; ++i) assertEquals(a[i], ai.get(i)); } /** * get and set for out of bound indices throw IndexOutOfBoundsException */ public void testIndexing() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); try { ai.get(SIZE); shouldThrow(); } catch (IndexOutOfBoundsException success) { } try { ai.get(-1); shouldThrow(); } catch (IndexOutOfBoundsException success) { } try { ai.set(SIZE, 0); shouldThrow(); } catch (IndexOutOfBoundsException success) { } try { ai.set(-1, 0); shouldThrow(); } catch (IndexOutOfBoundsException success) { } } /** * get returns the last value set at index */ public void testGetSet() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(1,ai.get(i)); ai.set(i, 2); assertEquals(2,ai.get(i)); ai.set(i, -3); assertEquals(-3,ai.get(i)); } } /** * get returns the last value lazySet at index by same thread */ public void testGetLazySet() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.lazySet(i, 1); assertEquals(1,ai.get(i)); ai.lazySet(i, 2); assertEquals(2,ai.get(i)); ai.lazySet(i, -3); assertEquals(-3,ai.get(i)); } } /** * compareAndSet succeeds in changing value if equal to expected else fails */ public void testCompareAndSet() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertTrue(ai.compareAndSet(i, 1,2)); assertTrue(ai.compareAndSet(i, 2,-4)); assertEquals(-4,ai.get(i)); assertFalse(ai.compareAndSet(i, -5,7)); assertEquals(-4,ai.get(i)); assertTrue(ai.compareAndSet(i, -4,7)); assertEquals(7,ai.get(i)); } } /** * compareAndSet in one thread enables another waiting for value * to succeed */ public void testCompareAndSetInMultipleThreads() throws Exception { final AtomicIntegerArray a = new AtomicIntegerArray(1); a.set(0, 1); Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!a.compareAndSet(0, 2, 3)) Thread.yield(); }}); t.start(); assertTrue(a.compareAndSet(0, 1, 2)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertEquals(a.get(0), 3); } /** * repeated weakCompareAndSet succeeds in changing value when equal * to expected */ public void testWeakCompareAndSet() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); while (!ai.weakCompareAndSet(i, 1,2)); while (!ai.weakCompareAndSet(i, 2,-4)); assertEquals(-4,ai.get(i)); while (!ai.weakCompareAndSet(i, -4,7)); assertEquals(7,ai.get(i)); } } /** * getAndSet returns previous value and sets to given value at given index */ public void testGetAndSet() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(1,ai.getAndSet(i,0)); assertEquals(0,ai.getAndSet(i,-10)); assertEquals(-10,ai.getAndSet(i,1)); } } /** * getAndAdd returns previous value and adds given value */ public void testGetAndAdd() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(1,ai.getAndAdd(i,2)); assertEquals(3,ai.get(i)); assertEquals(3,ai.getAndAdd(i,-4)); assertEquals(-1,ai.get(i)); } } /** * getAndDecrement returns previous value and decrements */ public void testGetAndDecrement() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(1,ai.getAndDecrement(i)); assertEquals(0,ai.getAndDecrement(i)); assertEquals(-1,ai.getAndDecrement(i)); } } /** * getAndIncrement returns previous value and increments */ public void testGetAndIncrement() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(1,ai.getAndIncrement(i)); assertEquals(2,ai.get(i)); ai.set(i,-2); assertEquals(-2,ai.getAndIncrement(i)); assertEquals(-1,ai.getAndIncrement(i)); assertEquals(0,ai.getAndIncrement(i)); assertEquals(1,ai.get(i)); } } /** * addAndGet adds given value to current, and returns current value */ public void testAddAndGet() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(3,ai.addAndGet(i,2)); assertEquals(3,ai.get(i)); assertEquals(-1,ai.addAndGet(i,-4)); assertEquals(-1,ai.get(i)); } } /** * decrementAndGet decrements and returns current value */ public void testDecrementAndGet() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(0,ai.decrementAndGet(i)); assertEquals(-1,ai.decrementAndGet(i)); assertEquals(-2,ai.decrementAndGet(i)); assertEquals(-2,ai.get(i)); } } /** * incrementAndGet increments and returns current value */ public void testIncrementAndGet() { AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(2,ai.incrementAndGet(i)); assertEquals(2,ai.get(i)); ai.set(i, -2); assertEquals(-1,ai.incrementAndGet(i)); assertEquals(0,ai.incrementAndGet(i)); assertEquals(1,ai.incrementAndGet(i)); assertEquals(1,ai.get(i)); } } static final int COUNTDOWN = 100000; class Counter extends CheckedRunnable { final AtomicIntegerArray ai; volatile int counts; Counter(AtomicIntegerArray a) { ai = a; } public void realRun() { for (;;) { boolean done = true; for (int i = 0; i < ai.length(); ++i) { int v = ai.get(i); assertTrue(v >= 0); if (v != 0) { done = false; if (ai.compareAndSet(i, v, v-1)) ++counts; } } if (done) break; } } } /** * Multiple threads using same array of counters successfully * update a number of times equal to total count */ public void testCountingInMultipleThreads() throws InterruptedException { final AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) ai.set(i, COUNTDOWN); Counter c1 = new Counter(ai); Counter c2 = new Counter(ai); Thread t1 = new Thread(c1); Thread t2 = new Thread(c2); t1.start(); t2.start(); t1.join(); t2.join(); assertEquals(c1.counts+c2.counts, SIZE * COUNTDOWN); } /** * a deserialized serialized array holds same values */ public void testSerialization() throws Exception { AtomicIntegerArray l = new AtomicIntegerArray(SIZE); for (int i = 0; i < SIZE; ++i) l.set(i, -i); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); AtomicIntegerArray r = (AtomicIntegerArray) in.readObject(); for (int i = 0; i < SIZE; ++i) { assertEquals(l.get(i), r.get(i)); } } /** * toString returns current value. */ public void testToString() { int[] a = { 17, 3, -42, 99, -7}; AtomicIntegerArray ai = new AtomicIntegerArray(a); assertEquals(Arrays.toString(a), ai.toString()); } } jsr166/src/test/tck/ArrayDequeTest.java0000644000000000000000000005603711537741072015115 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.*; public class ArrayDequeTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ArrayDequeTest.class); } /** * Create a deque of given size containing consecutive * Integers 0 ... n. */ private ArrayDeque populatedDeque(int n) { ArrayDeque q = new ArrayDeque(); assertTrue(q.isEmpty()); for (int i = 0; i < n; ++i) assertTrue(q.offerLast(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(n, q.size()); return q; } /** * new deque is empty */ public void testConstructor1() { assertEquals(0, new ArrayDeque().size()); } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { ArrayDeque q = new ArrayDeque((Collection)null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws NPE */ public void testConstructor4() { try { Integer[] ints = new Integer[SIZE]; ArrayDeque q = new ArrayDeque(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection with some null elements throws NPE */ public void testConstructor5() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); ArrayDeque q = new ArrayDeque(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Deque contains all elements of collection used to initialize */ public void testConstructor6() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ArrayDeque q = new ArrayDeque(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.pollFirst()); } /** * isEmpty is true before add, false after */ public void testEmpty() { ArrayDeque q = new ArrayDeque(); assertTrue(q.isEmpty()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.add(new Integer(2)); q.removeFirst(); q.removeFirst(); assertTrue(q.isEmpty()); } /** * size changes when elements added and removed */ public void testSize() { ArrayDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.removeFirst(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * push(null) throws NPE */ public void testPushNull() { try { ArrayDeque q = new ArrayDeque(1); q.push(null); shouldThrow(); } catch (NullPointerException success) {} } /** * peekFirst() returns element inserted with push */ public void testPush() { ArrayDeque q = populatedDeque(3); q.pollLast(); q.push(four); assertSame(four, q.peekFirst()); } /** * pop() removes next element, or throws NSEE if empty */ public void testPop() { ArrayDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pop()); } try { q.pop(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * offer(null) throws NPE */ public void testOfferNull() { try { ArrayDeque q = new ArrayDeque(); q.offer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * offerFirst(null) throws NPE */ public void testOfferFirstNull() { try { ArrayDeque q = new ArrayDeque(); q.offerFirst(null); shouldThrow(); } catch (NullPointerException success) {} } /** * offerLast(null) throws NPE */ public void testOfferLastNull() { try { ArrayDeque q = new ArrayDeque(); q.offerLast(null); shouldThrow(); } catch (NullPointerException success) {} } /** * offer(x) succeeds */ public void testOffer() { ArrayDeque q = new ArrayDeque(); assertTrue(q.offer(zero)); assertTrue(q.offer(one)); assertSame(zero, q.peekFirst()); assertSame(one, q.peekLast()); } /** * offerFirst(x) succeeds */ public void testOfferFirst() { ArrayDeque q = new ArrayDeque(); assertTrue(q.offerFirst(zero)); assertTrue(q.offerFirst(one)); assertSame(one, q.peekFirst()); assertSame(zero, q.peekLast()); } /** * offerLast(x) succeeds */ public void testOfferLast() { ArrayDeque q = new ArrayDeque(); assertTrue(q.offerLast(zero)); assertTrue(q.offerLast(one)); assertSame(zero, q.peekFirst()); assertSame(one, q.peekLast()); } /** * add(null) throws NPE */ public void testAddNull() { try { ArrayDeque q = new ArrayDeque(); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addFirst(null) throws NPE */ public void testAddFirstNull() { try { ArrayDeque q = new ArrayDeque(); q.addFirst(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addLast(null) throws NPE */ public void testAddLastNull() { try { ArrayDeque q = new ArrayDeque(); q.addLast(null); shouldThrow(); } catch (NullPointerException success) {} } /** * add(x) succeeds */ public void testAdd() { ArrayDeque q = new ArrayDeque(); assertTrue(q.add(zero)); assertTrue(q.add(one)); assertSame(zero, q.peekFirst()); assertSame(one, q.peekLast()); } /** * addFirst(x) succeeds */ public void testAddFirst() { ArrayDeque q = new ArrayDeque(); q.addFirst(zero); q.addFirst(one); assertSame(one, q.peekFirst()); assertSame(zero, q.peekLast()); } /** * addLast(x) succeeds */ public void testAddLast() { ArrayDeque q = new ArrayDeque(); q.addLast(zero); q.addLast(one); assertSame(zero, q.peekFirst()); assertSame(one, q.peekLast()); } /** * addAll(null) throws NPE */ public void testAddAll1() { try { ArrayDeque q = new ArrayDeque(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { ArrayDeque q = new ArrayDeque(); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { ArrayDeque q = new ArrayDeque(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Deque contains all elements, in traversal order, of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ArrayDeque q = new ArrayDeque(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.pollFirst()); } /** * pollFirst() succeeds unless empty */ public void testPollFirst() { ArrayDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst()); } assertNull(q.pollFirst()); } /** * pollLast() succeeds unless empty */ public void testPollLast() { ArrayDeque q = populatedDeque(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.pollLast()); } assertNull(q.pollLast()); } /** * poll() succeeds unless empty */ public void testPoll() { ArrayDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll()); } assertNull(q.poll()); } /** * remove() removes next element, or throws NSEE if empty */ public void testRemove() { ArrayDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remove()); } try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { ArrayDeque q = populatedDeque(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * peekFirst() returns next element, or null if empty */ public void testPeekFirst() { ArrayDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peekFirst()); assertEquals(i, q.pollFirst()); assertTrue(q.peekFirst() == null || !q.peekFirst().equals(i)); } assertNull(q.peekFirst()); } /** * peek() returns next element, or null if empty */ public void testPeek() { ArrayDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peek()); assertEquals(i, q.poll()); assertTrue(q.peek() == null || !q.peek().equals(i)); } assertNull(q.peek()); } /** * peekLast() returns next element, or null if empty */ public void testPeekLast() { ArrayDeque q = populatedDeque(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.peekLast()); assertEquals(i, q.pollLast()); assertTrue(q.peekLast() == null || !q.peekLast().equals(i)); } assertNull(q.peekLast()); } /** * element() returns first element, or throws NSEE if empty */ public void testElement() { ArrayDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.element()); assertEquals(i, q.poll()); } try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * getFirst() returns first element, or throws NSEE if empty */ public void testFirstElement() { ArrayDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.getFirst()); assertEquals(i, q.pollFirst()); } try { q.getFirst(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * getLast() returns last element, or throws NSEE if empty */ public void testLastElement() { ArrayDeque q = populatedDeque(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.getLast()); assertEquals(i, q.pollLast()); } try { q.getLast(); shouldThrow(); } catch (NoSuchElementException success) {} assertNull(q.peekLast()); } /** * removeFirst() removes first element, or throws NSEE if empty */ public void testRemoveFirst() { ArrayDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.removeFirst()); } try { q.removeFirst(); shouldThrow(); } catch (NoSuchElementException success) {} assertNull(q.peekFirst()); } /** * removeLast() removes last element, or throws NSEE if empty */ public void testRemoveLast() { ArrayDeque q = populatedDeque(SIZE); for (int i = SIZE - 1; i >= 0; --i) { assertEquals(i, q.removeLast()); } try { q.removeLast(); shouldThrow(); } catch (NoSuchElementException success) {} assertNull(q.peekLast()); } /** * removeFirstOccurrence(x) removes x and returns true if present */ public void testRemoveFirstOccurrence() { ArrayDeque q = populatedDeque(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.removeFirstOccurrence(new Integer(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.removeFirstOccurrence(new Integer(i))); assertFalse(q.removeFirstOccurrence(new Integer(i+1))); } assertTrue(q.isEmpty()); } /** * removeLastOccurrence(x) removes x and returns true if present */ public void testRemoveLastOccurrence() { ArrayDeque q = populatedDeque(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.removeLastOccurrence(new Integer(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.removeLastOccurrence(new Integer(i))); assertFalse(q.removeLastOccurrence(new Integer(i+1))); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { ArrayDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); assertEquals(i, q.pollFirst()); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { ArrayDeque q = populatedDeque(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); assertTrue(q.add(new Integer(1))); assertFalse(q.isEmpty()); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { ArrayDeque q = populatedDeque(SIZE); ArrayDeque p = new ArrayDeque(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); assertTrue(p.add(new Integer(i))); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { ArrayDeque q = populatedDeque(SIZE); ArrayDeque p = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); assertEquals(changed, (i > 0)); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.removeFirst(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { ArrayDeque q = populatedDeque(SIZE); ArrayDeque p = populatedDeque(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { assertFalse(q.contains(p.removeFirst())); } } } /** * toArray() contains all elements in FIFO order */ public void testToArray() { ArrayDeque q = populatedDeque(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) assertSame(o[i], q.pollFirst()); } /** * toArray(a) contains all elements in FIFO order */ public void testToArray2() { ArrayDeque q = populatedDeque(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.remove()); } /** * toArray(null) throws NullPointerException */ public void testToArray_NullArg() { ArrayDeque l = new ArrayDeque(); l.add(new Object()); try { l.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { ArrayDeque l = new ArrayDeque(); l.add(new Integer(5)); try { l.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * Iterator iterates through all elements */ public void testIterator() { ArrayDeque q = populatedDeque(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * Iterator ordering is FIFO */ public void testIteratorOrdering() { final ArrayDeque q = new ArrayDeque(); q.add(one); q.add(two); q.add(three); int k = 0; for (Iterator it = q.iterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); } /** * iterator.remove() removes current element */ public void testIteratorRemove() { final ArrayDeque q = new ArrayDeque(); final Random rng = new Random(); for (int iters = 0; iters < 100; ++iters) { int max = rng.nextInt(5) + 2; int split = rng.nextInt(max-1) + 1; for (int j = 1; j <= max; ++j) q.add(new Integer(j)); Iterator it = q.iterator(); for (int j = 1; j <= split; ++j) assertEquals(it.next(), new Integer(j)); it.remove(); assertEquals(it.next(), new Integer(split+1)); for (int j = 1; j <= split; ++j) q.remove(new Integer(j)); it = q.iterator(); for (int j = split+1; j <= max; ++j) { assertEquals(it.next(), new Integer(j)); it.remove(); } assertFalse(it.hasNext()); assertTrue(q.isEmpty()); } } /** * Descending iterator iterates through all elements */ public void testDescendingIterator() { ArrayDeque q = populatedDeque(SIZE); int i = 0; Iterator it = q.descendingIterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); assertFalse(it.hasNext()); try { it.next(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * Descending iterator ordering is reverse FIFO */ public void testDescendingIteratorOrdering() { final ArrayDeque q = new ArrayDeque(); for (int iters = 0; iters < 100; ++iters) { q.add(new Integer(3)); q.add(new Integer(2)); q.add(new Integer(1)); int k = 0; for (Iterator it = q.descendingIterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); q.remove(); q.remove(); q.remove(); } } /** * descendingIterator.remove() removes current element */ public void testDescendingIteratorRemove() { final ArrayDeque q = new ArrayDeque(); final Random rng = new Random(); for (int iters = 0; iters < 100; ++iters) { int max = rng.nextInt(5) + 2; int split = rng.nextInt(max-1) + 1; for (int j = max; j >= 1; --j) q.add(new Integer(j)); Iterator it = q.descendingIterator(); for (int j = 1; j <= split; ++j) assertEquals(it.next(), new Integer(j)); it.remove(); assertEquals(it.next(), new Integer(split+1)); for (int j = 1; j <= split; ++j) q.remove(new Integer(j)); it = q.descendingIterator(); for (int j = split+1; j <= max; ++j) { assertEquals(it.next(), new Integer(j)); it.remove(); } assertFalse(it.hasNext()); assertTrue(q.isEmpty()); } } /** * toString() contains toStrings of elements */ public void testToString() { ArrayDeque q = populatedDeque(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * A deserialized serialized deque has same elements in same order */ public void testSerialization() throws Exception { ArrayDeque q = populatedDeque(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); ArrayDeque r = (ArrayDeque)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.remove(), r.remove()); } } jsr166/src/test/tck/ExecutorsTest.java0000644000000000000000000005111311560754737015032 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.math.BigInteger; import java.security.*; public class ExecutorsTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ExecutorsTest.class); } /** * A newCachedThreadPool can execute runnables */ public void testNewCachedThreadPool1() { ExecutorService e = Executors.newCachedThreadPool(); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); joinPool(e); } /** * A newCachedThreadPool with given ThreadFactory can execute runnables */ public void testNewCachedThreadPool2() { ExecutorService e = Executors.newCachedThreadPool(new SimpleThreadFactory()); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); joinPool(e); } /** * A newCachedThreadPool with null ThreadFactory throws NPE */ public void testNewCachedThreadPool3() { try { ExecutorService e = Executors.newCachedThreadPool(null); shouldThrow(); } catch (NullPointerException success) {} } /** * A new SingleThreadExecutor can execute runnables */ public void testNewSingleThreadExecutor1() { ExecutorService e = Executors.newSingleThreadExecutor(); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); joinPool(e); } /** * A new SingleThreadExecutor with given ThreadFactory can execute runnables */ public void testNewSingleThreadExecutor2() { ExecutorService e = Executors.newSingleThreadExecutor(new SimpleThreadFactory()); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); joinPool(e); } /** * A new SingleThreadExecutor with null ThreadFactory throws NPE */ public void testNewSingleThreadExecutor3() { try { ExecutorService e = Executors.newSingleThreadExecutor(null); shouldThrow(); } catch (NullPointerException success) {} } /** * A new SingleThreadExecutor cannot be casted to concrete implementation */ public void testCastNewSingleThreadExecutor() { ExecutorService e = Executors.newSingleThreadExecutor(); try { ThreadPoolExecutor tpe = (ThreadPoolExecutor)e; shouldThrow(); } catch (ClassCastException success) { } finally { joinPool(e); } } /** * A new newFixedThreadPool can execute runnables */ public void testNewFixedThreadPool1() { ExecutorService e = Executors.newFixedThreadPool(2); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); joinPool(e); } /** * A new newFixedThreadPool with given ThreadFactory can execute runnables */ public void testNewFixedThreadPool2() { ExecutorService e = Executors.newFixedThreadPool(2, new SimpleThreadFactory()); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); joinPool(e); } /** * A new newFixedThreadPool with null ThreadFactory throws NPE */ public void testNewFixedThreadPool3() { try { ExecutorService e = Executors.newFixedThreadPool(2, null); shouldThrow(); } catch (NullPointerException success) {} } /** * A new newFixedThreadPool with 0 threads throws IAE */ public void testNewFixedThreadPool4() { try { ExecutorService e = Executors.newFixedThreadPool(0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * An unconfigurable newFixedThreadPool can execute runnables */ public void testunconfigurableExecutorService() { ExecutorService e = Executors.unconfigurableExecutorService(Executors.newFixedThreadPool(2)); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); e.execute(new NoOpRunnable()); joinPool(e); } /** * unconfigurableExecutorService(null) throws NPE */ public void testunconfigurableExecutorServiceNPE() { try { ExecutorService e = Executors.unconfigurableExecutorService(null); shouldThrow(); } catch (NullPointerException success) {} } /** * unconfigurableScheduledExecutorService(null) throws NPE */ public void testunconfigurableScheduledExecutorServiceNPE() { try { ExecutorService e = Executors.unconfigurableScheduledExecutorService(null); shouldThrow(); } catch (NullPointerException success) {} } /** * a newSingleThreadScheduledExecutor successfully runs delayed task */ public void testNewSingleThreadScheduledExecutor() throws Exception { ScheduledExecutorService p = Executors.newSingleThreadScheduledExecutor(); try { final CountDownLatch done = new CountDownLatch(1); final Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); }}; Future f = p.schedule(Executors.callable(task, Boolean.TRUE), SHORT_DELAY_MS, MILLISECONDS); assertFalse(f.isDone()); assertTrue(done.await(MEDIUM_DELAY_MS, MILLISECONDS)); assertSame(Boolean.TRUE, f.get(SMALL_DELAY_MS, MILLISECONDS)); assertSame(Boolean.TRUE, f.get()); assertTrue(f.isDone()); } finally { joinPool(p); } } /** * a newScheduledThreadPool successfully runs delayed task */ public void testnewScheduledThreadPool() throws Exception { ScheduledExecutorService p = Executors.newScheduledThreadPool(2); try { final CountDownLatch done = new CountDownLatch(1); final Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); }}; Future f = p.schedule(Executors.callable(task, Boolean.TRUE), SHORT_DELAY_MS, MILLISECONDS); assertFalse(f.isDone()); assertTrue(done.await(MEDIUM_DELAY_MS, MILLISECONDS)); assertSame(Boolean.TRUE, f.get(SMALL_DELAY_MS, MILLISECONDS)); assertSame(Boolean.TRUE, f.get()); assertTrue(f.isDone()); } finally { joinPool(p); } } /** * an unconfigurable newScheduledThreadPool successfully runs delayed task */ public void testunconfigurableScheduledExecutorService() throws Exception { ScheduledExecutorService p = Executors.unconfigurableScheduledExecutorService (Executors.newScheduledThreadPool(2)); try { final CountDownLatch done = new CountDownLatch(1); final Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); }}; Future f = p.schedule(Executors.callable(task, Boolean.TRUE), SHORT_DELAY_MS, MILLISECONDS); assertFalse(f.isDone()); assertTrue(done.await(MEDIUM_DELAY_MS, MILLISECONDS)); assertSame(Boolean.TRUE, f.get(SMALL_DELAY_MS, MILLISECONDS)); assertSame(Boolean.TRUE, f.get()); assertTrue(f.isDone()); } finally { joinPool(p); } } /** * Future.get on submitted tasks will time out if they compute too long. */ public void testTimedCallable() throws Exception { final Runnable sleeper = new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { delay(LONG_DELAY_MS); }}; for (ExecutorService executor : new ExecutorService[] { Executors.newSingleThreadExecutor(), Executors.newCachedThreadPool(), Executors.newFixedThreadPool(2), Executors.newScheduledThreadPool(2), }) { try { Future future = executor.submit(sleeper); try { future.get(SHORT_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (TimeoutException success) { } finally { future.cancel(true); } } finally { joinPool(executor); } } } /** * ThreadPoolExecutor using defaultThreadFactory has * specified group, priority, daemon status, and name */ public void testDefaultThreadFactory() throws Exception { final ThreadGroup egroup = Thread.currentThread().getThreadGroup(); Runnable r = new CheckedRunnable() { public void realRun() { try { Thread current = Thread.currentThread(); assertTrue(!current.isDaemon()); assertTrue(current.getPriority() <= Thread.NORM_PRIORITY); ThreadGroup g = current.getThreadGroup(); SecurityManager s = System.getSecurityManager(); if (s != null) assertTrue(g == s.getThreadGroup()); else assertTrue(g == egroup); String name = current.getName(); assertTrue(name.endsWith("thread-1")); } catch (SecurityException ok) { // Also pass if not allowed to change setting } }}; ExecutorService e = Executors.newSingleThreadExecutor(Executors.defaultThreadFactory()); e.execute(r); try { e.shutdown(); } catch (SecurityException ok) { } try { delay(SHORT_DELAY_MS); } finally { joinPool(e); } } /** * ThreadPoolExecutor using privilegedThreadFactory has * specified group, priority, daemon status, name, * access control context and context class loader */ public void testPrivilegedThreadFactory() throws Exception { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { final ThreadGroup egroup = Thread.currentThread().getThreadGroup(); final ClassLoader thisccl = Thread.currentThread().getContextClassLoader(); final AccessControlContext thisacc = AccessController.getContext(); Runnable r = new CheckedRunnable() { public void realRun() { Thread current = Thread.currentThread(); assertTrue(!current.isDaemon()); assertTrue(current.getPriority() <= Thread.NORM_PRIORITY); ThreadGroup g = current.getThreadGroup(); SecurityManager s = System.getSecurityManager(); if (s != null) assertTrue(g == s.getThreadGroup()); else assertTrue(g == egroup); String name = current.getName(); assertTrue(name.endsWith("thread-1")); assertSame(thisccl, current.getContextClassLoader()); assertEquals(thisacc, AccessController.getContext()); }}; ExecutorService e = Executors.newSingleThreadExecutor(Executors.privilegedThreadFactory()); e.execute(r); e.shutdown(); delay(SHORT_DELAY_MS); joinPool(e); }}; runWithPermissions(r, new RuntimePermission("getClassLoader"), new RuntimePermission("setContextClassLoader"), new RuntimePermission("modifyThread")); } boolean haveCCLPermissions() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { sm.checkPermission(new RuntimePermission("setContextClassLoader")); sm.checkPermission(new RuntimePermission("getClassLoader")); } catch (AccessControlException e) { return false; } } return true; } void checkCCL() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new RuntimePermission("setContextClassLoader")); sm.checkPermission(new RuntimePermission("getClassLoader")); } } class CheckCCL implements Callable { public Object call() { checkCCL(); return null; } } /** * Without class loader permissions, creating * privilegedCallableUsingCurrentClassLoader throws ACE */ public void testCreatePrivilegedCallableUsingCCLWithNoPrivs() { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { if (System.getSecurityManager() == null) return; try { Executors.privilegedCallableUsingCurrentClassLoader(new NoOpCallable()); shouldThrow(); } catch (AccessControlException success) {} }}; runWithoutPermissions(r); } /** * With class loader permissions, calling * privilegedCallableUsingCurrentClassLoader does not throw ACE */ public void testprivilegedCallableUsingCCLWithPrivs() throws Exception { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { Executors.privilegedCallableUsingCurrentClassLoader (new NoOpCallable()) .call(); }}; runWithPermissions(r, new RuntimePermission("getClassLoader"), new RuntimePermission("setContextClassLoader")); } /** * Without permissions, calling privilegedCallable throws ACE */ public void testprivilegedCallableWithNoPrivs() throws Exception { // Avoid classloader-related SecurityExceptions in swingui.TestRunner Executors.privilegedCallable(new CheckCCL()); Runnable r = new CheckedRunnable() { public void realRun() throws Exception { if (System.getSecurityManager() == null) return; Callable task = Executors.privilegedCallable(new CheckCCL()); try { task.call(); shouldThrow(); } catch (AccessControlException success) {} }}; runWithoutPermissions(r); // It seems rather difficult to test that the // AccessControlContext of the privilegedCallable is used // instead of its caller. Below is a failed attempt to do // that, which does not work because the AccessController // cannot capture the internal state of the current Policy. // It would be much more work to differentiate based on, // e.g. CodeSource. // final AccessControlContext[] noprivAcc = new AccessControlContext[1]; // final Callable[] task = new Callable[1]; // runWithPermissions // (new CheckedRunnable() { // public void realRun() { // if (System.getSecurityManager() == null) // return; // noprivAcc[0] = AccessController.getContext(); // task[0] = Executors.privilegedCallable(new CheckCCL()); // try { // AccessController.doPrivileged(new PrivilegedAction() { // public Void run() { // checkCCL(); // return null; // }}, noprivAcc[0]); // shouldThrow(); // } catch (AccessControlException success) {} // }}); // runWithPermissions // (new CheckedRunnable() { // public void realRun() throws Exception { // if (System.getSecurityManager() == null) // return; // // Verify that we have an underprivileged ACC // try { // AccessController.doPrivileged(new PrivilegedAction() { // public Void run() { // checkCCL(); // return null; // }}, noprivAcc[0]); // shouldThrow(); // } catch (AccessControlException success) {} // try { // task[0].call(); // shouldThrow(); // } catch (AccessControlException success) {} // }}, // new RuntimePermission("getClassLoader"), // new RuntimePermission("setContextClassLoader")); } /** * With permissions, calling privilegedCallable succeeds */ public void testprivilegedCallableWithPrivs() throws Exception { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { Executors.privilegedCallable(new CheckCCL()).call(); }}; runWithPermissions(r, new RuntimePermission("getClassLoader"), new RuntimePermission("setContextClassLoader")); } /** * callable(Runnable) returns null when called */ public void testCallable1() throws Exception { Callable c = Executors.callable(new NoOpRunnable()); assertNull(c.call()); } /** * callable(Runnable, result) returns result when called */ public void testCallable2() throws Exception { Callable c = Executors.callable(new NoOpRunnable(), one); assertSame(one, c.call()); } /** * callable(PrivilegedAction) returns its result when called */ public void testCallable3() throws Exception { Callable c = Executors.callable(new PrivilegedAction() { public Object run() { return one; }}); assertSame(one, c.call()); } /** * callable(PrivilegedExceptionAction) returns its result when called */ public void testCallable4() throws Exception { Callable c = Executors.callable(new PrivilegedExceptionAction() { public Object run() { return one; }}); assertSame(one, c.call()); } /** * callable(null Runnable) throws NPE */ public void testCallableNPE1() { try { Callable c = Executors.callable((Runnable) null); shouldThrow(); } catch (NullPointerException success) {} } /** * callable(null, result) throws NPE */ public void testCallableNPE2() { try { Callable c = Executors.callable((Runnable) null, one); shouldThrow(); } catch (NullPointerException success) {} } /** * callable(null PrivilegedAction) throws NPE */ public void testCallableNPE3() { try { Callable c = Executors.callable((PrivilegedAction) null); shouldThrow(); } catch (NullPointerException success) {} } /** * callable(null PrivilegedExceptionAction) throws NPE */ public void testCallableNPE4() { try { Callable c = Executors.callable((PrivilegedExceptionAction) null); shouldThrow(); } catch (NullPointerException success) {} } } jsr166/src/test/tck/AtomicLongArrayTest.java0000644000000000000000000002443411537741072016102 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.atomic.*; import java.io.*; import java.util.*; public class AtomicLongArrayTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicLongArrayTest.class); } /** * constructor creates array of given size with all elements zero */ public void testConstructor() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) assertEquals(0,ai.get(i)); } /** * constructor with null array throws NPE */ public void testConstructor2NPE() { try { long[] a = null; AtomicLongArray ai = new AtomicLongArray(a); shouldThrow(); } catch (NullPointerException success) {} } /** * constructor with array is of same size and has all elements */ public void testConstructor2() { long[] a = { 17L, 3L, -42L, 99L, -7L}; AtomicLongArray ai = new AtomicLongArray(a); assertEquals(a.length, ai.length()); for (int i = 0; i < a.length; ++i) assertEquals(a[i], ai.get(i)); } /** * get and set for out of bound indices throw IndexOutOfBoundsException */ public void testIndexing() { AtomicLongArray ai = new AtomicLongArray(SIZE); try { ai.get(SIZE); shouldThrow(); } catch (IndexOutOfBoundsException success) { } try { ai.get(-1); shouldThrow(); } catch (IndexOutOfBoundsException success) { } try { ai.set(SIZE, 0); shouldThrow(); } catch (IndexOutOfBoundsException success) { } try { ai.set(-1, 0); shouldThrow(); } catch (IndexOutOfBoundsException success) { } } /** * get returns the last value set at index */ public void testGetSet() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(1,ai.get(i)); ai.set(i, 2); assertEquals(2,ai.get(i)); ai.set(i, -3); assertEquals(-3,ai.get(i)); } } /** * get returns the last value lazySet at index by same thread */ public void testGetLazySet() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.lazySet(i, 1); assertEquals(1,ai.get(i)); ai.lazySet(i, 2); assertEquals(2,ai.get(i)); ai.lazySet(i, -3); assertEquals(-3,ai.get(i)); } } /** * compareAndSet succeeds in changing value if equal to expected else fails */ public void testCompareAndSet() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertTrue(ai.compareAndSet(i, 1,2)); assertTrue(ai.compareAndSet(i, 2,-4)); assertEquals(-4,ai.get(i)); assertFalse(ai.compareAndSet(i, -5,7)); assertEquals(-4,ai.get(i)); assertTrue(ai.compareAndSet(i, -4,7)); assertEquals(7,ai.get(i)); } } /** * compareAndSet in one thread enables another waiting for value * to succeed */ public void testCompareAndSetInMultipleThreads() throws InterruptedException { final AtomicLongArray a = new AtomicLongArray(1); a.set(0, 1); Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!a.compareAndSet(0, 2, 3)) Thread.yield(); }}); t.start(); assertTrue(a.compareAndSet(0, 1, 2)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertEquals(a.get(0), 3); } /** * repeated weakCompareAndSet succeeds in changing value when equal * to expected */ public void testWeakCompareAndSet() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); while (!ai.weakCompareAndSet(i, 1,2)); while (!ai.weakCompareAndSet(i, 2,-4)); assertEquals(-4,ai.get(i)); while (!ai.weakCompareAndSet(i, -4,7)); assertEquals(7,ai.get(i)); } } /** * getAndSet returns previous value and sets to given value at given index */ public void testGetAndSet() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(1,ai.getAndSet(i,0)); assertEquals(0,ai.getAndSet(i,-10)); assertEquals(-10,ai.getAndSet(i,1)); } } /** * getAndAdd returns previous value and adds given value */ public void testGetAndAdd() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(1,ai.getAndAdd(i,2)); assertEquals(3,ai.get(i)); assertEquals(3,ai.getAndAdd(i,-4)); assertEquals(-1,ai.get(i)); } } /** * getAndDecrement returns previous value and decrements */ public void testGetAndDecrement() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(1,ai.getAndDecrement(i)); assertEquals(0,ai.getAndDecrement(i)); assertEquals(-1,ai.getAndDecrement(i)); } } /** * getAndIncrement returns previous value and increments */ public void testGetAndIncrement() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(1,ai.getAndIncrement(i)); assertEquals(2,ai.get(i)); ai.set(i,-2); assertEquals(-2,ai.getAndIncrement(i)); assertEquals(-1,ai.getAndIncrement(i)); assertEquals(0,ai.getAndIncrement(i)); assertEquals(1,ai.get(i)); } } /** * addAndGet adds given value to current, and returns current value */ public void testAddAndGet() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(3,ai.addAndGet(i,2)); assertEquals(3,ai.get(i)); assertEquals(-1,ai.addAndGet(i,-4)); assertEquals(-1,ai.get(i)); } } /** * decrementAndGet decrements and returns current value */ public void testDecrementAndGet() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(0,ai.decrementAndGet(i)); assertEquals(-1,ai.decrementAndGet(i)); assertEquals(-2,ai.decrementAndGet(i)); assertEquals(-2,ai.get(i)); } } /** * incrementAndGet increments and returns current value */ public void testIncrementAndGet() { AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) { ai.set(i, 1); assertEquals(2,ai.incrementAndGet(i)); assertEquals(2,ai.get(i)); ai.set(i, -2); assertEquals(-1,ai.incrementAndGet(i)); assertEquals(0,ai.incrementAndGet(i)); assertEquals(1,ai.incrementAndGet(i)); assertEquals(1,ai.get(i)); } } static final long COUNTDOWN = 100000; class Counter extends CheckedRunnable { final AtomicLongArray ai; volatile long counts; Counter(AtomicLongArray a) { ai = a; } public void realRun() { for (;;) { boolean done = true; for (int i = 0; i < ai.length(); ++i) { long v = ai.get(i); assertTrue(v >= 0); if (v != 0) { done = false; if (ai.compareAndSet(i, v, v-1)) ++counts; } } if (done) break; } } } /** * Multiple threads using same array of counters successfully * update a number of times equal to total count */ public void testCountingInMultipleThreads() throws InterruptedException { final AtomicLongArray ai = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) ai.set(i, COUNTDOWN); Counter c1 = new Counter(ai); Counter c2 = new Counter(ai); Thread t1 = new Thread(c1); Thread t2 = new Thread(c2); t1.start(); t2.start(); t1.join(); t2.join(); assertEquals(c1.counts+c2.counts, SIZE * COUNTDOWN); } /** * a deserialized serialized array holds same values */ public void testSerialization() throws Exception { AtomicLongArray l = new AtomicLongArray(SIZE); for (int i = 0; i < SIZE; ++i) l.set(i, -i); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); AtomicLongArray r = (AtomicLongArray) in.readObject(); for (int i = 0; i < SIZE; ++i) { assertEquals(l.get(i), r.get(i)); } } /** * toString returns current value. */ public void testToString() { long[] a = { 17, 3, -42, 99, -7}; AtomicLongArray ai = new AtomicLongArray(a); assertEquals(Arrays.toString(a), ai.toString()); } } jsr166/src/test/tck/ExecutorCompletionServiceTest.java0000644000000000000000000001631711560754737020231 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.concurrent.atomic.*; import java.math.BigInteger; import java.security.*; public class ExecutorCompletionServiceTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ExecutorCompletionServiceTest.class); } /** * Creating a new ECS with null Executor throw NPE */ public void testConstructorNPE() { try { ExecutorCompletionService ecs = new ExecutorCompletionService(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Creating a new ECS with null queue throw NPE */ public void testConstructorNPE2() { try { ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e, null); shouldThrow(); } catch (NullPointerException success) {} } /** * Submitting a null callable throws NPE */ public void testSubmitNPE() { ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { Callable c = null; ecs.submit(c); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * Submitting a null runnable throws NPE */ public void testSubmitNPE2() { ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { Runnable r = null; ecs.submit(r, Boolean.TRUE); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * A taken submitted task is completed */ public void testTake() throws InterruptedException { ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { Callable c = new StringTask(); ecs.submit(c); Future f = ecs.take(); assertTrue(f.isDone()); } finally { joinPool(e); } } /** * Take returns the same future object returned by submit */ public void testTake2() throws InterruptedException { ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { Callable c = new StringTask(); Future f1 = ecs.submit(c); Future f2 = ecs.take(); assertSame(f1, f2); } finally { joinPool(e); } } /** * If poll returns non-null, the returned task is completed */ public void testPoll1() throws InterruptedException { ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { assertNull(ecs.poll()); Callable c = new StringTask(); ecs.submit(c); delay(SHORT_DELAY_MS); for (;;) { Future f = ecs.poll(); if (f != null) { assertTrue(f.isDone()); break; } } } finally { joinPool(e); } } /** * If timed poll returns non-null, the returned task is completed */ public void testPoll2() throws InterruptedException { ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { assertNull(ecs.poll()); Callable c = new StringTask(); ecs.submit(c); Future f = ecs.poll(SHORT_DELAY_MS, MILLISECONDS); if (f != null) assertTrue(f.isDone()); } finally { joinPool(e); } } /** * Submitting to underlying AES that overrides newTaskFor(Callable) * returns and eventually runs Future returned by newTaskFor. */ public void testNewTaskForCallable() throws InterruptedException { final AtomicBoolean done = new AtomicBoolean(false); class MyCallableFuture extends FutureTask { MyCallableFuture(Callable c) { super(c); } protected void done() { done.set(true); } } ExecutorService e = new ThreadPoolExecutor( 1, 1, 30L, TimeUnit.SECONDS, new ArrayBlockingQueue(1)) { protected RunnableFuture newTaskFor(Callable c) { return new MyCallableFuture(c); }}; ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { assertNull(ecs.poll()); Callable c = new StringTask(); Future f1 = ecs.submit(c); assertTrue("submit must return MyCallableFuture", f1 instanceof MyCallableFuture); Future f2 = ecs.take(); assertSame("submit and take must return same objects", f1, f2); assertTrue("completed task must have set done", done.get()); } finally { joinPool(e); } } /** * Submitting to underlying AES that overrides newTaskFor(Runnable,T) * returns and eventually runs Future returned by newTaskFor. */ public void testNewTaskForRunnable() throws InterruptedException { final AtomicBoolean done = new AtomicBoolean(false); class MyRunnableFuture extends FutureTask { MyRunnableFuture(Runnable t, V r) { super(t, r); } protected void done() { done.set(true); } } ExecutorService e = new ThreadPoolExecutor( 1, 1, 30L, TimeUnit.SECONDS, new ArrayBlockingQueue(1)) { protected RunnableFuture newTaskFor(Runnable t, T r) { return new MyRunnableFuture(t, r); }}; ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { assertNull(ecs.poll()); Runnable r = new NoOpRunnable(); Future f1 = ecs.submit(r, null); assertTrue("submit must return MyRunnableFuture", f1 instanceof MyRunnableFuture); Future f2 = ecs.take(); assertSame("submit and take must return same objects", f1, f2); assertTrue("completed task must have set done", done.get()); } finally { joinPool(e); } } } jsr166/src/test/tck/RecursiveTaskTest.java0000644000000000000000000010624611537741073015644 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.ForkJoinWorkerThread; import java.util.concurrent.RecursiveTask; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import static java.util.concurrent.TimeUnit.SECONDS; import java.util.HashSet; public class RecursiveTaskTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(RecursiveTaskTest.class); } private static ForkJoinPool mainPool() { return new ForkJoinPool(); } private static ForkJoinPool singletonPool() { return new ForkJoinPool(1); } private static ForkJoinPool asyncSingletonPool() { return new ForkJoinPool(1, ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true); } private T testInvokeOnPool(ForkJoinPool pool, RecursiveTask a) { try { checkNotDone(a); T result = pool.invoke(a); checkCompletedNormally(a, result); return result; } finally { joinPool(pool); } } void checkNotDone(RecursiveTask a) { assertFalse(a.isDone()); assertFalse(a.isCompletedNormally()); assertFalse(a.isCompletedAbnormally()); assertFalse(a.isCancelled()); assertNull(a.getException()); assertNull(a.getRawResult()); if (! ForkJoinTask.inForkJoinPool()) { Thread.currentThread().interrupt(); try { a.get(); shouldThrow(); } catch (InterruptedException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } Thread.currentThread().interrupt(); try { a.get(5L, SECONDS); shouldThrow(); } catch (InterruptedException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } } try { a.get(0L, SECONDS); shouldThrow(); } catch (TimeoutException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } } void checkCompletedNormally(RecursiveTask a, T expected) { assertTrue(a.isDone()); assertFalse(a.isCancelled()); assertTrue(a.isCompletedNormally()); assertFalse(a.isCompletedAbnormally()); assertNull(a.getException()); assertSame(expected, a.getRawResult()); assertSame(expected, a.join()); assertFalse(a.cancel(false)); assertFalse(a.cancel(true)); try { assertSame(expected, a.get()); } catch (Throwable fail) { threadUnexpectedException(fail); } try { assertSame(expected, a.get(5L, SECONDS)); } catch (Throwable fail) { threadUnexpectedException(fail); } } /** * Waits for the task to complete, and checks that when it does, * it will have an Integer result equals to the given int. */ void checkCompletesNormally(RecursiveTask a, int expected) { Integer r = a.join(); assertEquals(expected, (int) r); checkCompletedNormally(a, r); } /** * Like checkCompletesNormally, but verifies that the task has * already completed. */ void checkCompletedNormally(RecursiveTask a, int expected) { Integer r = a.getRawResult(); assertEquals(expected, (int) r); checkCompletedNormally(a, r); } void checkCancelled(RecursiveTask a) { assertTrue(a.isDone()); assertTrue(a.isCancelled()); assertFalse(a.isCompletedNormally()); assertTrue(a.isCompletedAbnormally()); assertTrue(a.getException() instanceof CancellationException); assertNull(a.getRawResult()); try { a.join(); shouldThrow(); } catch (CancellationException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } try { a.get(); shouldThrow(); } catch (CancellationException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } try { a.get(5L, SECONDS); shouldThrow(); } catch (CancellationException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } } void checkCompletedAbnormally(RecursiveTask a, Throwable t) { assertTrue(a.isDone()); assertFalse(a.isCancelled()); assertFalse(a.isCompletedNormally()); assertTrue(a.isCompletedAbnormally()); assertSame(t.getClass(), a.getException().getClass()); assertNull(a.getRawResult()); assertFalse(a.cancel(false)); assertFalse(a.cancel(true)); try { a.join(); shouldThrow(); } catch (Throwable expected) { assertSame(t.getClass(), expected.getClass()); } try { a.get(); shouldThrow(); } catch (ExecutionException success) { assertSame(t.getClass(), success.getCause().getClass()); } catch (Throwable fail) { threadUnexpectedException(fail); } try { a.get(5L, SECONDS); shouldThrow(); } catch (ExecutionException success) { assertSame(t.getClass(), success.getCause().getClass()); } catch (Throwable fail) { threadUnexpectedException(fail); } } public static final class FJException extends RuntimeException { public FJException() { super(); } } // An invalid return value for Fib static final Integer NoResult = Integer.valueOf(-17); // A simple recursive task for testing final class FibTask extends CheckedRecursiveTask { final int number; FibTask(int n) { number = n; } public Integer realCompute() { int n = number; if (n <= 1) return n; FibTask f1 = new FibTask(n - 1); f1.fork(); return (new FibTask(n - 2)).compute() + f1.join(); } public void publicSetRawResult(Integer result) { setRawResult(result); } } // A recursive action failing in base case final class FailingFibTask extends RecursiveTask { final int number; int result; FailingFibTask(int n) { number = n; } public Integer compute() { int n = number; if (n <= 1) throw new FJException(); FailingFibTask f1 = new FailingFibTask(n - 1); f1.fork(); return (new FibTask(n - 2)).compute() + f1.join(); } } /** * invoke returns value when task completes normally. * isCompletedAbnormally and isCancelled return false for normally * completed tasks. getRawResult of a completed non-null task * returns value; */ public void testInvoke() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); Integer r = f.invoke(); assertEquals(21, (int) r); checkCompletedNormally(f, r); return r; }}; assertEquals(21, (int) testInvokeOnPool(mainPool(), a)); } /** * quietlyInvoke task returns when task completes normally. * isCompletedAbnormally and isCancelled return false for normally * completed tasks */ public void testQuietlyInvoke() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); f.quietlyInvoke(); checkCompletedNormally(f, 21); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * join of a forked task returns when task completes */ public void testForkJoin() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); assertSame(f, f.fork()); Integer r = f.join(); assertEquals(21, (int) r); checkCompletedNormally(f, r); return r; }}; assertEquals(21, (int) testInvokeOnPool(mainPool(), a)); } /** * get of a forked task returns when task completes */ public void testForkGet() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() throws Exception { FibTask f = new FibTask(8); assertSame(f, f.fork()); Integer r = f.get(); assertEquals(21, (int) r); checkCompletedNormally(f, r); return r; }}; assertEquals(21, (int) testInvokeOnPool(mainPool(), a)); } /** * timed get of a forked task returns when task completes */ public void testForkTimedGet() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() throws Exception { FibTask f = new FibTask(8); assertSame(f, f.fork()); Integer r = f.get(5L, SECONDS); assertEquals(21, (int) r); checkCompletedNormally(f, r); return r; }}; assertEquals(21, (int) testInvokeOnPool(mainPool(), a)); } /** * quietlyJoin of a forked task returns when task completes */ public void testForkQuietlyJoin() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); assertSame(f, f.fork()); f.quietlyJoin(); Integer r = f.getRawResult(); assertEquals(21, (int) r); checkCompletedNormally(f, r); return r; }}; assertEquals(21, (int) testInvokeOnPool(mainPool(), a)); } /** * helpQuiesce returns when tasks are complete. * getQueuedTaskCount returns 0 when quiescent */ public void testForkHelpQuiesce() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); assertSame(f, f.fork()); f.helpQuiesce(); assertEquals(0, getQueuedTaskCount()); checkCompletedNormally(f, 21); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invoke task throws exception when task completes abnormally */ public void testAbnormalInvoke() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FailingFibTask f = new FailingFibTask(8); try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * quietlyInvoke task returns when task completes abnormally */ public void testAbnormalQuietlyInvoke() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FailingFibTask f = new FailingFibTask(8); f.quietlyInvoke(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * join of a forked task throws exception when task completes abnormally */ public void testAbnormalForkJoin() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FailingFibTask f = new FailingFibTask(8); assertSame(f, f.fork()); try { Integer r = f.join(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * get of a forked task throws exception when task completes abnormally */ public void testAbnormalForkGet() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() throws Exception { FailingFibTask f = new FailingFibTask(8); assertSame(f, f.fork()); try { Integer r = f.get(); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * timed get of a forked task throws exception when task completes abnormally */ public void testAbnormalForkTimedGet() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() throws Exception { FailingFibTask f = new FailingFibTask(8); assertSame(f, f.fork()); try { Integer r = f.get(5L, SECONDS); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * quietlyJoin of a forked task returns when task completes abnormally */ public void testAbnormalForkQuietlyJoin() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FailingFibTask f = new FailingFibTask(8); assertSame(f, f.fork()); f.quietlyJoin(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invoke task throws exception when task cancelled */ public void testCancelledInvoke() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); assertTrue(f.cancel(true)); try { Integer r = f.invoke(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * join of a forked task throws exception when task cancelled */ public void testCancelledForkJoin() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { Integer r = f.join(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * get of a forked task throws exception when task cancelled */ public void testCancelledForkGet() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() throws Exception { FibTask f = new FibTask(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { Integer r = f.get(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * timed get of a forked task throws exception when task cancelled */ public void testCancelledForkTimedGet() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() throws Exception { FibTask f = new FibTask(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { Integer r = f.get(5L, SECONDS); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * quietlyJoin of a forked task returns when task cancelled */ public void testCancelledForkQuietlyJoin() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); f.quietlyJoin(); checkCancelled(f); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * getPool of executing task returns its pool */ public void testGetPool() { final ForkJoinPool mainPool = mainPool(); RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { assertSame(mainPool, getPool()); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool, a)); } /** * getPool of non-FJ task returns null */ public void testGetPool2() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { assertNull(getPool()); return NoResult; }}; assertSame(NoResult, a.invoke()); } /** * inForkJoinPool of executing task returns true */ public void testInForkJoinPool() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { assertTrue(inForkJoinPool()); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * inForkJoinPool of non-FJ task returns false */ public void testInForkJoinPool2() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { assertFalse(inForkJoinPool()); return NoResult; }}; assertSame(NoResult, a.invoke()); } /** * The value set by setRawResult is returned by getRawResult */ public void testSetRawResult() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { setRawResult(NoResult); assertSame(NoResult, getRawResult()); return NoResult; } }; assertSame(NoResult, a.invoke()); } /** * A reinitialized normally completed task may be re-invoked */ public void testReinitialize() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); checkNotDone(f); for (int i = 0; i < 3; i++) { Integer r = f.invoke(); assertEquals(21, (int) r); checkCompletedNormally(f, r); f.reinitialize(); f.publicSetRawResult(null); checkNotDone(f); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * A reinitialized abnormally completed task may be re-invoked */ public void testReinitializeAbnormal() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FailingFibTask f = new FailingFibTask(8); checkNotDone(f); for (int i = 0; i < 3; i++) { try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } f.reinitialize(); checkNotDone(f); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invoke task throws exception after invoking completeExceptionally */ public void testCompleteExceptionally() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); f.completeExceptionally(new FJException()); try { Integer r = f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invoke task suppresses execution invoking complete */ public void testComplete() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); f.complete(NoResult); Integer r = f.invoke(); assertSame(NoResult, r); checkCompletedNormally(f, NoResult); return r; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invokeAll(t1, t2) invokes all task arguments */ public void testInvokeAll2() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); FibTask g = new FibTask(9); invokeAll(f, g); checkCompletedNormally(f, 21); checkCompletedNormally(g, 34); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invokeAll(tasks) with 1 argument invokes task */ public void testInvokeAll1() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); invokeAll(f); checkCompletedNormally(f, 21); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invokeAll(tasks) with > 2 argument invokes tasks */ public void testInvokeAll3() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); FibTask g = new FibTask(9); FibTask h = new FibTask(7); invokeAll(f, g, h); assertTrue(f.isDone()); assertTrue(g.isDone()); assertTrue(h.isDone()); checkCompletedNormally(f, 21); checkCompletedNormally(g, 34); checkCompletedNormally(h, 13); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invokeAll(collection) invokes all tasks in the collection */ public void testInvokeAllCollection() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); FibTask g = new FibTask(9); FibTask h = new FibTask(7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); invokeAll(set); assertTrue(f.isDone()); assertTrue(g.isDone()); assertTrue(h.isDone()); checkCompletedNormally(f, 21); checkCompletedNormally(g, 34); checkCompletedNormally(h, 13); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invokeAll(tasks) with any null task throws NPE */ public void testInvokeAllNPE() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); FibTask g = new FibTask(9); FibTask h = null; try { invokeAll(f, g, h); shouldThrow(); } catch (NullPointerException success) {} return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invokeAll(t1, t2) throw exception if any task does */ public void testAbnormalInvokeAll2() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); FailingFibTask g = new FailingFibTask(9); try { invokeAll(f, g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invokeAll(tasks) with 1 argument throws exception if task does */ public void testAbnormalInvokeAll1() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FailingFibTask g = new FailingFibTask(9); try { invokeAll(g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invokeAll(tasks) with > 2 argument throws exception if any task does */ public void testAbnormalInvokeAll3() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask f = new FibTask(8); FailingFibTask g = new FailingFibTask(9); FibTask h = new FibTask(7); try { invokeAll(f, g, h); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * invokeAll(collection) throws exception if any task does */ public void testAbnormalInvokeAllCollection() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FailingFibTask f = new FailingFibTask(8); FibTask g = new FibTask(9); FibTask h = new FibTask(7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); try { invokeAll(set); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } return NoResult; }}; assertSame(NoResult, testInvokeOnPool(mainPool(), a)); } /** * tryUnfork returns true for most recent unexecuted task, * and suppresses execution */ public void testTryUnfork() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask g = new FibTask(9); assertSame(g, g.fork()); FibTask f = new FibTask(8); assertSame(f, f.fork()); assertTrue(f.tryUnfork()); helpQuiesce(); checkNotDone(f); checkCompletedNormally(g, 34); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(singletonPool(), a)); } /** * getSurplusQueuedTaskCount returns > 0 when * there are more tasks than threads */ public void testGetSurplusQueuedTaskCount() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask h = new FibTask(7); assertSame(h, h.fork()); FibTask g = new FibTask(9); assertSame(g, g.fork()); FibTask f = new FibTask(8); assertSame(f, f.fork()); assertTrue(getSurplusQueuedTaskCount() > 0); helpQuiesce(); assertEquals(0, getSurplusQueuedTaskCount()); checkCompletedNormally(f, 21); checkCompletedNormally(g, 34); checkCompletedNormally(h, 13); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(singletonPool(), a)); } /** * peekNextLocalTask returns most recent unexecuted task. */ public void testPeekNextLocalTask() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask g = new FibTask(9); assertSame(g, g.fork()); FibTask f = new FibTask(8); assertSame(f, f.fork()); assertSame(f, peekNextLocalTask()); checkCompletesNormally(f, 21); helpQuiesce(); checkCompletedNormally(g, 34); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(singletonPool(), a)); } /** * pollNextLocalTask returns most recent unexecuted task * without executing it */ public void testPollNextLocalTask() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask g = new FibTask(9); assertSame(g, g.fork()); FibTask f = new FibTask(8); assertSame(f, f.fork()); assertSame(f, pollNextLocalTask()); helpQuiesce(); checkNotDone(f); checkCompletedNormally(g, 34); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(singletonPool(), a)); } /** * pollTask returns an unexecuted task without executing it */ public void testPollTask() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask g = new FibTask(9); assertSame(g, g.fork()); FibTask f = new FibTask(8); assertSame(f, f.fork()); assertSame(f, pollTask()); helpQuiesce(); checkNotDone(f); checkCompletedNormally(g, 34); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(singletonPool(), a)); } /** * peekNextLocalTask returns least recent unexecuted task in async mode */ public void testPeekNextLocalTaskAsync() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask g = new FibTask(9); assertSame(g, g.fork()); FibTask f = new FibTask(8); assertSame(f, f.fork()); assertSame(g, peekNextLocalTask()); assertEquals(21, (int) f.join()); helpQuiesce(); checkCompletedNormally(f, 21); checkCompletedNormally(g, 34); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(asyncSingletonPool(), a)); } /** * pollNextLocalTask returns least recent unexecuted task without * executing it, in async mode */ public void testPollNextLocalTaskAsync() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask g = new FibTask(9); assertSame(g, g.fork()); FibTask f = new FibTask(8); assertSame(f, f.fork()); assertSame(g, pollNextLocalTask()); helpQuiesce(); checkCompletedNormally(f, 21); checkNotDone(g); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(asyncSingletonPool(), a)); } /** * pollTask returns an unexecuted task without executing it, in * async mode */ public void testPollTaskAsync() { RecursiveTask a = new CheckedRecursiveTask() { public Integer realCompute() { FibTask g = new FibTask(9); assertSame(g, g.fork()); FibTask f = new FibTask(8); assertSame(f, f.fork()); assertSame(g, pollTask()); helpQuiesce(); checkCompletedNormally(f, 21); checkNotDone(g); return NoResult; }}; assertSame(NoResult, testInvokeOnPool(asyncSingletonPool(), a)); } } jsr166/src/test/tck/AbstractQueuedLongSynchronizerTest.java0000644000000000000000000010035711560754737021230 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.concurrent.locks.*; import java.io.*; public class AbstractQueuedLongSynchronizerTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AbstractQueuedLongSynchronizerTest.class); } /** * A simple mutex class, adapted from the * AbstractQueuedLongSynchronizer javadoc. Exclusive acquire tests * exercise this as a sample user extension. Other * methods/features of AbstractQueuedLongSynchronizerTest are tested * via other test classes, including those for ReentrantLock, * ReentrantReadWriteLock, and Semaphore */ static class Mutex extends AbstractQueuedLongSynchronizer { // Use value > 32 bits for locked state static final long LOCKED = 1 << 48; public boolean isHeldExclusively() { return getState() == LOCKED; } public boolean tryAcquire(long acquires) { return compareAndSetState(0, LOCKED); } public boolean tryRelease(long releases) { if (getState() == 0) throw new IllegalMonitorStateException(); setState(0); return true; } public AbstractQueuedLongSynchronizer.ConditionObject newCondition() { return new AbstractQueuedLongSynchronizer.ConditionObject(); } } /** * A simple latch class, to test shared mode. */ static class BooleanLatch extends AbstractQueuedLongSynchronizer { public boolean isSignalled() { return getState() != 0; } public long tryAcquireShared(long ignore) { return isSignalled() ? 1 : -1; } public boolean tryReleaseShared(long ignore) { setState(1 << 62); return true; } } /** * A runnable calling acquireInterruptibly that does not expect to * be interrupted. */ class InterruptibleSyncRunnable extends CheckedRunnable { final Mutex sync; InterruptibleSyncRunnable(Mutex l) { sync = l; } public void realRun() throws InterruptedException { sync.acquireInterruptibly(1); } } /** * A runnable calling acquireInterruptibly that expects to be * interrupted. */ class InterruptedSyncRunnable extends CheckedInterruptedRunnable { final Mutex sync; InterruptedSyncRunnable(Mutex l) { sync = l; } public void realRun() throws InterruptedException { sync.acquireInterruptibly(1); } } /** * isHeldExclusively is false upon construction */ public void testIsHeldExclusively() { Mutex rl = new Mutex(); assertFalse(rl.isHeldExclusively()); } /** * acquiring released sync succeeds */ public void testAcquire() { Mutex rl = new Mutex(); rl.acquire(1); assertTrue(rl.isHeldExclusively()); rl.release(1); assertFalse(rl.isHeldExclusively()); } /** * tryAcquire on an released sync succeeds */ public void testTryAcquire() { Mutex rl = new Mutex(); assertTrue(rl.tryAcquire(1)); assertTrue(rl.isHeldExclusively()); rl.release(1); } /** * hasQueuedThreads reports whether there are waiting threads */ public void testhasQueuedThreads() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertFalse(sync.hasQueuedThreads()); sync.acquire(1); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.hasQueuedThreads()); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.hasQueuedThreads()); t1.interrupt(); delay(SHORT_DELAY_MS); assertTrue(sync.hasQueuedThreads()); sync.release(1); delay(SHORT_DELAY_MS); assertFalse(sync.hasQueuedThreads()); t1.join(); t2.join(); } /** * isQueued(null) throws NPE */ public void testIsQueuedNPE() { final Mutex sync = new Mutex(); try { sync.isQueued(null); shouldThrow(); } catch (NullPointerException success) {} } /** * isQueued reports whether a thread is queued. */ public void testIsQueued() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertFalse(sync.isQueued(t1)); assertFalse(sync.isQueued(t2)); sync.acquire(1); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.isQueued(t1)); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.isQueued(t1)); assertTrue(sync.isQueued(t2)); t1.interrupt(); delay(SHORT_DELAY_MS); assertFalse(sync.isQueued(t1)); assertTrue(sync.isQueued(t2)); sync.release(1); delay(SHORT_DELAY_MS); assertFalse(sync.isQueued(t1)); delay(SHORT_DELAY_MS); assertFalse(sync.isQueued(t2)); t1.join(); t2.join(); } /** * getFirstQueuedThread returns first waiting thread or null if none */ public void testGetFirstQueuedThread() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertNull(sync.getFirstQueuedThread()); sync.acquire(1); t1.start(); delay(SHORT_DELAY_MS); assertEquals(t1, sync.getFirstQueuedThread()); t2.start(); delay(SHORT_DELAY_MS); assertEquals(t1, sync.getFirstQueuedThread()); t1.interrupt(); delay(SHORT_DELAY_MS); delay(SHORT_DELAY_MS); assertEquals(t2, sync.getFirstQueuedThread()); sync.release(1); delay(SHORT_DELAY_MS); assertNull(sync.getFirstQueuedThread()); t1.join(); t2.join(); } /** * hasContended reports false if no thread has ever blocked, else true */ public void testHasContended() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertFalse(sync.hasContended()); sync.acquire(1); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); t1.interrupt(); delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); sync.release(1); delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); t1.join(); t2.join(); } /** * getQueuedThreads includes waiting threads */ public void testGetQueuedThreads() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertTrue(sync.getQueuedThreads().isEmpty()); sync.acquire(1); assertTrue(sync.getQueuedThreads().isEmpty()); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getQueuedThreads().contains(t1)); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getQueuedThreads().contains(t1)); assertTrue(sync.getQueuedThreads().contains(t2)); t1.interrupt(); delay(SHORT_DELAY_MS); assertFalse(sync.getQueuedThreads().contains(t1)); assertTrue(sync.getQueuedThreads().contains(t2)); sync.release(1); delay(SHORT_DELAY_MS); assertTrue(sync.getQueuedThreads().isEmpty()); t1.join(); t2.join(); } /** * getExclusiveQueuedThreads includes waiting threads */ public void testGetExclusiveQueuedThreads() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertTrue(sync.getExclusiveQueuedThreads().isEmpty()); sync.acquire(1); assertTrue(sync.getExclusiveQueuedThreads().isEmpty()); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getExclusiveQueuedThreads().contains(t1)); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getExclusiveQueuedThreads().contains(t1)); assertTrue(sync.getExclusiveQueuedThreads().contains(t2)); t1.interrupt(); delay(SHORT_DELAY_MS); assertFalse(sync.getExclusiveQueuedThreads().contains(t1)); assertTrue(sync.getExclusiveQueuedThreads().contains(t2)); sync.release(1); delay(SHORT_DELAY_MS); assertTrue(sync.getExclusiveQueuedThreads().isEmpty()); t1.join(); t2.join(); } /** * getSharedQueuedThreads does not include exclusively waiting threads */ public void testGetSharedQueuedThreads() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertTrue(sync.getSharedQueuedThreads().isEmpty()); sync.acquire(1); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t1.interrupt(); delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); sync.release(1); delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t1.join(); t2.join(); } /** * tryAcquireNanos is interruptible. */ public void testInterruptedException2() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { sync.tryAcquireNanos(1, MILLISECONDS.toNanos(MEDIUM_DELAY_MS)); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * TryAcquire on exclusively held sync fails */ public void testTryAcquireWhenSynced() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new CheckedRunnable() { public void realRun() { assertFalse(sync.tryAcquire(1)); }}); t.start(); t.join(); sync.release(1); } /** * tryAcquireNanos on an exclusively held sync times out */ public void testAcquireNanos_Timeout() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { long nanos = MILLISECONDS.toNanos(SHORT_DELAY_MS); assertFalse(sync.tryAcquireNanos(1, nanos)); }}); t.start(); t.join(); sync.release(1); } /** * getState is true when acquired and false when not */ public void testGetState() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquire(1); assertTrue(sync.isHeldExclusively()); sync.release(1); assertFalse(sync.isHeldExclusively()); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); delay(SMALL_DELAY_MS); sync.release(1); }}); t.start(); delay(SHORT_DELAY_MS); assertTrue(sync.isHeldExclusively()); t.join(); assertFalse(sync.isHeldExclusively()); } /** * acquireInterruptibly is interruptible. */ public void testAcquireInterruptibly1() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new InterruptedSyncRunnable(sync)); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); delay(SHORT_DELAY_MS); sync.release(1); t.join(); } /** * acquireInterruptibly succeeds when released, else is interruptible */ public void testAcquireInterruptibly2() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquireInterruptibly(1); Thread t = new Thread(new InterruptedSyncRunnable(sync)); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); assertTrue(sync.isHeldExclusively()); t.join(); } /** * owns is true for a condition created by sync else false */ public void testOwns() { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); final Mutex sync2 = new Mutex(); assertTrue(sync.owns(c)); assertFalse(sync2.owns(c)); } /** * Calling await without holding sync throws IllegalMonitorStateException */ public void testAwait_IllegalMonitor() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { c.await(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * Calling signal without holding sync throws IllegalMonitorStateException */ public void testSignal_IllegalMonitor() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { c.signal(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * awaitNanos without a signal times out */ public void testAwaitNanos_Timeout() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); sync.acquire(1); long t = c.awaitNanos(100); assertTrue(t <= 0); sync.release(1); } /** * Timed await without a signal times out */ public void testAwait_Timeout() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); sync.acquire(1); assertFalse(c.await(SHORT_DELAY_MS, MILLISECONDS)); sync.release(1); } /** * awaitUntil without a signal times out */ public void testAwaitUntil_Timeout() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); sync.acquire(1); java.util.Date d = new java.util.Date(); assertFalse(c.awaitUntil(new java.util.Date(d.getTime() + 10))); sync.release(1); } /** * await returns when signalled */ public void testAwait() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); c.await(); sync.release(1); }}); t.start(); delay(SHORT_DELAY_MS); sync.acquire(1); c.signal(); sync.release(1); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * hasWaiters throws NPE if null */ public void testHasWaitersNPE() { final Mutex sync = new Mutex(); try { sync.hasWaiters(null); shouldThrow(); } catch (NullPointerException success) {} } /** * getWaitQueueLength throws NPE if null */ public void testGetWaitQueueLengthNPE() { final Mutex sync = new Mutex(); try { sync.getWaitQueueLength(null); shouldThrow(); } catch (NullPointerException success) {} } /** * getWaitingThreads throws NPE if null */ public void testGetWaitingThreadsNPE() { final Mutex sync = new Mutex(); try { sync.getWaitingThreads(null); shouldThrow(); } catch (NullPointerException success) {} } /** * hasWaiters throws IAE if not owned */ public void testHasWaitersIAE() { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); final Mutex sync2 = new Mutex(); try { sync2.hasWaiters(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * hasWaiters throws IMSE if not synced */ public void testHasWaitersIMSE() { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { sync.hasWaiters(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * getWaitQueueLength throws IAE if not owned */ public void testGetWaitQueueLengthIAE() { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); final Mutex sync2 = new Mutex(); try { sync2.getWaitQueueLength(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * getWaitQueueLength throws IMSE if not synced */ public void testGetWaitQueueLengthIMSE() { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { sync.getWaitQueueLength(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * getWaitingThreads throws IAE if not owned */ public void testGetWaitingThreadsIAE() { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); final Mutex sync2 = new Mutex(); try { sync2.getWaitingThreads(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * getWaitingThreads throws IMSE if not synced */ public void testGetWaitingThreadsIMSE() { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { sync.getWaitingThreads(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * hasWaiters returns true when a thread is waiting, else false */ public void testHasWaiters() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertEquals(0, sync.getWaitQueueLength(c)); c.await(); sync.release(1); }}); t.start(); delay(SHORT_DELAY_MS); sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertEquals(1, sync.getWaitQueueLength(c)); c.signal(); sync.release(1); delay(SHORT_DELAY_MS); sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertEquals(0, sync.getWaitQueueLength(c)); sync.release(1); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * getWaitQueueLength returns number of waiting threads */ public void testGetWaitQueueLength() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertEquals(0, sync.getWaitQueueLength(c)); c.await(); sync.release(1); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertEquals(1, sync.getWaitQueueLength(c)); c.await(); sync.release(1); }}); t1.start(); delay(SHORT_DELAY_MS); t2.start(); delay(SHORT_DELAY_MS); sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertEquals(2, sync.getWaitQueueLength(c)); c.signalAll(); sync.release(1); delay(SHORT_DELAY_MS); sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertEquals(0, sync.getWaitQueueLength(c)); sync.release(1); t1.join(SHORT_DELAY_MS); t2.join(SHORT_DELAY_MS); assertFalse(t1.isAlive()); assertFalse(t2.isAlive()); } /** * getWaitingThreads returns only and all waiting threads */ public void testGetWaitingThreads() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); assertTrue(sync.getWaitingThreads(c).isEmpty()); c.await(); sync.release(1); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); assertFalse(sync.getWaitingThreads(c).isEmpty()); c.await(); sync.release(1); }}); sync.acquire(1); assertTrue(sync.getWaitingThreads(c).isEmpty()); sync.release(1); t1.start(); delay(SHORT_DELAY_MS); t2.start(); delay(SHORT_DELAY_MS); sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertTrue(sync.getWaitingThreads(c).contains(t1)); assertTrue(sync.getWaitingThreads(c).contains(t2)); c.signalAll(); sync.release(1); delay(SHORT_DELAY_MS); sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertTrue(sync.getWaitingThreads(c).isEmpty()); sync.release(1); t1.join(SHORT_DELAY_MS); t2.join(SHORT_DELAY_MS); assertFalse(t1.isAlive()); assertFalse(t2.isAlive()); } /** * awaitUninterruptibly doesn't abort on interrupt */ public void testAwaitUninterruptibly() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedRunnable() { public void realRun() { sync.acquire(1); c.awaitUninterruptibly(); sync.release(1); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); sync.acquire(1); c.signal(); sync.release(1); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * await is interruptible */ public void testAwait_Interrupt() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); c.await(); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * awaitNanos is interruptible */ public void testAwaitNanos_Interrupt() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); c.awaitNanos(MILLISECONDS.toNanos(LONG_DELAY_MS)); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * awaitUntil is interruptible */ public void testAwaitUntil_Interrupt() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); java.util.Date d = new java.util.Date(); c.awaitUntil(new java.util.Date(d.getTime() + 10000)); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * signalAll wakes up all threads */ public void testSignalAll() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); c.await(); sync.release(1); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); c.await(); sync.release(1); }}); t1.start(); t2.start(); delay(SHORT_DELAY_MS); sync.acquire(1); c.signalAll(); sync.release(1); t1.join(SHORT_DELAY_MS); t2.join(SHORT_DELAY_MS); assertFalse(t1.isAlive()); assertFalse(t2.isAlive()); } /** * toString indicates current state */ public void testToString() { Mutex sync = new Mutex(); String us = sync.toString(); assertTrue(us.indexOf("State = 0") >= 0); sync.acquire(1); String ls = sync.toString(); assertTrue(ls.indexOf("State = " + Mutex.LOCKED) >= 0); } /** * A serialized AQS deserializes with current state */ public void testSerialization() throws Exception { Mutex l = new Mutex(); l.acquire(1); assertTrue(l.isHeldExclusively()); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); Mutex r = (Mutex) in.readObject(); assertTrue(r.isHeldExclusively()); } /** * tryReleaseShared setting state changes getState */ public void testGetStateWithReleaseShared() { final BooleanLatch l = new BooleanLatch(); assertFalse(l.isSignalled()); l.releaseShared(0); assertTrue(l.isSignalled()); } /** * releaseShared has no effect when already signalled */ public void testReleaseShared() { final BooleanLatch l = new BooleanLatch(); assertFalse(l.isSignalled()); l.releaseShared(0); assertTrue(l.isSignalled()); l.releaseShared(0); assertTrue(l.isSignalled()); } /** * acquireSharedInterruptibly returns after release, but not before */ public void testAcquireSharedInterruptibly() throws InterruptedException { final BooleanLatch l = new BooleanLatch(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(l.isSignalled()); l.acquireSharedInterruptibly(0); assertTrue(l.isSignalled()); }}); t.start(); assertFalse(l.isSignalled()); delay(SHORT_DELAY_MS); l.releaseShared(0); assertTrue(l.isSignalled()); t.join(); } /** * acquireSharedTimed returns after release */ public void testAcquireSharedTimed() throws InterruptedException { final BooleanLatch l = new BooleanLatch(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(l.isSignalled()); long nanos = MILLISECONDS.toNanos(MEDIUM_DELAY_MS); assertTrue(l.tryAcquireSharedNanos(0, nanos)); assertTrue(l.isSignalled()); }}); t.start(); assertFalse(l.isSignalled()); delay(SHORT_DELAY_MS); l.releaseShared(0); assertTrue(l.isSignalled()); t.join(); } /** * acquireSharedInterruptibly throws IE if interrupted before released */ public void testAcquireSharedInterruptibly_InterruptedException() throws InterruptedException { final BooleanLatch l = new BooleanLatch(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { assertFalse(l.isSignalled()); l.acquireSharedInterruptibly(0); }}); t.start(); assertFalse(l.isSignalled()); t.interrupt(); t.join(); } /** * acquireSharedTimed throws IE if interrupted before released */ public void testAcquireSharedNanos_InterruptedException() throws InterruptedException { final BooleanLatch l = new BooleanLatch(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { assertFalse(l.isSignalled()); long nanos = MILLISECONDS.toNanos(SMALL_DELAY_MS); l.tryAcquireSharedNanos(0, nanos); }}); t.start(); delay(SHORT_DELAY_MS); assertFalse(l.isSignalled()); t.interrupt(); t.join(); } /** * acquireSharedTimed times out if not released before timeout */ public void testAcquireSharedNanos_Timeout() throws InterruptedException { final BooleanLatch l = new BooleanLatch(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(l.isSignalled()); long nanos = MILLISECONDS.toNanos(SMALL_DELAY_MS); assertFalse(l.tryAcquireSharedNanos(0, nanos)); }}); t.start(); delay(SHORT_DELAY_MS); assertFalse(l.isSignalled()); t.join(); } } jsr166/src/test/tck/CopyOnWriteArrayListTest.java0000644000000000000000000004316311537741072017124 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class CopyOnWriteArrayListTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(CopyOnWriteArrayListTest.class); } static CopyOnWriteArrayList populatedArray(int n) { CopyOnWriteArrayList a = new CopyOnWriteArrayList(); assertTrue(a.isEmpty()); for (int i = 0; i < n; ++i) a.add(new Integer(i)); assertFalse(a.isEmpty()); assertEquals(n, a.size()); return a; } /** * a new list is empty */ public void testConstructor() { CopyOnWriteArrayList a = new CopyOnWriteArrayList(); assertTrue(a.isEmpty()); } /** * new list contains all elements of initializing array */ public void testConstructor2() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); CopyOnWriteArrayList a = new CopyOnWriteArrayList(ints); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], a.get(i)); } /** * new list contains all elements of initializing collection */ public void testConstructor3() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); CopyOnWriteArrayList a = new CopyOnWriteArrayList(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], a.get(i)); } /** * addAll adds each element from the given collection */ public void testAddAll() { CopyOnWriteArrayList full = populatedArray(3); Vector v = new Vector(); v.add(three); v.add(four); v.add(five); full.addAll(v); assertEquals(6, full.size()); } /** * addAllAbsent adds each element from the given collection that did not * already exist in the List */ public void testAddAllAbsent() { CopyOnWriteArrayList full = populatedArray(3); Vector v = new Vector(); v.add(three); v.add(four); v.add(one); // will not add this element full.addAllAbsent(v); assertEquals(5, full.size()); } /** * addIfAbsent will not add the element if it already exists in the list */ public void testAddIfAbsent() { CopyOnWriteArrayList full = populatedArray(SIZE); full.addIfAbsent(one); assertEquals(SIZE, full.size()); } /** * addIfAbsent adds the element when it does not exist in the list */ public void testAddIfAbsent2() { CopyOnWriteArrayList full = populatedArray(SIZE); full.addIfAbsent(three); assertTrue(full.contains(three)); } /** * clear removes all elements from the list */ public void testClear() { CopyOnWriteArrayList full = populatedArray(SIZE); full.clear(); assertEquals(0, full.size()); } /** * Cloned list is equal */ public void testClone() { CopyOnWriteArrayList l1 = populatedArray(SIZE); CopyOnWriteArrayList l2 = (CopyOnWriteArrayList)(l1.clone()); assertEquals(l1, l2); l1.clear(); assertFalse(l1.equals(l2)); } /** * contains is true for added elements */ public void testContains() { CopyOnWriteArrayList full = populatedArray(3); assertTrue(full.contains(one)); assertFalse(full.contains(five)); } /** * adding at an index places it in the indicated index */ public void testAddIndex() { CopyOnWriteArrayList full = populatedArray(3); full.add(0, m1); assertEquals(4, full.size()); assertEquals(m1, full.get(0)); assertEquals(zero, full.get(1)); full.add(2, m2); assertEquals(5, full.size()); assertEquals(m2, full.get(2)); assertEquals(two, full.get(4)); } /** * lists with same elements are equal and have same hashCode */ public void testEquals() { CopyOnWriteArrayList a = populatedArray(3); CopyOnWriteArrayList b = populatedArray(3); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); a.add(m1); assertFalse(a.equals(b)); assertFalse(b.equals(a)); b.add(m1); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); } /** * containsAll returns true for collection with subset of elements */ public void testContainsAll() { CopyOnWriteArrayList full = populatedArray(3); Vector v = new Vector(); v.add(one); v.add(two); assertTrue(full.containsAll(v)); v.add(six); assertFalse(full.containsAll(v)); } /** * get returns the value at the given index */ public void testGet() { CopyOnWriteArrayList full = populatedArray(3); assertEquals(0, full.get(0)); } /** * indexOf gives the index for the given object */ public void testIndexOf() { CopyOnWriteArrayList full = populatedArray(3); assertEquals(1, full.indexOf(one)); assertEquals(-1, full.indexOf("puppies")); } /** * indexOf gives the index based on the given index * at which to start searching */ public void testIndexOf2() { CopyOnWriteArrayList full = populatedArray(3); assertEquals(1, full.indexOf(one, 0)); assertEquals(-1, full.indexOf(one, 2)); } /** * isEmpty returns true when empty, else false */ public void testIsEmpty() { CopyOnWriteArrayList empty = new CopyOnWriteArrayList(); CopyOnWriteArrayList full = populatedArray(SIZE); assertTrue(empty.isEmpty()); assertFalse(full.isEmpty()); } /** * iterator() returns an iterator containing the elements of the list */ public void testIterator() { CopyOnWriteArrayList full = populatedArray(SIZE); Iterator i = full.iterator(); int j; for (j = 0; i.hasNext(); j++) assertEquals(j, i.next()); assertEquals(SIZE, j); } /** * iterator.remove throws UnsupportedOperationException */ public void testIteratorRemove() { CopyOnWriteArrayList full = populatedArray(SIZE); Iterator it = full.iterator(); it.next(); try { it.remove(); shouldThrow(); } catch (UnsupportedOperationException success) {} } /** * toString contains toString of elements */ public void testToString() { CopyOnWriteArrayList full = populatedArray(3); String s = full.toString(); for (int i = 0; i < 3; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * lastIndexOf returns the index for the given object */ public void testLastIndexOf1() { CopyOnWriteArrayList full = populatedArray(3); full.add(one); full.add(three); assertEquals(3, full.lastIndexOf(one)); assertEquals(-1, full.lastIndexOf(six)); } /** * lastIndexOf returns the index from the given starting point */ public void testlastIndexOf2() { CopyOnWriteArrayList full = populatedArray(3); full.add(one); full.add(three); assertEquals(3, full.lastIndexOf(one, 4)); assertEquals(-1, full.lastIndexOf(three, 3)); } /** * listIterator traverses all elements */ public void testListIterator1() { CopyOnWriteArrayList full = populatedArray(SIZE); ListIterator i = full.listIterator(); int j; for (j = 0; i.hasNext(); j++) assertEquals(j, i.next()); assertEquals(SIZE, j); } /** * listIterator only returns those elements after the given index */ public void testListIterator2() { CopyOnWriteArrayList full = populatedArray(3); ListIterator i = full.listIterator(1); int j; for (j = 0; i.hasNext(); j++) assertEquals(j+1, i.next()); assertEquals(2, j); } /** * remove removes and returns the object at the given index */ public void testRemove() { CopyOnWriteArrayList full = populatedArray(3); assertEquals(2, full.remove(2)); assertEquals(2, full.size()); } /** * removeAll removes all elements from the given collection */ public void testRemoveAll() { CopyOnWriteArrayList full = populatedArray(3); Vector v = new Vector(); v.add(one); v.add(two); full.removeAll(v); assertEquals(1, full.size()); } /** * set changes the element at the given index */ public void testSet() { CopyOnWriteArrayList full = populatedArray(3); assertEquals(2, full.set(2, four)); assertEquals(4, full.get(2)); } /** * size returns the number of elements */ public void testSize() { CopyOnWriteArrayList empty = new CopyOnWriteArrayList(); CopyOnWriteArrayList full = populatedArray(SIZE); assertEquals(SIZE, full.size()); assertEquals(0, empty.size()); } /** * toArray returns an Object array containing all elements from the list */ public void testToArray() { CopyOnWriteArrayList full = populatedArray(3); Object[] o = full.toArray(); assertEquals(3, o.length); assertEquals(0, o[0]); assertEquals(1, o[1]); assertEquals(2, o[2]); } /** * toArray returns an Integer array containing all elements from * the list */ public void testToArray2() { CopyOnWriteArrayList full = populatedArray(3); Integer[] i = new Integer[3]; i = (Integer[])full.toArray(i); assertEquals(3, i.length); assertEquals(0, i[0].intValue()); assertEquals(1, i[1].intValue()); assertEquals(2, i[2].intValue()); } /** * sublists contains elements at indexes offset from their base */ public void testSubList() { CopyOnWriteArrayList a = populatedArray(10); assertTrue(a.subList(1,1).isEmpty()); for (int j = 0; j < 9; ++j) { for (int i = j ; i < 10; ++i) { List b = a.subList(j,i); for (int k = j; k < i; ++k) { assertEquals(new Integer(k), b.get(k-j)); } } } List s = a.subList(2, 5); assertEquals(s.size(), 3); s.set(2, m1); assertEquals(a.get(4), m1); s.clear(); assertEquals(a.size(), 7); } // Exception tests /** * toArray throws an ArrayStoreException when the given array * can not store the objects inside the list */ public void testToArray_ArrayStoreException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.add("zfasdfsdf"); c.add("asdadasd"); c.toArray(new Long[5]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * get throws an IndexOutOfBoundsException on a negative index */ public void testGet1_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.get(-1); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * get throws an IndexOutOfBoundsException on a too high index */ public void testGet2_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.add("asdasd"); c.add("asdad"); c.get(100); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * set throws an IndexOutOfBoundsException on a negative index */ public void testSet1_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.set(-1,"qwerty"); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * set throws an IndexOutOfBoundsException on a too high index */ public void testSet2() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.add("asdasd"); c.add("asdad"); c.set(100, "qwerty"); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * add throws an IndexOutOfBoundsException on a negative index */ public void testAdd1_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.add(-1,"qwerty"); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * add throws an IndexOutOfBoundsException on a too high index */ public void testAdd2_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.add("asdasd"); c.add("asdasdasd"); c.add(100, "qwerty"); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * remove throws an IndexOutOfBoundsException on a negative index */ public void testRemove1_IndexOutOfBounds() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.remove(-1); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * remove throws an IndexOutOfBoundsException on a too high index */ public void testRemove2_IndexOutOfBounds() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.add("asdasd"); c.add("adasdasd"); c.remove(100); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * addAll throws an IndexOutOfBoundsException on a negative index */ public void testAddAll1_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.addAll(-1,new LinkedList()); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * addAll throws an IndexOutOfBoundsException on a too high index */ public void testAddAll2_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.add("asdasd"); c.add("asdasdasd"); c.addAll(100, new LinkedList()); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * listIterator throws an IndexOutOfBoundsException on a negative index */ public void testListIterator1_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.listIterator(-1); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * listIterator throws an IndexOutOfBoundsException on a too high index */ public void testListIterator2_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.add("adasd"); c.add("asdasdas"); c.listIterator(100); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * subList throws an IndexOutOfBoundsException on a negative index */ public void testSubList1_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.subList(-1,100); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * subList throws an IndexOutOfBoundsException on a too high index */ public void testSubList2_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.add("asdasd"); c.subList(1,100); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * subList throws IndexOutOfBoundsException when the second index * is lower then the first */ public void testSubList3_IndexOutOfBoundsException() { try { CopyOnWriteArrayList c = new CopyOnWriteArrayList(); c.subList(3,1); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * a deserialized serialized list is equal */ public void testSerialization() throws Exception { CopyOnWriteArrayList q = populatedArray(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); CopyOnWriteArrayList r = (CopyOnWriteArrayList)in.readObject(); assertEquals(q.size(), r.size()); assertTrue(q.equals(r)); assertTrue(r.equals(q)); } } jsr166/src/test/tck/ThreadPoolExecutorSubclassTest.java0000644000000000000000000017236711561321121020322 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.concurrent.locks.*; import junit.framework.*; import java.util.*; public class ThreadPoolExecutorSubclassTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ThreadPoolExecutorSubclassTest.class); } static class CustomTask implements RunnableFuture { final Callable callable; final ReentrantLock lock = new ReentrantLock(); final Condition cond = lock.newCondition(); boolean done; boolean cancelled; V result; Thread thread; Exception exception; CustomTask(Callable c) { if (c == null) throw new NullPointerException(); callable = c; } CustomTask(final Runnable r, final V res) { if (r == null) throw new NullPointerException(); callable = new Callable() { public V call() throws Exception { r.run(); return res; }}; } public boolean isDone() { lock.lock(); try { return done; } finally { lock.unlock() ; } } public boolean isCancelled() { lock.lock(); try { return cancelled; } finally { lock.unlock() ; } } public boolean cancel(boolean mayInterrupt) { lock.lock(); try { if (!done) { cancelled = true; done = true; if (mayInterrupt && thread != null) thread.interrupt(); return true; } return false; } finally { lock.unlock() ; } } public void run() { lock.lock(); try { if (done) return; thread = Thread.currentThread(); } finally { lock.unlock() ; } V v = null; Exception e = null; try { v = callable.call(); } catch (Exception ex) { e = ex; } lock.lock(); try { result = v; exception = e; done = true; thread = null; cond.signalAll(); } finally { lock.unlock(); } } public V get() throws InterruptedException, ExecutionException { lock.lock(); try { while (!done) cond.await(); if (exception != null) throw new ExecutionException(exception); return result; } finally { lock.unlock(); } } public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { long nanos = unit.toNanos(timeout); lock.lock(); try { for (;;) { if (done) break; if (nanos < 0) throw new TimeoutException(); nanos = cond.awaitNanos(nanos); } if (exception != null) throw new ExecutionException(exception); return result; } finally { lock.unlock(); } } } static class CustomTPE extends ThreadPoolExecutor { protected RunnableFuture newTaskFor(Callable c) { return new CustomTask(c); } protected RunnableFuture newTaskFor(Runnable r, V v) { return new CustomTask(r, v); } CustomTPE(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue); } CustomTPE(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue, ThreadFactory threadFactory) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory); } CustomTPE(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue, RejectedExecutionHandler handler) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler); } CustomTPE(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler); } volatile boolean beforeCalled = false; volatile boolean afterCalled = false; volatile boolean terminatedCalled = false; public CustomTPE() { super(1, 1, LONG_DELAY_MS, MILLISECONDS, new SynchronousQueue()); } protected void beforeExecute(Thread t, Runnable r) { beforeCalled = true; } protected void afterExecute(Runnable r, Throwable t) { afterCalled = true; } protected void terminated() { terminatedCalled = true; } } static class FailingThreadFactory implements ThreadFactory { int calls = 0; public Thread newThread(Runnable r) { if (++calls > 1) return null; return new Thread(r); } } /** * execute successfully executes a runnable */ public void testExecute() throws InterruptedException { final ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch done = new CountDownLatch(1); final Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); }}; try { p.execute(task); assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS)); } finally { joinPool(p); } } /** * getActiveCount increases but doesn't overestimate, when a * thread becomes active */ public void testGetActiveCount() throws InterruptedException { final ThreadPoolExecutor p = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getActiveCount()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getActiveCount()); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(1, p.getActiveCount()); } finally { done.countDown(); joinPool(p); } } /** * prestartCoreThread starts a thread if under corePoolSize, else doesn't */ public void testPrestartCoreThread() { ThreadPoolExecutor p = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertEquals(0, p.getPoolSize()); assertTrue(p.prestartCoreThread()); assertEquals(1, p.getPoolSize()); assertTrue(p.prestartCoreThread()); assertEquals(2, p.getPoolSize()); assertFalse(p.prestartCoreThread()); assertEquals(2, p.getPoolSize()); joinPool(p); } /** * prestartAllCoreThreads starts all corePoolSize threads */ public void testPrestartAllCoreThreads() { ThreadPoolExecutor p = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertEquals(0, p.getPoolSize()); p.prestartAllCoreThreads(); assertEquals(2, p.getPoolSize()); p.prestartAllCoreThreads(); assertEquals(2, p.getPoolSize()); joinPool(p); } /** * getCompletedTaskCount increases, but doesn't overestimate, * when tasks complete */ public void testGetCompletedTaskCount() throws InterruptedException { final ThreadPoolExecutor p = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch threadProceed = new CountDownLatch(1); final CountDownLatch threadDone = new CountDownLatch(1); try { assertEquals(0, p.getCompletedTaskCount()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(0, p.getCompletedTaskCount()); threadProceed.await(); threadDone.countDown(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(0, p.getCompletedTaskCount()); threadProceed.countDown(); threadDone.await(); delay(SHORT_DELAY_MS); assertEquals(1, p.getCompletedTaskCount()); } finally { joinPool(p); } } /** * getCorePoolSize returns size given in constructor if not otherwise set */ public void testGetCorePoolSize() { ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertEquals(1, p.getCorePoolSize()); joinPool(p); } /** * getKeepAliveTime returns value given in constructor if not otherwise set */ public void testGetKeepAliveTime() { ThreadPoolExecutor p = new CustomTPE(2, 2, 1000, MILLISECONDS, new ArrayBlockingQueue(10)); assertEquals(1, p.getKeepAliveTime(TimeUnit.SECONDS)); joinPool(p); } /** * getThreadFactory returns factory in constructor if not set */ public void testGetThreadFactory() { ThreadFactory tf = new SimpleThreadFactory(); ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), tf, new NoOpREHandler()); assertSame(tf, p.getThreadFactory()); joinPool(p); } /** * setThreadFactory sets the thread factory returned by getThreadFactory */ public void testSetThreadFactory() { ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); ThreadFactory tf = new SimpleThreadFactory(); p.setThreadFactory(tf); assertSame(tf, p.getThreadFactory()); joinPool(p); } /** * setThreadFactory(null) throws NPE */ public void testSetThreadFactoryNull() { ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { p.setThreadFactory(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(p); } } /** * getRejectedExecutionHandler returns handler in constructor if not set */ public void testGetRejectedExecutionHandler() { RejectedExecutionHandler h = new NoOpREHandler(); ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), h); assertSame(h, p.getRejectedExecutionHandler()); joinPool(p); } /** * setRejectedExecutionHandler sets the handler returned by * getRejectedExecutionHandler */ public void testSetRejectedExecutionHandler() { ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); RejectedExecutionHandler h = new NoOpREHandler(); p.setRejectedExecutionHandler(h); assertSame(h, p.getRejectedExecutionHandler()); joinPool(p); } /** * setRejectedExecutionHandler(null) throws NPE */ public void testSetRejectedExecutionHandlerNull() { ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { p.setRejectedExecutionHandler(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(p); } } /** * getLargestPoolSize increases, but doesn't overestimate, when * multiple threads active */ public void testGetLargestPoolSize() throws InterruptedException { final int THREADS = 3; final ThreadPoolExecutor p = new CustomTPE(THREADS, THREADS, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadsStarted = new CountDownLatch(THREADS); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getLargestPoolSize()); for (int i = 0; i < THREADS; i++) p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadsStarted.countDown(); done.await(); assertEquals(THREADS, p.getLargestPoolSize()); }}); assertTrue(threadsStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(THREADS, p.getLargestPoolSize()); } finally { done.countDown(); joinPool(p); assertEquals(THREADS, p.getLargestPoolSize()); } } /** * getMaximumPoolSize returns value given in constructor if not * otherwise set */ public void testGetMaximumPoolSize() { ThreadPoolExecutor p = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertEquals(2, p.getMaximumPoolSize()); joinPool(p); } /** * getPoolSize increases, but doesn't overestimate, when threads * become active */ public void testGetPoolSize() throws InterruptedException { final ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getPoolSize()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getPoolSize()); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(1, p.getPoolSize()); } finally { done.countDown(); joinPool(p); } } /** * getTaskCount increases, but doesn't overestimate, when tasks submitted */ public void testGetTaskCount() throws InterruptedException { final ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getTaskCount()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getTaskCount()); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(1, p.getTaskCount()); } finally { done.countDown(); joinPool(p); } } /** * isShutdown is false before shutdown, true after */ public void testIsShutdown() { ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertFalse(p.isShutdown()); try { p.shutdown(); } catch (SecurityException ok) { return; } assertTrue(p.isShutdown()); joinPool(p); } /** * isTerminated is false before termination, true after */ public void testIsTerminated() throws InterruptedException { final ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertFalse(p.isTerminating()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(p.isTerminating()); threadStarted.countDown(); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(p.isTerminating()); done.countDown(); } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); assertFalse(p.isTerminating()); } /** * isTerminating is not true when running or when terminated */ public void testIsTerminating() throws InterruptedException { final ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertFalse(p.isTerminating()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(p.isTerminating()); threadStarted.countDown(); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(p.isTerminating()); done.countDown(); } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); assertFalse(p.isTerminating()); } /** * getQueue returns the work queue, which contains queued tasks */ public void testGetQueue() throws InterruptedException { final BlockingQueue q = new ArrayBlockingQueue(10); final ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, q); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { FutureTask[] tasks = new FutureTask[5]; for (int i = 0; i < tasks.length; i++) { Callable task = new CheckedCallable() { public Boolean realCall() throws InterruptedException { threadStarted.countDown(); assertSame(q, p.getQueue()); done.await(); return Boolean.TRUE; }}; tasks[i] = new FutureTask(task); p.execute(tasks[i]); } assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertSame(q, p.getQueue()); assertFalse(q.contains(tasks[0])); assertTrue(q.contains(tasks[tasks.length - 1])); assertEquals(tasks.length - 1, q.size()); } finally { done.countDown(); joinPool(p); } } /** * remove(task) removes queued task, and fails to remove active task */ public void testRemove() throws InterruptedException { BlockingQueue q = new ArrayBlockingQueue(10); final ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, q); Runnable[] tasks = new Runnable[6]; final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { for (int i = 0; i < tasks.length; i++) { tasks[i] = new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); done.await(); }}; p.execute(tasks[i]); } assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(p.remove(tasks[0])); assertTrue(q.contains(tasks[4])); assertTrue(q.contains(tasks[3])); assertTrue(p.remove(tasks[4])); assertFalse(p.remove(tasks[4])); assertFalse(q.contains(tasks[4])); assertTrue(q.contains(tasks[3])); assertTrue(p.remove(tasks[3])); assertFalse(q.contains(tasks[3])); } finally { done.countDown(); joinPool(p); } } /** * purge removes cancelled tasks from the queue */ public void testPurge() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); final BlockingQueue q = new ArrayBlockingQueue(10); final ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, q); FutureTask[] tasks = new FutureTask[5]; try { for (int i = 0; i < tasks.length; i++) { Callable task = new CheckedCallable() { public Boolean realCall() throws InterruptedException { threadStarted.countDown(); done.await(); return Boolean.TRUE; }}; tasks[i] = new FutureTask(task); p.execute(tasks[i]); } assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(tasks.length, p.getTaskCount()); assertEquals(tasks.length - 1, q.size()); assertEquals(1L, p.getActiveCount()); assertEquals(0L, p.getCompletedTaskCount()); tasks[4].cancel(true); tasks[3].cancel(false); p.purge(); assertEquals(tasks.length - 3, q.size()); assertEquals(tasks.length - 2, p.getTaskCount()); p.purge(); // Nothing to do assertEquals(tasks.length - 3, q.size()); assertEquals(tasks.length - 2, p.getTaskCount()); } finally { done.countDown(); joinPool(p); } } /** * shutdownNow returns a list containing tasks that were not run */ public void testShutdownNow() { ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List l; try { for (int i = 0; i < 5; i++) p.execute(new MediumPossiblyInterruptedRunnable()); } finally { try { l = p.shutdownNow(); } catch (SecurityException ok) { return; } } assertTrue(p.isShutdown()); assertTrue(l.size() <= 4); } // Exception Tests /** * Constructor throws if corePoolSize argument is less than zero */ public void testConstructor1() { try { new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is less than zero */ public void testConstructor2() { try { new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is equal to zero */ public void testConstructor3() { try { new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if keepAliveTime is less than zero */ public void testConstructor4() { try { new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue(10)); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if corePoolSize is greater than the maximumPoolSize */ public void testConstructor5() { try { new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if workQueue is set to null */ public void testConstructorNullPointerException() { try { new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if corePoolSize argument is less than zero */ public void testConstructor6() { try { new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new SimpleThreadFactory()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is less than zero */ public void testConstructor7() { try { new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new SimpleThreadFactory()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is equal to zero */ public void testConstructor8() { try { new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new SimpleThreadFactory()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if keepAliveTime is less than zero */ public void testConstructor9() { try { new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue(10),new SimpleThreadFactory()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if corePoolSize is greater than the maximumPoolSize */ public void testConstructor10() { try { new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new SimpleThreadFactory()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if workQueue is set to null */ public void testConstructorNullPointerException2() { try { new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null,new SimpleThreadFactory()); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if threadFactory is set to null */ public void testConstructorNullPointerException3() { try { ThreadFactory f = null; new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue(10),f); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if corePoolSize argument is less than zero */ public void testConstructor11() { try { new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is less than zero */ public void testConstructor12() { try { new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is equal to zero */ public void testConstructor13() { try { new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if keepAliveTime is less than zero */ public void testConstructor14() { try { new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue(10),new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if corePoolSize is greater than the maximumPoolSize */ public void testConstructor15() { try { new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if workQueue is set to null */ public void testConstructorNullPointerException4() { try { new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null,new NoOpREHandler()); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if handler is set to null */ public void testConstructorNullPointerException5() { try { RejectedExecutionHandler r = null; new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue(10),r); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if corePoolSize argument is less than zero */ public void testConstructor16() { try { new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new SimpleThreadFactory(),new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is less than zero */ public void testConstructor17() { try { new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new SimpleThreadFactory(),new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if maximumPoolSize is equal to zero */ public void testConstructor18() { try { new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new SimpleThreadFactory(),new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if keepAliveTime is less than zero */ public void testConstructor19() { try { new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue(10),new SimpleThreadFactory(),new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if corePoolSize is greater than the maximumPoolSize */ public void testConstructor20() { try { new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10),new SimpleThreadFactory(),new NoOpREHandler()); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructor throws if workQueue is null */ public void testConstructorNullPointerException6() { try { new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null,new SimpleThreadFactory(),new NoOpREHandler()); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if handler is null */ public void testConstructorNullPointerException7() { try { RejectedExecutionHandler r = null; new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue(10),new SimpleThreadFactory(),r); shouldThrow(); } catch (NullPointerException success) {} } /** * Constructor throws if ThreadFactory is null */ public void testConstructorNullPointerException8() { try { new CustomTPE(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10), (ThreadFactory) null, new NoOpREHandler()); shouldThrow(); } catch (NullPointerException success) {} } /** * execute throws RejectedExecutionException if saturated. */ public void testSaturatedExecute() { ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1)); final CountDownLatch done = new CountDownLatch(1); try { Runnable task = new CheckedRunnable() { public void realRun() throws InterruptedException { done.await(); }}; for (int i = 0; i < 2; ++i) p.execute(task); for (int i = 0; i < 2; ++i) { try { p.execute(task); shouldThrow(); } catch (RejectedExecutionException success) {} assertTrue(p.getTaskCount() <= 2); } } finally { done.countDown(); joinPool(p); } } /** * executor using CallerRunsPolicy runs task if saturated. */ public void testSaturatedExecute2() { RejectedExecutionHandler h = new CustomTPE.CallerRunsPolicy(); ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { TrackedNoOpRunnable[] tasks = new TrackedNoOpRunnable[5]; for (int i = 0; i < tasks.length; ++i) tasks[i] = new TrackedNoOpRunnable(); TrackedLongRunnable mr = new TrackedLongRunnable(); p.execute(mr); for (int i = 0; i < tasks.length; ++i) p.execute(tasks[i]); for (int i = 1; i < tasks.length; ++i) assertTrue(tasks[i].done); try { p.shutdownNow(); } catch (SecurityException ok) { return; } } finally { joinPool(p); } } /** * executor using DiscardPolicy drops task if saturated. */ public void testSaturatedExecute3() { RejectedExecutionHandler h = new CustomTPE.DiscardPolicy(); ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { TrackedNoOpRunnable[] tasks = new TrackedNoOpRunnable[5]; for (int i = 0; i < tasks.length; ++i) tasks[i] = new TrackedNoOpRunnable(); p.execute(new TrackedLongRunnable()); for (TrackedNoOpRunnable task : tasks) p.execute(task); for (TrackedNoOpRunnable task : tasks) assertFalse(task.done); try { p.shutdownNow(); } catch (SecurityException ok) { return; } } finally { joinPool(p); } } /** * executor using DiscardOldestPolicy drops oldest task if saturated. */ public void testSaturatedExecute4() { RejectedExecutionHandler h = new CustomTPE.DiscardOldestPolicy(); ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { p.execute(new TrackedLongRunnable()); TrackedLongRunnable r2 = new TrackedLongRunnable(); p.execute(r2); assertTrue(p.getQueue().contains(r2)); TrackedNoOpRunnable r3 = new TrackedNoOpRunnable(); p.execute(r3); assertFalse(p.getQueue().contains(r2)); assertTrue(p.getQueue().contains(r3)); try { p.shutdownNow(); } catch (SecurityException ok) { return; } } finally { joinPool(p); } } /** * execute throws RejectedExecutionException if shutdown */ public void testRejectedExecutionExceptionOnShutdown() { ThreadPoolExecutor p = new CustomTPE(1,1,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue(1)); try { p.shutdown(); } catch (SecurityException ok) { return; } try { p.execute(new NoOpRunnable()); shouldThrow(); } catch (RejectedExecutionException success) {} joinPool(p); } /** * execute using CallerRunsPolicy drops task on shutdown */ public void testCallerRunsOnShutdown() { RejectedExecutionHandler h = new CustomTPE.CallerRunsPolicy(); ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { p.shutdown(); } catch (SecurityException ok) { return; } try { TrackedNoOpRunnable r = new TrackedNoOpRunnable(); p.execute(r); assertFalse(r.done); } finally { joinPool(p); } } /** * execute using DiscardPolicy drops task on shutdown */ public void testDiscardOnShutdown() { RejectedExecutionHandler h = new CustomTPE.DiscardPolicy(); ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { p.shutdown(); } catch (SecurityException ok) { return; } try { TrackedNoOpRunnable r = new TrackedNoOpRunnable(); p.execute(r); assertFalse(r.done); } finally { joinPool(p); } } /** * execute using DiscardOldestPolicy drops task on shutdown */ public void testDiscardOldestOnShutdown() { RejectedExecutionHandler h = new CustomTPE.DiscardOldestPolicy(); ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { p.shutdown(); } catch (SecurityException ok) { return; } try { TrackedNoOpRunnable r = new TrackedNoOpRunnable(); p.execute(r); assertFalse(r.done); } finally { joinPool(p); } } /** * execute(null) throws NPE */ public void testExecuteNull() { ThreadPoolExecutor p = null; try { p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue(10)); p.execute(null); shouldThrow(); } catch (NullPointerException success) {} joinPool(p); } /** * setCorePoolSize of negative value throws IllegalArgumentException */ public void testCorePoolSizeIllegalArgumentException() { ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue(10)); try { p.setCorePoolSize(-1); shouldThrow(); } catch (IllegalArgumentException success) { } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } joinPool(p); } /** * setMaximumPoolSize(int) throws IllegalArgumentException * if given a value less the core pool size */ public void testMaximumPoolSizeIllegalArgumentException() { ThreadPoolExecutor p = new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue(10)); try { p.setMaximumPoolSize(1); shouldThrow(); } catch (IllegalArgumentException success) { } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } joinPool(p); } /** * setMaximumPoolSize throws IllegalArgumentException * if given a negative value */ public void testMaximumPoolSizeIllegalArgumentException2() { ThreadPoolExecutor p = new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue(10)); try { p.setMaximumPoolSize(-1); shouldThrow(); } catch (IllegalArgumentException success) { } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } joinPool(p); } /** * setKeepAliveTime throws IllegalArgumentException * when given a negative value */ public void testKeepAliveTimeIllegalArgumentException() { ThreadPoolExecutor p = new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue(10)); try { p.setKeepAliveTime(-1,MILLISECONDS); shouldThrow(); } catch (IllegalArgumentException success) { } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } joinPool(p); } /** * terminated() is called on termination */ public void testTerminated() { CustomTPE p = new CustomTPE(); try { p.shutdown(); } catch (SecurityException ok) { return; } assertTrue(p.terminatedCalled); joinPool(p); } /** * beforeExecute and afterExecute are called when executing task */ public void testBeforeAfter() throws InterruptedException { CustomTPE p = new CustomTPE(); try { TrackedNoOpRunnable r = new TrackedNoOpRunnable(); p.execute(r); delay(SHORT_DELAY_MS); assertTrue(r.done); assertTrue(p.beforeCalled); assertTrue(p.afterCalled); try { p.shutdown(); } catch (SecurityException ok) { return; } } finally { joinPool(p); } } /** * completed submit of callable returns result */ public void testSubmitCallable() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { Future future = e.submit(new StringTask()); String result = future.get(); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * completed submit of runnable returns successfully */ public void testSubmitRunnable() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { Future future = e.submit(new NoOpRunnable()); future.get(); assertTrue(future.isDone()); } finally { joinPool(e); } } /** * completed submit of (runnable, result) returns result */ public void testSubmitRunnable2() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { Future future = e.submit(new NoOpRunnable(), TEST_STRING); String result = future.get(); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * invokeAny(null) throws NPE */ public void testInvokeAny1() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAny(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAny(empty collection) throws IAE */ public void testInvokeAny2() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAny(new ArrayList>()); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * invokeAny(c) throws NPE if c has null elements */ public void testInvokeAny3() throws Exception { CountDownLatch latch = new CountDownLatch(1); ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(latchAwaitingStringTask(latch)); l.add(null); try { e.invokeAny(l); shouldThrow(); } catch (NullPointerException success) { } finally { latch.countDown(); joinPool(e); } } /** * invokeAny(c) throws ExecutionException if no task completes */ public void testInvokeAny4() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * invokeAny(c) returns result of some task */ public void testInvokeAny5() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * invokeAll(null) throws NPE */ public void testInvokeAll1() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAll(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAll(empty collection) returns empty collection */ public void testInvokeAll2() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> r = e.invokeAll(new ArrayList>()); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * invokeAll(c) throws NPE if c has null elements */ public void testInvokeAll3() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of element of invokeAll(c) throws exception on failed task */ public void testInvokeAll4() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * invokeAll(c) returns results of all completed tasks */ public void testInvokeAll5() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } /** * timed invokeAny(null) throws NPE */ public void testTimedInvokeAny1() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAny(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(,,null) throws NPE */ public void testTimedInvokeAnyNullTimeUnit() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(empty collection) throws IAE */ public void testTimedInvokeAny2() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAny(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * timed invokeAny(c) throws NPE if c has null elements */ public void testTimedInvokeAny3() throws Exception { CountDownLatch latch = new CountDownLatch(1); ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(latchAwaitingStringTask(latch)); l.add(null); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { latch.countDown(); joinPool(e); } } /** * timed invokeAny(c) throws ExecutionException if no task completes */ public void testTimedInvokeAny4() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * timed invokeAny(c) returns result of some task */ public void testTimedInvokeAny5() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * timed invokeAll(null) throws NPE */ public void testTimedInvokeAll1() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { e.invokeAll(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(,,null) throws NPE */ public void testTimedInvokeAllNullTimeUnit() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAll(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(empty collection) returns empty collection */ public void testTimedInvokeAll2() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> r = e.invokeAll(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * timed invokeAll(c) throws NPE if c has null elements */ public void testTimedInvokeAll3() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of element of invokeAll(c) throws exception on failed task */ public void testTimedInvokeAll4() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * timed invokeAll(c) returns results of all completed tasks */ public void testTimedInvokeAll5() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } /** * timed invokeAll(c) cancels tasks not completed by timeout */ public void testTimedInvokeAll6() throws Exception { ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(Executors.callable(new MediumPossiblyInterruptedRunnable(), TEST_STRING)); l.add(new StringTask()); List> futures = e.invokeAll(l, SHORT_DELAY_MS, MILLISECONDS); assertEquals(3, futures.size()); Iterator> it = futures.iterator(); Future f1 = it.next(); Future f2 = it.next(); Future f3 = it.next(); assertTrue(f1.isDone()); assertTrue(f2.isDone()); assertTrue(f3.isDone()); assertFalse(f1.isCancelled()); assertTrue(f2.isCancelled()); } finally { joinPool(e); } } /** * Execution continues if there is at least one thread even if * thread factory fails to create more */ public void testFailingThreadFactory() throws InterruptedException { final ExecutorService e = new CustomTPE(100, 100, LONG_DELAY_MS, MILLISECONDS, new LinkedBlockingQueue(), new FailingThreadFactory()); try { final int TASKS = 100; final CountDownLatch done = new CountDownLatch(TASKS); for (int k = 0; k < TASKS; ++k) e.execute(new CheckedRunnable() { public void realRun() { done.countDown(); }}); assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS)); } finally { joinPool(e); } } /** * allowsCoreThreadTimeOut is by default false. */ public void testAllowsCoreThreadTimeOut() { ThreadPoolExecutor p = new CustomTPE(2, 2, 1000, MILLISECONDS, new ArrayBlockingQueue(10)); assertFalse(p.allowsCoreThreadTimeOut()); joinPool(p); } /** * allowCoreThreadTimeOut(true) causes idle threads to time out */ public void testAllowCoreThreadTimeOut_true() throws Exception { final ThreadPoolExecutor p = new CustomTPE(2, 10, SHORT_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); try { p.allowCoreThreadTimeOut(true); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getPoolSize()); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); for (int i = 0; i < (MEDIUM_DELAY_MS/10); i++) { if (p.getPoolSize() == 0) break; delay(10); } assertEquals(0, p.getPoolSize()); } finally { joinPool(p); } } /** * allowCoreThreadTimeOut(false) causes idle threads not to time out */ public void testAllowCoreThreadTimeOut_false() throws Exception { final ThreadPoolExecutor p = new CustomTPE(2, 10, SHORT_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); final CountDownLatch threadStarted = new CountDownLatch(1); try { p.allowCoreThreadTimeOut(false); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertTrue(p.getPoolSize() >= 1); }}); delay(SMALL_DELAY_MS); assertTrue(p.getPoolSize() >= 1); } finally { joinPool(p); } } } jsr166/src/test/tck/LinkedBlockingDequeTest.java0000644000000000000000000014510211560754737016716 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.io.*; public class LinkedBlockingDequeTest extends JSR166TestCase { public static class Unbounded extends BlockingQueueTest { protected BlockingQueue emptyCollection() { return new LinkedBlockingDeque(); } } public static class Bounded extends BlockingQueueTest { protected BlockingQueue emptyCollection() { return new LinkedBlockingDeque(20); } } public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return newTestSuite(LinkedBlockingDequeTest.class, new Unbounded().testSuite(), new Bounded().testSuite()); } /** * Create a deque of given size containing consecutive * Integers 0 ... n. */ private LinkedBlockingDeque populatedDeque(int n) { LinkedBlockingDeque q = new LinkedBlockingDeque(n); assertTrue(q.isEmpty()); for (int i = 0; i < n; i++) assertTrue(q.offer(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(0, q.remainingCapacity()); assertEquals(n, q.size()); return q; } /** * isEmpty is true before add, false after */ public void testEmpty() { LinkedBlockingDeque q = new LinkedBlockingDeque(); assertTrue(q.isEmpty()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.add(new Integer(2)); q.removeFirst(); q.removeFirst(); assertTrue(q.isEmpty()); } /** * size changes when elements added and removed */ public void testSize() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.removeFirst(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * offer(null) throws NPE */ public void testOfferFirstNull() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(); q.offerFirst(null); shouldThrow(); } catch (NullPointerException success) {} } /** * OfferFirst succeeds */ public void testOfferFirst() { LinkedBlockingDeque q = new LinkedBlockingDeque(); assertTrue(q.offerFirst(new Integer(0))); assertTrue(q.offerFirst(new Integer(1))); } /** * OfferLast succeeds */ public void testOfferLast() { LinkedBlockingDeque q = new LinkedBlockingDeque(); assertTrue(q.offerLast(new Integer(0))); assertTrue(q.offerLast(new Integer(1))); } /** * pollFirst succeeds unless empty */ public void testPollFirst() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst()); } assertNull(q.pollFirst()); } /** * pollLast succeeds unless empty */ public void testPollLast() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.pollLast()); } assertNull(q.pollLast()); } /** * peekFirst returns next element, or null if empty */ public void testPeekFirst() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peekFirst()); assertEquals(i, q.pollFirst()); assertTrue(q.peekFirst() == null || !q.peekFirst().equals(i)); } assertNull(q.peekFirst()); } /** * peek returns next element, or null if empty */ public void testPeek() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peek()); assertEquals(i, q.pollFirst()); assertTrue(q.peek() == null || !q.peek().equals(i)); } assertNull(q.peek()); } /** * peekLast returns next element, or null if empty */ public void testPeekLast() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.peekLast()); assertEquals(i, q.pollLast()); assertTrue(q.peekLast() == null || !q.peekLast().equals(i)); } assertNull(q.peekLast()); } /** * getFirst() returns first element, or throws NSEE if empty */ public void testFirstElement() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.getFirst()); assertEquals(i, q.pollFirst()); } try { q.getFirst(); shouldThrow(); } catch (NoSuchElementException success) {} assertNull(q.peekFirst()); } /** * getLast() returns last element, or throws NSEE if empty */ public void testLastElement() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.getLast()); assertEquals(i, q.pollLast()); } try { q.getLast(); shouldThrow(); } catch (NoSuchElementException success) {} assertNull(q.peekLast()); } /** * removeFirst() removes first element, or throws NSEE if empty */ public void testRemoveFirst() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.removeFirst()); } try { q.removeFirst(); shouldThrow(); } catch (NoSuchElementException success) {} assertNull(q.peekFirst()); } /** * removeLast() removes last element, or throws NSEE if empty */ public void testRemoveLast() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = SIZE - 1; i >= 0; --i) { assertEquals(i, q.removeLast()); } try { q.removeLast(); shouldThrow(); } catch (NoSuchElementException success) {} assertNull(q.peekLast()); } /** * remove removes next element, or throws NSEE if empty */ public void testRemove() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remove()); } try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * removeFirstOccurrence(x) removes x and returns true if present */ public void testRemoveFirstOccurrence() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.removeFirstOccurrence(new Integer(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.removeFirstOccurrence(new Integer(i))); assertFalse(q.removeFirstOccurrence(new Integer(i+1))); } assertTrue(q.isEmpty()); } /** * removeLastOccurrence(x) removes x and returns true if present */ public void testRemoveLastOccurrence() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.removeLastOccurrence(new Integer(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.removeLastOccurrence(new Integer(i))); assertFalse(q.removeLastOccurrence(new Integer(i+1))); } assertTrue(q.isEmpty()); } /** * peekFirst returns element inserted with addFirst */ public void testAddFirst() { LinkedBlockingDeque q = populatedDeque(3); q.pollLast(); q.addFirst(four); assertSame(four, q.peekFirst()); } /** * peekLast returns element inserted with addLast */ public void testAddLast() { LinkedBlockingDeque q = populatedDeque(3); q.pollLast(); q.addLast(four); assertSame(four, q.peekLast()); } /** * A new deque has the indicated capacity, or Integer.MAX_VALUE if * none given */ public void testConstructor1() { assertEquals(SIZE, new LinkedBlockingDeque(SIZE).remainingCapacity()); assertEquals(Integer.MAX_VALUE, new LinkedBlockingDeque().remainingCapacity()); } /** * Constructor throws IAE if capacity argument nonpositive */ public void testConstructor2() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws NPE */ public void testConstructor4() { try { Integer[] ints = new Integer[SIZE]; LinkedBlockingDeque q = new LinkedBlockingDeque(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection with some null elements throws NPE */ public void testConstructor5() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); LinkedBlockingDeque q = new LinkedBlockingDeque(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Deque contains all elements of collection used to initialize */ public void testConstructor6() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); LinkedBlockingDeque q = new LinkedBlockingDeque(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * Deque transitions from empty to full when elements added */ public void testEmptyFull() { LinkedBlockingDeque q = new LinkedBlockingDeque(2); assertTrue(q.isEmpty()); assertEquals("should have room for 2", 2, q.remainingCapacity()); q.add(one); assertFalse(q.isEmpty()); q.add(two); assertFalse(q.isEmpty()); assertEquals(0, q.remainingCapacity()); assertFalse(q.offer(three)); } /** * remainingCapacity decreases on add, increases on remove */ public void testRemainingCapacity() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remainingCapacity()); assertEquals(SIZE-i, q.size()); q.remove(); } for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.remainingCapacity()); assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * offer(null) throws NPE */ public void testOfferNull() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(1); q.offer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * add(null) throws NPE */ public void testAddNull() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(1); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * push(null) throws NPE */ public void testPushNull() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(1); q.push(null); shouldThrow(); } catch (NullPointerException success) {} } /** * push succeeds if not full; throws ISE if full */ public void testPush() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); for (int i = 0; i < SIZE; ++i) { Integer I = new Integer(i); q.push(I); assertEquals(I, q.peek()); } assertEquals(0, q.remainingCapacity()); q.push(new Integer(SIZE)); shouldThrow(); } catch (IllegalStateException success) {} } /** * peekFirst returns element inserted with push */ public void testPushWithPeek() { LinkedBlockingDeque q = populatedDeque(3); q.pollLast(); q.push(four); assertSame(four, q.peekFirst()); } /** * pop removes next element, or throws NSEE if empty */ public void testPop() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pop()); } try { q.pop(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * Offer succeeds if not full; fails if full */ public void testOffer() { LinkedBlockingDeque q = new LinkedBlockingDeque(1); assertTrue(q.offer(zero)); assertFalse(q.offer(one)); } /** * add succeeds if not full; throws ISE if full */ public void testAdd() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.add(new Integer(i))); } assertEquals(0, q.remainingCapacity()); q.add(new Integer(SIZE)); shouldThrow(); } catch (IllegalStateException success) {} } /** * addAll(null) throws NPE */ public void testAddAll1() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(1); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll(this) throws IAE */ public void testAddAllSelf() { try { LinkedBlockingDeque q = populatedDeque(SIZE); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll throws ISE if not enough room */ public void testAddAll4() { try { LinkedBlockingDeque q = new LinkedBlockingDeque(1); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (IllegalStateException success) {} } /** * Deque contains all elements, in traversal order, of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * put(null) throws NPE */ public void testPutNull() throws InterruptedException { try { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); q.put(null); shouldThrow(); } catch (NullPointerException success) {} } /** * all elements successfully put are contained */ public void testPut() throws InterruptedException { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); for (int i = 0; i < SIZE; ++i) { Integer I = new Integer(i); q.put(I); assertTrue(q.contains(I)); } assertEquals(0, q.remainingCapacity()); } /** * put blocks interruptibly if full */ public void testBlockingPut() throws InterruptedException { final LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) q.put(i); assertEquals(SIZE, q.size()); assertEquals(0, q.remainingCapacity()); try { q.put(99); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(SIZE, q.size()); assertEquals(0, q.remainingCapacity()); } /** * put blocks waiting for take when full */ public void testPutWithTake() throws InterruptedException { final int capacity = 2; final LinkedBlockingDeque q = new LinkedBlockingDeque(capacity); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < capacity + 1; i++) q.put(i); try { q.put(99); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); assertEquals(q.remainingCapacity(), 0); assertEquals(0, q.take()); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(q.remainingCapacity(), 0); } /** * timed offer times out if full and elements not taken */ public void testTimedOffer() throws InterruptedException { final LinkedBlockingDeque q = new LinkedBlockingDeque(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.put(new Object()); q.put(new Object()); assertFalse(q.offer(new Object(), SHORT_DELAY_MS, MILLISECONDS)); try { q.offer(new Object(), LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SMALL_DELAY_MS); t.interrupt(); t.join(); } /** * take retrieves elements in FIFO order */ public void testTake() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } } /** * Take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { final LinkedBlockingDeque q = populatedDeque(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } try { q.take(); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * poll succeeds unless empty */ public void testPoll() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll()); } assertNull(q.poll()); } /** * timed poll with zero timeout succeeds when non-empty, else times out */ public void testTimedPoll0() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll(0, MILLISECONDS)); } assertNull(q.poll(0, MILLISECONDS)); } /** * timed poll with nonzero timeout succeeds when non-empty, else times out */ public void testTimedPoll() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll(SHORT_DELAY_MS, MILLISECONDS)); } assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); } /** * Interrupted timed poll throws InterruptedException instead of * returning timeout status */ public void testInterruptedTimedPoll() throws InterruptedException { final BlockingQueue q = populatedDeque(SIZE); final CountDownLatch aboutToWait = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { long t0 = System.nanoTime(); assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); } long t0 = System.nanoTime(); aboutToWait.countDown(); try { q.poll(MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); } }}); aboutToWait.await(); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); checkEmpty(q); } /** * putFirst(null) throws NPE */ public void testPutFirstNull() throws InterruptedException { try { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); q.putFirst(null); shouldThrow(); } catch (NullPointerException success) {} } /** * all elements successfully putFirst are contained */ public void testPutFirst() throws InterruptedException { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); for (int i = 0; i < SIZE; ++i) { Integer I = new Integer(i); q.putFirst(I); assertTrue(q.contains(I)); } assertEquals(0, q.remainingCapacity()); } /** * putFirst blocks interruptibly if full */ public void testBlockingPutFirst() throws InterruptedException { final LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) q.putFirst(i); assertEquals(SIZE, q.size()); assertEquals(0, q.remainingCapacity()); try { q.putFirst(99); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(SIZE, q.size()); assertEquals(0, q.remainingCapacity()); } /** * putFirst blocks waiting for take when full */ public void testPutFirstWithTake() throws InterruptedException { final int capacity = 2; final LinkedBlockingDeque q = new LinkedBlockingDeque(capacity); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < capacity + 1; i++) q.putFirst(i); try { q.putFirst(99); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); assertEquals(q.remainingCapacity(), 0); assertEquals(capacity - 1, q.take()); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(q.remainingCapacity(), 0); } /** * timed offerFirst times out if full and elements not taken */ public void testTimedOfferFirst() throws InterruptedException { final LinkedBlockingDeque q = new LinkedBlockingDeque(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.putFirst(new Object()); q.putFirst(new Object()); assertFalse(q.offerFirst(new Object(), SHORT_DELAY_MS, MILLISECONDS)); try { q.offerFirst(new Object(), LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SMALL_DELAY_MS); t.interrupt(); t.join(); } /** * take retrieves elements in FIFO order */ public void testTakeFirst() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.takeFirst()); } } /** * takeFirst blocks interruptibly when empty */ public void testTakeFirstFromEmpty() throws InterruptedException { final LinkedBlockingDeque q = new LinkedBlockingDeque(2); Thread t = new ThreadShouldThrow(InterruptedException.class) { public void realRun() throws InterruptedException { q.takeFirst(); }}; t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * TakeFirst removes existing elements until empty, then blocks interruptibly */ public void testBlockingTakeFirst() throws InterruptedException { final LinkedBlockingDeque q = populatedDeque(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) assertEquals(i, q.takeFirst()); try { q.takeFirst(); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * timed pollFirst with zero timeout succeeds when non-empty, else times out */ public void testTimedPollFirst0() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst(0, MILLISECONDS)); } assertNull(q.pollFirst(0, MILLISECONDS)); } /** * timed pollFirst with nonzero timeout succeeds when non-empty, else times out */ public void testTimedPollFirst() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst(SHORT_DELAY_MS, MILLISECONDS)); } assertNull(q.pollFirst(SHORT_DELAY_MS, MILLISECONDS)); } /** * Interrupted timed pollFirst throws InterruptedException instead of * returning timeout status */ public void testInterruptedTimedPollFirst() throws InterruptedException { Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst(SHORT_DELAY_MS, MILLISECONDS)); } try { q.pollFirst(SMALL_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * timed pollFirst before a delayed offerFirst fails; after offerFirst succeeds; * on interruption throws */ public void testTimedPollFirstWithOfferFirst() throws InterruptedException { final LinkedBlockingDeque q = new LinkedBlockingDeque(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertNull(q.pollFirst(SHORT_DELAY_MS, MILLISECONDS)); assertSame(zero, q.pollFirst(LONG_DELAY_MS, MILLISECONDS)); try { q.pollFirst(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SMALL_DELAY_MS); assertTrue(q.offerFirst(zero, SHORT_DELAY_MS, MILLISECONDS)); t.interrupt(); t.join(); } /** * putLast(null) throws NPE */ public void testPutLastNull() throws InterruptedException { try { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); q.putLast(null); shouldThrow(); } catch (NullPointerException success) {} } /** * all elements successfully putLast are contained */ public void testPutLast() throws InterruptedException { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); for (int i = 0; i < SIZE; ++i) { Integer I = new Integer(i); q.putLast(I); assertTrue(q.contains(I)); } assertEquals(0, q.remainingCapacity()); } /** * putLast blocks interruptibly if full */ public void testBlockingPutLast() throws InterruptedException { final LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) q.putLast(i); assertEquals(SIZE, q.size()); assertEquals(0, q.remainingCapacity()); try { q.putLast(99); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(SIZE, q.size()); assertEquals(0, q.remainingCapacity()); } /** * putLast blocks waiting for take when full */ public void testPutLastWithTake() throws InterruptedException { final int capacity = 2; final LinkedBlockingDeque q = new LinkedBlockingDeque(capacity); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < capacity + 1; i++) q.putLast(i); try { q.putLast(99); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); assertEquals(q.remainingCapacity(), 0); assertEquals(0, q.take()); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(q.remainingCapacity(), 0); } /** * timed offerLast times out if full and elements not taken */ public void testTimedOfferLast() throws InterruptedException { final LinkedBlockingDeque q = new LinkedBlockingDeque(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.putLast(new Object()); q.putLast(new Object()); assertFalse(q.offerLast(new Object(), SHORT_DELAY_MS, MILLISECONDS)); try { q.offerLast(new Object(), LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SMALL_DELAY_MS); t.interrupt(); t.join(); } /** * takeLast retrieves elements in FIFO order */ public void testTakeLast() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i-1, q.takeLast()); } } /** * takeLast blocks interruptibly when empty */ public void testTakeLastFromEmpty() throws InterruptedException { final LinkedBlockingDeque q = new LinkedBlockingDeque(2); Thread t = new ThreadShouldThrow(InterruptedException.class) { public void realRun() throws InterruptedException { q.takeLast(); }}; t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * TakeLast removes existing elements until empty, then blocks interruptibly */ public void testBlockingTakeLast() throws InterruptedException { final LinkedBlockingDeque q = populatedDeque(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) assertEquals(SIZE - 1 - i, q.takeLast()); try { q.takeLast(); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * timed pollLast with zero timeout succeeds when non-empty, else times out */ public void testTimedPollLast0() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i-1, q.pollLast(0, MILLISECONDS)); } assertNull(q.pollLast(0, MILLISECONDS)); } /** * timed pollLast with nonzero timeout succeeds when non-empty, else times out */ public void testTimedPollLast() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i-1, q.pollLast(SHORT_DELAY_MS, MILLISECONDS)); } assertNull(q.pollLast(SHORT_DELAY_MS, MILLISECONDS)); } /** * Interrupted timed pollLast throws InterruptedException instead of * returning timeout status */ public void testInterruptedTimedPollLast() throws InterruptedException { Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i-1, q.pollLast(SHORT_DELAY_MS, MILLISECONDS)); } try { q.pollLast(SMALL_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * timed poll before a delayed offerLast fails; after offerLast succeeds; * on interruption throws */ public void testTimedPollWithOfferLast() throws InterruptedException { final LinkedBlockingDeque q = new LinkedBlockingDeque(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS)); try { q.poll(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SMALL_DELAY_MS); assertTrue(q.offerLast(zero, SHORT_DELAY_MS, MILLISECONDS)); t.interrupt(); t.join(); } /** * element returns next element, or throws NSEE if empty */ public void testElement() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.element()); q.poll(); } try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { LinkedBlockingDeque q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.poll(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { LinkedBlockingDeque q = populatedDeque(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); assertEquals(SIZE, q.remainingCapacity()); q.add(one); assertFalse(q.isEmpty()); assertTrue(q.contains(one)); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { LinkedBlockingDeque q = populatedDeque(SIZE); LinkedBlockingDeque p = new LinkedBlockingDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { LinkedBlockingDeque q = populatedDeque(SIZE); LinkedBlockingDeque p = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.remove(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { LinkedBlockingDeque q = populatedDeque(SIZE); LinkedBlockingDeque p = populatedDeque(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.remove()); assertFalse(q.contains(I)); } } } /** * toArray contains all elements in FIFO order */ public void testToArray() throws InterruptedException{ LinkedBlockingDeque q = populatedDeque(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) assertSame(o[i], q.poll()); } /** * toArray(a) contains all elements in FIFO order */ public void testToArray2() { LinkedBlockingDeque q = populatedDeque(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.remove()); } /** * toArray(null) throws NullPointerException */ public void testToArray_NullArg() { LinkedBlockingDeque q = populatedDeque(SIZE); try { q.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { LinkedBlockingDeque q = populatedDeque(SIZE); try { q.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * iterator iterates through all elements */ public void testIterator() throws InterruptedException { LinkedBlockingDeque q = populatedDeque(SIZE); Iterator it = q.iterator(); while (it.hasNext()) { assertEquals(it.next(), q.take()); } } /** * iterator.remove removes current element */ public void testIteratorRemove() { final LinkedBlockingDeque q = new LinkedBlockingDeque(3); q.add(two); q.add(one); q.add(three); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertSame(it.next(), one); assertSame(it.next(), three); assertFalse(it.hasNext()); } /** * iterator ordering is FIFO */ public void testIteratorOrdering() { final LinkedBlockingDeque q = new LinkedBlockingDeque(3); q.add(one); q.add(two); q.add(three); assertEquals(0, q.remainingCapacity()); int k = 0; for (Iterator it = q.iterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); } /** * Modifications do not cause iterators to fail */ public void testWeaklyConsistentIteration() { final LinkedBlockingDeque q = new LinkedBlockingDeque(3); q.add(one); q.add(two); q.add(three); for (Iterator it = q.iterator(); it.hasNext();) { q.remove(); it.next(); } assertEquals(0, q.size()); } /** * Descending iterator iterates through all elements */ public void testDescendingIterator() { LinkedBlockingDeque q = populatedDeque(SIZE); int i = 0; Iterator it = q.descendingIterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); assertFalse(it.hasNext()); try { it.next(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * Descending iterator ordering is reverse FIFO */ public void testDescendingIteratorOrdering() { final LinkedBlockingDeque q = new LinkedBlockingDeque(); for (int iters = 0; iters < 100; ++iters) { q.add(new Integer(3)); q.add(new Integer(2)); q.add(new Integer(1)); int k = 0; for (Iterator it = q.descendingIterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); q.remove(); q.remove(); q.remove(); } } /** * descendingIterator.remove removes current element */ public void testDescendingIteratorRemove() { final LinkedBlockingDeque q = new LinkedBlockingDeque(); for (int iters = 0; iters < 100; ++iters) { q.add(new Integer(3)); q.add(new Integer(2)); q.add(new Integer(1)); Iterator it = q.descendingIterator(); assertEquals(it.next(), new Integer(1)); it.remove(); assertEquals(it.next(), new Integer(2)); it = q.descendingIterator(); assertEquals(it.next(), new Integer(2)); assertEquals(it.next(), new Integer(3)); it.remove(); assertFalse(it.hasNext()); q.remove(); } } /** * toString contains toStrings of elements */ public void testToString() { LinkedBlockingDeque q = populatedDeque(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * offer transfers elements across Executor tasks */ public void testOfferInExecutor() { final LinkedBlockingDeque q = new LinkedBlockingDeque(2); q.add(one); q.add(two); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(q.offer(three)); assertTrue(q.offer(three, MEDIUM_DELAY_MS, MILLISECONDS)); assertEquals(0, q.remainingCapacity()); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { delay(SMALL_DELAY_MS); assertSame(one, q.take()); }}); joinPool(executor); } /** * poll retrieves elements across Executor threads */ public void testPollInExecutor() { final LinkedBlockingDeque q = new LinkedBlockingDeque(2); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertNull(q.poll()); assertSame(one, q.poll(MEDIUM_DELAY_MS, MILLISECONDS)); assertTrue(q.isEmpty()); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { delay(SMALL_DELAY_MS); q.put(one); }}); joinPool(executor); } /** * A deserialized serialized deque has same elements in same order */ public void testSerialization() throws Exception { LinkedBlockingDeque q = populatedDeque(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); LinkedBlockingDeque r = (LinkedBlockingDeque)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.remove(), r.remove()); } /** * drainTo(null) throws NPE */ public void testDrainToNull() { LinkedBlockingDeque q = populatedDeque(SIZE); try { q.drainTo(null); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this) throws IAE */ public void testDrainToSelf() { LinkedBlockingDeque q = populatedDeque(SIZE); try { q.drainTo(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c) empties deque into another collection c */ public void testDrainTo() { LinkedBlockingDeque q = populatedDeque(SIZE); ArrayList l = new ArrayList(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), SIZE); for (int i = 0; i < SIZE; ++i) assertEquals(l.get(i), new Integer(i)); q.add(zero); q.add(one); assertFalse(q.isEmpty()); assertTrue(q.contains(zero)); assertTrue(q.contains(one)); l.clear(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), 2); for (int i = 0; i < 2; ++i) assertEquals(l.get(i), new Integer(i)); } /** * drainTo empties full deque, unblocking a waiting put. */ public void testDrainToWithActivePut() throws InterruptedException { final LinkedBlockingDeque q = populatedDeque(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.put(new Integer(SIZE+1)); }}); t.start(); ArrayList l = new ArrayList(); q.drainTo(l); assertTrue(l.size() >= SIZE); for (int i = 0; i < SIZE; ++i) assertEquals(l.get(i), new Integer(i)); t.join(); assertTrue(q.size() + l.size() >= SIZE); } /** * drainTo(null, n) throws NPE */ public void testDrainToNullN() { LinkedBlockingDeque q = populatedDeque(SIZE); try { q.drainTo(null, 0); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this, n) throws IAE */ public void testDrainToSelfN() { LinkedBlockingDeque q = populatedDeque(SIZE); try { q.drainTo(q, 0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c, n) empties first min(n, size) elements of queue into c */ public void testDrainToN() { LinkedBlockingDeque q = new LinkedBlockingDeque(); for (int i = 0; i < SIZE + 2; ++i) { for (int j = 0; j < SIZE; j++) assertTrue(q.offer(new Integer(j))); ArrayList l = new ArrayList(); q.drainTo(l, i); int k = (i < SIZE) ? i : SIZE; assertEquals(l.size(), k); assertEquals(q.size(), SIZE-k); for (int j = 0; j < k; ++j) assertEquals(l.get(j), new Integer(j)); while (q.poll() != null) ; } } } jsr166/src/test/tck/TreeSubSetTest.java0000644000000000000000000007424711537741073015104 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class TreeSubSetTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(TreeSubSetTest.class); } static class MyReverseComparator implements Comparator { public int compare(Object x, Object y) { return ((Comparable)y).compareTo(x); } } /** * Create a set of given size containing consecutive * Integers 0 ... n. */ private NavigableSet populatedSet(int n) { TreeSet q = new TreeSet(); assertTrue(q.isEmpty()); for (int i = n-1; i >= 0; i-=2) assertTrue(q.add(new Integer(i))); for (int i = (n & 1); i < n; i+=2) assertTrue(q.add(new Integer(i))); assertTrue(q.add(new Integer(-n))); assertTrue(q.add(new Integer(n))); NavigableSet s = q.subSet(new Integer(0), true, new Integer(n), false); assertFalse(s.isEmpty()); assertEquals(n, s.size()); return s; } /** * Create set of first 5 ints */ private NavigableSet set5() { TreeSet q = new TreeSet(); assertTrue(q.isEmpty()); q.add(one); q.add(two); q.add(three); q.add(four); q.add(five); q.add(zero); q.add(seven); NavigableSet s = q.subSet(one, true, seven, false); assertEquals(5, s.size()); return s; } private NavigableSet dset5() { TreeSet q = new TreeSet(); assertTrue(q.isEmpty()); q.add(m1); q.add(m2); q.add(m3); q.add(m4); q.add(m5); NavigableSet s = q.descendingSet(); assertEquals(5, s.size()); return s; } private static NavigableSet set0() { TreeSet set = new TreeSet(); assertTrue(set.isEmpty()); return set.tailSet(m1, false); } private static NavigableSet dset0() { TreeSet set = new TreeSet(); assertTrue(set.isEmpty()); return set; } /** * A new set has unbounded capacity */ public void testConstructor1() { assertEquals(0, set0().size()); } /** * isEmpty is true before add, false after */ public void testEmpty() { NavigableSet q = set0(); assertTrue(q.isEmpty()); assertTrue(q.add(new Integer(1))); assertFalse(q.isEmpty()); assertTrue(q.add(new Integer(2))); q.pollFirst(); q.pollFirst(); assertTrue(q.isEmpty()); } /** * size changes when elements added and removed */ public void testSize() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.pollFirst(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * add(null) throws NPE */ public void testAddNull() { try { NavigableSet q = set0(); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Add of comparable element succeeds */ public void testAdd() { NavigableSet q = set0(); assertTrue(q.add(six)); } /** * Add of duplicate element fails */ public void testAddDup() { NavigableSet q = set0(); assertTrue(q.add(six)); assertFalse(q.add(six)); } /** * Add of non-Comparable throws CCE */ public void testAddNonComparable() { try { NavigableSet q = set0(); q.add(new Object()); q.add(new Object()); q.add(new Object()); shouldThrow(); } catch (ClassCastException success) {} } /** * addAll(null) throws NPE */ public void testAddAll1() { try { NavigableSet q = set0(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { NavigableSet q = set0(); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { NavigableSet q = set0(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i+SIZE); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Set contains all elements of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(SIZE-1- i); NavigableSet q = set0(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(new Integer(i), q.pollFirst()); } /** * poll succeeds unless empty */ public void testPoll() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst()); } assertNull(q.pollFirst()); } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { NavigableSet q = populatedSet(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.pollFirst(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { NavigableSet q = populatedSet(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); assertTrue(q.add(new Integer(1))); assertFalse(q.isEmpty()); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { NavigableSet q = populatedSet(SIZE); NavigableSet p = set0(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { NavigableSet q = populatedSet(SIZE); NavigableSet p = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.pollFirst(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { NavigableSet q = populatedSet(SIZE); NavigableSet p = populatedSet(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.pollFirst()); assertFalse(q.contains(I)); } } } /** * lower returns preceding element */ public void testLower() { NavigableSet q = set5(); Object e1 = q.lower(three); assertEquals(two, e1); Object e2 = q.lower(six); assertEquals(five, e2); Object e3 = q.lower(one); assertNull(e3); Object e4 = q.lower(zero); assertNull(e4); } /** * higher returns next element */ public void testHigher() { NavigableSet q = set5(); Object e1 = q.higher(three); assertEquals(four, e1); Object e2 = q.higher(zero); assertEquals(one, e2); Object e3 = q.higher(five); assertNull(e3); Object e4 = q.higher(six); assertNull(e4); } /** * floor returns preceding element */ public void testFloor() { NavigableSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); } /** * ceiling returns next element */ public void testCeiling() { NavigableSet q = set5(); Object e1 = q.ceiling(three); assertEquals(three, e1); Object e2 = q.ceiling(zero); assertEquals(one, e2); Object e3 = q.ceiling(five); assertEquals(five, e3); Object e4 = q.ceiling(six); assertNull(e4); } /** * toArray contains all elements in sorted order */ public void testToArray() { NavigableSet q = populatedSet(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) assertSame(o[i], q.pollFirst()); } /** * toArray(a) contains all elements in sorted order */ public void testToArray2() { NavigableSet q = populatedSet(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.pollFirst()); } /** * iterator iterates through all elements */ public void testIterator() { NavigableSet q = populatedSet(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * iterator of empty set has no elements */ public void testEmptyIterator() { NavigableSet q = set0(); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, 0); } /** * iterator.remove removes current element */ public void testIteratorRemove() { final NavigableSet q = set0(); q.add(new Integer(2)); q.add(new Integer(1)); q.add(new Integer(3)); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertEquals(it.next(), 2); assertEquals(it.next(), 3); assertFalse(it.hasNext()); } /** * toString contains toStrings of elements */ public void testToString() { NavigableSet q = populatedSet(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * A deserialized serialized set has same elements */ public void testSerialization() throws Exception { NavigableSet q = populatedSet(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); NavigableSet r = (NavigableSet)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.pollFirst(), r.pollFirst()); } /** * subSet returns set with keys in requested range */ public void testSubSetContents() { NavigableSet set = set5(); SortedSet sm = set.subSet(two, four); assertEquals(two, sm.first()); assertEquals(three, sm.last()); assertEquals(2, sm.size()); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(two)); assertEquals(4, set.size()); assertEquals(1, sm.size()); assertEquals(three, sm.first()); assertEquals(three, sm.last()); assertTrue(sm.remove(three)); assertTrue(sm.isEmpty()); assertEquals(3, set.size()); } public void testSubSetContents2() { NavigableSet set = set5(); SortedSet sm = set.subSet(two, three); assertEquals(1, sm.size()); assertEquals(two, sm.first()); assertEquals(two, sm.last()); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertFalse(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(two)); assertEquals(4, set.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertFalse(sm.remove(three)); assertEquals(4, set.size()); } /** * headSet returns set with keys in requested range */ public void testHeadSetContents() { NavigableSet set = set5(); SortedSet sm = set.headSet(four); assertTrue(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(one, k); k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, set.size()); assertEquals(four, set.first()); } /** * tailSet returns set with keys in requested range */ public void testTailSetContents() { NavigableSet set = set5(); SortedSet sm = set.tailSet(two); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertTrue(sm.contains(four)); assertTrue(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); k = (Integer)(i.next()); assertEquals(four, k); k = (Integer)(i.next()); assertEquals(five, k); assertFalse(i.hasNext()); SortedSet ssm = sm.tailSet(four); assertEquals(four, ssm.first()); assertEquals(five, ssm.last()); assertTrue(ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, set.size()); } /** * size changes when elements added and removed */ public void testDescendingSize() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.pollFirst(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * Add of comparable element succeeds */ public void testDescendingAdd() { NavigableSet q = dset0(); assertTrue(q.add(m6)); } /** * Add of duplicate element fails */ public void testDescendingAddDup() { NavigableSet q = dset0(); assertTrue(q.add(m6)); assertFalse(q.add(m6)); } /** * Add of non-Comparable throws CCE */ public void testDescendingAddNonComparable() { try { NavigableSet q = dset0(); q.add(new Object()); q.add(new Object()); q.add(new Object()); shouldThrow(); } catch (ClassCastException success) {} } /** * addAll(null) throws NPE */ public void testDescendingAddAll1() { try { NavigableSet q = dset0(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testDescendingAddAll2() { try { NavigableSet q = dset0(); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testDescendingAddAll3() { try { NavigableSet q = dset0(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i+SIZE); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Set contains all elements of successful addAll */ public void testDescendingAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(SIZE-1- i); NavigableSet q = dset0(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(new Integer(i), q.pollFirst()); } /** * poll succeeds unless empty */ public void testDescendingPoll() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst()); } assertNull(q.pollFirst()); } /** * remove(x) removes x and returns true if present */ public void testDescendingRemoveElement() { NavigableSet q = populatedSet(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.remove(new Integer(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.remove(new Integer(i))); assertFalse(q.remove(new Integer(i+1))); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testDescendingContains() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.pollFirst(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testDescendingClear() { NavigableSet q = populatedSet(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); assertTrue(q.add(new Integer(1))); assertFalse(q.isEmpty()); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testDescendingContainsAll() { NavigableSet q = populatedSet(SIZE); NavigableSet p = dset0(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testDescendingRetainAll() { NavigableSet q = populatedSet(SIZE); NavigableSet p = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.pollFirst(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testDescendingRemoveAll() { for (int i = 1; i < SIZE; ++i) { NavigableSet q = populatedSet(SIZE); NavigableSet p = populatedSet(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.pollFirst()); assertFalse(q.contains(I)); } } } /** * lower returns preceding element */ public void testDescendingLower() { NavigableSet q = dset5(); Object e1 = q.lower(m3); assertEquals(m2, e1); Object e2 = q.lower(m6); assertEquals(m5, e2); Object e3 = q.lower(m1); assertNull(e3); Object e4 = q.lower(zero); assertNull(e4); } /** * higher returns next element */ public void testDescendingHigher() { NavigableSet q = dset5(); Object e1 = q.higher(m3); assertEquals(m4, e1); Object e2 = q.higher(zero); assertEquals(m1, e2); Object e3 = q.higher(m5); assertNull(e3); Object e4 = q.higher(m6); assertNull(e4); } /** * floor returns preceding element */ public void testDescendingFloor() { NavigableSet q = dset5(); Object e1 = q.floor(m3); assertEquals(m3, e1); Object e2 = q.floor(m6); assertEquals(m5, e2); Object e3 = q.floor(m1); assertEquals(m1, e3); Object e4 = q.floor(zero); assertNull(e4); } /** * ceiling returns next element */ public void testDescendingCeiling() { NavigableSet q = dset5(); Object e1 = q.ceiling(m3); assertEquals(m3, e1); Object e2 = q.ceiling(zero); assertEquals(m1, e2); Object e3 = q.ceiling(m5); assertEquals(m5, e3); Object e4 = q.ceiling(m6); assertNull(e4); } /** * toArray contains all elements */ public void testDescendingToArray() { NavigableSet q = populatedSet(SIZE); Object[] o = q.toArray(); Arrays.sort(o); for (int i = 0; i < o.length; i++) assertEquals(o[i], q.pollFirst()); } /** * toArray(a) contains all elements */ public void testDescendingToArray2() { NavigableSet q = populatedSet(SIZE); Integer[] ints = new Integer[SIZE]; assertSame(ints, q.toArray(ints)); Arrays.sort(ints); for (int i = 0; i < ints.length; i++) assertEquals(ints[i], q.pollFirst()); } /** * iterator iterates through all elements */ public void testDescendingIterator() { NavigableSet q = populatedSet(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * iterator of empty set has no elements */ public void testDescendingEmptyIterator() { NavigableSet q = dset0(); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, 0); } /** * iterator.remove removes current element */ public void testDescendingIteratorRemove() { final NavigableSet q = dset0(); q.add(new Integer(2)); q.add(new Integer(1)); q.add(new Integer(3)); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertEquals(it.next(), 2); assertEquals(it.next(), 3); assertFalse(it.hasNext()); } /** * toString contains toStrings of elements */ public void testDescendingToString() { NavigableSet q = populatedSet(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * A deserialized serialized set has same elements */ public void testDescendingSerialization() throws Exception { NavigableSet q = populatedSet(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); NavigableSet r = (NavigableSet)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.pollFirst(), r.pollFirst()); } /** * subSet returns set with keys in requested range */ public void testDescendingSubSetContents() { NavigableSet set = dset5(); SortedSet sm = set.subSet(m2, m4); assertEquals(m2, sm.first()); assertEquals(m3, sm.last()); assertEquals(2, sm.size()); assertFalse(sm.contains(m1)); assertTrue(sm.contains(m2)); assertTrue(sm.contains(m3)); assertFalse(sm.contains(m4)); assertFalse(sm.contains(m5)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(m2)); assertEquals(4, set.size()); assertEquals(1, sm.size()); assertEquals(m3, sm.first()); assertEquals(m3, sm.last()); assertTrue(sm.remove(m3)); assertTrue(sm.isEmpty()); assertEquals(3, set.size()); } public void testDescendingSubSetContents2() { NavigableSet set = dset5(); SortedSet sm = set.subSet(m2, m3); assertEquals(1, sm.size()); assertEquals(m2, sm.first()); assertEquals(m2, sm.last()); assertFalse(sm.contains(m1)); assertTrue(sm.contains(m2)); assertFalse(sm.contains(m3)); assertFalse(sm.contains(m4)); assertFalse(sm.contains(m5)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(m2)); assertEquals(4, set.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertFalse(sm.remove(m3)); assertEquals(4, set.size()); } /** * headSet returns set with keys in requested range */ public void testDescendingHeadSetContents() { NavigableSet set = dset5(); SortedSet sm = set.headSet(m4); assertTrue(sm.contains(m1)); assertTrue(sm.contains(m2)); assertTrue(sm.contains(m3)); assertFalse(sm.contains(m4)); assertFalse(sm.contains(m5)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(m1, k); k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, set.size()); assertEquals(m4, set.first()); } /** * tailSet returns set with keys in requested range */ public void testDescendingTailSetContents() { NavigableSet set = dset5(); SortedSet sm = set.tailSet(m2); assertFalse(sm.contains(m1)); assertTrue(sm.contains(m2)); assertTrue(sm.contains(m3)); assertTrue(sm.contains(m4)); assertTrue(sm.contains(m5)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); k = (Integer)(i.next()); assertEquals(m4, k); k = (Integer)(i.next()); assertEquals(m5, k); assertFalse(i.hasNext()); SortedSet ssm = sm.tailSet(m4); assertEquals(m4, ssm.first()); assertEquals(m5, ssm.last()); assertTrue(ssm.remove(m4)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, set.size()); } } jsr166/src/test/tck/ReentrantLockTest.java0000644000000000000000000010466711561313576015632 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.locks.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.*; import java.io.*; public class ReentrantLockTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ReentrantLockTest.class); } /** * A runnable calling lockInterruptibly */ class InterruptibleLockRunnable extends CheckedRunnable { final ReentrantLock lock; InterruptibleLockRunnable(ReentrantLock l) { lock = l; } public void realRun() throws InterruptedException { lock.lockInterruptibly(); } } /** * A runnable calling lockInterruptibly that expects to be * interrupted */ class InterruptedLockRunnable extends CheckedInterruptedRunnable { final ReentrantLock lock; InterruptedLockRunnable(ReentrantLock l) { lock = l; } public void realRun() throws InterruptedException { lock.lockInterruptibly(); } } /** * Subclass to expose protected methods */ static class PublicReentrantLock extends ReentrantLock { PublicReentrantLock() { super(); } PublicReentrantLock(boolean fair) { super(fair); } public Thread getOwner() { return super.getOwner(); } public Collection getQueuedThreads() { return super.getQueuedThreads(); } public Collection getWaitingThreads(Condition c) { return super.getWaitingThreads(c); } } /** * Releases write lock, checking that it had a hold count of 1. */ void releaseLock(PublicReentrantLock lock) { assertLockedBy(lock, Thread.currentThread()); lock.unlock(); assertFalse(lock.isHeldByCurrentThread()); assertNotLocked(lock); } /** * Spin-waits until lock.hasQueuedThread(t) becomes true. */ void waitForQueuedThread(PublicReentrantLock lock, Thread t) { long startTime = System.nanoTime(); while (!lock.hasQueuedThread(t)) { if (millisElapsedSince(startTime) > LONG_DELAY_MS) throw new AssertionError("timed out"); Thread.yield(); } assertTrue(t.isAlive()); assertTrue(lock.getOwner() != t); } /** * Checks that lock is not locked. */ void assertNotLocked(PublicReentrantLock lock) { assertFalse(lock.isLocked()); assertFalse(lock.isHeldByCurrentThread()); assertNull(lock.getOwner()); assertEquals(0, lock.getHoldCount()); } /** * Checks that lock is locked by the given thread. */ void assertLockedBy(PublicReentrantLock lock, Thread t) { assertTrue(lock.isLocked()); assertSame(t, lock.getOwner()); assertEquals(t == Thread.currentThread(), lock.isHeldByCurrentThread()); assertEquals(t == Thread.currentThread(), lock.getHoldCount() > 0); } /** * Checks that condition c has no waiters. */ void assertHasNoWaiters(PublicReentrantLock lock, Condition c) { assertHasWaiters(lock, c, new Thread[] {}); } /** * Checks that condition c has exactly the given waiter threads. */ void assertHasWaiters(PublicReentrantLock lock, Condition c, Thread... threads) { lock.lock(); assertEquals(threads.length > 0, lock.hasWaiters(c)); assertEquals(threads.length, lock.getWaitQueueLength(c)); assertEquals(threads.length == 0, lock.getWaitingThreads(c).isEmpty()); assertEquals(threads.length, lock.getWaitingThreads(c).size()); assertEquals(new HashSet(lock.getWaitingThreads(c)), new HashSet(Arrays.asList(threads))); lock.unlock(); } /** * Constructor sets given fairness, and is in unlocked state */ public void testConstructor() { PublicReentrantLock lock; lock = new PublicReentrantLock(); assertFalse(lock.isFair()); assertNotLocked(lock); lock = new PublicReentrantLock(true); assertTrue(lock.isFair()); assertNotLocked(lock); lock = new PublicReentrantLock(false); assertFalse(lock.isFair()); assertNotLocked(lock); } /** * locking an unlocked lock succeeds */ public void testLock() { PublicReentrantLock lock = new PublicReentrantLock(); lock.lock(); assertLockedBy(lock, Thread.currentThread()); releaseLock(lock); } /** * locking an unlocked fair lock succeeds */ public void testFairLock() { PublicReentrantLock lock = new PublicReentrantLock(true); lock.lock(); assertLockedBy(lock, Thread.currentThread()); releaseLock(lock); } /** * Unlocking an unlocked lock throws IllegalMonitorStateException */ public void testUnlock_IllegalMonitorStateException() { ReentrantLock lock = new ReentrantLock(); try { lock.unlock(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * tryLock on an unlocked lock succeeds */ public void testTryLock() { PublicReentrantLock lock = new PublicReentrantLock(); assertTrue(lock.tryLock()); assertLockedBy(lock, Thread.currentThread()); releaseLock(lock); } /** * hasQueuedThreads reports whether there are waiting threads */ public void testHasQueuedThreads() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertFalse(lock.hasQueuedThreads()); lock.lock(); assertFalse(lock.hasQueuedThreads()); t1.start(); waitForQueuedThread(lock, t1); assertTrue(lock.hasQueuedThreads()); t2.start(); waitForQueuedThread(lock, t2); assertTrue(lock.hasQueuedThreads()); t1.interrupt(); awaitTermination(t1); assertTrue(lock.hasQueuedThreads()); lock.unlock(); awaitTermination(t2); assertFalse(lock.hasQueuedThreads()); } /** * getQueueLength reports number of waiting threads */ public void testGetQueueLength() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertEquals(0, lock.getQueueLength()); lock.lock(); t1.start(); waitForQueuedThread(lock, t1); assertEquals(1, lock.getQueueLength()); t2.start(); waitForQueuedThread(lock, t2); assertEquals(2, lock.getQueueLength()); t1.interrupt(); awaitTermination(t1); assertEquals(1, lock.getQueueLength()); lock.unlock(); awaitTermination(t2); assertEquals(0, lock.getQueueLength()); } /** * getQueueLength reports number of waiting threads */ public void testGetQueueLength_fair() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(true); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertEquals(0, lock.getQueueLength()); lock.lock(); t1.start(); waitForQueuedThread(lock, t1); assertEquals(1, lock.getQueueLength()); t2.start(); waitForQueuedThread(lock, t2); assertEquals(2, lock.getQueueLength()); t1.interrupt(); awaitTermination(t1); assertEquals(1, lock.getQueueLength()); lock.unlock(); awaitTermination(t2); assertEquals(0, lock.getQueueLength()); } /** * hasQueuedThread(null) throws NPE */ public void testHasQueuedThreadNPE() { final ReentrantLock lock = new ReentrantLock(); try { lock.hasQueuedThread(null); shouldThrow(); } catch (NullPointerException success) {} } /** * hasQueuedThread reports whether a thread is queued. */ public void testHasQueuedThread() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertFalse(lock.hasQueuedThread(t1)); assertFalse(lock.hasQueuedThread(t2)); lock.lock(); t1.start(); waitForQueuedThread(lock, t1); assertTrue(lock.hasQueuedThread(t1)); assertFalse(lock.hasQueuedThread(t2)); t2.start(); waitForQueuedThread(lock, t2); assertTrue(lock.hasQueuedThread(t1)); assertTrue(lock.hasQueuedThread(t2)); t1.interrupt(); awaitTermination(t1); assertFalse(lock.hasQueuedThread(t1)); assertTrue(lock.hasQueuedThread(t2)); lock.unlock(); awaitTermination(t2); assertFalse(lock.hasQueuedThread(t1)); assertFalse(lock.hasQueuedThread(t2)); } /** * getQueuedThreads includes waiting threads */ public void testGetQueuedThreads() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertTrue(lock.getQueuedThreads().isEmpty()); lock.lock(); assertTrue(lock.getQueuedThreads().isEmpty()); t1.start(); waitForQueuedThread(lock, t1); assertEquals(1, lock.getQueuedThreads().size()); assertTrue(lock.getQueuedThreads().contains(t1)); t2.start(); waitForQueuedThread(lock, t2); assertEquals(2, lock.getQueuedThreads().size()); assertTrue(lock.getQueuedThreads().contains(t1)); assertTrue(lock.getQueuedThreads().contains(t2)); t1.interrupt(); awaitTermination(t1); assertFalse(lock.getQueuedThreads().contains(t1)); assertTrue(lock.getQueuedThreads().contains(t2)); assertEquals(1, lock.getQueuedThreads().size()); lock.unlock(); awaitTermination(t2); assertTrue(lock.getQueuedThreads().isEmpty()); } /** * timed tryLock is interruptible. */ public void testTryLock_Interrupted() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); lock.lock(); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.tryLock(2 * LONG_DELAY_MS, MILLISECONDS); }}); waitForQueuedThread(lock, t); t.interrupt(); awaitTermination(t); releaseLock(lock); } /** * tryLock on a locked lock fails */ public void testTryLockWhenLocked() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); lock.lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { assertFalse(lock.tryLock()); }}); awaitTermination(t); releaseLock(lock); } /** * Timed tryLock on a locked lock times out */ public void testTryLock_Timeout() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); lock.lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long startTime = System.nanoTime(); long timeoutMillis = 10; assertFalse(lock.tryLock(timeoutMillis, MILLISECONDS)); assertTrue(millisElapsedSince(startTime) >= timeoutMillis); }}); awaitTermination(t); releaseLock(lock); } /** * getHoldCount returns number of recursive holds */ public void testGetHoldCount() { ReentrantLock lock = new ReentrantLock(); for (int i = 1; i <= SIZE; i++) { lock.lock(); assertEquals(i, lock.getHoldCount()); } for (int i = SIZE; i > 0; i--) { lock.unlock(); assertEquals(i-1, lock.getHoldCount()); } } /** * isLocked is true when locked and false when not */ public void testIsLocked() throws Exception { final ReentrantLock lock = new ReentrantLock(); assertFalse(lock.isLocked()); lock.lock(); assertTrue(lock.isLocked()); lock.lock(); assertTrue(lock.isLocked()); lock.unlock(); assertTrue(lock.isLocked()); lock.unlock(); assertFalse(lock.isLocked()); final CyclicBarrier barrier = new CyclicBarrier(2); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws Exception { lock.lock(); assertTrue(lock.isLocked()); barrier.await(); barrier.await(); lock.unlock(); }}); barrier.await(); assertTrue(lock.isLocked()); barrier.await(); awaitTermination(t); assertFalse(lock.isLocked()); } /** * lockInterruptibly is interruptible. */ public void testLockInterruptibly_Interrupted() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); lock.lock(); Thread t = newStartedThread(new InterruptedLockRunnable(lock)); waitForQueuedThread(lock, t); t.interrupt(); awaitTermination(t); releaseLock(lock); } /** * lockInterruptibly succeeds when unlocked, else is interruptible */ public void testLockInterruptibly_Interrupted2() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); lock.lockInterruptibly(); Thread t = newStartedThread(new InterruptedLockRunnable(lock)); waitForQueuedThread(lock, t); t.interrupt(); assertTrue(lock.isLocked()); assertTrue(lock.isHeldByCurrentThread()); awaitTermination(t); releaseLock(lock); } /** * Calling await without holding lock throws IllegalMonitorStateException */ public void testAwait_IllegalMonitor() throws InterruptedException { final ReentrantLock lock = new ReentrantLock(); final Condition c = lock.newCondition(); try { c.await(); shouldThrow(); } catch (IllegalMonitorStateException success) {} try { c.await(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (IllegalMonitorStateException success) {} try { c.awaitNanos(100); shouldThrow(); } catch (IllegalMonitorStateException success) {} try { c.awaitUninterruptibly(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * Calling signal without holding lock throws IllegalMonitorStateException */ public void testSignal_IllegalMonitor() { final ReentrantLock lock = new ReentrantLock(); final Condition c = lock.newCondition(); try { c.signal(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * awaitNanos without a signal times out */ public void testAwaitNanos_Timeout() throws InterruptedException { final ReentrantLock lock = new ReentrantLock(); final Condition c = lock.newCondition(); lock.lock(); long startTime = System.nanoTime(); long timeoutMillis = 10; long timeoutNanos = MILLISECONDS.toNanos(timeoutMillis); long nanosRemaining = c.awaitNanos(timeoutNanos); assertTrue(nanosRemaining <= 0); assertTrue(millisElapsedSince(startTime) >= timeoutMillis); lock.unlock(); } /** * timed await without a signal times out */ public void testAwait_Timeout() throws InterruptedException { final ReentrantLock lock = new ReentrantLock(); final Condition c = lock.newCondition(); lock.lock(); long startTime = System.nanoTime(); long timeoutMillis = 10; assertFalse(c.await(timeoutMillis, MILLISECONDS)); assertTrue(millisElapsedSince(startTime) >= timeoutMillis); lock.unlock(); } /** * awaitUntil without a signal times out */ public void testAwaitUntil_Timeout() throws InterruptedException { final ReentrantLock lock = new ReentrantLock(); final Condition c = lock.newCondition(); lock.lock(); long startTime = System.nanoTime(); long timeoutMillis = 10; java.util.Date d = new java.util.Date(); assertFalse(c.awaitUntil(new java.util.Date(d.getTime() + timeoutMillis))); assertTrue(millisElapsedSince(startTime) >= timeoutMillis); lock.unlock(); } /** * await returns when signalled */ public void testAwait() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); final Condition c = lock.newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.lock(); locked.countDown(); c.await(); lock.unlock(); }}); locked.await(); lock.lock(); assertHasWaiters(lock, c, t); c.signal(); assertHasNoWaiters(lock, c); assertTrue(t.isAlive()); lock.unlock(); awaitTermination(t); } /** * hasWaiters throws NPE if null */ public void testHasWaitersNPE() { final ReentrantLock lock = new ReentrantLock(); try { lock.hasWaiters(null); shouldThrow(); } catch (NullPointerException success) {} } /** * getWaitQueueLength throws NPE if null */ public void testGetWaitQueueLengthNPE() { final ReentrantLock lock = new ReentrantLock(); try { lock.getWaitQueueLength(null); shouldThrow(); } catch (NullPointerException success) {} } /** * getWaitingThreads throws NPE if null */ public void testGetWaitingThreadsNPE() { final PublicReentrantLock lock = new PublicReentrantLock(); try { lock.getWaitingThreads(null); shouldThrow(); } catch (NullPointerException success) {} } /** * hasWaiters throws IllegalArgumentException if not owned */ public void testHasWaitersIAE() { final ReentrantLock lock = new ReentrantLock(); final Condition c = lock.newCondition(); final ReentrantLock lock2 = new ReentrantLock(); try { lock2.hasWaiters(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * hasWaiters throws IllegalMonitorStateException if not locked */ public void testHasWaitersIMSE() { final ReentrantLock lock = new ReentrantLock(); final Condition c = lock.newCondition(); try { lock.hasWaiters(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * getWaitQueueLength throws IllegalArgumentException if not owned */ public void testGetWaitQueueLengthIAE() { final ReentrantLock lock = new ReentrantLock(); final Condition c = lock.newCondition(); final ReentrantLock lock2 = new ReentrantLock(); try { lock2.getWaitQueueLength(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * getWaitQueueLength throws IllegalMonitorStateException if not locked */ public void testGetWaitQueueLengthIMSE() { final ReentrantLock lock = new ReentrantLock(); final Condition c = lock.newCondition(); try { lock.getWaitQueueLength(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * getWaitingThreads throws IllegalArgumentException if not owned */ public void testGetWaitingThreadsIAE() { final PublicReentrantLock lock = new PublicReentrantLock(); final Condition c = lock.newCondition(); final PublicReentrantLock lock2 = new PublicReentrantLock(); try { lock2.getWaitingThreads(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * getWaitingThreads throws IllegalMonitorStateException if not locked */ public void testGetWaitingThreadsIMSE() { final PublicReentrantLock lock = new PublicReentrantLock(); final Condition c = lock.newCondition(); try { lock.getWaitingThreads(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * hasWaiters returns true when a thread is waiting, else false */ public void testHasWaiters() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); final Condition c = lock.newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.lock(); assertHasNoWaiters(lock, c); assertFalse(lock.hasWaiters(c)); locked.countDown(); c.await(); assertHasNoWaiters(lock, c); assertFalse(lock.hasWaiters(c)); lock.unlock(); }}); locked.await(); lock.lock(); assertHasWaiters(lock, c, t); assertTrue(lock.hasWaiters(c)); c.signal(); assertHasNoWaiters(lock, c); assertFalse(lock.hasWaiters(c)); lock.unlock(); awaitTermination(t); assertHasNoWaiters(lock, c); } /** * getWaitQueueLength returns number of waiting threads */ public void testGetWaitQueueLength() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); final Condition c = lock.newCondition(); final CountDownLatch locked1 = new CountDownLatch(1); final CountDownLatch locked2 = new CountDownLatch(1); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.lock(); assertFalse(lock.hasWaiters(c)); assertEquals(0, lock.getWaitQueueLength(c)); locked1.countDown(); c.await(); lock.unlock(); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.lock(); assertTrue(lock.hasWaiters(c)); assertEquals(1, lock.getWaitQueueLength(c)); locked2.countDown(); c.await(); lock.unlock(); }}); lock.lock(); assertEquals(0, lock.getWaitQueueLength(c)); lock.unlock(); t1.start(); locked1.await(); lock.lock(); assertHasWaiters(lock, c, t1); assertEquals(1, lock.getWaitQueueLength(c)); lock.unlock(); t2.start(); locked2.await(); lock.lock(); assertHasWaiters(lock, c, t1, t2); assertEquals(2, lock.getWaitQueueLength(c)); c.signalAll(); assertHasNoWaiters(lock, c); lock.unlock(); awaitTermination(t1); awaitTermination(t2); assertHasNoWaiters(lock, c); } /** * getWaitingThreads returns only and all waiting threads */ public void testGetWaitingThreads() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); final Condition c = lock.newCondition(); final CountDownLatch locked1 = new CountDownLatch(1); final CountDownLatch locked2 = new CountDownLatch(1); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.lock(); assertTrue(lock.getWaitingThreads(c).isEmpty()); locked1.countDown(); c.await(); lock.unlock(); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.lock(); assertFalse(lock.getWaitingThreads(c).isEmpty()); locked2.countDown(); c.await(); lock.unlock(); }}); lock.lock(); assertTrue(lock.getWaitingThreads(c).isEmpty()); lock.unlock(); t1.start(); locked1.await(); lock.lock(); assertHasWaiters(lock, c, t1); assertTrue(lock.getWaitingThreads(c).contains(t1)); assertFalse(lock.getWaitingThreads(c).contains(t2)); assertEquals(1, lock.getWaitingThreads(c).size()); lock.unlock(); t2.start(); locked2.await(); lock.lock(); assertHasWaiters(lock, c, t1, t2); assertTrue(lock.getWaitingThreads(c).contains(t1)); assertTrue(lock.getWaitingThreads(c).contains(t2)); assertEquals(2, lock.getWaitingThreads(c).size()); c.signalAll(); assertHasNoWaiters(lock, c); lock.unlock(); awaitTermination(t1); awaitTermination(t2); assertHasNoWaiters(lock, c); } /** * awaitUninterruptibly doesn't abort on interrupt */ public void testAwaitUninterruptibly() throws InterruptedException { final ReentrantLock lock = new ReentrantLock(); final Condition c = lock.newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { lock.lock(); locked.countDown(); c.awaitUninterruptibly(); assertTrue(Thread.interrupted()); lock.unlock(); }}); locked.await(); lock.lock(); lock.unlock(); t.interrupt(); long timeoutMillis = 10; assertThreadJoinTimesOut(t, timeoutMillis); lock.lock(); c.signal(); lock.unlock(); awaitTermination(t); } /** * await is interruptible */ public void testAwait_Interrupt() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); final Condition c = lock.newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.lock(); assertTrue(lock.isLocked()); assertTrue(lock.isHeldByCurrentThread()); assertHasNoWaiters(lock, c); locked.countDown(); try { c.await(); } finally { assertTrue(lock.isLocked()); assertTrue(lock.isHeldByCurrentThread()); assertHasNoWaiters(lock, c); lock.unlock(); assertFalse(Thread.interrupted()); } }}); locked.await(); assertHasWaiters(lock, c, t); t.interrupt(); awaitTermination(t); assertFalse(lock.isLocked()); } /** * awaitNanos is interruptible */ public void testAwaitNanos_Interrupt() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); final Condition c = lock.newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.lock(); assertTrue(lock.isLocked()); assertTrue(lock.isHeldByCurrentThread()); assertHasNoWaiters(lock, c); locked.countDown(); try { c.awaitNanos(MILLISECONDS.toNanos(2 * LONG_DELAY_MS)); } finally { assertTrue(lock.isLocked()); assertTrue(lock.isHeldByCurrentThread()); assertHasNoWaiters(lock, c); lock.unlock(); assertFalse(Thread.interrupted()); } }}); locked.await(); assertHasWaiters(lock, c, t); t.interrupt(); awaitTermination(t); assertFalse(lock.isLocked()); } /** * awaitUntil is interruptible */ public void testAwaitUntil_Interrupt() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); final Condition c = lock.newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.lock(); assertTrue(lock.isLocked()); assertTrue(lock.isHeldByCurrentThread()); assertHasNoWaiters(lock, c); locked.countDown(); java.util.Date d = new java.util.Date(); try { c.awaitUntil(new java.util.Date(d.getTime() + 2 * LONG_DELAY_MS)); } finally { assertTrue(lock.isLocked()); assertTrue(lock.isHeldByCurrentThread()); assertHasNoWaiters(lock, c); lock.unlock(); assertFalse(Thread.interrupted()); } }}); locked.await(); assertHasWaiters(lock, c, t); t.interrupt(); awaitTermination(t); assertFalse(lock.isLocked()); } /** * signalAll wakes up all threads */ public void testSignalAll() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); final Condition c = lock.newCondition(); final CountDownLatch locked = new CountDownLatch(2); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.lock(); locked.countDown(); c.await(); lock.unlock(); }}); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.lock(); locked.countDown(); c.await(); lock.unlock(); }}); locked.await(); lock.lock(); assertHasWaiters(lock, c, t1, t2); c.signalAll(); assertHasNoWaiters(lock, c); lock.unlock(); awaitTermination(t1); awaitTermination(t2); } /** * await after multiple reentrant locking preserves lock count */ public void testAwaitLockCount() throws InterruptedException { final PublicReentrantLock lock = new PublicReentrantLock(); final Condition c = lock.newCondition(); final CountDownLatch locked = new CountDownLatch(2); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.lock(); assertLockedBy(lock, Thread.currentThread()); assertEquals(1, lock.getHoldCount()); locked.countDown(); c.await(); assertLockedBy(lock, Thread.currentThread()); assertEquals(1, lock.getHoldCount()); lock.unlock(); }}); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.lock(); lock.lock(); assertLockedBy(lock, Thread.currentThread()); assertEquals(2, lock.getHoldCount()); locked.countDown(); c.await(); assertLockedBy(lock, Thread.currentThread()); assertEquals(2, lock.getHoldCount()); lock.unlock(); lock.unlock(); }}); locked.await(); lock.lock(); assertHasWaiters(lock, c, t1, t2); assertEquals(1, lock.getHoldCount()); c.signalAll(); assertHasNoWaiters(lock, c); lock.unlock(); awaitTermination(t1); awaitTermination(t2); } /** * A serialized lock deserializes as unlocked */ public void testSerialization() throws Exception { ReentrantLock l = new ReentrantLock(); l.lock(); l.unlock(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); ReentrantLock r = (ReentrantLock) in.readObject(); r.lock(); r.unlock(); } /** * toString indicates current lock state */ public void testToString() { ReentrantLock lock = new ReentrantLock(); String us = lock.toString(); assertTrue(us.indexOf("Unlocked") >= 0); lock.lock(); String ls = lock.toString(); assertTrue(ls.indexOf("Locked") >= 0); } } jsr166/src/test/tck/AtomicReferenceFieldUpdaterTest.java0000644000000000000000000001363711537741072020376 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import java.util.concurrent.atomic.*; import junit.framework.*; import java.util.*; public class AtomicReferenceFieldUpdaterTest extends JSR166TestCase { volatile Integer x = null; Object z; Integer w; public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicReferenceFieldUpdaterTest.class); } /** * Construction with non-existent field throws RuntimeException */ public void testConstructor() { try { AtomicReferenceFieldUpdater a = AtomicReferenceFieldUpdater.newUpdater (AtomicReferenceFieldUpdaterTest.class, Integer.class, "y"); shouldThrow(); } catch (RuntimeException success) {} } /** * construction with field not of given type throws RuntimeException */ public void testConstructor2() { try { AtomicReferenceFieldUpdater a = AtomicReferenceFieldUpdater.newUpdater (AtomicReferenceFieldUpdaterTest.class, Integer.class, "z"); shouldThrow(); } catch (RuntimeException success) {} } /** * Constructor with non-volatile field throws exception */ public void testConstructor3() { try { AtomicReferenceFieldUpdater a = AtomicReferenceFieldUpdater.newUpdater (AtomicReferenceFieldUpdaterTest.class, Integer.class, "w"); shouldThrow(); } catch (RuntimeException success) {} } /** * get returns the last value set or assigned */ public void testGetSet() { AtomicReferenceFieldUpdatera; try { a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x"); } catch (RuntimeException ok) { return; } x = one; assertSame(one,a.get(this)); a.set(this,two); assertSame(two,a.get(this)); a.set(this,m3); assertSame(m3,a.get(this)); } /** * get returns the last value lazySet by same thread */ public void testGetLazySet() { AtomicReferenceFieldUpdatera; try { a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x"); } catch (RuntimeException ok) { return; } x = one; assertSame(one,a.get(this)); a.lazySet(this,two); assertSame(two,a.get(this)); a.lazySet(this,m3); assertSame(m3,a.get(this)); } /** * compareAndSet succeeds in changing value if equal to expected else fails */ public void testCompareAndSet() { AtomicReferenceFieldUpdatera; try { a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x"); } catch (RuntimeException ok) { return; } x = one; assertTrue(a.compareAndSet(this, one, two)); assertTrue(a.compareAndSet(this, two, m4)); assertSame(m4, a.get(this)); assertFalse(a.compareAndSet(this, m5, seven)); assertFalse(seven == a.get(this)); assertTrue(a.compareAndSet(this, m4, seven)); assertSame(seven,a.get(this)); } /** * compareAndSet in one thread enables another waiting for value * to succeed */ public void testCompareAndSetInMultipleThreads() throws Exception { x = one; final AtomicReferenceFieldUpdatera; try { a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x"); } catch (RuntimeException ok) { return; } Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!a.compareAndSet(AtomicReferenceFieldUpdaterTest.this, two, three)) Thread.yield(); }}); t.start(); assertTrue(a.compareAndSet(this, one, two)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertSame(a.get(this), three); } /** * repeated weakCompareAndSet succeeds in changing value when equal * to expected */ public void testWeakCompareAndSet() { AtomicReferenceFieldUpdatera; try { a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x"); } catch (RuntimeException ok) { return; } x = one; while (!a.weakCompareAndSet(this,one,two)); while (!a.weakCompareAndSet(this,two,m4)); assertSame(m4,a.get(this)); while (!a.weakCompareAndSet(this,m4,seven)); assertSame(seven,a.get(this)); } /** * getAndSet returns previous value and sets to given value */ public void testGetAndSet() { AtomicReferenceFieldUpdatera; try { a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x"); } catch (RuntimeException ok) { return; } x = one; assertSame(one,a.getAndSet(this, zero)); assertSame(zero,a.getAndSet(this,m10)); assertSame(m10,a.getAndSet(this,1)); } } jsr166/src/test/tck/CyclicBarrierTest.java0000644000000000000000000003251511560754737015573 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; public class CyclicBarrierTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(CyclicBarrierTest.class); } private volatile int countAction; private class MyAction implements Runnable { public void run() { ++countAction; } } /** * Creating with negative parties throws IAE */ public void testConstructor1() { try { new CyclicBarrier(-1, (Runnable)null); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Creating with negative parties and no action throws IAE */ public void testConstructor2() { try { new CyclicBarrier(-1); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * getParties returns the number of parties given in constructor */ public void testGetParties() { CyclicBarrier b = new CyclicBarrier(2); assertEquals(2, b.getParties()); assertEquals(0, b.getNumberWaiting()); } /** * A 1-party barrier triggers after single await */ public void testSingleParty() throws Exception { CyclicBarrier b = new CyclicBarrier(1); assertEquals(1, b.getParties()); assertEquals(0, b.getNumberWaiting()); b.await(); b.await(); assertEquals(0, b.getNumberWaiting()); } /** * The supplied barrier action is run at barrier */ public void testBarrierAction() throws Exception { countAction = 0; CyclicBarrier b = new CyclicBarrier(1, new MyAction()); assertEquals(1, b.getParties()); assertEquals(0, b.getNumberWaiting()); b.await(); b.await(); assertEquals(0, b.getNumberWaiting()); assertEquals(countAction, 2); } /** * A 2-party/thread barrier triggers after both threads invoke await */ public void testTwoParties() throws Exception { final CyclicBarrier b = new CyclicBarrier(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws Exception { b.await(); b.await(); b.await(); b.await(); }}); t.start(); b.await(); b.await(); b.await(); b.await(); t.join(); } /** * An interruption in one party causes others waiting in await to * throw BrokenBarrierException */ public void testAwait1_Interrupted_BrokenBarrier() throws Exception { final CyclicBarrier c = new CyclicBarrier(3); Thread t1 = new ThreadShouldThrow(InterruptedException.class) { public void realRun() throws Exception { c.await(); }}; Thread t2 = new ThreadShouldThrow(BrokenBarrierException.class) { public void realRun() throws Exception { c.await(); }}; t1.start(); t2.start(); delay(SHORT_DELAY_MS); t1.interrupt(); t1.join(); t2.join(); } /** * An interruption in one party causes others waiting in timed await to * throw BrokenBarrierException */ public void testAwait2_Interrupted_BrokenBarrier() throws Exception { final CyclicBarrier c = new CyclicBarrier(3); Thread t1 = new ThreadShouldThrow(InterruptedException.class) { public void realRun() throws Exception { c.await(LONG_DELAY_MS, MILLISECONDS); }}; Thread t2 = new ThreadShouldThrow(BrokenBarrierException.class) { public void realRun() throws Exception { c.await(LONG_DELAY_MS, MILLISECONDS); }}; t1.start(); t2.start(); delay(SHORT_DELAY_MS); t1.interrupt(); t1.join(); t2.join(); } /** * A timeout in timed await throws TimeoutException */ public void testAwait3_TimeOutException() throws InterruptedException { final CyclicBarrier c = new CyclicBarrier(2); Thread t = new ThreadShouldThrow(TimeoutException.class) { public void realRun() throws Exception { c.await(SHORT_DELAY_MS, MILLISECONDS); }}; t.start(); t.join(); } /** * A timeout in one party causes others waiting in timed await to * throw BrokenBarrierException */ public void testAwait4_Timeout_BrokenBarrier() throws InterruptedException { final CyclicBarrier c = new CyclicBarrier(3); Thread t1 = new ThreadShouldThrow(TimeoutException.class) { public void realRun() throws Exception { c.await(SHORT_DELAY_MS, MILLISECONDS); }}; Thread t2 = new ThreadShouldThrow(BrokenBarrierException.class) { public void realRun() throws Exception { c.await(MEDIUM_DELAY_MS, MILLISECONDS); }}; t1.start(); t2.start(); t1.join(); t2.join(); } /** * A timeout in one party causes others waiting in await to * throw BrokenBarrierException */ public void testAwait5_Timeout_BrokenBarrier() throws InterruptedException { final CyclicBarrier c = new CyclicBarrier(3); Thread t1 = new ThreadShouldThrow(TimeoutException.class) { public void realRun() throws Exception { c.await(SHORT_DELAY_MS, MILLISECONDS); }}; Thread t2 = new ThreadShouldThrow(BrokenBarrierException.class) { public void realRun() throws Exception { c.await(); }}; t1.start(); t2.start(); t1.join(); t2.join(); } /** * A reset of an active barrier causes waiting threads to throw * BrokenBarrierException */ public void testReset_BrokenBarrier() throws InterruptedException { final CyclicBarrier c = new CyclicBarrier(3); Thread t1 = new ThreadShouldThrow(BrokenBarrierException.class) { public void realRun() throws Exception { c.await(); }}; Thread t2 = new ThreadShouldThrow(BrokenBarrierException.class) { public void realRun() throws Exception { c.await(); }}; t1.start(); t2.start(); delay(SHORT_DELAY_MS); c.reset(); t1.join(); t2.join(); } /** * A reset before threads enter barrier does not throw * BrokenBarrierException */ public void testReset_NoBrokenBarrier() throws Exception { final CyclicBarrier c = new CyclicBarrier(3); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws Exception { c.await(); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws Exception { c.await(); }}); c.reset(); t1.start(); t2.start(); c.await(); t1.join(); t2.join(); } /** * All threads block while a barrier is broken. */ public void testReset_Leakage() throws InterruptedException { final CyclicBarrier c = new CyclicBarrier(2); final AtomicBoolean done = new AtomicBoolean(); Thread t = new Thread() { public void run() { while (!done.get()) { try { while (c.isBroken()) c.reset(); c.await(); threadFail("await should not return"); } catch (BrokenBarrierException e) { } catch (InterruptedException ie) { } } } }; t.start(); for (int i = 0; i < 4; i++) { delay(SHORT_DELAY_MS); t.interrupt(); } done.set(true); t.interrupt(); t.join(); } /** * Reset of a non-broken barrier does not break barrier */ public void testResetWithoutBreakage() throws Exception { final CyclicBarrier start = new CyclicBarrier(3); final CyclicBarrier barrier = new CyclicBarrier(3); for (int i = 0; i < 3; i++) { Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws Exception { start.await(); barrier.await(); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws Exception { start.await(); barrier.await(); }}); t1.start(); t2.start(); start.await(); barrier.await(); t1.join(); t2.join(); assertFalse(barrier.isBroken()); assertEquals(0, barrier.getNumberWaiting()); if (i == 1) barrier.reset(); assertFalse(barrier.isBroken()); assertEquals(0, barrier.getNumberWaiting()); } } /** * Reset of a barrier after interruption reinitializes it. */ public void testResetAfterInterrupt() throws Exception { final CyclicBarrier start = new CyclicBarrier(3); final CyclicBarrier barrier = new CyclicBarrier(3); for (int i = 0; i < 2; i++) { Thread t1 = new ThreadShouldThrow(InterruptedException.class) { public void realRun() throws Exception { start.await(); barrier.await(); }}; Thread t2 = new ThreadShouldThrow(BrokenBarrierException.class) { public void realRun() throws Exception { start.await(); barrier.await(); }}; t1.start(); t2.start(); start.await(); t1.interrupt(); t1.join(); t2.join(); assertTrue(barrier.isBroken()); assertEquals(0, barrier.getNumberWaiting()); barrier.reset(); assertFalse(barrier.isBroken()); assertEquals(0, barrier.getNumberWaiting()); } } /** * Reset of a barrier after timeout reinitializes it. */ public void testResetAfterTimeout() throws Exception { final CyclicBarrier start = new CyclicBarrier(2); final CyclicBarrier barrier = new CyclicBarrier(3); for (int i = 0; i < 2; i++) { Thread t1 = new ThreadShouldThrow(TimeoutException.class) { public void realRun() throws Exception { start.await(); barrier.await(SHORT_DELAY_MS, MILLISECONDS); }}; Thread t2 = new ThreadShouldThrow(BrokenBarrierException.class) { public void realRun() throws Exception { start.await(); barrier.await(); }}; t1.start(); t2.start(); t1.join(); t2.join(); assertTrue(barrier.isBroken()); assertEquals(0, barrier.getNumberWaiting()); barrier.reset(); assertFalse(barrier.isBroken()); assertEquals(0, barrier.getNumberWaiting()); } } /** * Reset of a barrier after a failed command reinitializes it. */ public void testResetAfterCommandException() throws Exception { final CyclicBarrier start = new CyclicBarrier(3); final CyclicBarrier barrier = new CyclicBarrier(3, new Runnable() { public void run() { throw new NullPointerException(); }}); for (int i = 0; i < 2; i++) { Thread t1 = new ThreadShouldThrow(BrokenBarrierException.class) { public void realRun() throws Exception { start.await(); barrier.await(); }}; Thread t2 = new ThreadShouldThrow(BrokenBarrierException.class) { public void realRun() throws Exception { start.await(); barrier.await(); }}; t1.start(); t2.start(); start.await(); while (barrier.getNumberWaiting() < 2) { Thread.yield(); } try { barrier.await(); shouldThrow(); } catch (NullPointerException success) {} t1.join(); t2.join(); assertTrue(barrier.isBroken()); assertEquals(0, barrier.getNumberWaiting()); barrier.reset(); assertFalse(barrier.isBroken()); assertEquals(0, barrier.getNumberWaiting()); } } } jsr166/src/test/tck/PhaserTest.java0000644000000000000000000006377411537741073014304 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include John Vint */ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.NANOSECONDS; import junit.framework.Test; import junit.framework.TestSuite; public class PhaserTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(PhaserTest.class); } private static final int maxParties = 65535; /** Checks state of unterminated phaser. */ protected void assertState(Phaser phaser, int phase, int parties, int unarrived) { assertEquals(phase, phaser.getPhase()); assertEquals(parties, phaser.getRegisteredParties()); assertEquals(unarrived, phaser.getUnarrivedParties()); assertEquals(parties - unarrived, phaser.getArrivedParties()); assertFalse(phaser.isTerminated()); } /** Checks state of terminated phaser. */ protected void assertTerminated(Phaser phaser, int maxPhase, int parties) { assertTrue(phaser.isTerminated()); int expectedPhase = maxPhase + Integer.MIN_VALUE; assertEquals(expectedPhase, phaser.getPhase()); assertEquals(parties, phaser.getRegisteredParties()); assertEquals(expectedPhase, phaser.register()); assertEquals(expectedPhase, phaser.arrive()); assertEquals(expectedPhase, phaser.arriveAndDeregister()); } protected void assertTerminated(Phaser phaser, int maxPhase) { assertTerminated(phaser, maxPhase, 0); } /** * Empty constructor builds a new Phaser with no parent, no registered * parties and initial phase number of 0 */ public void testConstructorDefaultValues() { Phaser phaser = new Phaser(); assertNull(phaser.getParent()); assertEquals(0, phaser.getRegisteredParties()); assertEquals(0, phaser.getArrivedParties()); assertEquals(0, phaser.getUnarrivedParties()); assertEquals(0, phaser.getPhase()); } /** * Constructing with a negative number of parties throws * IllegalArgumentException */ public void testConstructorNegativeParties() { try { new Phaser(-1); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructing with a negative number of parties throws * IllegalArgumentException */ public void testConstructorNegativeParties2() { try { new Phaser(new Phaser(), -1); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Constructing with a number of parties > 65535 throws * IllegalArgumentException */ public void testConstructorPartiesExceedsLimit() { new Phaser(maxParties); try { new Phaser(maxParties + 1); shouldThrow(); } catch (IllegalArgumentException success) {} new Phaser(new Phaser(), maxParties); try { new Phaser(new Phaser(), maxParties + 1); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * The parent provided to the constructor should be returned from * a later call to getParent */ public void testConstructor3() { Phaser parent = new Phaser(); assertSame(parent, new Phaser(parent).getParent()); assertNull(new Phaser(null).getParent()); } /** * The parent being input into the parameter should equal the original * parent when being returned */ public void testConstructor5() { Phaser parent = new Phaser(); assertSame(parent, new Phaser(parent, 0).getParent()); assertNull(new Phaser(null, 0).getParent()); } /** * register() will increment the number of unarrived parties by * one and not affect its arrived parties */ public void testRegister1() { Phaser phaser = new Phaser(); assertState(phaser, 0, 0, 0); assertEquals(0, phaser.register()); assertState(phaser, 0, 1, 1); } /** * Registering more than 65536 parties causes IllegalStateException */ public void testRegister2() { Phaser phaser = new Phaser(0); assertState(phaser, 0, 0, 0); assertEquals(0, phaser.bulkRegister(maxParties - 10)); assertState(phaser, 0, maxParties - 10, maxParties - 10); for (int i = 0; i < 10; i++) { assertState(phaser, 0, maxParties - 10 + i, maxParties - 10 + i); assertEquals(0, phaser.register()); } assertState(phaser, 0, maxParties, maxParties); try { phaser.register(); shouldThrow(); } catch (IllegalStateException success) {} try { phaser.bulkRegister(Integer.MAX_VALUE); shouldThrow(); } catch (IllegalStateException success) {} assertEquals(0, phaser.bulkRegister(0)); assertState(phaser, 0, maxParties, maxParties); } /** * register() correctly returns the current barrier phase number when * invoked */ public void testRegister3() { Phaser phaser = new Phaser(); assertEquals(0, phaser.register()); assertEquals(0, phaser.arrive()); assertEquals(1, phaser.register()); assertState(phaser, 1, 2, 2); } /** * register causes the next arrive to not increment the phase rather retain * the phase number */ public void testRegister4() { Phaser phaser = new Phaser(1); assertEquals(0, phaser.arrive()); assertEquals(1, phaser.register()); assertEquals(1, phaser.arrive()); assertState(phaser, 1, 2, 1); } /** * Invoking bulkRegister with a negative parameter throws an * IllegalArgumentException */ public void testBulkRegister1() { try { new Phaser().bulkRegister(-1); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * bulkRegister should correctly record the number of unarrived parties with * the number of parties being registered */ public void testBulkRegister2() { Phaser phaser = new Phaser(); assertEquals(0, phaser.bulkRegister(0)); assertState(phaser, 0, 0, 0); assertEquals(0, phaser.bulkRegister(20)); assertState(phaser, 0, 20, 20); } /** * Registering with a number of parties greater than or equal to 1<<16 * throws IllegalStateException. */ public void testBulkRegister3() { assertEquals(0, new Phaser().bulkRegister((1 << 16) - 1)); try { new Phaser().bulkRegister(1 << 16); shouldThrow(); } catch (IllegalStateException success) {} try { new Phaser(2).bulkRegister((1 << 16) - 2); shouldThrow(); } catch (IllegalStateException success) {} } /** * the phase number increments correctly when tripping the barrier */ public void testPhaseIncrement1() { for (int size = 1; size < nine; size++) { final Phaser phaser = new Phaser(size); for (int index = 0; index <= (1 << size); index++) { int phase = phaser.arrive(); assertTrue(index % size == 0 ? (index / size) == phase : index - (phase * size) > 0); } } } /** * arrive() on a registered phaser increments phase. */ public void testArrive1() { Phaser phaser = new Phaser(1); assertState(phaser, 0, 1, 1); assertEquals(0, phaser.arrive()); assertState(phaser, 1, 1, 1); } /** * arriveAndDeregister does not wait for others to arrive at barrier */ public void testArriveAndDeregister() throws InterruptedException { final Phaser phaser = new Phaser(1); for (int i = 0; i < 10; i++) { assertState(phaser, 0, 1, 1); assertEquals(0, phaser.register()); assertState(phaser, 0, 2, 2); assertEquals(0, phaser.arriveAndDeregister()); assertState(phaser, 0, 1, 1); } assertEquals(0, phaser.arriveAndDeregister()); assertTerminated(phaser, 1); } /** * arriveAndDeregister does not wait for others to arrive at barrier */ public void testArrive2() throws InterruptedException { final Phaser phaser = new Phaser(); assertEquals(0, phaser.register()); List threads = new ArrayList(); for (int i = 0; i < 10; i++) { assertEquals(0, phaser.register()); threads.add(newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertEquals(0, phaser.arriveAndDeregister()); }})); } for (Thread thread : threads) awaitTermination(thread, LONG_DELAY_MS); assertState(phaser, 0, 1, 1); assertEquals(0, phaser.arrive()); assertState(phaser, 1, 1, 1); } /** * arrive() returns a negative number if the Phaser is terminated */ public void testArrive3() { Phaser phaser = new Phaser(1); phaser.forceTermination(); assertTerminated(phaser, 0, 1); assertEquals(0, phaser.getPhase() + Integer.MIN_VALUE); assertTrue(phaser.arrive() < 0); assertTrue(phaser.register() < 0); assertTrue(phaser.arriveAndDeregister() < 0); assertTrue(phaser.awaitAdvance(1) < 0); assertTrue(phaser.getPhase() < 0); } /** * arriveAndDeregister() throws IllegalStateException if number of * registered or unarrived parties would become negative */ public void testArriveAndDeregister1() { try { Phaser phaser = new Phaser(); phaser.arriveAndDeregister(); shouldThrow(); } catch (IllegalStateException success) {} } /** * arriveAndDeregister reduces the number of arrived parties */ public void testArriveAndDeregister2() { final Phaser phaser = new Phaser(1); assertEquals(0, phaser.register()); assertEquals(0, phaser.arrive()); assertState(phaser, 0, 2, 1); assertEquals(0, phaser.arriveAndDeregister()); assertState(phaser, 1, 1, 1); } /** * arriveAndDeregister arrives at the barrier on a phaser with a parent and * when a deregistration occurs and causes the phaser to have zero parties * its parent will be deregistered as well */ public void testArriveAndDeregister3() { Phaser parent = new Phaser(); Phaser child = new Phaser(parent); assertState(child, 0, 0, 0); assertState(parent, 0, 0, 0); assertEquals(0, child.register()); assertState(child, 0, 1, 1); assertState(parent, 0, 1, 1); assertEquals(0, child.arriveAndDeregister()); assertTerminated(child, 1); assertTerminated(parent, 1); } /** * arriveAndDeregister deregisters one party from its parent when * the number of parties of child is zero after deregistration */ public void testArriveAndDeregister4() { Phaser parent = new Phaser(); Phaser child = new Phaser(parent); assertEquals(0, parent.register()); assertEquals(0, child.register()); assertState(child, 0, 1, 1); assertState(parent, 0, 2, 2); assertEquals(0, child.arriveAndDeregister()); assertState(child, 0, 0, 0); assertState(parent, 0, 1, 1); } /** * arriveAndDeregister deregisters one party from its parent when * the number of parties of root is nonzero after deregistration. */ public void testArriveAndDeregister5() { Phaser root = new Phaser(); Phaser parent = new Phaser(root); Phaser child = new Phaser(parent); assertState(root, 0, 0, 0); assertState(parent, 0, 0, 0); assertState(child, 0, 0, 0); assertEquals(0, child.register()); assertState(root, 0, 1, 1); assertState(parent, 0, 1, 1); assertState(child, 0, 1, 1); assertEquals(0, child.arriveAndDeregister()); assertTerminated(child, 1); assertTerminated(parent, 1); assertTerminated(root, 1); } /** * arriveAndDeregister returns the phase in which it leaves the * phaser in after deregistration */ public void testArriveAndDeregister6() throws InterruptedException { final Phaser phaser = new Phaser(2); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { assertEquals(0, phaser.arrive()); }}); assertEquals(1, phaser.arriveAndAwaitAdvance()); assertState(phaser, 1, 2, 2); assertEquals(1, phaser.arriveAndDeregister()); assertState(phaser, 1, 1, 1); assertEquals(1, phaser.arriveAndDeregister()); assertTerminated(phaser, 2); awaitTermination(t, SHORT_DELAY_MS); } /** * awaitAdvance succeeds upon advance */ public void testAwaitAdvance1() { final Phaser phaser = new Phaser(1); assertEquals(0, phaser.arrive()); assertEquals(1, phaser.awaitAdvance(0)); } /** * awaitAdvance with a negative parameter will return without affecting the * phaser */ public void testAwaitAdvance2() { Phaser phaser = new Phaser(); assertTrue(phaser.awaitAdvance(-1) < 0); assertState(phaser, 0, 0, 0); } /** * awaitAdvance continues waiting if interrupted before waiting */ public void testAwaitAdvanceAfterInterrupt() throws InterruptedException { final Phaser phaser = new Phaser(); assertEquals(0, phaser.register()); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { Thread.currentThread().interrupt(); assertEquals(0, phaser.register()); assertEquals(0, phaser.arrive()); threadStarted.countDown(); assertTrue(Thread.currentThread().isInterrupted()); assertEquals(1, phaser.awaitAdvance(0)); assertTrue(Thread.currentThread().isInterrupted()); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); assertEquals(0, phaser.arrive()); awaitTermination(t, SMALL_DELAY_MS); Thread.currentThread().interrupt(); assertEquals(1, phaser.awaitAdvance(0)); assertTrue(Thread.interrupted()); } /** * awaitAdvance continues waiting if interrupted while waiting */ public void testAwaitAdvanceBeforeInterrupt() throws InterruptedException { final Phaser phaser = new Phaser(); assertEquals(0, phaser.register()); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertEquals(0, phaser.register()); assertEquals(0, phaser.arrive()); threadStarted.countDown(); assertFalse(Thread.currentThread().isInterrupted()); assertEquals(1, phaser.awaitAdvance(0)); assertTrue(Thread.currentThread().isInterrupted()); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); t.interrupt(); assertEquals(0, phaser.arrive()); awaitTermination(t, SMALL_DELAY_MS); Thread.currentThread().interrupt(); assertEquals(1, phaser.awaitAdvance(0)); assertTrue(Thread.interrupted()); } /** * arriveAndAwaitAdvance continues waiting if interrupted before waiting */ public void testArriveAndAwaitAdvanceAfterInterrupt() throws InterruptedException { final Phaser phaser = new Phaser(); assertEquals(0, phaser.register()); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { Thread.currentThread().interrupt(); assertEquals(0, phaser.register()); threadStarted.countDown(); assertTrue(Thread.currentThread().isInterrupted()); assertEquals(1, phaser.arriveAndAwaitAdvance()); assertTrue(Thread.currentThread().isInterrupted()); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); Thread.currentThread().interrupt(); assertEquals(1, phaser.arriveAndAwaitAdvance()); assertTrue(Thread.interrupted()); awaitTermination(t, SMALL_DELAY_MS); } /** * arriveAndAwaitAdvance continues waiting if interrupted while waiting */ public void testArriveAndAwaitAdvanceBeforeInterrupt() throws InterruptedException { final Phaser phaser = new Phaser(); assertEquals(0, phaser.register()); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertEquals(0, phaser.register()); threadStarted.countDown(); assertFalse(Thread.currentThread().isInterrupted()); assertEquals(1, phaser.arriveAndAwaitAdvance()); assertTrue(Thread.currentThread().isInterrupted()); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); t.interrupt(); Thread.currentThread().interrupt(); assertEquals(1, phaser.arriveAndAwaitAdvance()); assertTrue(Thread.interrupted()); awaitTermination(t, SMALL_DELAY_MS); } /** * awaitAdvance atomically waits for all parties within the same phase to * complete before continuing */ public void testAwaitAdvance4() throws InterruptedException { final Phaser phaser = new Phaser(4); final AtomicInteger count = new AtomicInteger(0); List threads = new ArrayList(); for (int i = 0; i < 4; i++) threads.add(newStartedThread(new CheckedRunnable() { public void realRun() { for (int k = 0; k < 3; k++) { assertEquals(2*k+1, phaser.arriveAndAwaitAdvance()); count.incrementAndGet(); assertEquals(2*k+1, phaser.arrive()); assertEquals(2*k+2, phaser.awaitAdvance(2*k+1)); assertEquals(count.get(), 4*(k+1)); }}})); for (Thread thread : threads) awaitTermination(thread, MEDIUM_DELAY_MS); } /** * awaitAdvance returns the current phase */ public void testAwaitAdvance5() throws InterruptedException { final Phaser phaser = new Phaser(1); assertEquals(1, phaser.awaitAdvance(phaser.arrive())); assertEquals(1, phaser.getPhase()); assertEquals(1, phaser.register()); List threads = new ArrayList(); for (int i = 0; i < 8; i++) { final CountDownLatch latch = new CountDownLatch(1); final boolean goesFirst = ((i & 1) == 0); threads.add(newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { if (goesFirst) latch.countDown(); else assertTrue(latch.await(SMALL_DELAY_MS, MILLISECONDS)); phaser.arrive(); }})); if (goesFirst) assertTrue(latch.await(SMALL_DELAY_MS, MILLISECONDS)); else latch.countDown(); assertEquals(i + 2, phaser.awaitAdvance(phaser.arrive())); assertEquals(i + 2, phaser.getPhase()); } for (Thread thread : threads) awaitTermination(thread, SMALL_DELAY_MS); } /** * awaitAdvance returns the current phase in child phasers */ public void testAwaitAdvanceTieredPhaser() throws Exception { final Phaser parent = new Phaser(); final List zeroPartyChildren = new ArrayList(3); final List onePartyChildren = new ArrayList(3); for (int i = 0; i < 3; i++) { zeroPartyChildren.add(new Phaser(parent, 0)); onePartyChildren.add(new Phaser(parent, 1)); } final List phasers = new ArrayList(); phasers.addAll(zeroPartyChildren); phasers.addAll(onePartyChildren); phasers.add(parent); for (Phaser phaser : phasers) { assertEquals(-42, phaser.awaitAdvance(-42)); assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42)); assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42, SMALL_DELAY_MS, MILLISECONDS)); } for (Phaser child : onePartyChildren) assertEquals(0, child.arrive()); for (Phaser phaser : phasers) { assertEquals(-42, phaser.awaitAdvance(-42)); assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42)); assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42, SMALL_DELAY_MS, MILLISECONDS)); assertEquals(1, phaser.awaitAdvance(0)); assertEquals(1, phaser.awaitAdvanceInterruptibly(0)); assertEquals(1, phaser.awaitAdvanceInterruptibly(0, SMALL_DELAY_MS, MILLISECONDS)); } for (Phaser child : onePartyChildren) assertEquals(1, child.arrive()); for (Phaser phaser : phasers) { assertEquals(-42, phaser.awaitAdvance(-42)); assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42)); assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42, SMALL_DELAY_MS, MILLISECONDS)); assertEquals(2, phaser.awaitAdvance(0)); assertEquals(2, phaser.awaitAdvanceInterruptibly(0)); assertEquals(2, phaser.awaitAdvanceInterruptibly(0, SMALL_DELAY_MS, MILLISECONDS)); assertEquals(2, phaser.awaitAdvance(1)); assertEquals(2, phaser.awaitAdvanceInterruptibly(1)); assertEquals(2, phaser.awaitAdvanceInterruptibly(1, SMALL_DELAY_MS, MILLISECONDS)); } } /** * awaitAdvance returns when the phaser is externally terminated */ public void testAwaitAdvance6() throws InterruptedException { final Phaser phaser = new Phaser(3); final CountDownLatch threadsStarted = new CountDownLatch(2); final List threads = new ArrayList(); for (int i = 0; i < 2; i++) { Runnable r = new CheckedRunnable() { public void realRun() { assertEquals(0, phaser.arrive()); threadsStarted.countDown(); assertTrue(phaser.awaitAdvance(0) < 0); assertTrue(phaser.isTerminated()); assertTrue(phaser.getPhase() < 0); assertEquals(0, phaser.getPhase() + Integer.MIN_VALUE); assertEquals(3, phaser.getRegisteredParties()); }}; threads.add(newStartedThread(r)); } threadsStarted.await(); phaser.forceTermination(); assertTrue(phaser.isTerminated()); assertEquals(0, phaser.getPhase() + Integer.MIN_VALUE); for (Thread thread : threads) awaitTermination(thread, SMALL_DELAY_MS); assertEquals(3, phaser.getRegisteredParties()); } /** * arriveAndAwaitAdvance throws IllegalStateException with no * unarrived parties */ public void testArriveAndAwaitAdvance1() { try { Phaser phaser = new Phaser(); phaser.arriveAndAwaitAdvance(); shouldThrow(); } catch (IllegalStateException success) {} } /** * arriveAndAwaitAdvance waits for all threads to arrive, the * number of arrived parties is the same number that is accounted * for when the main thread awaitsAdvance */ public void testArriveAndAwaitAdvance3() throws InterruptedException { final Phaser phaser = new Phaser(1); final int THREADS = 3; final CountDownLatch threadsStarted = new CountDownLatch(THREADS); final List threads = new ArrayList(); for (int i = 0; i < THREADS; i++) threads.add(newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertEquals(0, phaser.register()); threadsStarted.countDown(); assertEquals(1, phaser.arriveAndAwaitAdvance()); }})); assertTrue(threadsStarted.await(MEDIUM_DELAY_MS, MILLISECONDS)); long t0 = System.nanoTime(); while (phaser.getArrivedParties() < THREADS) Thread.yield(); assertEquals(THREADS, phaser.getArrivedParties()); assertTrue(NANOSECONDS.toMillis(System.nanoTime() - t0) < SMALL_DELAY_MS); for (Thread thread : threads) assertTrue(thread.isAlive()); assertState(phaser, 0, THREADS + 1, 1); phaser.arriveAndAwaitAdvance(); for (Thread thread : threads) awaitTermination(thread, SMALL_DELAY_MS); assertState(phaser, 1, THREADS + 1, THREADS + 1); } } jsr166/src/test/tck/PriorityQueueTest.java0000644000000000000000000003367311537741073015703 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class PriorityQueueTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(PriorityQueueTest.class); } static class MyReverseComparator implements Comparator { public int compare(Object x, Object y) { return ((Comparable)y).compareTo(x); } } /** * Create a queue of given size containing consecutive * Integers 0 ... n. */ private PriorityQueue populatedQueue(int n) { PriorityQueue q = new PriorityQueue(n); assertTrue(q.isEmpty()); for (int i = n-1; i >= 0; i-=2) assertTrue(q.offer(new Integer(i))); for (int i = (n & 1); i < n; i+=2) assertTrue(q.offer(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(n, q.size()); return q; } /** * A new queue has unbounded capacity */ public void testConstructor1() { assertEquals(0, new PriorityQueue(SIZE).size()); } /** * Constructor throws IAE if capacity argument nonpositive */ public void testConstructor2() { try { PriorityQueue q = new PriorityQueue(0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { PriorityQueue q = new PriorityQueue((Collection)null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws NPE */ public void testConstructor4() { try { Integer[] ints = new Integer[SIZE]; PriorityQueue q = new PriorityQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection with some null elements throws NPE */ public void testConstructor5() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); PriorityQueue q = new PriorityQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements of collection used to initialize */ public void testConstructor6() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); PriorityQueue q = new PriorityQueue(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * The comparator used in constructor is used */ public void testConstructor7() { MyReverseComparator cmp = new MyReverseComparator(); PriorityQueue q = new PriorityQueue(SIZE, cmp); assertEquals(cmp, q.comparator()); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); for (int i = SIZE-1; i >= 0; --i) assertEquals(ints[i], q.poll()); } /** * isEmpty is true before add, false after */ public void testEmpty() { PriorityQueue q = new PriorityQueue(2); assertTrue(q.isEmpty()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.add(new Integer(2)); q.remove(); q.remove(); assertTrue(q.isEmpty()); } /** * size changes when elements added and removed */ public void testSize() { PriorityQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.remove(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * offer(null) throws NPE */ public void testOfferNull() { try { PriorityQueue q = new PriorityQueue(1); q.offer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * add(null) throws NPE */ public void testAddNull() { try { PriorityQueue q = new PriorityQueue(1); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Offer of comparable element succeeds */ public void testOffer() { PriorityQueue q = new PriorityQueue(1); assertTrue(q.offer(zero)); assertTrue(q.offer(one)); } /** * Offer of non-Comparable throws CCE */ public void testOfferNonComparable() { try { PriorityQueue q = new PriorityQueue(1); q.offer(new Object()); q.offer(new Object()); q.offer(new Object()); shouldThrow(); } catch (ClassCastException success) {} } /** * add of comparable succeeds */ public void testAdd() { PriorityQueue q = new PriorityQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); assertTrue(q.add(new Integer(i))); } } /** * addAll(null) throws NPE */ public void testAddAll1() { try { PriorityQueue q = new PriorityQueue(1); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { PriorityQueue q = new PriorityQueue(SIZE); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { PriorityQueue q = new PriorityQueue(SIZE); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(SIZE-1-i); PriorityQueue q = new PriorityQueue(SIZE); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(new Integer(i), q.poll()); } /** * poll succeeds unless empty */ public void testPoll() { PriorityQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll()); } assertNull(q.poll()); } /** * peek returns next element, or null if empty */ public void testPeek() { PriorityQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peek()); assertEquals(i, q.poll()); assertTrue(q.peek() == null || !q.peek().equals(i)); } assertNull(q.peek()); } /** * element returns next element, or throws NSEE if empty */ public void testElement() { PriorityQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.element()); assertEquals(i, q.poll()); } try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove removes next element, or throws NSEE if empty */ public void testRemove() { PriorityQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remove()); } try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { PriorityQueue q = populatedQueue(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { PriorityQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.poll(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { PriorityQueue q = populatedQueue(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { PriorityQueue q = populatedQueue(SIZE); PriorityQueue p = new PriorityQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { PriorityQueue q = populatedQueue(SIZE); PriorityQueue p = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.remove(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { PriorityQueue q = populatedQueue(SIZE); PriorityQueue p = populatedQueue(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.remove()); assertFalse(q.contains(I)); } } } /** * toArray contains all elements */ public void testToArray() { PriorityQueue q = populatedQueue(SIZE); Object[] o = q.toArray(); Arrays.sort(o); for (int i = 0; i < o.length; i++) assertSame(o[i], q.poll()); } /** * toArray(a) contains all elements */ public void testToArray2() { PriorityQueue q = populatedQueue(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); Arrays.sort(ints); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.poll()); } /** * iterator iterates through all elements */ public void testIterator() { PriorityQueue q = populatedQueue(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * iterator.remove removes current element */ public void testIteratorRemove() { final PriorityQueue q = new PriorityQueue(3); q.add(new Integer(2)); q.add(new Integer(1)); q.add(new Integer(3)); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertEquals(it.next(), new Integer(2)); assertEquals(it.next(), new Integer(3)); assertFalse(it.hasNext()); } /** * toString contains toStrings of elements */ public void testToString() { PriorityQueue q = populatedQueue(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * A deserialized serialized queue has same elements */ public void testSerialization() throws Exception { PriorityQueue q = populatedQueue(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); PriorityQueue r = (PriorityQueue)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.remove(), r.remove()); } } jsr166/src/test/tck/AtomicStampedReferenceTest.java0000644000000000000000000001155511537741072017420 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.atomic.*; public class AtomicStampedReferenceTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicStampedReferenceTest.class); } /** * constructor initializes to given reference and stamp */ public void testConstructor() { AtomicStampedReference ai = new AtomicStampedReference(one, 0); assertSame(one,ai.getReference()); assertEquals(0, ai.getStamp()); AtomicStampedReference a2 = new AtomicStampedReference(null, 1); assertNull(a2.getReference()); assertEquals(1, a2.getStamp()); } /** * get returns the last values of reference and stamp set */ public void testGetSet() { int[] mark = new int[1]; AtomicStampedReference ai = new AtomicStampedReference(one, 0); assertSame(one,ai.getReference()); assertEquals(0, ai.getStamp()); assertSame(one, ai.get(mark)); assertEquals(0, mark[0]); ai.set(two, 0); assertSame(two,ai.getReference()); assertEquals(0, ai.getStamp()); assertSame(two, ai.get(mark)); assertEquals(0, mark[0]); ai.set(one, 1); assertSame(one,ai.getReference()); assertEquals(1, ai.getStamp()); assertSame(one, ai.get(mark)); assertEquals(1,mark[0]); } /** * attemptStamp succeeds in single thread */ public void testAttemptStamp() { int[] mark = new int[1]; AtomicStampedReference ai = new AtomicStampedReference(one, 0); assertEquals(0, ai.getStamp()); assertTrue(ai.attemptStamp(one, 1)); assertEquals(1, ai.getStamp()); assertSame(one, ai.get(mark)); assertEquals(1, mark[0]); } /** * compareAndSet succeeds in changing values if equal to expected reference * and stamp else fails */ public void testCompareAndSet() { int[] mark = new int[1]; AtomicStampedReference ai = new AtomicStampedReference(one, 0); assertSame(one, ai.get(mark)); assertEquals(0, ai.getStamp()); assertEquals(0, mark[0]); assertTrue(ai.compareAndSet(one, two, 0, 0)); assertSame(two, ai.get(mark)); assertEquals(0, mark[0]); assertTrue(ai.compareAndSet(two, m3, 0, 1)); assertSame(m3, ai.get(mark)); assertEquals(1, mark[0]); assertFalse(ai.compareAndSet(two, m3, 1, 1)); assertSame(m3, ai.get(mark)); assertEquals(1, mark[0]); } /** * compareAndSet in one thread enables another waiting for reference value * to succeed */ public void testCompareAndSetInMultipleThreads() throws Exception { final AtomicStampedReference ai = new AtomicStampedReference(one, 0); Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!ai.compareAndSet(two, three, 0, 0)) Thread.yield(); }}); t.start(); assertTrue(ai.compareAndSet(one, two, 0, 0)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertSame(ai.getReference(), three); assertEquals(ai.getStamp(), 0); } /** * compareAndSet in one thread enables another waiting for stamp value * to succeed */ public void testCompareAndSetInMultipleThreads2() throws Exception { final AtomicStampedReference ai = new AtomicStampedReference(one, 0); Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!ai.compareAndSet(one, one, 1, 2)) Thread.yield(); }}); t.start(); assertTrue(ai.compareAndSet(one, one, 0, 1)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertSame(ai.getReference(), one); assertEquals(ai.getStamp(), 2); } /** * repeated weakCompareAndSet succeeds in changing values when equal * to expected */ public void testWeakCompareAndSet() { int[] mark = new int[1]; AtomicStampedReference ai = new AtomicStampedReference(one, 0); assertSame(one, ai.get(mark)); assertEquals(0, ai.getStamp()); assertEquals(0, mark[0]); while (!ai.weakCompareAndSet(one, two, 0, 0)); assertSame(two, ai.get(mark)); assertEquals(0, mark[0]); while (!ai.weakCompareAndSet(two, m3, 0, 1)); assertSame(m3, ai.get(mark)); assertEquals(1, mark[0]); } } jsr166/src/test/tck/AtomicIntegerFieldUpdaterTest.java0000644000000000000000000002206211537741072020065 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import java.util.concurrent.atomic.*; import junit.framework.*; import java.util.*; public class AtomicIntegerFieldUpdaterTest extends JSR166TestCase { volatile int x = 0; int w; long z; public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicIntegerFieldUpdaterTest.class); } /** * Construction with non-existent field throws RuntimeException */ public void testConstructor() { try { AtomicIntegerFieldUpdater a = AtomicIntegerFieldUpdater.newUpdater (AtomicIntegerFieldUpdaterTest.class, "y"); shouldThrow(); } catch (RuntimeException success) {} } /** * construction with field not of given type throws RuntimeException */ public void testConstructor2() { try { AtomicIntegerFieldUpdater a = AtomicIntegerFieldUpdater.newUpdater (AtomicIntegerFieldUpdaterTest.class, "z"); shouldThrow(); } catch (RuntimeException success) {} } /** * construction with non-volatile field throws RuntimeException */ public void testConstructor3() { try { AtomicIntegerFieldUpdater a = AtomicIntegerFieldUpdater.newUpdater (AtomicIntegerFieldUpdaterTest.class, "w"); shouldThrow(); } catch (RuntimeException success) {} } /** * get returns the last value set or assigned */ public void testGetSet() { AtomicIntegerFieldUpdater a; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.get(this)); a.set(this,2); assertEquals(2,a.get(this)); a.set(this,-3); assertEquals(-3,a.get(this)); } /** * get returns the last value lazySet by same thread */ public void testGetLazySet() { AtomicIntegerFieldUpdater a; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.get(this)); a.lazySet(this,2); assertEquals(2,a.get(this)); a.lazySet(this,-3); assertEquals(-3,a.get(this)); } /** * compareAndSet succeeds in changing value if equal to expected else fails */ public void testCompareAndSet() { AtomicIntegerFieldUpdater a; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertTrue(a.compareAndSet(this,1,2)); assertTrue(a.compareAndSet(this,2,-4)); assertEquals(-4,a.get(this)); assertFalse(a.compareAndSet(this,-5,7)); assertEquals(-4,a.get(this)); assertTrue(a.compareAndSet(this,-4,7)); assertEquals(7,a.get(this)); } /** * compareAndSet in one thread enables another waiting for value * to succeed */ public void testCompareAndSetInMultipleThreads() throws Exception { x = 1; final AtomicIntegerFieldUpdatera; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!a.compareAndSet(AtomicIntegerFieldUpdaterTest.this, 2, 3)) Thread.yield(); }}); t.start(); assertTrue(a.compareAndSet(this, 1, 2)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertEquals(a.get(this), 3); } /** * repeated weakCompareAndSet succeeds in changing value when equal * to expected */ public void testWeakCompareAndSet() { AtomicIntegerFieldUpdater a; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; while (!a.weakCompareAndSet(this,1,2)); while (!a.weakCompareAndSet(this,2,-4)); assertEquals(-4,a.get(this)); while (!a.weakCompareAndSet(this,-4,7)); assertEquals(7,a.get(this)); } /** * getAndSet returns previous value and sets to given value */ public void testGetAndSet() { AtomicIntegerFieldUpdater a; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.getAndSet(this, 0)); assertEquals(0,a.getAndSet(this,-10)); assertEquals(-10,a.getAndSet(this,1)); } /** * getAndAdd returns previous value and adds given value */ public void testGetAndAdd() { AtomicIntegerFieldUpdater a; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.getAndAdd(this,2)); assertEquals(3,a.get(this)); assertEquals(3,a.getAndAdd(this,-4)); assertEquals(-1,a.get(this)); } /** * getAndDecrement returns previous value and decrements */ public void testGetAndDecrement() { AtomicIntegerFieldUpdater a; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.getAndDecrement(this)); assertEquals(0,a.getAndDecrement(this)); assertEquals(-1,a.getAndDecrement(this)); } /** * getAndIncrement returns previous value and increments */ public void testGetAndIncrement() { AtomicIntegerFieldUpdater a; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.getAndIncrement(this)); assertEquals(2,a.get(this)); a.set(this,-2); assertEquals(-2,a.getAndIncrement(this)); assertEquals(-1,a.getAndIncrement(this)); assertEquals(0,a.getAndIncrement(this)); assertEquals(1,a.get(this)); } /** * addAndGet adds given value to current, and returns current value */ public void testAddAndGet() { AtomicIntegerFieldUpdater a; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(3,a.addAndGet(this,2)); assertEquals(3,a.get(this)); assertEquals(-1,a.addAndGet(this,-4)); assertEquals(-1,a.get(this)); } /** * decrementAndGet decrements and returns current value */ public void testDecrementAndGet() { AtomicIntegerFieldUpdater a; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(0,a.decrementAndGet(this)); assertEquals(-1,a.decrementAndGet(this)); assertEquals(-2,a.decrementAndGet(this)); assertEquals(-2,a.get(this)); } /** * incrementAndGet increments and returns current value */ public void testIncrementAndGet() { AtomicIntegerFieldUpdater a; try { a = AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(2,a.incrementAndGet(this)); assertEquals(2,a.get(this)); a.set(this,-2); assertEquals(-1,a.incrementAndGet(this)); assertEquals(0,a.incrementAndGet(this)); assertEquals(1,a.incrementAndGet(this)); assertEquals(1,a.get(this)); } } jsr166/src/test/tck/ThreadLocalRandomTest.java0000644000000000000000000002012211537741073016361 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.concurrent.*; import java.util.*; public class ThreadLocalRandomTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ThreadLocalRandomTest.class); } /** * Testing coverage notes: * * We don't test randomness properties, but only that repeated * calls, up to NCALLS tries, produce at least one different * result. For bounded versions, we sample various intervals * across multiples of primes. */ // static final int NCALLS = 10000; // max sampled int bound static final int MAX_INT_BOUND = (1 << 28); // Max sampled long bound static final long MAX_LONG_BOUND = (1L << 42); /** * setSeed throws UnsupportedOperationException */ public void testSetSeed() { try { ThreadLocalRandom.current().setSeed(17); shouldThrow(); } catch (UnsupportedOperationException success) {} } /** * Repeated calls to nextInt produce at least one different result */ public void testNextInt() { int f = ThreadLocalRandom.current().nextInt(); int i = 0; while (i < NCALLS && ThreadLocalRandom.current().nextInt() == f) ++i; assertTrue(i < NCALLS); } /** * Repeated calls to nextLong produce at least one different result */ public void testNextLong() { long f = ThreadLocalRandom.current().nextLong(); int i = 0; while (i < NCALLS && ThreadLocalRandom.current().nextLong() == f) ++i; assertTrue(i < NCALLS); } /** * Repeated calls to nextBoolean produce at least one different result */ public void testNextBoolean() { boolean f = ThreadLocalRandom.current().nextBoolean(); int i = 0; while (i < NCALLS && ThreadLocalRandom.current().nextBoolean() == f) ++i; assertTrue(i < NCALLS); } /** * Repeated calls to nextFloat produce at least one different result */ public void testNextFloat() { float f = ThreadLocalRandom.current().nextFloat(); int i = 0; while (i < NCALLS && ThreadLocalRandom.current().nextFloat() == f) ++i; assertTrue(i < NCALLS); } /** * Repeated calls to nextDouble produce at least one different result */ public void testNextDouble() { double f = ThreadLocalRandom.current().nextDouble(); double i = 0; while (i < NCALLS && ThreadLocalRandom.current().nextDouble() == f) ++i; assertTrue(i < NCALLS); } /** * Repeated calls to nextGaussian produce at least one different result */ public void testNextGaussian() { double f = ThreadLocalRandom.current().nextGaussian(); int i = 0; while (i < NCALLS && ThreadLocalRandom.current().nextGaussian() == f) ++i; assertTrue(i < NCALLS); } /** * nextInt(negative) throws IllegalArgumentException; */ public void testNextIntBoundedNeg() { try { int f = ThreadLocalRandom.current().nextInt(-17); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * nextInt(least >= bound) throws IllegalArgumentException; */ public void testNextIntBadBounds() { try { int f = ThreadLocalRandom.current().nextInt(17, 2); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * nextInt(bound) returns 0 <= value < bound; * repeated calls produce at least one different result */ public void testNextIntBounded() { // sample bound space across prime number increments for (int bound = 2; bound < MAX_INT_BOUND; bound += 524959) { int f = ThreadLocalRandom.current().nextInt(bound); assertTrue(0 <= f && f < bound); int i = 0; int j; while (i < NCALLS && (j = ThreadLocalRandom.current().nextInt(bound)) == f) { assertTrue(0 <= j && j < bound); ++i; } assertTrue(i < NCALLS); } } /** * nextInt(least, bound) returns least <= value < bound; * repeated calls produce at least one different result */ public void testNextIntBounded2() { for (int least = -15485863; least < MAX_INT_BOUND; least += 524959) { for (int bound = least + 2; bound > least && bound < MAX_INT_BOUND; bound += 49979687) { int f = ThreadLocalRandom.current().nextInt(least, bound); assertTrue(least <= f && f < bound); int i = 0; int j; while (i < NCALLS && (j = ThreadLocalRandom.current().nextInt(least, bound)) == f) { assertTrue(least <= j && j < bound); ++i; } assertTrue(i < NCALLS); } } } /** * nextLong(negative) throws IllegalArgumentException; */ public void testNextLongBoundedNeg() { try { long f = ThreadLocalRandom.current().nextLong(-17); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * nextLong(least >= bound) throws IllegalArgumentException; */ public void testNextLongBadBounds() { try { long f = ThreadLocalRandom.current().nextLong(17, 2); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * nextLong(bound) returns 0 <= value < bound; * repeated calls produce at least one different result */ public void testNextLongBounded() { for (long bound = 2; bound < MAX_LONG_BOUND; bound += 15485863) { long f = ThreadLocalRandom.current().nextLong(bound); assertTrue(0 <= f && f < bound); int i = 0; long j; while (i < NCALLS && (j = ThreadLocalRandom.current().nextLong(bound)) == f) { assertTrue(0 <= j && j < bound); ++i; } assertTrue(i < NCALLS); } } /** * nextLong(least, bound) returns least <= value < bound; * repeated calls produce at least one different result */ public void testNextLongBounded2() { for (long least = -86028121; least < MAX_LONG_BOUND; least += 982451653L) { for (long bound = least + 2; bound > least && bound < MAX_LONG_BOUND; bound += Math.abs(bound * 7919)) { long f = ThreadLocalRandom.current().nextLong(least, bound); assertTrue(least <= f && f < bound); int i = 0; long j; while (i < NCALLS && (j = ThreadLocalRandom.current().nextLong(least, bound)) == f) { assertTrue(least <= j && j < bound); ++i; } assertTrue(i < NCALLS); } } } /** * nextDouble(least, bound) returns least <= value < bound; * repeated calls produce at least one different result */ public void testNextDoubleBounded2() { for (double least = 0.0001; least < 1.0e20; least *= 8) { for (double bound = least * 1.001; bound < 1.0e20; bound *= 16) { double f = ThreadLocalRandom.current().nextDouble(least, bound); assertTrue(least <= f && f < bound); int i = 0; double j; while (i < NCALLS && (j = ThreadLocalRandom.current().nextDouble(least, bound)) == f) { assertTrue(least <= j && j < bound); ++i; } assertTrue(i < NCALLS); } } } } jsr166/src/test/tck/LinkedListTest.java0000644000000000000000000004174111537741072015111 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; public class LinkedListTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(LinkedListTest.class); } /** * Create a queue of given size containing consecutive * Integers 0 ... n. */ private LinkedList populatedQueue(int n) { LinkedList q = new LinkedList(); assertTrue(q.isEmpty()); for (int i = 0; i < n; ++i) assertTrue(q.offer(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(n, q.size()); return q; } /** * new queue is empty */ public void testConstructor1() { assertEquals(0, new LinkedList().size()); } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { LinkedList q = new LinkedList((Collection)null); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements of collection used to initialize */ public void testConstructor6() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = i; LinkedList q = new LinkedList(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * isEmpty is true before add, false after */ public void testEmpty() { LinkedList q = new LinkedList(); assertTrue(q.isEmpty()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.add(new Integer(2)); q.remove(); q.remove(); assertTrue(q.isEmpty()); } /** * size changes when elements added and removed */ public void testSize() { LinkedList q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.remove(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * offer(null) succeeds */ public void testOfferNull() { LinkedList q = new LinkedList(); q.offer(null); } /** * Offer succeeds */ public void testOffer() { LinkedList q = new LinkedList(); assertTrue(q.offer(new Integer(0))); assertTrue(q.offer(new Integer(1))); } /** * add succeeds */ public void testAdd() { LinkedList q = new LinkedList(); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); assertTrue(q.add(new Integer(i))); } } /** * addAll(null) throws NPE */ public void testAddAll1() { try { LinkedList q = new LinkedList(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements, in traversal order, of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = i; LinkedList q = new LinkedList(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * addAll with too large an index throws IOOBE */ public void testAddAll2_IndexOutOfBoundsException() { LinkedList l = new LinkedList(); l.add(new Object()); LinkedList m = new LinkedList(); m.add(new Object()); try { l.addAll(4,m); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * addAll with negative index throws IOOBE */ public void testAddAll4_BadIndex() { LinkedList l = new LinkedList(); l.add(new Object()); LinkedList m = new LinkedList(); m.add(new Object()); try { l.addAll(-1,m); shouldThrow(); } catch (IndexOutOfBoundsException success) {} } /** * poll succeeds unless empty */ public void testPoll() { LinkedList q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll()); } assertNull(q.poll()); } /** * peek returns next element, or null if empty */ public void testPeek() { LinkedList q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peek()); assertEquals(i, q.poll()); assertTrue(q.peek() == null || !q.peek().equals(i)); } assertNull(q.peek()); } /** * element returns next element, or throws NSEE if empty */ public void testElement() { LinkedList q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.element()); assertEquals(i, q.poll()); } try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove removes next element, or throws NSEE if empty */ public void testRemove() { LinkedList q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remove()); } try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { LinkedList q = populatedQueue(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove((Integer)i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove((Integer)i)); assertFalse(q.contains(i)); assertFalse(q.remove((Integer)(i+1))); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { LinkedList q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.poll(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { LinkedList q = populatedQueue(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); assertTrue(q.add(new Integer(1))); assertFalse(q.isEmpty()); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { LinkedList q = populatedQueue(SIZE); LinkedList p = new LinkedList(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); assertTrue(p.add(new Integer(i))); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { LinkedList q = populatedQueue(SIZE); LinkedList p = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.remove(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { LinkedList q = populatedQueue(SIZE); LinkedList p = populatedQueue(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.remove()); assertFalse(q.contains(I)); } } } /** * toArray contains all elements in FIFO order */ public void testToArray() { LinkedList q = populatedQueue(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) assertSame(o[i], q.poll()); } /** * toArray(a) contains all elements in FIFO order */ public void testToArray2() { LinkedList q = populatedQueue(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.poll()); } /** * toArray(null) throws NullPointerException */ public void testToArray_NullArg() { LinkedList l = new LinkedList(); l.add(new Object()); try { l.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { LinkedList l = new LinkedList(); l.add(new Integer(5)); try { l.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * iterator iterates through all elements */ public void testIterator() { LinkedList q = populatedQueue(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * iterator ordering is FIFO */ public void testIteratorOrdering() { final LinkedList q = new LinkedList(); q.add(new Integer(1)); q.add(new Integer(2)); q.add(new Integer(3)); int k = 0; for (Iterator it = q.iterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); } /** * iterator.remove removes current element */ public void testIteratorRemove() { final LinkedList q = new LinkedList(); q.add(new Integer(1)); q.add(new Integer(2)); q.add(new Integer(3)); Iterator it = q.iterator(); assertEquals(it.next(), 1); it.remove(); it = q.iterator(); assertEquals(it.next(), 2); assertEquals(it.next(), 3); assertFalse(it.hasNext()); } /** * Descending iterator iterates through all elements */ public void testDescendingIterator() { LinkedList q = populatedQueue(SIZE); int i = 0; Iterator it = q.descendingIterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); assertFalse(it.hasNext()); try { it.next(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * Descending iterator ordering is reverse FIFO */ public void testDescendingIteratorOrdering() { final LinkedList q = new LinkedList(); q.add(new Integer(3)); q.add(new Integer(2)); q.add(new Integer(1)); int k = 0; for (Iterator it = q.descendingIterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); } /** * descendingIterator.remove removes current element */ public void testDescendingIteratorRemove() { final LinkedList q = new LinkedList(); q.add(three); q.add(two); q.add(one); Iterator it = q.descendingIterator(); it.next(); it.remove(); it = q.descendingIterator(); assertSame(it.next(), two); assertSame(it.next(), three); assertFalse(it.hasNext()); } /** * toString contains toStrings of elements */ public void testToString() { LinkedList q = populatedQueue(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * peek returns element inserted with addFirst */ public void testAddFirst() { LinkedList q = populatedQueue(3); q.addFirst(four); assertSame(four, q.peek()); } /** * peekFirst returns element inserted with push */ public void testPush() { LinkedList q = populatedQueue(3); q.push(four); assertSame(four, q.peekFirst()); } /** * pop removes next element, or throws NSEE if empty */ public void testPop() { LinkedList q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pop()); } try { q.pop(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * OfferFirst succeeds */ public void testOfferFirst() { LinkedList q = new LinkedList(); assertTrue(q.offerFirst(new Integer(0))); assertTrue(q.offerFirst(new Integer(1))); } /** * OfferLast succeeds */ public void testOfferLast() { LinkedList q = new LinkedList(); assertTrue(q.offerLast(new Integer(0))); assertTrue(q.offerLast(new Integer(1))); } /** * pollLast succeeds unless empty */ public void testPollLast() { LinkedList q = populatedQueue(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.pollLast()); } assertNull(q.pollLast()); } /** * peekFirst returns next element, or null if empty */ public void testPeekFirst() { LinkedList q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peekFirst()); assertEquals(i, q.pollFirst()); assertTrue(q.peekFirst() == null || !q.peekFirst().equals(i)); } assertNull(q.peekFirst()); } /** * peekLast returns next element, or null if empty */ public void testPeekLast() { LinkedList q = populatedQueue(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.peekLast()); assertEquals(i, q.pollLast()); assertTrue(q.peekLast() == null || !q.peekLast().equals(i)); } assertNull(q.peekLast()); } public void testFirstElement() { LinkedList q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.getFirst()); assertEquals(i, q.pollFirst()); } try { q.getFirst(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * getLast returns next element, or throws NSEE if empty */ public void testLastElement() { LinkedList q = populatedQueue(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.getLast()); assertEquals(i, q.pollLast()); } try { q.getLast(); shouldThrow(); } catch (NoSuchElementException success) {} assertNull(q.peekLast()); } /** * removeFirstOccurrence(x) removes x and returns true if present */ public void testRemoveFirstOccurrence() { LinkedList q = populatedQueue(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.removeFirstOccurrence(new Integer(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.removeFirstOccurrence(new Integer(i))); assertFalse(q.removeFirstOccurrence(new Integer(i+1))); } assertTrue(q.isEmpty()); } /** * removeLastOccurrence(x) removes x and returns true if present */ public void testRemoveLastOccurrence() { LinkedList q = populatedQueue(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.removeLastOccurrence(new Integer(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.removeLastOccurrence(new Integer(i))); assertFalse(q.removeLastOccurrence(new Integer(i+1))); } assertTrue(q.isEmpty()); } } jsr166/src/test/tck/TreeMapTest.java0000644000000000000000000010034311551675514014401 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class TreeMapTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(TreeMapTest.class); } /** * Create a map from Integers 1-5 to Strings "A"-"E". */ private static TreeMap map5() { TreeMap map = new TreeMap(); assertTrue(map.isEmpty()); map.put(one, "A"); map.put(five, "E"); map.put(three, "C"); map.put(two, "B"); map.put(four, "D"); assertFalse(map.isEmpty()); assertEquals(5, map.size()); return map; } /** * clear removes all pairs */ public void testClear() { TreeMap map = map5(); map.clear(); assertEquals(map.size(), 0); } /** * */ public void testConstructFromSorted() { TreeMap map = map5(); TreeMap map2 = new TreeMap(map); assertEquals(map, map2); } /** * Maps with same contents are equal */ public void testEquals() { TreeMap map1 = map5(); TreeMap map2 = map5(); assertEquals(map1, map2); assertEquals(map2, map1); map1.clear(); assertFalse(map1.equals(map2)); assertFalse(map2.equals(map1)); } /** * containsKey returns true for contained key */ public void testContainsKey() { TreeMap map = map5(); assertTrue(map.containsKey(one)); assertFalse(map.containsKey(zero)); } /** * containsValue returns true for held values */ public void testContainsValue() { TreeMap map = map5(); assertTrue(map.containsValue("A")); assertFalse(map.containsValue("Z")); } /** * get returns the correct element at the given key, * or null if not present */ public void testGet() { TreeMap map = map5(); assertEquals("A", (String)map.get(one)); TreeMap empty = new TreeMap(); assertNull(empty.get(one)); } /** * isEmpty is true of empty map and false for non-empty */ public void testIsEmpty() { TreeMap empty = new TreeMap(); TreeMap map = map5(); assertTrue(empty.isEmpty()); assertFalse(map.isEmpty()); } /** * firstKey returns first key */ public void testFirstKey() { TreeMap map = map5(); assertEquals(one, map.firstKey()); } /** * lastKey returns last key */ public void testLastKey() { TreeMap map = map5(); assertEquals(five, map.lastKey()); } /** * keySet.toArray returns contains all keys */ public void testKeySetToArray() { TreeMap map = map5(); Set s = map.keySet(); Object[] ar = s.toArray(); assertTrue(s.containsAll(Arrays.asList(ar))); assertEquals(5, ar.length); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); } /** * descendingkeySet.toArray returns contains all keys */ public void testDescendingKeySetToArray() { TreeMap map = map5(); Set s = map.descendingKeySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); assertTrue(s.containsAll(Arrays.asList(ar))); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); } /** * keySet returns a Set containing all the keys */ public void testKeySet() { TreeMap map = map5(); Set s = map.keySet(); assertEquals(5, s.size()); assertTrue(s.contains(one)); assertTrue(s.contains(two)); assertTrue(s.contains(three)); assertTrue(s.contains(four)); assertTrue(s.contains(five)); } /** * keySet is ordered */ public void testKeySetOrder() { TreeMap map = map5(); Set s = map.keySet(); Iterator i = s.iterator(); Integer last = (Integer)i.next(); assertEquals(last, one); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) < 0); last = k; ++count; } assertEquals(count ,5); } /** * descending iterator of key set is inverse ordered */ public void testKeySetDescendingIteratorOrder() { TreeMap map = map5(); NavigableSet s = map.navigableKeySet(); Iterator i = s.descendingIterator(); Integer last = (Integer)i.next(); assertEquals(last, five); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) > 0); last = k; ++count; } assertEquals(count ,5); } /** * descendingKeySet is ordered */ public void testDescendingKeySetOrder() { TreeMap map = map5(); Set s = map.descendingKeySet(); Iterator i = s.iterator(); Integer last = (Integer)i.next(); assertEquals(last, five); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) > 0); last = k; ++count; } assertEquals(count, 5); } /** * descending iterator of descendingKeySet is ordered */ public void testDescendingKeySetDescendingIteratorOrder() { TreeMap map = map5(); NavigableSet s = map.descendingKeySet(); Iterator i = s.descendingIterator(); Integer last = (Integer)i.next(); assertEquals(last, one); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) < 0); last = k; ++count; } assertEquals(count, 5); } /** * values collection contains all values */ public void testValues() { TreeMap map = map5(); Collection s = map.values(); assertEquals(5, s.size()); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * entrySet contains all pairs */ public void testEntrySet() { TreeMap map = map5(); Set s = map.entrySet(); assertEquals(5, s.size()); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); assertTrue( (e.getKey().equals(one) && e.getValue().equals("A")) || (e.getKey().equals(two) && e.getValue().equals("B")) || (e.getKey().equals(three) && e.getValue().equals("C")) || (e.getKey().equals(four) && e.getValue().equals("D")) || (e.getKey().equals(five) && e.getValue().equals("E"))); } } /** * descendingEntrySet contains all pairs */ public void testDescendingEntrySet() { TreeMap map = map5(); Set s = map.descendingMap().entrySet(); assertEquals(5, s.size()); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); assertTrue( (e.getKey().equals(one) && e.getValue().equals("A")) || (e.getKey().equals(two) && e.getValue().equals("B")) || (e.getKey().equals(three) && e.getValue().equals("C")) || (e.getKey().equals(four) && e.getValue().equals("D")) || (e.getKey().equals(five) && e.getValue().equals("E"))); } } /** * entrySet.toArray contains all entries */ public void testEntrySetToArray() { TreeMap map = map5(); Set s = map.entrySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); for (int i = 0; i < 5; ++i) { assertTrue(map.containsKey(((Map.Entry)(ar[i])).getKey())); assertTrue(map.containsValue(((Map.Entry)(ar[i])).getValue())); } } /** * descendingEntrySet.toArray contains all entries */ public void testDescendingEntrySetToArray() { TreeMap map = map5(); Set s = map.descendingMap().entrySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); for (int i = 0; i < 5; ++i) { assertTrue(map.containsKey(((Map.Entry)(ar[i])).getKey())); assertTrue(map.containsValue(((Map.Entry)(ar[i])).getValue())); } } /** * putAll adds all key-value pairs from the given map */ public void testPutAll() { TreeMap empty = new TreeMap(); TreeMap map = map5(); empty.putAll(map); assertEquals(5, empty.size()); assertTrue(empty.containsKey(one)); assertTrue(empty.containsKey(two)); assertTrue(empty.containsKey(three)); assertTrue(empty.containsKey(four)); assertTrue(empty.containsKey(five)); } /** * remove removes the correct key-value pair from the map */ public void testRemove() { TreeMap map = map5(); map.remove(five); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); } /** * lowerEntry returns preceding entry. */ public void testLowerEntry() { TreeMap map = map5(); Map.Entry e1 = map.lowerEntry(three); assertEquals(two, e1.getKey()); Map.Entry e2 = map.lowerEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.lowerEntry(one); assertNull(e3); Map.Entry e4 = map.lowerEntry(zero); assertNull(e4); } /** * higherEntry returns next entry. */ public void testHigherEntry() { TreeMap map = map5(); Map.Entry e1 = map.higherEntry(three); assertEquals(four, e1.getKey()); Map.Entry e2 = map.higherEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.higherEntry(five); assertNull(e3); Map.Entry e4 = map.higherEntry(six); assertNull(e4); } /** * floorEntry returns preceding entry. */ public void testFloorEntry() { TreeMap map = map5(); Map.Entry e1 = map.floorEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.floorEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.floorEntry(one); assertEquals(one, e3.getKey()); Map.Entry e4 = map.floorEntry(zero); assertNull(e4); } /** * ceilingEntry returns next entry. */ public void testCeilingEntry() { TreeMap map = map5(); Map.Entry e1 = map.ceilingEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.ceilingEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.ceilingEntry(five); assertEquals(five, e3.getKey()); Map.Entry e4 = map.ceilingEntry(six); assertNull(e4); } /** * lowerKey returns preceding element */ public void testLowerKey() { TreeMap q = map5(); Object e1 = q.lowerKey(three); assertEquals(two, e1); Object e2 = q.lowerKey(six); assertEquals(five, e2); Object e3 = q.lowerKey(one); assertNull(e3); Object e4 = q.lowerKey(zero); assertNull(e4); } /** * higherKey returns next element */ public void testHigherKey() { TreeMap q = map5(); Object e1 = q.higherKey(three); assertEquals(four, e1); Object e2 = q.higherKey(zero); assertEquals(one, e2); Object e3 = q.higherKey(five); assertNull(e3); Object e4 = q.higherKey(six); assertNull(e4); } /** * floorKey returns preceding element */ public void testFloorKey() { TreeMap q = map5(); Object e1 = q.floorKey(three); assertEquals(three, e1); Object e2 = q.floorKey(six); assertEquals(five, e2); Object e3 = q.floorKey(one); assertEquals(one, e3); Object e4 = q.floorKey(zero); assertNull(e4); } /** * ceilingKey returns next element */ public void testCeilingKey() { TreeMap q = map5(); Object e1 = q.ceilingKey(three); assertEquals(three, e1); Object e2 = q.ceilingKey(zero); assertEquals(one, e2); Object e3 = q.ceilingKey(five); assertEquals(five, e3); Object e4 = q.ceilingKey(six); assertNull(e4); } /** * pollFirstEntry returns entries in order */ public void testPollFirstEntry() { TreeMap map = map5(); Map.Entry e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(two, e.getKey()); map.put(one, "A"); e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(three, e.getKey()); map.remove(four); e = map.pollFirstEntry(); assertEquals(five, e.getKey()); try { e.setValue("A"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollFirstEntry(); assertNull(e); } /** * pollLastEntry returns entries in order */ public void testPollLastEntry() { TreeMap map = map5(); Map.Entry e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(four, e.getKey()); map.put(five, "E"); e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(three, e.getKey()); map.remove(two); e = map.pollLastEntry(); assertEquals(one, e.getKey()); try { e.setValue("E"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollLastEntry(); assertNull(e); } /** * size returns the correct values */ public void testSize() { TreeMap map = map5(); TreeMap empty = new TreeMap(); assertEquals(0, empty.size()); assertEquals(5, map.size()); } /** * toString contains toString of elements */ public void testToString() { TreeMap map = map5(); String s = map.toString(); for (int i = 1; i <= 5; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } // Exception tests /** * get(null) of nonempty map throws NPE */ public void testGet_NullPointerException() { try { TreeMap c = map5(); c.get(null); shouldThrow(); } catch (NullPointerException success) {} } /** * containsKey(null) of nonempty map throws NPE */ public void testContainsKey_NullPointerException() { try { TreeMap c = map5(); c.containsKey(null); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(null) throws NPE for nonempty map */ public void testRemove1_NullPointerException() { try { TreeMap c = new TreeMap(); c.put("sadsdf", "asdads"); c.remove(null); shouldThrow(); } catch (NullPointerException success) {} } /** * A deserialized map equals original */ public void testSerialization() throws Exception { TreeMap q = map5(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); TreeMap r = (TreeMap)in.readObject(); assertEquals(q.size(), r.size()); assertTrue(q.equals(r)); assertTrue(r.equals(q)); } /** * subMap returns map with keys in requested range */ public void testSubMapContents() { TreeMap map = map5(); NavigableMap sm = map.subMap(two, true, four, false); assertEquals(two, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals(2, sm.size()); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); Iterator r = sm.descendingKeySet().iterator(); k = (Integer)(r.next()); assertEquals(three, k); k = (Integer)(r.next()); assertEquals(two, k); assertFalse(r.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(two)); assertEquals(4, map.size()); assertEquals(1, sm.size()); assertEquals(three, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals("C", sm.remove(three)); assertTrue(sm.isEmpty()); assertEquals(3, map.size()); } public void testSubMapContents2() { TreeMap map = map5(); NavigableMap sm = map.subMap(two, true, three, false); assertEquals(1, sm.size()); assertEquals(two, sm.firstKey()); assertEquals(two, sm.lastKey()); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertFalse(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); assertFalse(i.hasNext()); Iterator r = sm.descendingKeySet().iterator(); k = (Integer)(r.next()); assertEquals(two, k); assertFalse(r.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(two)); assertEquals(4, map.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertSame(sm.remove(three), null); assertEquals(4, map.size()); } /** * headMap returns map with keys in requested range */ public void testHeadMapContents() { TreeMap map = map5(); NavigableMap sm = map.headMap(four, false); assertTrue(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(one, k); k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, map.size()); assertEquals(four, map.firstKey()); } /** * headMap returns map with keys in requested range */ public void testTailMapContents() { TreeMap map = map5(); NavigableMap sm = map.tailMap(two, true); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertTrue(sm.containsKey(four)); assertTrue(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); k = (Integer)(i.next()); assertEquals(four, k); k = (Integer)(i.next()); assertEquals(five, k); assertFalse(i.hasNext()); Iterator r = sm.descendingKeySet().iterator(); k = (Integer)(r.next()); assertEquals(five, k); k = (Integer)(r.next()); assertEquals(four, k); k = (Integer)(r.next()); assertEquals(three, k); k = (Integer)(r.next()); assertEquals(two, k); assertFalse(r.hasNext()); Iterator ei = sm.entrySet().iterator(); Map.Entry e; e = (Map.Entry)(ei.next()); assertEquals(two, e.getKey()); assertEquals("B", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(three, e.getKey()); assertEquals("C", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(four, e.getKey()); assertEquals("D", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); assertFalse(i.hasNext()); NavigableMap ssm = sm.tailMap(four, true); assertEquals(four, ssm.firstKey()); assertEquals(five, ssm.lastKey()); assertEquals("D", ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, map.size()); } Random rnd = new Random(666); BitSet bs; /** * Submaps of submaps subdivide correctly */ public void testRecursiveSubMaps() throws Exception { int mapSize = expensiveTests ? 1000 : 100; Class cl = TreeMap.class; NavigableMap map = newMap(cl); bs = new BitSet(mapSize); populate(map, mapSize); check(map, 0, mapSize - 1, true); check(map.descendingMap(), 0, mapSize - 1, false); mutateMap(map, 0, mapSize - 1); check(map, 0, mapSize - 1, true); check(map.descendingMap(), 0, mapSize - 1, false); bashSubMap(map.subMap(0, true, mapSize, false), 0, mapSize - 1, true); } static NavigableMap newMap(Class cl) throws Exception { NavigableMap result = (NavigableMap) cl.newInstance(); assertEquals(result.size(), 0); assertFalse(result.keySet().iterator().hasNext()); return result; } void populate(NavigableMap map, int limit) { for (int i = 0, n = 2 * limit / 3; i < n; i++) { int key = rnd.nextInt(limit); put(map, key); } } void mutateMap(NavigableMap map, int min, int max) { int size = map.size(); int rangeSize = max - min + 1; // Remove a bunch of entries directly for (int i = 0, n = rangeSize / 2; i < n; i++) { remove(map, min - 5 + rnd.nextInt(rangeSize + 10)); } // Remove a bunch of entries with iterator for (Iterator it = map.keySet().iterator(); it.hasNext(); ) { if (rnd.nextBoolean()) { bs.clear(it.next()); it.remove(); } } // Add entries till we're back to original size while (map.size() < size) { int key = min + rnd.nextInt(rangeSize); assertTrue(key >= min && key<= max); put(map, key); } } void mutateSubMap(NavigableMap map, int min, int max) { int size = map.size(); int rangeSize = max - min + 1; // Remove a bunch of entries directly for (int i = 0, n = rangeSize / 2; i < n; i++) { remove(map, min - 5 + rnd.nextInt(rangeSize + 10)); } // Remove a bunch of entries with iterator for (Iterator it = map.keySet().iterator(); it.hasNext(); ) { if (rnd.nextBoolean()) { bs.clear(it.next()); it.remove(); } } // Add entries till we're back to original size while (map.size() < size) { int key = min - 5 + rnd.nextInt(rangeSize + 10); if (key >= min && key<= max) { put(map, key); } else { try { map.put(key, 2 * key); shouldThrow(); } catch (IllegalArgumentException success) {} } } } void put(NavigableMap map, int key) { if (map.put(key, 2 * key) == null) bs.set(key); } void remove(NavigableMap map, int key) { if (map.remove(key) != null) bs.clear(key); } void bashSubMap(NavigableMap map, int min, int max, boolean ascending) { check(map, min, max, ascending); check(map.descendingMap(), min, max, !ascending); mutateSubMap(map, min, max); check(map, min, max, ascending); check(map.descendingMap(), min, max, !ascending); // Recurse if (max - min < 2) return; int midPoint = (min + max) / 2; // headMap - pick direction and endpoint inclusion randomly boolean incl = rnd.nextBoolean(); NavigableMap hm = map.headMap(midPoint, incl); if (ascending) { if (rnd.nextBoolean()) bashSubMap(hm, min, midPoint - (incl ? 0 : 1), true); else bashSubMap(hm.descendingMap(), min, midPoint - (incl ? 0 : 1), false); } else { if (rnd.nextBoolean()) bashSubMap(hm, midPoint + (incl ? 0 : 1), max, false); else bashSubMap(hm.descendingMap(), midPoint + (incl ? 0 : 1), max, true); } // tailMap - pick direction and endpoint inclusion randomly incl = rnd.nextBoolean(); NavigableMap tm = map.tailMap(midPoint,incl); if (ascending) { if (rnd.nextBoolean()) bashSubMap(tm, midPoint + (incl ? 0 : 1), max, true); else bashSubMap(tm.descendingMap(), midPoint + (incl ? 0 : 1), max, false); } else { if (rnd.nextBoolean()) { bashSubMap(tm, min, midPoint - (incl ? 0 : 1), false); } else { bashSubMap(tm.descendingMap(), min, midPoint - (incl ? 0 : 1), true); } } // subMap - pick direction and endpoint inclusion randomly int rangeSize = max - min + 1; int[] endpoints = new int[2]; endpoints[0] = min + rnd.nextInt(rangeSize); endpoints[1] = min + rnd.nextInt(rangeSize); Arrays.sort(endpoints); boolean lowIncl = rnd.nextBoolean(); boolean highIncl = rnd.nextBoolean(); if (ascending) { NavigableMap sm = map.subMap( endpoints[0], lowIncl, endpoints[1], highIncl); if (rnd.nextBoolean()) bashSubMap(sm, endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), true); else bashSubMap(sm.descendingMap(), endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), false); } else { NavigableMap sm = map.subMap( endpoints[1], highIncl, endpoints[0], lowIncl); if (rnd.nextBoolean()) bashSubMap(sm, endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), false); else bashSubMap(sm.descendingMap(), endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), true); } } /** * min and max are both inclusive. If max < min, interval is empty. */ void check(NavigableMap map, final int min, final int max, final boolean ascending) { class ReferenceSet { int lower(int key) { return ascending ? lowerAscending(key) : higherAscending(key); } int floor(int key) { return ascending ? floorAscending(key) : ceilingAscending(key); } int ceiling(int key) { return ascending ? ceilingAscending(key) : floorAscending(key); } int higher(int key) { return ascending ? higherAscending(key) : lowerAscending(key); } int first() { return ascending ? firstAscending() : lastAscending(); } int last() { return ascending ? lastAscending() : firstAscending(); } int lowerAscending(int key) { return floorAscending(key - 1); } int floorAscending(int key) { if (key < min) return -1; else if (key > max) key = max; // BitSet should support this! Test would run much faster while (key >= min) { if (bs.get(key)) return key; key--; } return -1; } int ceilingAscending(int key) { if (key < min) key = min; else if (key > max) return -1; int result = bs.nextSetBit(key); return result > max ? -1 : result; } int higherAscending(int key) { return ceilingAscending(key + 1); } private int firstAscending() { int result = ceilingAscending(min); return result > max ? -1 : result; } private int lastAscending() { int result = floorAscending(max); return result < min ? -1 : result; } } ReferenceSet rs = new ReferenceSet(); // Test contents using containsKey int size = 0; for (int i = min; i <= max; i++) { boolean bsContainsI = bs.get(i); assertEquals(bsContainsI, map.containsKey(i)); if (bsContainsI) size++; } assertEquals(map.size(), size); // Test contents using contains keySet iterator int size2 = 0; int previousKey = -1; for (int key : map.keySet()) { assertTrue(bs.get(key)); size2++; assertTrue(previousKey < 0 || (ascending ? key - previousKey > 0 : key - previousKey < 0)); previousKey = key; } assertEquals(size2, size); // Test navigation ops for (int key = min - 1; key <= max + 1; key++) { assertEq(map.lowerKey(key), rs.lower(key)); assertEq(map.floorKey(key), rs.floor(key)); assertEq(map.higherKey(key), rs.higher(key)); assertEq(map.ceilingKey(key), rs.ceiling(key)); } // Test extrema if (map.size() != 0) { assertEq(map.firstKey(), rs.first()); assertEq(map.lastKey(), rs.last()); } else { assertEq(rs.first(), -1); assertEq(rs.last(), -1); try { map.firstKey(); shouldThrow(); } catch (NoSuchElementException success) {} try { map.lastKey(); shouldThrow(); } catch (NoSuchElementException success) {} } } static void assertEq(Integer i, int j) { if (i == null) assertEquals(j, -1); else assertEquals((int) i, j); } static boolean eq(Integer i, int j) { return i == null ? j == -1 : i == j; } } jsr166/src/test/tck/CountDownLatchTest.java0000644000000000000000000001171211560754737015746 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; public class CountDownLatchTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(CountDownLatchTest.class); } /** * negative constructor argument throws IAE */ public void testConstructor() { try { new CountDownLatch(-1); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * getCount returns initial count and decreases after countDown */ public void testGetCount() { final CountDownLatch l = new CountDownLatch(2); assertEquals(2, l.getCount()); l.countDown(); assertEquals(1, l.getCount()); } /** * countDown decrements count when positive and has no effect when zero */ public void testCountDown() { final CountDownLatch l = new CountDownLatch(1); assertEquals(1, l.getCount()); l.countDown(); assertEquals(0, l.getCount()); l.countDown(); assertEquals(0, l.getCount()); } /** * await returns after countDown to zero, but not before */ public void testAwait() throws InterruptedException { final CountDownLatch l = new CountDownLatch(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertTrue(l.getCount() > 0); l.await(); assertEquals(0, l.getCount()); }}); t.start(); assertEquals(l.getCount(), 2); delay(SHORT_DELAY_MS); l.countDown(); assertEquals(l.getCount(), 1); l.countDown(); assertEquals(l.getCount(), 0); t.join(); } /** * timed await returns after countDown to zero */ public void testTimedAwait() throws InterruptedException { final CountDownLatch l = new CountDownLatch(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertTrue(l.getCount() > 0); assertTrue(l.await(SMALL_DELAY_MS, MILLISECONDS)); }}); t.start(); assertEquals(l.getCount(), 2); delay(SHORT_DELAY_MS); l.countDown(); assertEquals(l.getCount(), 1); l.countDown(); assertEquals(l.getCount(), 0); t.join(); } /** * await throws IE if interrupted before counted down */ public void testAwait_InterruptedException() throws InterruptedException { final CountDownLatch l = new CountDownLatch(1); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { assertTrue(l.getCount() > 0); l.await(); }}); t.start(); assertEquals(l.getCount(), 1); t.interrupt(); t.join(); } /** * timed await throws IE if interrupted before counted down */ public void testTimedAwait_InterruptedException() throws InterruptedException { final CountDownLatch l = new CountDownLatch(1); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { assertTrue(l.getCount() > 0); l.await(MEDIUM_DELAY_MS, MILLISECONDS); }}); t.start(); delay(SHORT_DELAY_MS); assertEquals(l.getCount(), 1); t.interrupt(); t.join(); } /** * timed await times out if not counted down before timeout */ public void testAwaitTimeout() throws InterruptedException { final CountDownLatch l = new CountDownLatch(1); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertTrue(l.getCount() > 0); assertFalse(l.await(SHORT_DELAY_MS, MILLISECONDS)); assertTrue(l.getCount() > 0); }}); t.start(); assertEquals(l.getCount(), 1); t.join(); } /** * toString indicates current count */ public void testToString() { CountDownLatch s = new CountDownLatch(2); String us = s.toString(); assertTrue(us.indexOf("Count = 2") >= 0); s.countDown(); String s1 = s.toString(); assertTrue(s1.indexOf("Count = 1") >= 0); s.countDown(); String s2 = s.toString(); assertTrue(s2.indexOf("Count = 0") >= 0); } } jsr166/src/test/tck/SynchronousQueueTest.java0000644000000000000000000005224111560754737016413 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.io.*; public class SynchronousQueueTest extends JSR166TestCase { public static class Fair extends BlockingQueueTest { protected BlockingQueue emptyCollection() { return new SynchronousQueue(true); } } public static class NonFair extends BlockingQueueTest { protected BlockingQueue emptyCollection() { return new SynchronousQueue(false); } } public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return newTestSuite(SynchronousQueueTest.class, new Fair().testSuite(), new NonFair().testSuite()); } /** * Any SynchronousQueue is both empty and full */ public void testEmptyFull(SynchronousQueue q) { assertTrue(q.isEmpty()); assertEquals(0, q.size()); assertEquals(0, q.remainingCapacity()); assertFalse(q.offer(zero)); } /** * A non-fair SynchronousQueue is both empty and full */ public void testEmptyFull() { testEmptyFull(new SynchronousQueue()); } /** * A fair SynchronousQueue is both empty and full */ public void testFairEmptyFull() { testEmptyFull(new SynchronousQueue(true)); } /** * offer(null) throws NPE */ public void testOfferNull() { try { SynchronousQueue q = new SynchronousQueue(); q.offer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * add(null) throws NPE */ public void testAddNull() { try { SynchronousQueue q = new SynchronousQueue(); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * offer fails if no active taker */ public void testOffer() { SynchronousQueue q = new SynchronousQueue(); assertFalse(q.offer(one)); } /** * add throws ISE if no active taker */ public void testAdd() { try { SynchronousQueue q = new SynchronousQueue(); assertEquals(0, q.remainingCapacity()); q.add(one); shouldThrow(); } catch (IllegalStateException success) {} } /** * addAll(null) throws NPE */ public void testAddAll1() { try { SynchronousQueue q = new SynchronousQueue(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll(this) throws IAE */ public void testAddAllSelf() { try { SynchronousQueue q = new SynchronousQueue(); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { SynchronousQueue q = new SynchronousQueue(); Integer[] ints = new Integer[1]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll throws ISE if no active taker */ public void testAddAll4() { try { SynchronousQueue q = new SynchronousQueue(); Integer[] ints = new Integer[1]; for (int i = 0; i < 1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (IllegalStateException success) {} } /** * put(null) throws NPE */ public void testPutNull() throws InterruptedException { try { SynchronousQueue q = new SynchronousQueue(); q.put(null); shouldThrow(); } catch (NullPointerException success) {} } /** * put blocks interruptibly if no active taker */ public void testBlockingPut() throws InterruptedException { Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { SynchronousQueue q = new SynchronousQueue(); q.put(zero); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * put blocks waiting for take */ public void testPutWithTake() throws InterruptedException { final SynchronousQueue q = new SynchronousQueue(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { int added = 0; try { while (true) { q.put(added); ++added; } } catch (InterruptedException success) { assertEquals(1, added); } }}); t.start(); delay(SHORT_DELAY_MS); assertEquals(0, q.take()); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * timed offer times out if elements not taken */ public void testTimedOffer(final SynchronousQueue q) throws InterruptedException { final CountDownLatch pleaseInterrupt = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long t0 = System.nanoTime(); assertFalse(q.offer(new Object(), SHORT_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); pleaseInterrupt.countDown(); t0 = System.nanoTime(); try { q.offer(new Object(), LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); }}); assertTrue(pleaseInterrupt.await(MEDIUM_DELAY_MS, MILLISECONDS)); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); } /** * timed offer times out if elements not taken */ public void testTimedOffer() throws InterruptedException { testTimedOffer(new SynchronousQueue()); } /** * timed offer times out if elements not taken */ public void testFairTimedOffer() throws InterruptedException { testTimedOffer(new SynchronousQueue(true)); } /** * put blocks interruptibly if no active taker */ public void testFairBlockingPut() throws InterruptedException { Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { SynchronousQueue q = new SynchronousQueue(true); q.put(zero); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * put blocks waiting for take */ public void testFairPutWithTake() throws InterruptedException { final SynchronousQueue q = new SynchronousQueue(true); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { int added = 0; try { while (true) { q.put(added); ++added; } } catch (InterruptedException success) { assertEquals(1, added); } }}); t.start(); delay(SHORT_DELAY_MS); assertEquals(0, q.take()); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * take blocks interruptibly when empty */ public void testFairTakeFromEmpty() throws InterruptedException { final SynchronousQueue q = new SynchronousQueue(true); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { q.take(); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * poll return null if no active putter */ public void testPoll() { SynchronousQueue q = new SynchronousQueue(); assertNull(q.poll()); } /** * timed poll with zero timeout times out if no active putter */ public void testTimedPoll0() throws InterruptedException { SynchronousQueue q = new SynchronousQueue(); assertNull(q.poll(0, MILLISECONDS)); } /** * timed poll with nonzero timeout times out if no active putter */ public void testTimedPoll() throws InterruptedException { SynchronousQueue q = new SynchronousQueue(); long t0 = System.nanoTime(); assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); } /** * Interrupted timed poll throws InterruptedException instead of * returning timeout status */ public void testInterruptedTimedPoll(final SynchronousQueue q) throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long t0 = System.nanoTime(); threadStarted.countDown(); try { q.poll(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); }}); threadStarted.await(); delay(SHORT_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); } /** * Interrupted timed poll throws InterruptedException instead of * returning timeout status */ public void testInterruptedTimedPoll() throws InterruptedException { testInterruptedTimedPoll(new SynchronousQueue()); } /** * Interrupted timed poll throws InterruptedException instead of * returning timeout status */ public void testFairInterruptedTimedPoll() throws InterruptedException { testInterruptedTimedPoll(new SynchronousQueue(true)); } /** * timed poll before a delayed offer times out, returning null; * after offer succeeds; on interruption throws */ public void testFairTimedPollWithOffer() throws InterruptedException { final SynchronousQueue q = new SynchronousQueue(true); final CountDownLatch pleaseOffer = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long t0 = System.nanoTime(); assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); pleaseOffer.countDown(); t0 = System.nanoTime(); assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); t0 = System.nanoTime(); try { q.poll(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); }}); assertTrue(pleaseOffer.await(MEDIUM_DELAY_MS, MILLISECONDS)); long t0 = System.nanoTime(); assertTrue(q.offer(zero, LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); } /** * peek() returns null if no active putter */ public void testPeek() { SynchronousQueue q = new SynchronousQueue(); assertNull(q.peek()); } /** * element() throws NSEE if no active putter */ public void testElement() { SynchronousQueue q = new SynchronousQueue(); try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove() throws NSEE if no active putter */ public void testRemove() { SynchronousQueue q = new SynchronousQueue(); try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove(x) returns false */ public void testRemoveElement() { SynchronousQueue q = new SynchronousQueue(); assertFalse(q.remove(zero)); assertTrue(q.isEmpty()); } /** * contains returns false */ public void testContains() { SynchronousQueue q = new SynchronousQueue(); assertFalse(q.contains(zero)); } /** * clear ensures isEmpty */ public void testClear() { SynchronousQueue q = new SynchronousQueue(); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll returns false unless empty */ public void testContainsAll() { SynchronousQueue q = new SynchronousQueue(); Integer[] empty = new Integer[0]; assertTrue(q.containsAll(Arrays.asList(empty))); Integer[] ints = new Integer[1]; ints[0] = zero; assertFalse(q.containsAll(Arrays.asList(ints))); } /** * retainAll returns false */ public void testRetainAll() { SynchronousQueue q = new SynchronousQueue(); Integer[] empty = new Integer[0]; assertFalse(q.retainAll(Arrays.asList(empty))); Integer[] ints = new Integer[1]; ints[0] = zero; assertFalse(q.retainAll(Arrays.asList(ints))); } /** * removeAll returns false */ public void testRemoveAll() { SynchronousQueue q = new SynchronousQueue(); Integer[] empty = new Integer[0]; assertFalse(q.removeAll(Arrays.asList(empty))); Integer[] ints = new Integer[1]; ints[0] = zero; assertFalse(q.containsAll(Arrays.asList(ints))); } /** * toArray is empty */ public void testToArray() { SynchronousQueue q = new SynchronousQueue(); Object[] o = q.toArray(); assertEquals(o.length, 0); } /** * toArray(a) is nulled at position 0 */ public void testToArray2() { SynchronousQueue q = new SynchronousQueue(); Integer[] ints = new Integer[1]; assertNull(ints[0]); } /** * toArray(null) throws NPE */ public void testToArray_BadArg() { SynchronousQueue q = new SynchronousQueue(); try { Object o[] = q.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** * iterator does not traverse any elements */ public void testIterator() { SynchronousQueue q = new SynchronousQueue(); Iterator it = q.iterator(); assertFalse(it.hasNext()); try { Object x = it.next(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * iterator remove throws ISE */ public void testIteratorRemove() { SynchronousQueue q = new SynchronousQueue(); Iterator it = q.iterator(); try { it.remove(); shouldThrow(); } catch (IllegalStateException success) {} } /** * toString returns a non-null string */ public void testToString() { SynchronousQueue q = new SynchronousQueue(); String s = q.toString(); assertNotNull(s); } /** * offer transfers elements across Executor tasks */ public void testOfferInExecutor() { final SynchronousQueue q = new SynchronousQueue(); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(q.offer(one)); assertTrue(q.offer(one, MEDIUM_DELAY_MS, MILLISECONDS)); assertEquals(0, q.remainingCapacity()); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { delay(SMALL_DELAY_MS); assertSame(one, q.take()); }}); joinPool(executor); } /** * poll retrieves elements across Executor threads */ public void testPollInExecutor() { final SynchronousQueue q = new SynchronousQueue(); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertNull(q.poll()); assertSame(one, q.poll(MEDIUM_DELAY_MS, MILLISECONDS)); assertTrue(q.isEmpty()); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { delay(SHORT_DELAY_MS); q.put(one); }}); joinPool(executor); } /** * a deserialized serialized queue is usable */ public void testSerialization() throws Exception { SynchronousQueue q = new SynchronousQueue(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); SynchronousQueue r = (SynchronousQueue)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.remove(), r.remove()); } /** * drainTo(null) throws NPE */ public void testDrainToNull() { SynchronousQueue q = new SynchronousQueue(); try { q.drainTo(null); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this) throws IAE */ public void testDrainToSelf() { SynchronousQueue q = new SynchronousQueue(); try { q.drainTo(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c) of empty queue doesn't transfer elements */ public void testDrainTo() { SynchronousQueue q = new SynchronousQueue(); ArrayList l = new ArrayList(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), 0); } /** * drainTo empties queue, unblocking a waiting put. */ public void testDrainToWithActivePut() throws InterruptedException { final SynchronousQueue q = new SynchronousQueue(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.put(new Integer(1)); }}); t.start(); ArrayList l = new ArrayList(); delay(SHORT_DELAY_MS); q.drainTo(l); assertTrue(l.size() <= 1); if (l.size() > 0) assertEquals(l.get(0), new Integer(1)); t.join(); assertTrue(l.size() <= 1); } /** * drainTo(null, n) throws NPE */ public void testDrainToNullN() { SynchronousQueue q = new SynchronousQueue(); try { q.drainTo(null, 0); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this, n) throws IAE */ public void testDrainToSelfN() { SynchronousQueue q = new SynchronousQueue(); try { q.drainTo(q, 0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c, n) empties up to n elements of queue into c */ public void testDrainToN() throws InterruptedException { final SynchronousQueue q = new SynchronousQueue(); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.put(one); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.put(two); }}); t1.start(); t2.start(); ArrayList l = new ArrayList(); delay(SHORT_DELAY_MS); q.drainTo(l, 1); assertEquals(1, l.size()); q.drainTo(l, 1); assertEquals(2, l.size()); assertTrue(l.contains(one)); assertTrue(l.contains(two)); t1.join(); t2.join(); } } jsr166/src/test/tck/CopyOnWriteArraySetTest.java0000644000000000000000000001766011537741072016747 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class CopyOnWriteArraySetTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(CopyOnWriteArraySetTest.class); } static CopyOnWriteArraySet populatedSet(int n) { CopyOnWriteArraySet a = new CopyOnWriteArraySet(); assertTrue(a.isEmpty()); for (int i = 0; i < n; ++i) a.add(new Integer(i)); assertFalse(a.isEmpty()); assertEquals(n, a.size()); return a; } /** * Default-constructed set is empty */ public void testConstructor() { CopyOnWriteArraySet a = new CopyOnWriteArraySet(); assertTrue(a.isEmpty()); } /** * Collection-constructed set holds all of its elements */ public void testConstructor3() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); CopyOnWriteArraySet a = new CopyOnWriteArraySet(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertTrue(a.contains(ints[i])); } /** * addAll adds each element from the given collection */ public void testAddAll() { CopyOnWriteArraySet full = populatedSet(3); Vector v = new Vector(); v.add(three); v.add(four); v.add(five); full.addAll(v); assertEquals(6, full.size()); } /** * addAll adds each element from the given collection that did not * already exist in the set */ public void testAddAll2() { CopyOnWriteArraySet full = populatedSet(3); Vector v = new Vector(); v.add(three); v.add(four); v.add(one); // will not add this element full.addAll(v); assertEquals(5, full.size()); } /** * add will not add the element if it already exists in the set */ public void testAdd2() { CopyOnWriteArraySet full = populatedSet(3); full.add(one); assertEquals(3, full.size()); } /** * add adds the element when it does not exist in the set */ public void testAdd3() { CopyOnWriteArraySet full = populatedSet(3); full.add(three); assertTrue(full.contains(three)); } /** * clear removes all elements from the set */ public void testClear() { CopyOnWriteArraySet full = populatedSet(3); full.clear(); assertEquals(0, full.size()); } /** * contains returns true for added elements */ public void testContains() { CopyOnWriteArraySet full = populatedSet(3); assertTrue(full.contains(one)); assertFalse(full.contains(five)); } /** * Sets with equal elements are equal */ public void testEquals() { CopyOnWriteArraySet a = populatedSet(3); CopyOnWriteArraySet b = populatedSet(3); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); a.add(m1); assertFalse(a.equals(b)); assertFalse(b.equals(a)); b.add(m1); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); } /** * containsAll returns true for collections with subset of elements */ public void testContainsAll() { CopyOnWriteArraySet full = populatedSet(3); Vector v = new Vector(); v.add(one); v.add(two); assertTrue(full.containsAll(v)); v.add(six); assertFalse(full.containsAll(v)); } /** * isEmpty is true when empty, else false */ public void testIsEmpty() { CopyOnWriteArraySet empty = new CopyOnWriteArraySet(); CopyOnWriteArraySet full = populatedSet(3); assertTrue(empty.isEmpty()); assertFalse(full.isEmpty()); } /** * iterator() returns an iterator containing the elements of the set */ public void testIterator() { CopyOnWriteArraySet full = populatedSet(3); Iterator i = full.iterator(); int j; for (j = 0; i.hasNext(); j++) assertEquals(j, i.next()); assertEquals(3, j); } /** * iterator remove is unsupported */ public void testIteratorRemove() { CopyOnWriteArraySet full = populatedSet(3); Iterator it = full.iterator(); it.next(); try { it.remove(); shouldThrow(); } catch (UnsupportedOperationException success) {} } /** * toString holds toString of elements */ public void testToString() { CopyOnWriteArraySet full = populatedSet(3); String s = full.toString(); for (int i = 0; i < 3; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * removeAll removes all elements from the given collection */ public void testRemoveAll() { CopyOnWriteArraySet full = populatedSet(3); Vector v = new Vector(); v.add(one); v.add(two); full.removeAll(v); assertEquals(1, full.size()); } /** * remove removes an element */ public void testRemove() { CopyOnWriteArraySet full = populatedSet(3); full.remove(one); assertFalse(full.contains(one)); assertEquals(2, full.size()); } /** * size returns the number of elements */ public void testSize() { CopyOnWriteArraySet empty = new CopyOnWriteArraySet(); CopyOnWriteArraySet full = populatedSet(3); assertEquals(3, full.size()); assertEquals(0, empty.size()); } /** * toArray returns an Object array containing all elements from the set */ public void testToArray() { CopyOnWriteArraySet full = populatedSet(3); Object[] o = full.toArray(); assertEquals(3, o.length); assertEquals(0, o[0]); assertEquals(1, o[1]); assertEquals(2, o[2]); } /** * toArray returns an Integer array containing all elements from * the set */ public void testToArray2() { CopyOnWriteArraySet full = populatedSet(3); Integer[] i = new Integer[3]; i = (Integer[])full.toArray(i); assertEquals(3, i.length); assertEquals(0, (int) i[0]); assertEquals(1, (int) i[1]); assertEquals(2, (int) i[2]); } /** * toArray throws an ArrayStoreException when the given array can * not store the objects inside the set */ public void testToArray_ArrayStoreException() { try { CopyOnWriteArraySet c = new CopyOnWriteArraySet(); c.add("zfasdfsdf"); c.add("asdadasd"); c.toArray(new Long[5]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * A deserialized serialized set is equal */ public void testSerialization() throws Exception { CopyOnWriteArraySet q = populatedSet(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); CopyOnWriteArraySet r = (CopyOnWriteArraySet)in.readObject(); assertEquals(q.size(), r.size()); assertTrue(q.equals(r)); assertTrue(r.equals(q)); } } jsr166/src/test/tck/LinkedTransferQueueTest.java0000644000000000000000000011100411561022501016737 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include John Vint */ import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.NANOSECONDS; import junit.framework.Test; import junit.framework.TestSuite; @SuppressWarnings({"unchecked", "rawtypes"}) public class LinkedTransferQueueTest extends JSR166TestCase { public static class Generic extends BlockingQueueTest { protected BlockingQueue emptyCollection() { return new LinkedTransferQueue(); } } public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return newTestSuite(LinkedTransferQueueTest.class, new Generic().testSuite()); } /** * Constructor builds new queue with size being zero and empty * being true */ public void testConstructor1() { assertEquals(0, new LinkedTransferQueue().size()); assertTrue(new LinkedTransferQueue().isEmpty()); } /** * Initializing constructor with null collection throws * NullPointerException */ public void testConstructor2() { try { new LinkedTransferQueue(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws * NullPointerException */ public void testConstructor3() { try { Integer[] ints = new Integer[SIZE]; new LinkedTransferQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing constructor with a collection containing some null elements * throws NullPointerException */ public void testConstructor4() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE - 1; ++i) { ints[i] = i; } new LinkedTransferQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements of the collection it is initialized by */ public void testConstructor5() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) { ints[i] = i; } List intList = Arrays.asList(ints); LinkedTransferQueue q = new LinkedTransferQueue(intList); assertEquals(q.size(), intList.size()); assertEquals(q.toString(), intList.toString()); assertTrue(Arrays.equals(q.toArray(), intList.toArray())); assertTrue(Arrays.equals(q.toArray(new Object[0]), intList.toArray(new Object[0]))); assertTrue(Arrays.equals(q.toArray(new Object[SIZE]), intList.toArray(new Object[SIZE]))); for (int i = 0; i < SIZE; ++i) { assertEquals(ints[i], q.poll()); } } /** * remainingCapacity() always returns Integer.MAX_VALUE */ public void testRemainingCapacity() { LinkedTransferQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(SIZE - i, q.size()); q.remove(); } for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(i, q.size()); q.add(i); } } /** * offer(null) throws NullPointerException */ public void testOfferNull() { try { LinkedTransferQueue q = new LinkedTransferQueue(); q.offer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * add(null) throws NullPointerException */ public void testAddNull() { try { LinkedTransferQueue q = new LinkedTransferQueue(); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll(null) throws NullPointerException */ public void testAddAll1() { try { LinkedTransferQueue q = new LinkedTransferQueue(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll(this) throws IllegalArgumentException */ public void testAddAllSelf() { try { LinkedTransferQueue q = populatedQueue(SIZE); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * addAll of a collection with null elements throws NullPointerException */ public void testAddAll2() { try { LinkedTransferQueue q = new LinkedTransferQueue(); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws * NullPointerException after possibly adding some elements */ public void testAddAll3() { try { LinkedTransferQueue q = new LinkedTransferQueue(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE - 1; ++i) { ints[i] = i; } q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements, in traversal order, of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) { ints[i] = i; } LinkedTransferQueue q = new LinkedTransferQueue(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) { assertEquals(ints[i], q.poll()); } } /** * put(null) throws NullPointerException */ public void testPutNull() throws InterruptedException { try { LinkedTransferQueue q = new LinkedTransferQueue(); q.put(null); shouldThrow(); } catch (NullPointerException success) {} } /** * all elements successfully put are contained */ public void testPut() { LinkedTransferQueue q = new LinkedTransferQueue(); for (int i = 0; i < SIZE; ++i) { assertEquals(q.size(), i); q.put(i); assertTrue(q.contains(i)); } } /** * take retrieves elements in FIFO order */ public void testTake() throws InterruptedException { LinkedTransferQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, (int) q.take()); } } /** * take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { final BlockingQueue q = populatedQueue(SIZE); final CountDownLatch aboutToWait = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { assertEquals(i, (int) q.take()); } aboutToWait.countDown(); try { q.take(); shouldThrow(); } catch (InterruptedException success) {} }}); aboutToWait.await(); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); checkEmpty(q); } /** * poll succeeds unless empty */ public void testPoll() throws InterruptedException { LinkedTransferQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, (int) q.poll()); } assertNull(q.poll()); checkEmpty(q); } /** * timed poll with zero timeout succeeds when non-empty, else times out */ public void testTimedPoll0() throws InterruptedException { LinkedTransferQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, (int) q.poll(0, MILLISECONDS)); } assertNull(q.poll(0, MILLISECONDS)); checkEmpty(q); } /** * timed poll with nonzero timeout succeeds when non-empty, else times out */ public void testTimedPoll() throws InterruptedException { LinkedTransferQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { long t0 = System.nanoTime(); assertEquals(i, (int) q.poll(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); } long t0 = System.nanoTime(); assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); checkEmpty(q); } /** * Interrupted timed poll throws InterruptedException instead of * returning timeout status */ public void testInterruptedTimedPoll() throws InterruptedException { final BlockingQueue q = populatedQueue(SIZE); final CountDownLatch aboutToWait = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { long t0 = System.nanoTime(); assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); } long t0 = System.nanoTime(); aboutToWait.countDown(); try { q.poll(MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); } }}); aboutToWait.await(); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); checkEmpty(q); } /** * timed poll after thread interrupted throws InterruptedException * instead of returning timeout status */ public void testTimedPollAfterInterrupt() throws InterruptedException { final BlockingQueue q = populatedQueue(SIZE); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { Thread.currentThread().interrupt(); for (int i = 0; i < SIZE; ++i) { long t0 = System.nanoTime(); assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); } try { q.poll(MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); awaitTermination(t, MEDIUM_DELAY_MS); checkEmpty(q); } /** * peek returns next element, or null if empty */ public void testPeek() throws InterruptedException { LinkedTransferQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, (int) q.peek()); assertEquals(i, (int) q.poll()); assertTrue(q.peek() == null || i != (int) q.peek()); } assertNull(q.peek()); checkEmpty(q); } /** * element returns next element, or throws NoSuchElementException if empty */ public void testElement() throws InterruptedException { LinkedTransferQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, (int) q.element()); assertEquals(i, (int) q.poll()); } try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} checkEmpty(q); } /** * remove removes next element, or throws NoSuchElementException if empty */ public void testRemove() throws InterruptedException { LinkedTransferQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, (int) q.remove()); } try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} checkEmpty(q); } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() throws InterruptedException { LinkedTransferQueue q = populatedQueue(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } checkEmpty(q); } /** * An add following remove(x) succeeds */ public void testRemoveElementAndAdd() throws InterruptedException { LinkedTransferQueue q = new LinkedTransferQueue(); assertTrue(q.add(one)); assertTrue(q.add(two)); assertTrue(q.remove(one)); assertTrue(q.remove(two)); assertTrue(q.add(three)); assertSame(q.take(), three); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { LinkedTransferQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(i)); assertEquals(i, (int) q.poll()); assertFalse(q.contains(i)); } } /** * clear removes all elements */ public void testClear() throws InterruptedException { LinkedTransferQueue q = populatedQueue(SIZE); q.clear(); checkEmpty(q); assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); q.add(one); assertFalse(q.isEmpty()); assertEquals(1, q.size()); assertTrue(q.contains(one)); q.clear(); checkEmpty(q); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { LinkedTransferQueue q = populatedQueue(SIZE); LinkedTransferQueue p = new LinkedTransferQueue(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(i); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true * if changed */ public void testRetainAll() { LinkedTransferQueue q = populatedQueue(SIZE); LinkedTransferQueue p = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) { assertFalse(changed); } else { assertTrue(changed); } assertTrue(q.containsAll(p)); assertEquals(SIZE - i, q.size()); p.remove(); } } /** * removeAll(c) removes only those elements of c and reports true * if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { LinkedTransferQueue q = populatedQueue(SIZE); LinkedTransferQueue p = populatedQueue(i); assertTrue(q.removeAll(p)); assertEquals(SIZE - i, q.size()); for (int j = 0; j < i; ++j) { assertFalse(q.contains(p.remove())); } } } /** * toArray() contains all elements in FIFO order */ public void testToArray() { LinkedTransferQueue q = populatedQueue(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) { assertSame(o[i], q.poll()); } } /** * toArray(a) contains all elements in FIFO order */ public void testToArray2() { LinkedTransferQueue q = populatedQueue(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) { assertSame(ints[i], q.poll()); } } /** * toArray(null) throws NullPointerException */ public void testToArray_NullArg() { LinkedTransferQueue q = populatedQueue(SIZE); try { q.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { LinkedTransferQueue q = populatedQueue(SIZE); try { q.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * iterator iterates through all elements */ public void testIterator() throws InterruptedException { LinkedTransferQueue q = populatedQueue(SIZE); Iterator it = q.iterator(); int i = 0; while (it.hasNext()) { assertEquals(it.next(), i++); } assertEquals(i, SIZE); } /** * iterator.remove() removes current element */ public void testIteratorRemove() { final LinkedTransferQueue q = new LinkedTransferQueue(); q.add(two); q.add(one); q.add(three); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertSame(it.next(), one); assertSame(it.next(), three); assertFalse(it.hasNext()); } /** * iterator ordering is FIFO */ public void testIteratorOrdering() { final LinkedTransferQueue q = new LinkedTransferQueue(); assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); q.add(one); q.add(two); q.add(three); assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); int k = 0; for (Integer n : q) { assertEquals(++k, (int) n); } assertEquals(3, k); } /** * Modifications do not cause iterators to fail */ public void testWeaklyConsistentIteration() { final LinkedTransferQueue q = new LinkedTransferQueue(); q.add(one); q.add(two); q.add(three); for (Iterator it = q.iterator(); it.hasNext();) { q.remove(); it.next(); } assertEquals(0, q.size()); } /** * toString contains toStrings of elements */ public void testToString() { LinkedTransferQueue q = populatedQueue(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * offer transfers elements across Executor tasks */ public void testOfferInExecutor() { final LinkedTransferQueue q = new LinkedTransferQueue(); final CountDownLatch threadsStarted = new CountDownLatch(2); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadsStarted.countDown(); threadsStarted.await(); assertTrue(q.offer(one, MEDIUM_DELAY_MS, MILLISECONDS)); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadsStarted.countDown(); threadsStarted.await(); assertSame(one, q.take()); checkEmpty(q); }}); joinPool(executor); } /** * timed poll retrieves elements across Executor threads */ public void testPollInExecutor() { final LinkedTransferQueue q = new LinkedTransferQueue(); final CountDownLatch threadsStarted = new CountDownLatch(2); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertNull(q.poll()); threadsStarted.countDown(); threadsStarted.await(); assertSame(one, q.poll(SMALL_DELAY_MS, MILLISECONDS)); checkEmpty(q); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadsStarted.countDown(); threadsStarted.await(); q.put(one); }}); joinPool(executor); } /** * A deserialized serialized queue has same elements in same order */ public void testSerialization() throws Exception { LinkedTransferQueue q = populatedQueue(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); LinkedTransferQueue r = (LinkedTransferQueue) in.readObject(); assertEquals(q.size(), r.size()); assertEquals(q.toString(), r.toString()); assertTrue(Arrays.equals(q.toArray(), r.toArray())); while (!q.isEmpty()) { assertEquals(q.remove(), r.remove()); } } /** * drainTo(null) throws NullPointerException */ public void testDrainToNull() { LinkedTransferQueue q = populatedQueue(SIZE); try { q.drainTo(null); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this) throws IllegalArgumentException */ public void testDrainToSelf() { LinkedTransferQueue q = populatedQueue(SIZE); try { q.drainTo(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c) empties queue into another collection c */ public void testDrainTo() { LinkedTransferQueue q = populatedQueue(SIZE); ArrayList l = new ArrayList(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(l.get(i), i); } q.add(zero); q.add(one); assertFalse(q.isEmpty()); assertTrue(q.contains(zero)); assertTrue(q.contains(one)); l.clear(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), 2); for (int i = 0; i < 2; ++i) { assertEquals(l.get(i), i); } } /** * drainTo(c) empties full queue, unblocking a waiting put. */ public void testDrainToWithActivePut() throws InterruptedException { final LinkedTransferQueue q = populatedQueue(SIZE); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { q.put(SIZE + 1); }}); ArrayList l = new ArrayList(); q.drainTo(l); assertTrue(l.size() >= SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(l.get(i), i); } awaitTermination(t, MEDIUM_DELAY_MS); assertTrue(q.size() + l.size() >= SIZE); } /** * drainTo(null, n) throws NullPointerException */ public void testDrainToNullN() { LinkedTransferQueue q = populatedQueue(SIZE); try { q.drainTo(null, SIZE); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this, n) throws IllegalArgumentException */ public void testDrainToSelfN() { LinkedTransferQueue q = populatedQueue(SIZE); try { q.drainTo(q, SIZE); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c, n) empties first min(n, size) elements of queue into c */ public void testDrainToN() { LinkedTransferQueue q = new LinkedTransferQueue(); for (int i = 0; i < SIZE + 2; ++i) { for (int j = 0; j < SIZE; j++) { assertTrue(q.offer(j)); } ArrayList l = new ArrayList(); q.drainTo(l, i); int k = (i < SIZE) ? i : SIZE; assertEquals(l.size(), k); assertEquals(q.size(), SIZE - k); for (int j = 0; j < k; ++j) { assertEquals(l.get(j), j); } while (q.poll() != null) ; } } /** * timed poll() or take() increments the waiting consumer count; * offer(e) decrements the waiting consumer count */ public void testWaitingConsumer() throws InterruptedException { final LinkedTransferQueue q = new LinkedTransferQueue(); assertEquals(q.getWaitingConsumerCount(), 0); assertFalse(q.hasWaitingConsumer()); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertSame(one, q.poll(LONG_DELAY_MS, MILLISECONDS)); assertEquals(q.getWaitingConsumerCount(), 0); assertFalse(q.hasWaitingConsumer()); }}); threadStarted.await(); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); assertEquals(q.getWaitingConsumerCount(), 1); assertTrue(q.hasWaitingConsumer()); assertTrue(q.offer(one)); assertEquals(q.getWaitingConsumerCount(), 0); assertFalse(q.hasWaitingConsumer()); awaitTermination(t, MEDIUM_DELAY_MS); } /** * transfer(null) throws NullPointerException */ public void testTransfer1() throws InterruptedException { try { LinkedTransferQueue q = new LinkedTransferQueue(); q.transfer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * transfer waits until a poll occurs. The transfered element * is returned by this associated poll. */ public void testTransfer2() throws InterruptedException { final LinkedTransferQueue q = new LinkedTransferQueue(); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); q.transfer(five); checkEmpty(q); }}); threadStarted.await(); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); assertEquals(1, q.size()); assertSame(five, q.poll()); checkEmpty(q); awaitTermination(t, MEDIUM_DELAY_MS); } /** * transfer waits until a poll occurs, and then transfers in fifo order */ public void testTransfer3() throws InterruptedException { final LinkedTransferQueue q = new LinkedTransferQueue(); Thread first = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.transfer(four); assertTrue(!q.contains(four)); assertEquals(1, q.size()); }}); Thread interruptedThread = newStartedThread( new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { while (q.isEmpty()) Thread.yield(); q.transfer(five); }}); while (q.size() < 2) Thread.yield(); assertEquals(2, q.size()); assertSame(four, q.poll()); first.join(); assertEquals(1, q.size()); interruptedThread.interrupt(); interruptedThread.join(); checkEmpty(q); } /** * transfer waits until a poll occurs, at which point the polling * thread returns the element */ public void testTransfer4() throws InterruptedException { final LinkedTransferQueue q = new LinkedTransferQueue(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.transfer(four); assertFalse(q.contains(four)); assertSame(three, q.poll()); }}); while (q.isEmpty()) Thread.yield(); assertFalse(q.isEmpty()); assertEquals(1, q.size()); assertTrue(q.offer(three)); assertSame(four, q.poll()); awaitTermination(t, MEDIUM_DELAY_MS); } /** * transfer waits until a take occurs. The transfered element * is returned by this associated take. */ public void testTransfer5() throws InterruptedException { final LinkedTransferQueue q = new LinkedTransferQueue(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { q.transfer(four); checkEmpty(q); }}); while (q.isEmpty()) Thread.yield(); assertFalse(q.isEmpty()); assertEquals(1, q.size()); assertSame(four, q.take()); checkEmpty(q); awaitTermination(t, MEDIUM_DELAY_MS); } /** * tryTransfer(null) throws NullPointerException */ public void testTryTransfer1() { try { final LinkedTransferQueue q = new LinkedTransferQueue(); q.tryTransfer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * tryTransfer returns false and does not enqueue if there are no * consumers waiting to poll or take. */ public void testTryTransfer2() throws InterruptedException { final LinkedTransferQueue q = new LinkedTransferQueue(); assertFalse(q.tryTransfer(new Object())); assertFalse(q.hasWaitingConsumer()); checkEmpty(q); } /** * If there is a consumer waiting in timed poll, tryTransfer * returns true while successfully transfering object. */ public void testTryTransfer3() throws InterruptedException { final Object hotPotato = new Object(); final LinkedTransferQueue q = new LinkedTransferQueue(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { while (! q.hasWaitingConsumer()) Thread.yield(); assertTrue(q.hasWaitingConsumer()); checkEmpty(q); assertTrue(q.tryTransfer(hotPotato)); }}); assertSame(hotPotato, q.poll(MEDIUM_DELAY_MS, MILLISECONDS)); checkEmpty(q); awaitTermination(t, MEDIUM_DELAY_MS); } /** * If there is a consumer waiting in take, tryTransfer returns * true while successfully transfering object. */ public void testTryTransfer4() throws InterruptedException { final Object hotPotato = new Object(); final LinkedTransferQueue q = new LinkedTransferQueue(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { while (! q.hasWaitingConsumer()) Thread.yield(); assertTrue(q.hasWaitingConsumer()); checkEmpty(q); assertTrue(q.tryTransfer(hotPotato)); }}); assertSame(q.take(), hotPotato); checkEmpty(q); awaitTermination(t, MEDIUM_DELAY_MS); } /** * tryTransfer waits the amount given, and throws * InterruptedException when interrupted. */ public void testTryTransfer5() throws InterruptedException { final LinkedTransferQueue q = new LinkedTransferQueue(); final CountDownLatch threadStarted = new CountDownLatch(1); assertTrue(q.isEmpty()); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long t0 = System.nanoTime(); threadStarted.countDown(); try { q.tryTransfer(new Object(), LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); }}); threadStarted.await(); while (q.isEmpty()) Thread.yield(); delay(SHORT_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); checkEmpty(q); } /** * tryTransfer gives up after the timeout and returns false */ public void testTryTransfer6() throws InterruptedException { final LinkedTransferQueue q = new LinkedTransferQueue(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long t0 = System.nanoTime(); assertFalse(q.tryTransfer(new Object(), SHORT_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); checkEmpty(q); }}); awaitTermination(t, MEDIUM_DELAY_MS); checkEmpty(q); } /** * tryTransfer waits for any elements previously in to be removed * before transfering to a poll or take */ public void testTryTransfer7() throws InterruptedException { final LinkedTransferQueue q = new LinkedTransferQueue(); assertTrue(q.offer(four)); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertTrue(q.tryTransfer(five, MEDIUM_DELAY_MS, MILLISECONDS)); checkEmpty(q); }}); while (q.size() != 2) Thread.yield(); assertEquals(2, q.size()); assertSame(four, q.poll()); assertSame(five, q.poll()); checkEmpty(q); awaitTermination(t, MEDIUM_DELAY_MS); } /** * tryTransfer attempts to enqueue into the queue and fails * returning false not enqueueing and the successive poll is null */ public void testTryTransfer8() throws InterruptedException { final LinkedTransferQueue q = new LinkedTransferQueue(); assertTrue(q.offer(four)); assertEquals(1, q.size()); long t0 = System.nanoTime(); assertFalse(q.tryTransfer(five, SHORT_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); assertEquals(1, q.size()); assertSame(four, q.poll()); assertNull(q.poll()); checkEmpty(q); } private LinkedTransferQueue populatedQueue(int n) { LinkedTransferQueue q = new LinkedTransferQueue(); checkEmpty(q); for (int i = 0; i < n; i++) { assertEquals(i, q.size()); assertTrue(q.offer(i)); assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); } assertFalse(q.isEmpty()); return q; } } jsr166/src/test/tck/ScheduledExecutorTest.java0000644000000000000000000012320211561321121016441 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.concurrent.atomic.*; public class ScheduledExecutorTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ScheduledExecutorTest.class); } /** * execute successfully executes a runnable */ public void testExecute() throws InterruptedException { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); final CountDownLatch done = new CountDownLatch(1); final Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); }}; try { p.execute(task); assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS)); } finally { joinPool(p); } } /** * delayed schedule of callable successfully executes after delay */ public void testSchedule1() throws Exception { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); final long t0 = System.nanoTime(); final long timeoutNanos = SHORT_DELAY_MS * 1000L * 1000L; final CountDownLatch done = new CountDownLatch(1); try { Callable task = new CheckedCallable() { public Boolean realCall() { done.countDown(); assertTrue(System.nanoTime() - t0 >= timeoutNanos); return Boolean.TRUE; }}; Future f = p.schedule(task, SHORT_DELAY_MS, MILLISECONDS); assertEquals(Boolean.TRUE, f.get()); assertTrue(System.nanoTime() - t0 >= timeoutNanos); assertTrue(done.await(0L, MILLISECONDS)); } finally { joinPool(p); } } /** * delayed schedule of runnable successfully executes after delay */ public void testSchedule3() throws Exception { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); final long t0 = System.nanoTime(); final long timeoutNanos = SHORT_DELAY_MS * 1000L * 1000L; final CountDownLatch done = new CountDownLatch(1); try { Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); assertTrue(System.nanoTime() - t0 >= timeoutNanos); }}; Future f = p.schedule(task, SHORT_DELAY_MS, MILLISECONDS); assertNull(f.get()); assertTrue(System.nanoTime() - t0 >= timeoutNanos); assertTrue(done.await(0L, MILLISECONDS)); } finally { joinPool(p); } } /** * scheduleAtFixedRate executes runnable after given initial delay */ public void testSchedule4() throws Exception { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); final long t0 = System.nanoTime(); final long timeoutNanos = SHORT_DELAY_MS * 1000L * 1000L; final CountDownLatch done = new CountDownLatch(1); try { Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); assertTrue(System.nanoTime() - t0 >= timeoutNanos); }}; ScheduledFuture f = p.scheduleAtFixedRate(task, SHORT_DELAY_MS, SHORT_DELAY_MS, MILLISECONDS); assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(System.nanoTime() - t0 >= timeoutNanos); f.cancel(true); } finally { joinPool(p); } } /** * scheduleWithFixedDelay executes runnable after given initial delay */ public void testSchedule5() throws InterruptedException { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); final long t0 = System.nanoTime(); final long timeoutNanos = SHORT_DELAY_MS * 1000L * 1000L; final CountDownLatch done = new CountDownLatch(1); try { Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); assertTrue(System.nanoTime() - t0 >= timeoutNanos); }}; ScheduledFuture f = p.scheduleWithFixedDelay(task, SHORT_DELAY_MS, SHORT_DELAY_MS, MILLISECONDS); assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(System.nanoTime() - t0 >= timeoutNanos); f.cancel(true); } finally { joinPool(p); } } static class RunnableCounter implements Runnable { AtomicInteger count = new AtomicInteger(0); public void run() { count.getAndIncrement(); } } /** * scheduleAtFixedRate executes series of tasks at given rate */ public void testFixedRateSequence() throws InterruptedException { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); RunnableCounter counter = new RunnableCounter(); ScheduledFuture h = p.scheduleAtFixedRate(counter, 0, 1, MILLISECONDS); delay(SMALL_DELAY_MS); h.cancel(true); int c = counter.count.get(); // By time scaling conventions, we must have at least // an execution per SHORT delay, but no more than one SHORT more assertTrue(c >= SMALL_DELAY_MS / SHORT_DELAY_MS); assertTrue(c <= SMALL_DELAY_MS + SHORT_DELAY_MS); joinPool(p); } /** * scheduleWithFixedDelay executes series of tasks with given period */ public void testFixedDelaySequence() throws InterruptedException { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); RunnableCounter counter = new RunnableCounter(); ScheduledFuture h = p.scheduleWithFixedDelay(counter, 0, 1, MILLISECONDS); delay(SMALL_DELAY_MS); h.cancel(true); int c = counter.count.get(); assertTrue(c >= SMALL_DELAY_MS / SHORT_DELAY_MS); assertTrue(c <= SMALL_DELAY_MS + SHORT_DELAY_MS); joinPool(p); } /** * execute(null) throws NPE */ public void testExecuteNull() throws InterruptedException { ScheduledThreadPoolExecutor se = null; try { se = new ScheduledThreadPoolExecutor(1); se.execute(null); shouldThrow(); } catch (NullPointerException success) {} joinPool(se); } /** * schedule(null) throws NPE */ public void testScheduleNull() throws InterruptedException { ScheduledThreadPoolExecutor se = new ScheduledThreadPoolExecutor(1); try { TrackedCallable callable = null; Future f = se.schedule(callable, SHORT_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) {} joinPool(se); } /** * execute throws RejectedExecutionException if shutdown */ public void testSchedule1_RejectedExecutionException() throws InterruptedException { ScheduledThreadPoolExecutor se = new ScheduledThreadPoolExecutor(1); try { se.shutdown(); se.schedule(new NoOpRunnable(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (RejectedExecutionException success) { } catch (SecurityException ok) { } joinPool(se); } /** * schedule throws RejectedExecutionException if shutdown */ public void testSchedule2_RejectedExecutionException() throws InterruptedException { ScheduledThreadPoolExecutor se = new ScheduledThreadPoolExecutor(1); try { se.shutdown(); se.schedule(new NoOpCallable(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (RejectedExecutionException success) { } catch (SecurityException ok) { } joinPool(se); } /** * schedule callable throws RejectedExecutionException if shutdown */ public void testSchedule3_RejectedExecutionException() throws InterruptedException { ScheduledThreadPoolExecutor se = new ScheduledThreadPoolExecutor(1); try { se.shutdown(); se.schedule(new NoOpCallable(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (RejectedExecutionException success) { } catch (SecurityException ok) { } joinPool(se); } /** * scheduleAtFixedRate throws RejectedExecutionException if shutdown */ public void testScheduleAtFixedRate1_RejectedExecutionException() throws InterruptedException { ScheduledThreadPoolExecutor se = new ScheduledThreadPoolExecutor(1); try { se.shutdown(); se.scheduleAtFixedRate(new NoOpRunnable(), MEDIUM_DELAY_MS, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (RejectedExecutionException success) { } catch (SecurityException ok) { } joinPool(se); } /** * scheduleWithFixedDelay throws RejectedExecutionException if shutdown */ public void testScheduleWithFixedDelay1_RejectedExecutionException() throws InterruptedException { ScheduledThreadPoolExecutor se = new ScheduledThreadPoolExecutor(1); try { se.shutdown(); se.scheduleWithFixedDelay(new NoOpRunnable(), MEDIUM_DELAY_MS, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (RejectedExecutionException success) { } catch (SecurityException ok) { } joinPool(se); } /** * getActiveCount increases but doesn't overestimate, when a * thread becomes active */ public void testGetActiveCount() throws InterruptedException { final ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(2); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getActiveCount()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getActiveCount()); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(1, p.getActiveCount()); } finally { done.countDown(); joinPool(p); } } /** * getCompletedTaskCount increases, but doesn't overestimate, * when tasks complete */ public void testGetCompletedTaskCount() throws InterruptedException { final ThreadPoolExecutor p = new ScheduledThreadPoolExecutor(2); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch threadProceed = new CountDownLatch(1); final CountDownLatch threadDone = new CountDownLatch(1); try { assertEquals(0, p.getCompletedTaskCount()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(0, p.getCompletedTaskCount()); threadProceed.await(); threadDone.countDown(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(0, p.getCompletedTaskCount()); threadProceed.countDown(); threadDone.await(); delay(SHORT_DELAY_MS); assertEquals(1, p.getCompletedTaskCount()); } finally { joinPool(p); } } /** * getCorePoolSize returns size given in constructor if not otherwise set */ public void testGetCorePoolSize() throws InterruptedException { ThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); assertEquals(1, p.getCorePoolSize()); joinPool(p); } /** * getLargestPoolSize increases, but doesn't overestimate, when * multiple threads active */ public void testGetLargestPoolSize() throws InterruptedException { final int THREADS = 3; final ThreadPoolExecutor p = new ScheduledThreadPoolExecutor(THREADS); final CountDownLatch threadsStarted = new CountDownLatch(THREADS); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getLargestPoolSize()); for (int i = 0; i < THREADS; i++) p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadsStarted.countDown(); done.await(); assertEquals(THREADS, p.getLargestPoolSize()); }}); assertTrue(threadsStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(THREADS, p.getLargestPoolSize()); } finally { done.countDown(); joinPool(p); assertEquals(THREADS, p.getLargestPoolSize()); } } /** * getPoolSize increases, but doesn't overestimate, when threads * become active */ public void testGetPoolSize() throws InterruptedException { final ThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getPoolSize()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getPoolSize()); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(1, p.getPoolSize()); } finally { done.countDown(); joinPool(p); } } /** * getTaskCount increases, but doesn't overestimate, when tasks * submitted */ public void testGetTaskCount() throws InterruptedException { final ThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); final int TASKS = 5; try { assertEquals(0, p.getTaskCount()); for (int i = 0; i < TASKS; i++) p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(TASKS, p.getTaskCount()); } finally { done.countDown(); joinPool(p); } } /** * getThreadFactory returns factory in constructor if not set */ public void testGetThreadFactory() throws InterruptedException { ThreadFactory tf = new SimpleThreadFactory(); ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1, tf); assertSame(tf, p.getThreadFactory()); joinPool(p); } /** * setThreadFactory sets the thread factory returned by getThreadFactory */ public void testSetThreadFactory() throws InterruptedException { ThreadFactory tf = new SimpleThreadFactory(); ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); p.setThreadFactory(tf); assertSame(tf, p.getThreadFactory()); joinPool(p); } /** * setThreadFactory(null) throws NPE */ public void testSetThreadFactoryNull() throws InterruptedException { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); try { p.setThreadFactory(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(p); } } /** * isShutdown is false before shutdown, true after */ public void testIsShutdown() { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); try { assertFalse(p.isShutdown()); } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } assertTrue(p.isShutdown()); } /** * isTerminated is false before termination, true after */ public void testIsTerminated() throws InterruptedException { final ThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); assertFalse(p.isTerminated()); try { p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(p.isTerminated()); threadStarted.countDown(); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(p.isTerminating()); done.countDown(); } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); } /** * isTerminating is not true when running or when terminated */ public void testIsTerminating() throws InterruptedException { final ThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertFalse(p.isTerminating()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(p.isTerminating()); threadStarted.countDown(); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(p.isTerminating()); done.countDown(); } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); assertFalse(p.isTerminating()); } /** * getQueue returns the work queue, which contains queued tasks */ public void testGetQueue() throws InterruptedException { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { ScheduledFuture[] tasks = new ScheduledFuture[5]; for (int i = 0; i < tasks.length; i++) { Runnable r = new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); done.await(); }}; tasks[i] = p.schedule(r, 1, MILLISECONDS); } assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); BlockingQueue q = p.getQueue(); assertTrue(q.contains(tasks[tasks.length - 1])); assertFalse(q.contains(tasks[0])); } finally { done.countDown(); joinPool(p); } } /** * remove(task) removes queued task, and fails to remove active task */ public void testRemove() throws InterruptedException { final ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); ScheduledFuture[] tasks = new ScheduledFuture[5]; final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { for (int i = 0; i < tasks.length; i++) { Runnable r = new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); done.await(); }}; tasks[i] = p.schedule(r, 1, MILLISECONDS); } assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); BlockingQueue q = p.getQueue(); assertFalse(p.remove((Runnable)tasks[0])); assertTrue(q.contains((Runnable)tasks[4])); assertTrue(q.contains((Runnable)tasks[3])); assertTrue(p.remove((Runnable)tasks[4])); assertFalse(p.remove((Runnable)tasks[4])); assertFalse(q.contains((Runnable)tasks[4])); assertTrue(q.contains((Runnable)tasks[3])); assertTrue(p.remove((Runnable)tasks[3])); assertFalse(q.contains((Runnable)tasks[3])); } finally { done.countDown(); joinPool(p); } } /** * purge eventually removes cancelled tasks from the queue */ public void testPurge() throws InterruptedException { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); ScheduledFuture[] tasks = new ScheduledFuture[5]; for (int i = 0; i < tasks.length; i++) tasks[i] = p.schedule(new SmallPossiblyInterruptedRunnable(), LONG_DELAY_MS, MILLISECONDS); try { int max = tasks.length; if (tasks[4].cancel(true)) --max; if (tasks[3].cancel(true)) --max; // There must eventually be an interference-free point at // which purge will not fail. (At worst, when queue is empty.) long startTime = System.nanoTime(); do { p.purge(); long count = p.getTaskCount(); if (count == max) return; } while (millisElapsedSince(startTime) < MEDIUM_DELAY_MS); fail("Purge failed to remove cancelled tasks"); } finally { for (ScheduledFuture task : tasks) task.cancel(true); joinPool(p); } } /** * shutdownNow returns a list containing tasks that were not run */ public void testShutdownNow() { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); for (int i = 0; i < 5; i++) p.schedule(new SmallPossiblyInterruptedRunnable(), LONG_DELAY_MS, MILLISECONDS); try { List l = p.shutdownNow(); assertTrue(p.isShutdown()); assertEquals(5, l.size()); } catch (SecurityException ok) { // Allowed in case test doesn't have privs } finally { joinPool(p); } } /** * In default setting, shutdown cancels periodic but not delayed * tasks at shutdown */ public void testShutdown1() throws InterruptedException { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); ScheduledFuture[] tasks = new ScheduledFuture[5]; for (int i = 0; i < tasks.length; i++) tasks[i] = p.schedule(new NoOpRunnable(), SHORT_DELAY_MS, MILLISECONDS); try { p.shutdown(); } catch (SecurityException ok) { return; } BlockingQueue q = p.getQueue(); for (ScheduledFuture task : tasks) { assertFalse(task.isDone()); assertFalse(task.isCancelled()); assertTrue(q.contains(task)); } assertTrue(p.isShutdown()); assertTrue(p.awaitTermination(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); for (ScheduledFuture task : tasks) { assertTrue(task.isDone()); assertFalse(task.isCancelled()); } } /** * If setExecuteExistingDelayedTasksAfterShutdownPolicy is false, * delayed tasks are cancelled at shutdown */ public void testShutdown2() throws InterruptedException { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); p.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); assertFalse(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); ScheduledFuture[] tasks = new ScheduledFuture[5]; for (int i = 0; i < tasks.length; i++) tasks[i] = p.schedule(new NoOpRunnable(), SHORT_DELAY_MS, MILLISECONDS); BlockingQueue q = p.getQueue(); assertEquals(tasks.length, q.size()); try { p.shutdown(); } catch (SecurityException ok) { return; } assertTrue(p.isShutdown()); assertTrue(q.isEmpty()); assertTrue(p.awaitTermination(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); for (ScheduledFuture task : tasks) { assertTrue(task.isDone()); assertTrue(task.isCancelled()); } } /** * If setContinueExistingPeriodicTasksAfterShutdownPolicy is set false, * periodic tasks are cancelled at shutdown */ public void testShutdown3() throws InterruptedException { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); p.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); ScheduledFuture task = p.scheduleAtFixedRate(new NoOpRunnable(), 5, 5, MILLISECONDS); try { p.shutdown(); } catch (SecurityException ok) { return; } assertTrue(p.isShutdown()); BlockingQueue q = p.getQueue(); assertTrue(p.getQueue().isEmpty()); assertTrue(task.isDone()); assertTrue(task.isCancelled()); assertTrue(p.awaitTermination(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); } /** * if setContinueExistingPeriodicTasksAfterShutdownPolicy is true, * periodic tasks are not cancelled at shutdown */ public void testShutdown4() throws InterruptedException { ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); final CountDownLatch counter = new CountDownLatch(2); try { p.setContinueExistingPeriodicTasksAfterShutdownPolicy(true); assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); assertTrue(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); final Runnable r = new CheckedRunnable() { public void realRun() { counter.countDown(); }}; ScheduledFuture task = p.scheduleAtFixedRate(r, 1, 1, MILLISECONDS); assertFalse(task.isDone()); assertFalse(task.isCancelled()); try { p.shutdown(); } catch (SecurityException ok) { return; } assertFalse(task.isCancelled()); assertFalse(p.isTerminated()); assertTrue(p.isShutdown()); assertTrue(counter.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(task.isCancelled()); assertTrue(task.cancel(false)); assertTrue(task.isDone()); assertTrue(task.isCancelled()); assertTrue(p.awaitTermination(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); } finally { joinPool(p); } } /** * completed submit of callable returns result */ public void testSubmitCallable() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { Future future = e.submit(new StringTask()); String result = future.get(); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * completed submit of runnable returns successfully */ public void testSubmitRunnable() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { Future future = e.submit(new NoOpRunnable()); future.get(); assertTrue(future.isDone()); } finally { joinPool(e); } } /** * completed submit of (runnable, result) returns result */ public void testSubmitRunnable2() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { Future future = e.submit(new NoOpRunnable(), TEST_STRING); String result = future.get(); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * invokeAny(null) throws NPE */ public void testInvokeAny1() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { e.invokeAny(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAny(empty collection) throws IAE */ public void testInvokeAny2() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { e.invokeAny(new ArrayList>()); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * invokeAny(c) throws NPE if c has null elements */ public void testInvokeAny3() throws Exception { CountDownLatch latch = new CountDownLatch(1); ExecutorService e = new ScheduledThreadPoolExecutor(2); List> l = new ArrayList>(); l.add(latchAwaitingStringTask(latch)); l.add(null); try { e.invokeAny(l); shouldThrow(); } catch (NullPointerException success) { } finally { latch.countDown(); joinPool(e); } } /** * invokeAny(c) throws ExecutionException if no task completes */ public void testInvokeAny4() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * invokeAny(c) returns result of some task */ public void testInvokeAny5() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * invokeAll(null) throws NPE */ public void testInvokeAll1() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { e.invokeAll(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAll(empty collection) returns empty collection */ public void testInvokeAll2() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { List> r = e.invokeAll(new ArrayList>()); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * invokeAll(c) throws NPE if c has null elements */ public void testInvokeAll3() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of invokeAll(c) throws exception on failed task */ public void testInvokeAll4() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * invokeAll(c) returns results of all completed tasks */ public void testInvokeAll5() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } /** * timed invokeAny(null) throws NPE */ public void testTimedInvokeAny1() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { e.invokeAny(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(,,null) throws NPE */ public void testTimedInvokeAnyNullTimeUnit() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(empty collection) throws IAE */ public void testTimedInvokeAny2() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { e.invokeAny(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * timed invokeAny(c) throws NPE if c has null elements */ public void testTimedInvokeAny3() throws Exception { CountDownLatch latch = new CountDownLatch(1); ExecutorService e = new ScheduledThreadPoolExecutor(2); List> l = new ArrayList>(); l.add(latchAwaitingStringTask(latch)); l.add(null); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { latch.countDown(); joinPool(e); } } /** * timed invokeAny(c) throws ExecutionException if no task completes */ public void testTimedInvokeAny4() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * timed invokeAny(c) returns result of some task */ public void testTimedInvokeAny5() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * timed invokeAll(null) throws NPE */ public void testTimedInvokeAll1() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { e.invokeAll(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(,,null) throws NPE */ public void testTimedInvokeAllNullTimeUnit() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAll(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(empty collection) returns empty collection */ public void testTimedInvokeAll2() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { List> r = e.invokeAll(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * timed invokeAll(c) throws NPE if c has null elements */ public void testTimedInvokeAll3() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of element of invokeAll(c) throws exception on failed task */ public void testTimedInvokeAll4() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * timed invokeAll(c) returns results of all completed tasks */ public void testTimedInvokeAll5() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } /** * timed invokeAll(c) cancels tasks not completed by timeout */ public void testTimedInvokeAll6() throws Exception { ExecutorService e = new ScheduledThreadPoolExecutor(2); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(Executors.callable(new MediumPossiblyInterruptedRunnable(), TEST_STRING)); l.add(new StringTask()); List> futures = e.invokeAll(l, SHORT_DELAY_MS, MILLISECONDS); assertEquals(3, futures.size()); Iterator> it = futures.iterator(); Future f1 = it.next(); Future f2 = it.next(); Future f3 = it.next(); assertTrue(f1.isDone()); assertTrue(f2.isDone()); assertTrue(f3.isDone()); assertFalse(f1.isCancelled()); assertTrue(f2.isCancelled()); } finally { joinPool(e); } } } jsr166/src/test/tck/TreeSetTest.java0000644000000000000000000007111111551675514014417 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class TreeSetTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(TreeSetTest.class); } static class MyReverseComparator implements Comparator { public int compare(Object x, Object y) { return ((Comparable)y).compareTo(x); } } /** * The number of elements to place in collections, arrays, etc. */ static final int SIZE = 20; /** * Create a set of given size containing consecutive * Integers 0 ... n. */ private TreeSet populatedSet(int n) { TreeSet q = new TreeSet(); assertTrue(q.isEmpty()); for (int i = n-1; i >= 0; i-=2) assertTrue(q.add(new Integer(i))); for (int i = (n & 1); i < n; i+=2) assertTrue(q.add(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(n, q.size()); return q; } /** * Create set of first 5 ints */ private TreeSet set5() { TreeSet q = new TreeSet(); assertTrue(q.isEmpty()); q.add(one); q.add(two); q.add(three); q.add(four); q.add(five); assertEquals(5, q.size()); return q; } /** * A new set has unbounded capacity */ public void testConstructor1() { assertEquals(0, new TreeSet().size()); } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { TreeSet q = new TreeSet((Collection)null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws NPE */ public void testConstructor4() { try { Integer[] ints = new Integer[SIZE]; TreeSet q = new TreeSet(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection with some null elements throws NPE */ public void testConstructor5() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); TreeSet q = new TreeSet(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Set contains all elements of collection used to initialize */ public void testConstructor6() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); TreeSet q = new TreeSet(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.pollFirst()); } /** * The comparator used in constructor is used */ public void testConstructor7() { MyReverseComparator cmp = new MyReverseComparator(); TreeSet q = new TreeSet(cmp); assertEquals(cmp, q.comparator()); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); for (int i = SIZE-1; i >= 0; --i) assertEquals(ints[i], q.pollFirst()); } /** * isEmpty is true before add, false after */ public void testEmpty() { TreeSet q = new TreeSet(); assertTrue(q.isEmpty()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.add(new Integer(2)); q.pollFirst(); q.pollFirst(); assertTrue(q.isEmpty()); } /** * size changes when elements added and removed */ public void testSize() { TreeSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.pollFirst(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * add(null) throws NPE if nonempty */ public void testAddNull() { try { TreeSet q = populatedSet(SIZE); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Add of comparable element succeeds */ public void testAdd() { TreeSet q = new TreeSet(); assertTrue(q.add(zero)); assertTrue(q.add(one)); } /** * Add of duplicate element fails */ public void testAddDup() { TreeSet q = new TreeSet(); assertTrue(q.add(zero)); assertFalse(q.add(zero)); } /** * Add of non-Comparable throws CCE */ public void testAddNonComparable() { try { TreeSet q = new TreeSet(); q.add(new Object()); q.add(new Object()); q.add(new Object()); shouldThrow(); } catch (ClassCastException success) {} } /** * addAll(null) throws NPE */ public void testAddAll1() { try { TreeSet q = new TreeSet(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { TreeSet q = new TreeSet(); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { TreeSet q = new TreeSet(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Set contains all elements of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(SIZE-1-i); TreeSet q = new TreeSet(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(new Integer(i), q.pollFirst()); } /** * pollFirst succeeds unless empty */ public void testPollFirst() { TreeSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst()); } assertNull(q.pollFirst()); } /** * pollLast succeeds unless empty */ public void testPollLast() { TreeSet q = populatedSet(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.pollLast()); } assertNull(q.pollFirst()); } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { TreeSet q = populatedSet(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { TreeSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.pollFirst(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { TreeSet q = populatedSet(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { TreeSet q = populatedSet(SIZE); TreeSet p = new TreeSet(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { TreeSet q = populatedSet(SIZE); TreeSet p = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.pollFirst(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { TreeSet q = populatedSet(SIZE); TreeSet p = populatedSet(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.pollFirst()); assertFalse(q.contains(I)); } } } /** * lower returns preceding element */ public void testLower() { TreeSet q = set5(); Object e1 = q.lower(three); assertEquals(two, e1); Object e2 = q.lower(six); assertEquals(five, e2); Object e3 = q.lower(one); assertNull(e3); Object e4 = q.lower(zero); assertNull(e4); } /** * higher returns next element */ public void testHigher() { TreeSet q = set5(); Object e1 = q.higher(three); assertEquals(four, e1); Object e2 = q.higher(zero); assertEquals(one, e2); Object e3 = q.higher(five); assertNull(e3); Object e4 = q.higher(six); assertNull(e4); } /** * floor returns preceding element */ public void testFloor() { TreeSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); } /** * ceiling returns next element */ public void testCeiling() { TreeSet q = set5(); Object e1 = q.ceiling(three); assertEquals(three, e1); Object e2 = q.ceiling(zero); assertEquals(one, e2); Object e3 = q.ceiling(five); assertEquals(five, e3); Object e4 = q.ceiling(six); assertNull(e4); } /** * toArray contains all elements in sorted order */ public void testToArray() { TreeSet q = populatedSet(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) assertSame(o[i], q.pollFirst()); } /** * toArray(a) contains all elements in sorted order */ public void testToArray2() { TreeSet q = populatedSet(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.pollFirst()); } /** * iterator iterates through all elements */ public void testIterator() { TreeSet q = populatedSet(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * iterator of empty set has no elements */ public void testEmptyIterator() { TreeSet q = new TreeSet(); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, 0); } /** * iterator.remove removes current element */ public void testIteratorRemove() { final TreeSet q = new TreeSet(); q.add(new Integer(2)); q.add(new Integer(1)); q.add(new Integer(3)); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertEquals(it.next(), new Integer(2)); assertEquals(it.next(), new Integer(3)); assertFalse(it.hasNext()); } /** * toString contains toStrings of elements */ public void testToString() { TreeSet q = populatedSet(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * A deserialized serialized set has same elements */ public void testSerialization() throws Exception { TreeSet q = populatedSet(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); TreeSet r = (TreeSet)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.pollFirst(), r.pollFirst()); } /** * subSet returns set with keys in requested range */ public void testSubSetContents() { TreeSet set = set5(); SortedSet sm = set.subSet(two, four); assertEquals(two, sm.first()); assertEquals(three, sm.last()); assertEquals(2, sm.size()); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(two)); assertEquals(4, set.size()); assertEquals(1, sm.size()); assertEquals(three, sm.first()); assertEquals(three, sm.last()); assertTrue(sm.remove(three)); assertTrue(sm.isEmpty()); assertEquals(3, set.size()); } public void testSubSetContents2() { TreeSet set = set5(); SortedSet sm = set.subSet(two, three); assertEquals(1, sm.size()); assertEquals(two, sm.first()); assertEquals(two, sm.last()); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertFalse(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(two)); assertEquals(4, set.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertFalse(sm.remove(three)); assertEquals(4, set.size()); } /** * headSet returns set with keys in requested range */ public void testHeadSetContents() { TreeSet set = set5(); SortedSet sm = set.headSet(four); assertTrue(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(one, k); k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, set.size()); assertEquals(four, set.first()); } /** * tailSet returns set with keys in requested range */ public void testTailSetContents() { TreeSet set = set5(); SortedSet sm = set.tailSet(two); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertTrue(sm.contains(four)); assertTrue(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); k = (Integer)(i.next()); assertEquals(four, k); k = (Integer)(i.next()); assertEquals(five, k); assertFalse(i.hasNext()); SortedSet ssm = sm.tailSet(four); assertEquals(four, ssm.first()); assertEquals(five, ssm.last()); assertTrue(ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, set.size()); } Random rnd = new Random(666); BitSet bs; /** * Subsets of subsets subdivide correctly */ public void testRecursiveSubSets() throws Exception { int setSize = expensiveTests ? 1000 : 100; Class cl = TreeSet.class; NavigableSet set = newSet(cl); bs = new BitSet(setSize); populate(set, setSize); check(set, 0, setSize - 1, true); check(set.descendingSet(), 0, setSize - 1, false); mutateSet(set, 0, setSize - 1); check(set, 0, setSize - 1, true); check(set.descendingSet(), 0, setSize - 1, false); bashSubSet(set.subSet(0, true, setSize, false), 0, setSize - 1, true); } static NavigableSet newSet(Class cl) throws Exception { NavigableSet result = (NavigableSet) cl.newInstance(); assertEquals(result.size(), 0); assertFalse(result.iterator().hasNext()); return result; } void populate(NavigableSet set, int limit) { for (int i = 0, n = 2 * limit / 3; i < n; i++) { int element = rnd.nextInt(limit); put(set, element); } } void mutateSet(NavigableSet set, int min, int max) { int size = set.size(); int rangeSize = max - min + 1; // Remove a bunch of entries directly for (int i = 0, n = rangeSize / 2; i < n; i++) { remove(set, min - 5 + rnd.nextInt(rangeSize + 10)); } // Remove a bunch of entries with iterator for (Iterator it = set.iterator(); it.hasNext(); ) { if (rnd.nextBoolean()) { bs.clear(it.next()); it.remove(); } } // Add entries till we're back to original size while (set.size() < size) { int element = min + rnd.nextInt(rangeSize); assertTrue(element >= min && element<= max); put(set, element); } } void mutateSubSet(NavigableSet set, int min, int max) { int size = set.size(); int rangeSize = max - min + 1; // Remove a bunch of entries directly for (int i = 0, n = rangeSize / 2; i < n; i++) { remove(set, min - 5 + rnd.nextInt(rangeSize + 10)); } // Remove a bunch of entries with iterator for (Iterator it = set.iterator(); it.hasNext(); ) { if (rnd.nextBoolean()) { bs.clear(it.next()); it.remove(); } } // Add entries till we're back to original size while (set.size() < size) { int element = min - 5 + rnd.nextInt(rangeSize + 10); if (element >= min && element<= max) { put(set, element); } else { try { set.add(element); shouldThrow(); } catch (IllegalArgumentException success) {} } } } void put(NavigableSet set, int element) { if (set.add(element)) bs.set(element); } void remove(NavigableSet set, int element) { if (set.remove(element)) bs.clear(element); } void bashSubSet(NavigableSet set, int min, int max, boolean ascending) { check(set, min, max, ascending); check(set.descendingSet(), min, max, !ascending); mutateSubSet(set, min, max); check(set, min, max, ascending); check(set.descendingSet(), min, max, !ascending); // Recurse if (max - min < 2) return; int midPoint = (min + max) / 2; // headSet - pick direction and endpoint inclusion randomly boolean incl = rnd.nextBoolean(); NavigableSet hm = set.headSet(midPoint, incl); if (ascending) { if (rnd.nextBoolean()) bashSubSet(hm, min, midPoint - (incl ? 0 : 1), true); else bashSubSet(hm.descendingSet(), min, midPoint - (incl ? 0 : 1), false); } else { if (rnd.nextBoolean()) bashSubSet(hm, midPoint + (incl ? 0 : 1), max, false); else bashSubSet(hm.descendingSet(), midPoint + (incl ? 0 : 1), max, true); } // tailSet - pick direction and endpoint inclusion randomly incl = rnd.nextBoolean(); NavigableSet tm = set.tailSet(midPoint,incl); if (ascending) { if (rnd.nextBoolean()) bashSubSet(tm, midPoint + (incl ? 0 : 1), max, true); else bashSubSet(tm.descendingSet(), midPoint + (incl ? 0 : 1), max, false); } else { if (rnd.nextBoolean()) { bashSubSet(tm, min, midPoint - (incl ? 0 : 1), false); } else { bashSubSet(tm.descendingSet(), min, midPoint - (incl ? 0 : 1), true); } } // subSet - pick direction and endpoint inclusion randomly int rangeSize = max - min + 1; int[] endpoints = new int[2]; endpoints[0] = min + rnd.nextInt(rangeSize); endpoints[1] = min + rnd.nextInt(rangeSize); Arrays.sort(endpoints); boolean lowIncl = rnd.nextBoolean(); boolean highIncl = rnd.nextBoolean(); if (ascending) { NavigableSet sm = set.subSet( endpoints[0], lowIncl, endpoints[1], highIncl); if (rnd.nextBoolean()) bashSubSet(sm, endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), true); else bashSubSet(sm.descendingSet(), endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), false); } else { NavigableSet sm = set.subSet( endpoints[1], highIncl, endpoints[0], lowIncl); if (rnd.nextBoolean()) bashSubSet(sm, endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), false); else bashSubSet(sm.descendingSet(), endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), true); } } /** * min and max are both inclusive. If max < min, interval is empty. */ void check(NavigableSet set, final int min, final int max, final boolean ascending) { class ReferenceSet { int lower(int element) { return ascending ? lowerAscending(element) : higherAscending(element); } int floor(int element) { return ascending ? floorAscending(element) : ceilingAscending(element); } int ceiling(int element) { return ascending ? ceilingAscending(element) : floorAscending(element); } int higher(int element) { return ascending ? higherAscending(element) : lowerAscending(element); } int first() { return ascending ? firstAscending() : lastAscending(); } int last() { return ascending ? lastAscending() : firstAscending(); } int lowerAscending(int element) { return floorAscending(element - 1); } int floorAscending(int element) { if (element < min) return -1; else if (element > max) element = max; // BitSet should support this! Test would run much faster while (element >= min) { if (bs.get(element)) return element; element--; } return -1; } int ceilingAscending(int element) { if (element < min) element = min; else if (element > max) return -1; int result = bs.nextSetBit(element); return result > max ? -1 : result; } int higherAscending(int element) { return ceilingAscending(element + 1); } private int firstAscending() { int result = ceilingAscending(min); return result > max ? -1 : result; } private int lastAscending() { int result = floorAscending(max); return result < min ? -1 : result; } } ReferenceSet rs = new ReferenceSet(); // Test contents using containsElement int size = 0; for (int i = min; i <= max; i++) { boolean bsContainsI = bs.get(i); assertEquals(bsContainsI, set.contains(i)); if (bsContainsI) size++; } assertEquals(set.size(), size); // Test contents using contains elementSet iterator int size2 = 0; int previousElement = -1; for (int element : set) { assertTrue(bs.get(element)); size2++; assertTrue(previousElement < 0 || (ascending ? element - previousElement > 0 : element - previousElement < 0)); previousElement = element; } assertEquals(size2, size); // Test navigation ops for (int element = min - 1; element <= max + 1; element++) { assertEq(set.lower(element), rs.lower(element)); assertEq(set.floor(element), rs.floor(element)); assertEq(set.higher(element), rs.higher(element)); assertEq(set.ceiling(element), rs.ceiling(element)); } // Test extrema if (set.size() != 0) { assertEq(set.first(), rs.first()); assertEq(set.last(), rs.last()); } else { assertEq(rs.first(), -1); assertEq(rs.last(), -1); try { set.first(); shouldThrow(); } catch (NoSuchElementException success) {} try { set.last(); shouldThrow(); } catch (NoSuchElementException success) {} } } static void assertEq(Integer i, int j) { if (i == null) assertEquals(j, -1); else assertEquals((int) i, j); } static boolean eq(Integer i, int j) { return i == null ? j == -1 : i == j; } } jsr166/src/test/tck/ScheduledExecutorSubclassTest.java0000644000000000000000000012443211561321121020147 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.concurrent.atomic.*; public class ScheduledExecutorSubclassTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ScheduledExecutorSubclassTest.class); } static class CustomTask implements RunnableScheduledFuture { RunnableScheduledFuture task; volatile boolean ran; CustomTask(RunnableScheduledFuture t) { task = t; } public boolean isPeriodic() { return task.isPeriodic(); } public void run() { ran = true; task.run(); } public long getDelay(TimeUnit unit) { return task.getDelay(unit); } public int compareTo(Delayed t) { return task.compareTo(((CustomTask)t).task); } public boolean cancel(boolean mayInterruptIfRunning) { return task.cancel(mayInterruptIfRunning); } public boolean isCancelled() { return task.isCancelled(); } public boolean isDone() { return task.isDone(); } public V get() throws InterruptedException, ExecutionException { V v = task.get(); assertTrue(ran); return v; } public V get(long time, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { V v = task.get(time, unit); assertTrue(ran); return v; } } public class CustomExecutor extends ScheduledThreadPoolExecutor { protected RunnableScheduledFuture decorateTask(Runnable r, RunnableScheduledFuture task) { return new CustomTask(task); } protected RunnableScheduledFuture decorateTask(Callable c, RunnableScheduledFuture task) { return new CustomTask(task); } CustomExecutor(int corePoolSize) { super(corePoolSize);} CustomExecutor(int corePoolSize, RejectedExecutionHandler handler) { super(corePoolSize, handler); } CustomExecutor(int corePoolSize, ThreadFactory threadFactory) { super(corePoolSize, threadFactory); } CustomExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler) { super(corePoolSize, threadFactory, handler); } } /** * execute successfully executes a runnable */ public void testExecute() throws InterruptedException { CustomExecutor p = new CustomExecutor(1); final CountDownLatch done = new CountDownLatch(1); final Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); }}; try { p.execute(task); assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS)); } finally { joinPool(p); } } /** * delayed schedule of callable successfully executes after delay */ public void testSchedule1() throws Exception { CustomExecutor p = new CustomExecutor(1); final long t0 = System.nanoTime(); final long timeoutNanos = SHORT_DELAY_MS * 1000L * 1000L; final CountDownLatch done = new CountDownLatch(1); try { Callable task = new CheckedCallable() { public Boolean realCall() { done.countDown(); assertTrue(System.nanoTime() - t0 >= timeoutNanos); return Boolean.TRUE; }}; Future f = p.schedule(task, SHORT_DELAY_MS, MILLISECONDS); assertEquals(Boolean.TRUE, f.get()); assertTrue(System.nanoTime() - t0 >= timeoutNanos); assertTrue(done.await(0L, MILLISECONDS)); } finally { joinPool(p); } } /** * delayed schedule of runnable successfully executes after delay */ public void testSchedule3() throws Exception { CustomExecutor p = new CustomExecutor(1); final long t0 = System.nanoTime(); final long timeoutNanos = SHORT_DELAY_MS * 1000L * 1000L; final CountDownLatch done = new CountDownLatch(1); try { Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); assertTrue(System.nanoTime() - t0 >= timeoutNanos); }}; Future f = p.schedule(task, SHORT_DELAY_MS, MILLISECONDS); assertNull(f.get()); assertTrue(System.nanoTime() - t0 >= timeoutNanos); assertTrue(done.await(0L, MILLISECONDS)); } finally { joinPool(p); } } /** * scheduleAtFixedRate executes runnable after given initial delay */ public void testSchedule4() throws InterruptedException { CustomExecutor p = new CustomExecutor(1); final long t0 = System.nanoTime(); final long timeoutNanos = SHORT_DELAY_MS * 1000L * 1000L; final CountDownLatch done = new CountDownLatch(1); try { Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); assertTrue(System.nanoTime() - t0 >= timeoutNanos); }}; ScheduledFuture f = p.scheduleAtFixedRate(task, SHORT_DELAY_MS, SHORT_DELAY_MS, MILLISECONDS); assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(System.nanoTime() - t0 >= timeoutNanos); f.cancel(true); } finally { joinPool(p); } } /** * scheduleWithFixedDelay executes runnable after given initial delay */ public void testSchedule5() throws InterruptedException { CustomExecutor p = new CustomExecutor(1); final long t0 = System.nanoTime(); final long timeoutNanos = SHORT_DELAY_MS * 1000L * 1000L; final CountDownLatch done = new CountDownLatch(1); try { Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); assertTrue(System.nanoTime() - t0 >= timeoutNanos); }}; ScheduledFuture f = p.scheduleWithFixedDelay(task, SHORT_DELAY_MS, SHORT_DELAY_MS, MILLISECONDS); assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(System.nanoTime() - t0 >= timeoutNanos); f.cancel(true); } finally { joinPool(p); } } static class RunnableCounter implements Runnable { AtomicInteger count = new AtomicInteger(0); public void run() { count.getAndIncrement(); } } /** * scheduleAtFixedRate executes series of tasks at given rate */ public void testFixedRateSequence() throws InterruptedException { CustomExecutor p = new CustomExecutor(1); RunnableCounter counter = new RunnableCounter(); ScheduledFuture h = p.scheduleAtFixedRate(counter, 0, 1, MILLISECONDS); delay(SMALL_DELAY_MS); h.cancel(true); int c = counter.count.get(); // By time scaling conventions, we must have at least // an execution per SHORT delay, but no more than one SHORT more assertTrue(c >= SMALL_DELAY_MS / SHORT_DELAY_MS); assertTrue(c <= SMALL_DELAY_MS + SHORT_DELAY_MS); joinPool(p); } /** * scheduleWithFixedDelay executes series of tasks with given period */ public void testFixedDelaySequence() throws InterruptedException { CustomExecutor p = new CustomExecutor(1); RunnableCounter counter = new RunnableCounter(); ScheduledFuture h = p.scheduleWithFixedDelay(counter, 0, 1, MILLISECONDS); delay(SMALL_DELAY_MS); h.cancel(true); int c = counter.count.get(); assertTrue(c >= SMALL_DELAY_MS / SHORT_DELAY_MS); assertTrue(c <= SMALL_DELAY_MS + SHORT_DELAY_MS); joinPool(p); } /** * execute(null) throws NPE */ public void testExecuteNull() throws InterruptedException { CustomExecutor se = new CustomExecutor(1); try { se.execute(null); shouldThrow(); } catch (NullPointerException success) {} joinPool(se); } /** * schedule(null) throws NPE */ public void testScheduleNull() throws InterruptedException { CustomExecutor se = new CustomExecutor(1); try { TrackedCallable callable = null; Future f = se.schedule(callable, SHORT_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) {} joinPool(se); } /** * execute throws RejectedExecutionException if shutdown */ public void testSchedule1_RejectedExecutionException() { CustomExecutor se = new CustomExecutor(1); try { se.shutdown(); se.schedule(new NoOpRunnable(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (RejectedExecutionException success) { } catch (SecurityException ok) { } joinPool(se); } /** * schedule throws RejectedExecutionException if shutdown */ public void testSchedule2_RejectedExecutionException() { CustomExecutor se = new CustomExecutor(1); try { se.shutdown(); se.schedule(new NoOpCallable(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (RejectedExecutionException success) { } catch (SecurityException ok) { } joinPool(se); } /** * schedule callable throws RejectedExecutionException if shutdown */ public void testSchedule3_RejectedExecutionException() { CustomExecutor se = new CustomExecutor(1); try { se.shutdown(); se.schedule(new NoOpCallable(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (RejectedExecutionException success) { } catch (SecurityException ok) { } joinPool(se); } /** * scheduleAtFixedRate throws RejectedExecutionException if shutdown */ public void testScheduleAtFixedRate1_RejectedExecutionException() { CustomExecutor se = new CustomExecutor(1); try { se.shutdown(); se.scheduleAtFixedRate(new NoOpRunnable(), MEDIUM_DELAY_MS, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (RejectedExecutionException success) { } catch (SecurityException ok) { } joinPool(se); } /** * scheduleWithFixedDelay throws RejectedExecutionException if shutdown */ public void testScheduleWithFixedDelay1_RejectedExecutionException() { CustomExecutor se = new CustomExecutor(1); try { se.shutdown(); se.scheduleWithFixedDelay(new NoOpRunnable(), MEDIUM_DELAY_MS, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (RejectedExecutionException success) { } catch (SecurityException ok) { } joinPool(se); } /** * getActiveCount increases but doesn't overestimate, when a * thread becomes active */ public void testGetActiveCount() throws InterruptedException { final ThreadPoolExecutor p = new CustomExecutor(2); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getActiveCount()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getActiveCount()); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(1, p.getActiveCount()); } finally { done.countDown(); joinPool(p); } } /** * getCompletedTaskCount increases, but doesn't overestimate, * when tasks complete */ public void testGetCompletedTaskCount() throws InterruptedException { final ThreadPoolExecutor p = new CustomExecutor(2); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch threadProceed = new CountDownLatch(1); final CountDownLatch threadDone = new CountDownLatch(1); try { assertEquals(0, p.getCompletedTaskCount()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(0, p.getCompletedTaskCount()); threadProceed.await(); threadDone.countDown(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(0, p.getCompletedTaskCount()); threadProceed.countDown(); threadDone.await(); delay(SHORT_DELAY_MS); assertEquals(1, p.getCompletedTaskCount()); } finally { joinPool(p); } } /** * getCorePoolSize returns size given in constructor if not otherwise set */ public void testGetCorePoolSize() { CustomExecutor p = new CustomExecutor(1); assertEquals(1, p.getCorePoolSize()); joinPool(p); } /** * getLargestPoolSize increases, but doesn't overestimate, when * multiple threads active */ public void testGetLargestPoolSize() throws InterruptedException { final int THREADS = 3; final ThreadPoolExecutor p = new CustomExecutor(THREADS); final CountDownLatch threadsStarted = new CountDownLatch(THREADS); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getLargestPoolSize()); for (int i = 0; i < THREADS; i++) p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadsStarted.countDown(); done.await(); assertEquals(THREADS, p.getLargestPoolSize()); }}); assertTrue(threadsStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(THREADS, p.getLargestPoolSize()); } finally { done.countDown(); joinPool(p); assertEquals(THREADS, p.getLargestPoolSize()); } } /** * getPoolSize increases, but doesn't overestimate, when threads * become active */ public void testGetPoolSize() throws InterruptedException { final ThreadPoolExecutor p = new CustomExecutor(1); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertEquals(0, p.getPoolSize()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getPoolSize()); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(1, p.getPoolSize()); } finally { done.countDown(); joinPool(p); } } /** * getTaskCount increases, but doesn't overestimate, when tasks * submitted */ public void testGetTaskCount() throws InterruptedException { final ThreadPoolExecutor p = new CustomExecutor(1); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); final int TASKS = 5; try { assertEquals(0, p.getTaskCount()); for (int i = 0; i < TASKS; i++) p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertEquals(TASKS, p.getTaskCount()); } finally { done.countDown(); joinPool(p); } } /** * getThreadFactory returns factory in constructor if not set */ public void testGetThreadFactory() { ThreadFactory tf = new SimpleThreadFactory(); CustomExecutor p = new CustomExecutor(1, tf); assertSame(tf, p.getThreadFactory()); joinPool(p); } /** * setThreadFactory sets the thread factory returned by getThreadFactory */ public void testSetThreadFactory() { ThreadFactory tf = new SimpleThreadFactory(); CustomExecutor p = new CustomExecutor(1); p.setThreadFactory(tf); assertSame(tf, p.getThreadFactory()); joinPool(p); } /** * setThreadFactory(null) throws NPE */ public void testSetThreadFactoryNull() { CustomExecutor p = new CustomExecutor(1); try { p.setThreadFactory(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(p); } } /** * isShutdown is false before shutdown, true after */ public void testIsShutdown() { CustomExecutor p = new CustomExecutor(1); try { assertFalse(p.isShutdown()); } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } assertTrue(p.isShutdown()); } /** * isTerminated is false before termination, true after */ public void testIsTerminated() throws InterruptedException { final ThreadPoolExecutor p = new CustomExecutor(1); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); assertFalse(p.isTerminated()); try { p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(p.isTerminated()); threadStarted.countDown(); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(p.isTerminating()); done.countDown(); } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); } /** * isTerminating is not true when running or when terminated */ public void testIsTerminating() throws InterruptedException { final ThreadPoolExecutor p = new CustomExecutor(1); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { assertFalse(p.isTerminating()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(p.isTerminating()); threadStarted.countDown(); done.await(); }}); assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(p.isTerminating()); done.countDown(); } finally { try { p.shutdown(); } catch (SecurityException ok) { return; } } assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); assertFalse(p.isTerminating()); } /** * getQueue returns the work queue, which contains queued tasks */ public void testGetQueue() throws InterruptedException { ScheduledThreadPoolExecutor p = new CustomExecutor(1); final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { ScheduledFuture[] tasks = new ScheduledFuture[5]; for (int i = 0; i < tasks.length; i++) { Runnable r = new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); done.await(); }}; tasks[i] = p.schedule(r, 1, MILLISECONDS); } assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); BlockingQueue q = p.getQueue(); assertTrue(q.contains(tasks[tasks.length - 1])); assertFalse(q.contains(tasks[0])); } finally { done.countDown(); joinPool(p); } } /** * remove(task) removes queued task, and fails to remove active task */ public void testRemove() throws InterruptedException { final ScheduledThreadPoolExecutor p = new CustomExecutor(1); ScheduledFuture[] tasks = new ScheduledFuture[5]; final CountDownLatch threadStarted = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); try { for (int i = 0; i < tasks.length; i++) { Runnable r = new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); done.await(); }}; tasks[i] = p.schedule(r, 1, MILLISECONDS); } assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); BlockingQueue q = p.getQueue(); assertFalse(p.remove((Runnable)tasks[0])); assertTrue(q.contains((Runnable)tasks[4])); assertTrue(q.contains((Runnable)tasks[3])); assertTrue(p.remove((Runnable)tasks[4])); assertFalse(p.remove((Runnable)tasks[4])); assertFalse(q.contains((Runnable)tasks[4])); assertTrue(q.contains((Runnable)tasks[3])); assertTrue(p.remove((Runnable)tasks[3])); assertFalse(q.contains((Runnable)tasks[3])); } finally { done.countDown(); joinPool(p); } } /** * purge removes cancelled tasks from the queue */ public void testPurge() throws InterruptedException { CustomExecutor p = new CustomExecutor(1); ScheduledFuture[] tasks = new ScheduledFuture[5]; for (int i = 0; i < tasks.length; i++) tasks[i] = p.schedule(new SmallPossiblyInterruptedRunnable(), LONG_DELAY_MS, MILLISECONDS); try { int max = tasks.length; if (tasks[4].cancel(true)) --max; if (tasks[3].cancel(true)) --max; // There must eventually be an interference-free point at // which purge will not fail. (At worst, when queue is empty.) long startTime = System.nanoTime(); do { p.purge(); long count = p.getTaskCount(); if (count == max) return; } while (millisElapsedSince(startTime) < MEDIUM_DELAY_MS); fail("Purge failed to remove cancelled tasks"); } finally { for (ScheduledFuture task : tasks) task.cancel(true); joinPool(p); } } /** * shutdownNow returns a list containing tasks that were not run */ public void testShutdownNow() { CustomExecutor p = new CustomExecutor(1); for (int i = 0; i < 5; i++) p.schedule(new SmallPossiblyInterruptedRunnable(), LONG_DELAY_MS, MILLISECONDS); try { List l = p.shutdownNow(); assertTrue(p.isShutdown()); assertEquals(5, l.size()); } catch (SecurityException ok) { // Allowed in case test doesn't have privs } finally { joinPool(p); } } /** * In default setting, shutdown cancels periodic but not delayed * tasks at shutdown */ public void testShutdown1() throws InterruptedException { CustomExecutor p = new CustomExecutor(1); assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); ScheduledFuture[] tasks = new ScheduledFuture[5]; for (int i = 0; i < tasks.length; i++) tasks[i] = p.schedule(new NoOpRunnable(), SHORT_DELAY_MS, MILLISECONDS); try { p.shutdown(); } catch (SecurityException ok) { return; } BlockingQueue q = p.getQueue(); for (ScheduledFuture task : tasks) { assertFalse(task.isDone()); assertFalse(task.isCancelled()); assertTrue(q.contains(task)); } assertTrue(p.isShutdown()); assertTrue(p.awaitTermination(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); for (ScheduledFuture task : tasks) { assertTrue(task.isDone()); assertFalse(task.isCancelled()); } } /** * If setExecuteExistingDelayedTasksAfterShutdownPolicy is false, * delayed tasks are cancelled at shutdown */ public void testShutdown2() throws InterruptedException { CustomExecutor p = new CustomExecutor(1); p.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); assertFalse(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); ScheduledFuture[] tasks = new ScheduledFuture[5]; for (int i = 0; i < tasks.length; i++) tasks[i] = p.schedule(new NoOpRunnable(), SHORT_DELAY_MS, MILLISECONDS); BlockingQueue q = p.getQueue(); assertEquals(tasks.length, q.size()); try { p.shutdown(); } catch (SecurityException ok) { return; } assertTrue(p.isShutdown()); assertTrue(q.isEmpty()); assertTrue(p.awaitTermination(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); for (ScheduledFuture task : tasks) { assertTrue(task.isDone()); assertTrue(task.isCancelled()); } } /** * If setContinueExistingPeriodicTasksAfterShutdownPolicy is set false, * periodic tasks are cancelled at shutdown */ public void testShutdown3() throws InterruptedException { CustomExecutor p = new CustomExecutor(1); assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); p.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); ScheduledFuture task = p.scheduleAtFixedRate(new NoOpRunnable(), 5, 5, MILLISECONDS); try { p.shutdown(); } catch (SecurityException ok) { return; } assertTrue(p.isShutdown()); BlockingQueue q = p.getQueue(); assertTrue(p.getQueue().isEmpty()); assertTrue(task.isDone()); assertTrue(task.isCancelled()); assertTrue(p.awaitTermination(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); } /** * if setContinueExistingPeriodicTasksAfterShutdownPolicy is true, * periodic tasks are not cancelled at shutdown */ public void testShutdown4() throws InterruptedException { CustomExecutor p = new CustomExecutor(1); final CountDownLatch counter = new CountDownLatch(2); try { p.setContinueExistingPeriodicTasksAfterShutdownPolicy(true); assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); assertTrue(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); final Runnable r = new CheckedRunnable() { public void realRun() { counter.countDown(); }}; ScheduledFuture task = p.scheduleAtFixedRate(r, 1, 1, MILLISECONDS); assertFalse(task.isDone()); assertFalse(task.isCancelled()); try { p.shutdown(); } catch (SecurityException ok) { return; } assertFalse(task.isCancelled()); assertFalse(p.isTerminated()); assertTrue(p.isShutdown()); assertTrue(counter.await(SMALL_DELAY_MS, MILLISECONDS)); assertFalse(task.isCancelled()); assertTrue(task.cancel(false)); assertTrue(task.isDone()); assertTrue(task.isCancelled()); assertTrue(p.awaitTermination(SMALL_DELAY_MS, MILLISECONDS)); assertTrue(p.isTerminated()); } finally { joinPool(p); } } /** * completed submit of callable returns result */ public void testSubmitCallable() throws Exception { ExecutorService e = new CustomExecutor(2); try { Future future = e.submit(new StringTask()); String result = future.get(); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * completed submit of runnable returns successfully */ public void testSubmitRunnable() throws Exception { ExecutorService e = new CustomExecutor(2); try { Future future = e.submit(new NoOpRunnable()); future.get(); assertTrue(future.isDone()); } finally { joinPool(e); } } /** * completed submit of (runnable, result) returns result */ public void testSubmitRunnable2() throws Exception { ExecutorService e = new CustomExecutor(2); try { Future future = e.submit(new NoOpRunnable(), TEST_STRING); String result = future.get(); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * invokeAny(null) throws NPE */ public void testInvokeAny1() throws Exception { ExecutorService e = new CustomExecutor(2); try { e.invokeAny(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAny(empty collection) throws IAE */ public void testInvokeAny2() throws Exception { ExecutorService e = new CustomExecutor(2); try { e.invokeAny(new ArrayList>()); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * invokeAny(c) throws NPE if c has null elements */ public void testInvokeAny3() throws Exception { CountDownLatch latch = new CountDownLatch(1); ExecutorService e = new CustomExecutor(2); List> l = new ArrayList>(); l.add(latchAwaitingStringTask(latch)); l.add(null); try { e.invokeAny(l); shouldThrow(); } catch (NullPointerException success) { } finally { latch.countDown(); joinPool(e); } } /** * invokeAny(c) throws ExecutionException if no task completes */ public void testInvokeAny4() throws Exception { ExecutorService e = new CustomExecutor(2); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * invokeAny(c) returns result of some task */ public void testInvokeAny5() throws Exception { ExecutorService e = new CustomExecutor(2); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * invokeAll(null) throws NPE */ public void testInvokeAll1() throws Exception { ExecutorService e = new CustomExecutor(2); try { e.invokeAll(null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * invokeAll(empty collection) returns empty collection */ public void testInvokeAll2() throws Exception { ExecutorService e = new CustomExecutor(2); try { List> r = e.invokeAll(new ArrayList>()); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * invokeAll(c) throws NPE if c has null elements */ public void testInvokeAll3() throws Exception { ExecutorService e = new CustomExecutor(2); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of invokeAll(c) throws exception on failed task */ public void testInvokeAll4() throws Exception { ExecutorService e = new CustomExecutor(2); List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * invokeAll(c) returns results of all completed tasks */ public void testInvokeAll5() throws Exception { ExecutorService e = new CustomExecutor(2); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } /** * timed invokeAny(null) throws NPE */ public void testTimedInvokeAny1() throws Exception { ExecutorService e = new CustomExecutor(2); try { e.invokeAny(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(,,null) throws NPE */ public void testTimedInvokeAnyNullTimeUnit() throws Exception { ExecutorService e = new CustomExecutor(2); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAny(empty collection) throws IAE */ public void testTimedInvokeAny2() throws Exception { ExecutorService e = new CustomExecutor(2); try { e.invokeAny(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (IllegalArgumentException success) { } finally { joinPool(e); } } /** * timed invokeAny(c) throws NPE if c has null elements */ public void testTimedInvokeAny3() throws Exception { CountDownLatch latch = new CountDownLatch(1); ExecutorService e = new CustomExecutor(2); List> l = new ArrayList>(); l.add(latchAwaitingStringTask(latch)); l.add(null); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { latch.countDown(); joinPool(e); } } /** * timed invokeAny(c) throws ExecutionException if no task completes */ public void testTimedInvokeAny4() throws Exception { ExecutorService e = new CustomExecutor(2); List> l = new ArrayList>(); l.add(new NPETask()); try { e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * timed invokeAny(c) returns result of some task */ public void testTimedInvokeAny5() throws Exception { ExecutorService e = new CustomExecutor(2); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); assertSame(TEST_STRING, result); } finally { joinPool(e); } } /** * timed invokeAll(null) throws NPE */ public void testTimedInvokeAll1() throws Exception { ExecutorService e = new CustomExecutor(2); try { e.invokeAll(null, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(,,null) throws NPE */ public void testTimedInvokeAllNullTimeUnit() throws Exception { ExecutorService e = new CustomExecutor(2); List> l = new ArrayList>(); l.add(new StringTask()); try { e.invokeAll(l, MEDIUM_DELAY_MS, null); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * timed invokeAll(empty collection) returns empty collection */ public void testTimedInvokeAll2() throws Exception { ExecutorService e = new CustomExecutor(2); try { List> r = e.invokeAll(new ArrayList>(), MEDIUM_DELAY_MS, MILLISECONDS); assertTrue(r.isEmpty()); } finally { joinPool(e); } } /** * timed invokeAll(c) throws NPE if c has null elements */ public void testTimedInvokeAll3() throws Exception { ExecutorService e = new CustomExecutor(2); List> l = new ArrayList>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { joinPool(e); } } /** * get of element of invokeAll(c) throws exception on failed task */ public void testTimedInvokeAll4() throws Exception { ExecutorService e = new CustomExecutor(2); List> l = new ArrayList>(); l.add(new NPETask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(1, futures.size()); try { futures.get(0).get(); shouldThrow(); } catch (ExecutionException success) { assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } } /** * timed invokeAll(c) returns results of all completed tasks */ public void testTimedInvokeAll5() throws Exception { ExecutorService e = new CustomExecutor(2); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(new StringTask()); List> futures = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS); assertEquals(2, futures.size()); for (Future future : futures) assertSame(TEST_STRING, future.get()); } finally { joinPool(e); } } /** * timed invokeAll(c) cancels tasks not completed by timeout */ public void testTimedInvokeAll6() throws Exception { ExecutorService e = new CustomExecutor(2); try { List> l = new ArrayList>(); l.add(new StringTask()); l.add(Executors.callable(new MediumPossiblyInterruptedRunnable(), TEST_STRING)); l.add(new StringTask()); List> futures = e.invokeAll(l, SHORT_DELAY_MS, MILLISECONDS); assertEquals(3, futures.size()); Iterator> it = futures.iterator(); Future f1 = it.next(); Future f2 = it.next(); Future f3 = it.next(); assertTrue(f1.isDone()); assertTrue(f2.isDone()); assertTrue(f3.isDone()); assertFalse(f1.isCancelled()); assertTrue(f2.isCancelled()); } finally { joinPool(e); } } } jsr166/src/test/tck/ThreadTest.java0000644000000000000000000000455611537741073014262 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; public class ThreadTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ThreadTest.class); } static class MyHandler implements Thread.UncaughtExceptionHandler { public void uncaughtException(Thread t, Throwable e) { e.printStackTrace(); } } /** * getUncaughtExceptionHandler returns ThreadGroup unless set, * otherwise returning value of last setUncaughtExceptionHandler. */ public void testGetAndSetUncaughtExceptionHandler() { // these must be done all at once to avoid state // dependencies across tests Thread current = Thread.currentThread(); ThreadGroup tg = current.getThreadGroup(); MyHandler eh = new MyHandler(); assertEquals(tg, current.getUncaughtExceptionHandler()); current.setUncaughtExceptionHandler(eh); assertEquals(eh, current.getUncaughtExceptionHandler()); current.setUncaughtExceptionHandler(null); assertEquals(tg, current.getUncaughtExceptionHandler()); } /** * getDefaultUncaughtExceptionHandler returns value of last * setDefaultUncaughtExceptionHandler. */ public void testGetAndSetDefaultUncaughtExceptionHandler() { assertEquals(null, Thread.getDefaultUncaughtExceptionHandler()); // failure due to securityException is OK. // Would be nice to explicitly test both ways, but cannot yet. try { Thread current = Thread.currentThread(); ThreadGroup tg = current.getThreadGroup(); MyHandler eh = new MyHandler(); Thread.setDefaultUncaughtExceptionHandler(eh); assertEquals(eh, Thread.getDefaultUncaughtExceptionHandler()); Thread.setDefaultUncaughtExceptionHandler(null); } catch (SecurityException ok) { } assertEquals(null, Thread.getDefaultUncaughtExceptionHandler()); } // How to test actually using UEH within junit? } jsr166/src/test/tck/ConcurrentSkipListSubMapTest.java0000644000000000000000000012300211537741072017753 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class ConcurrentSkipListSubMapTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ConcurrentSkipListSubMapTest.class); } /** * Create a map from Integers 1-5 to Strings "A"-"E". */ private static ConcurrentNavigableMap map5() { ConcurrentSkipListMap map = new ConcurrentSkipListMap(); assertTrue(map.isEmpty()); map.put(zero, "Z"); map.put(one, "A"); map.put(five, "E"); map.put(three, "C"); map.put(two, "B"); map.put(four, "D"); map.put(seven, "F"); assertFalse(map.isEmpty()); assertEquals(7, map.size()); return map.subMap(one, true, seven, false); } /** * Create a map from Integers -5 to -1 to Strings "A"-"E". */ private static ConcurrentNavigableMap dmap5() { ConcurrentSkipListMap map = new ConcurrentSkipListMap(); assertTrue(map.isEmpty()); map.put(m1, "A"); map.put(m5, "E"); map.put(m3, "C"); map.put(m2, "B"); map.put(m4, "D"); assertFalse(map.isEmpty()); assertEquals(5, map.size()); return map.descendingMap(); } private static ConcurrentNavigableMap map0() { ConcurrentSkipListMap map = new ConcurrentSkipListMap(); assertTrue(map.isEmpty()); return map.tailMap(one, true); } private static ConcurrentNavigableMap dmap0() { ConcurrentSkipListMap map = new ConcurrentSkipListMap(); assertTrue(map.isEmpty()); return map; } /** * clear removes all pairs */ public void testClear() { ConcurrentNavigableMap map = map5(); map.clear(); assertEquals(map.size(), 0); } /** * Maps with same contents are equal */ public void testEquals() { ConcurrentNavigableMap map1 = map5(); ConcurrentNavigableMap map2 = map5(); assertEquals(map1, map2); assertEquals(map2, map1); map1.clear(); assertFalse(map1.equals(map2)); assertFalse(map2.equals(map1)); } /** * containsKey returns true for contained key */ public void testContainsKey() { ConcurrentNavigableMap map = map5(); assertTrue(map.containsKey(one)); assertFalse(map.containsKey(zero)); } /** * containsValue returns true for held values */ public void testContainsValue() { ConcurrentNavigableMap map = map5(); assertTrue(map.containsValue("A")); assertFalse(map.containsValue("Z")); } /** * get returns the correct element at the given key, * or null if not present */ public void testGet() { ConcurrentNavigableMap map = map5(); assertEquals("A", (String)map.get(one)); ConcurrentNavigableMap empty = map0(); assertNull(empty.get(one)); } /** * isEmpty is true of empty map and false for non-empty */ public void testIsEmpty() { ConcurrentNavigableMap empty = map0(); ConcurrentNavigableMap map = map5(); assertTrue(empty.isEmpty()); assertFalse(map.isEmpty()); } /** * firstKey returns first key */ public void testFirstKey() { ConcurrentNavigableMap map = map5(); assertEquals(one, map.firstKey()); } /** * lastKey returns last key */ public void testLastKey() { ConcurrentNavigableMap map = map5(); assertEquals(five, map.lastKey()); } /** * keySet returns a Set containing all the keys */ public void testKeySet() { ConcurrentNavigableMap map = map5(); Set s = map.keySet(); assertEquals(5, s.size()); assertTrue(s.contains(one)); assertTrue(s.contains(two)); assertTrue(s.contains(three)); assertTrue(s.contains(four)); assertTrue(s.contains(five)); } /** * keySet is ordered */ public void testKeySetOrder() { ConcurrentNavigableMap map = map5(); Set s = map.keySet(); Iterator i = s.iterator(); Integer last = (Integer)i.next(); assertEquals(last, one); while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) < 0); last = k; } } /** * values collection contains all values */ public void testValues() { ConcurrentNavigableMap map = map5(); Collection s = map.values(); assertEquals(5, s.size()); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * keySet.toArray returns contains all keys */ public void testKeySetToArray() { ConcurrentNavigableMap map = map5(); Set s = map.keySet(); Object[] ar = s.toArray(); assertTrue(s.containsAll(Arrays.asList(ar))); assertEquals(5, ar.length); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); } /** * descendingkeySet.toArray returns contains all keys */ public void testDescendingKeySetToArray() { ConcurrentNavigableMap map = map5(); Set s = map.descendingKeySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); assertTrue(s.containsAll(Arrays.asList(ar))); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); } /** * Values.toArray contains all values */ public void testValuesToArray() { ConcurrentNavigableMap map = map5(); Collection v = map.values(); Object[] ar = v.toArray(); ArrayList s = new ArrayList(Arrays.asList(ar)); assertEquals(5, ar.length); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * entrySet contains all pairs */ public void testEntrySet() { ConcurrentNavigableMap map = map5(); Set s = map.entrySet(); assertEquals(5, s.size()); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); assertTrue( (e.getKey().equals(one) && e.getValue().equals("A")) || (e.getKey().equals(two) && e.getValue().equals("B")) || (e.getKey().equals(three) && e.getValue().equals("C")) || (e.getKey().equals(four) && e.getValue().equals("D")) || (e.getKey().equals(five) && e.getValue().equals("E"))); } } /** * putAll adds all key-value pairs from the given map */ public void testPutAll() { ConcurrentNavigableMap empty = map0(); ConcurrentNavigableMap map = map5(); empty.putAll(map); assertEquals(5, empty.size()); assertTrue(empty.containsKey(one)); assertTrue(empty.containsKey(two)); assertTrue(empty.containsKey(three)); assertTrue(empty.containsKey(four)); assertTrue(empty.containsKey(five)); } /** * putIfAbsent works when the given key is not present */ public void testPutIfAbsent() { ConcurrentNavigableMap map = map5(); map.putIfAbsent(six, "Z"); assertTrue(map.containsKey(six)); } /** * putIfAbsent does not add the pair if the key is already present */ public void testPutIfAbsent2() { ConcurrentNavigableMap map = map5(); assertEquals("A", map.putIfAbsent(one, "Z")); } /** * replace fails when the given key is not present */ public void testReplace() { ConcurrentNavigableMap map = map5(); assertNull(map.replace(six, "Z")); assertFalse(map.containsKey(six)); } /** * replace succeeds if the key is already present */ public void testReplace2() { ConcurrentNavigableMap map = map5(); assertNotNull(map.replace(one, "Z")); assertEquals("Z", map.get(one)); } /** * replace value fails when the given key not mapped to expected value */ public void testReplaceValue() { ConcurrentNavigableMap map = map5(); assertEquals("A", map.get(one)); assertFalse(map.replace(one, "Z", "Z")); assertEquals("A", map.get(one)); } /** * replace value succeeds when the given key mapped to expected value */ public void testReplaceValue2() { ConcurrentNavigableMap map = map5(); assertEquals("A", map.get(one)); assertTrue(map.replace(one, "A", "Z")); assertEquals("Z", map.get(one)); } /** * remove removes the correct key-value pair from the map */ public void testRemove() { ConcurrentNavigableMap map = map5(); map.remove(five); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); } /** * remove(key,value) removes only if pair present */ public void testRemove2() { ConcurrentNavigableMap map = map5(); assertTrue(map.containsKey(five)); assertEquals("E", map.get(five)); map.remove(five, "E"); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); map.remove(four, "A"); assertEquals(4, map.size()); assertTrue(map.containsKey(four)); } /** * lowerEntry returns preceding entry. */ public void testLowerEntry() { ConcurrentNavigableMap map = map5(); Map.Entry e1 = map.lowerEntry(three); assertEquals(two, e1.getKey()); Map.Entry e2 = map.lowerEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.lowerEntry(one); assertNull(e3); Map.Entry e4 = map.lowerEntry(zero); assertNull(e4); } /** * higherEntry returns next entry. */ public void testHigherEntry() { ConcurrentNavigableMap map = map5(); Map.Entry e1 = map.higherEntry(three); assertEquals(four, e1.getKey()); Map.Entry e2 = map.higherEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.higherEntry(five); assertNull(e3); Map.Entry e4 = map.higherEntry(six); assertNull(e4); } /** * floorEntry returns preceding entry. */ public void testFloorEntry() { ConcurrentNavigableMap map = map5(); Map.Entry e1 = map.floorEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.floorEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.floorEntry(one); assertEquals(one, e3.getKey()); Map.Entry e4 = map.floorEntry(zero); assertNull(e4); } /** * ceilingEntry returns next entry. */ public void testCeilingEntry() { ConcurrentNavigableMap map = map5(); Map.Entry e1 = map.ceilingEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.ceilingEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.ceilingEntry(five); assertEquals(five, e3.getKey()); Map.Entry e4 = map.ceilingEntry(six); assertNull(e4); } /** * pollFirstEntry returns entries in order */ public void testPollFirstEntry() { ConcurrentNavigableMap map = map5(); Map.Entry e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(two, e.getKey()); map.put(one, "A"); e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(three, e.getKey()); map.remove(four); e = map.pollFirstEntry(); assertEquals(five, e.getKey()); try { e.setValue("A"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollFirstEntry(); assertNull(e); } /** * pollLastEntry returns entries in order */ public void testPollLastEntry() { ConcurrentNavigableMap map = map5(); Map.Entry e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(four, e.getKey()); map.put(five, "E"); e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(three, e.getKey()); map.remove(two); e = map.pollLastEntry(); assertEquals(one, e.getKey()); try { e.setValue("E"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollLastEntry(); assertNull(e); } /** * size returns the correct values */ public void testSize() { ConcurrentNavigableMap map = map5(); ConcurrentNavigableMap empty = map0(); assertEquals(0, empty.size()); assertEquals(5, map.size()); } /** * toString contains toString of elements */ public void testToString() { ConcurrentNavigableMap map = map5(); String s = map.toString(); for (int i = 1; i <= 5; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } // Exception tests /** * get(null) of nonempty map throws NPE */ public void testGet_NullPointerException() { try { ConcurrentNavigableMap c = map5(); c.get(null); shouldThrow(); } catch (NullPointerException success) {} } /** * containsKey(null) of nonempty map throws NPE */ public void testContainsKey_NullPointerException() { try { ConcurrentNavigableMap c = map5(); c.containsKey(null); shouldThrow(); } catch (NullPointerException success) {} } /** * containsValue(null) throws NPE */ public void testContainsValue_NullPointerException() { try { ConcurrentNavigableMap c = map0(); c.containsValue(null); shouldThrow(); } catch (NullPointerException success) {} } /** * put(null,x) throws NPE */ public void testPut1_NullPointerException() { try { ConcurrentNavigableMap c = map5(); c.put(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * putIfAbsent(null, x) throws NPE */ public void testPutIfAbsent1_NullPointerException() { try { ConcurrentNavigableMap c = map5(); c.putIfAbsent(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * replace(null, x) throws NPE */ public void testReplace_NullPointerException() { try { ConcurrentNavigableMap c = map5(); c.replace(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * replace(null, x, y) throws NPE */ public void testReplaceValue_NullPointerException() { try { ConcurrentNavigableMap c = map5(); c.replace(null, one, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(null) throws NPE */ public void testRemove1_NullPointerException() { try { ConcurrentNavigableMap c = map5(); c.remove(null); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(null, x) throws NPE */ public void testRemove2_NullPointerException() { try { ConcurrentNavigableMap c = map5(); c.remove(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * A deserialized map equals original */ public void testSerialization() throws Exception { ConcurrentNavigableMap q = map5(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); ConcurrentNavigableMap r = (ConcurrentNavigableMap)in.readObject(); assertEquals(q.size(), r.size()); assertTrue(q.equals(r)); assertTrue(r.equals(q)); } /** * subMap returns map with keys in requested range */ public void testSubMapContents() { ConcurrentNavigableMap map = map5(); SortedMap sm = map.subMap(two, four); assertEquals(two, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals(2, sm.size()); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(two)); assertEquals(4, map.size()); assertEquals(1, sm.size()); assertEquals(three, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals("C", sm.remove(three)); assertTrue(sm.isEmpty()); assertEquals(3, map.size()); } public void testSubMapContents2() { ConcurrentNavigableMap map = map5(); SortedMap sm = map.subMap(two, three); assertEquals(1, sm.size()); assertEquals(two, sm.firstKey()); assertEquals(two, sm.lastKey()); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertFalse(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); assertFalse(i.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(two)); assertEquals(4, map.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertSame(sm.remove(three), null); assertEquals(4, map.size()); } /** * headMap returns map with keys in requested range */ public void testHeadMapContents() { ConcurrentNavigableMap map = map5(); SortedMap sm = map.headMap(four); assertTrue(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(one, k); k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, map.size()); assertEquals(four, map.firstKey()); } /** * headMap returns map with keys in requested range */ public void testTailMapContents() { ConcurrentNavigableMap map = map5(); SortedMap sm = map.tailMap(two); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertTrue(sm.containsKey(four)); assertTrue(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); k = (Integer)(i.next()); assertEquals(four, k); k = (Integer)(i.next()); assertEquals(five, k); assertFalse(i.hasNext()); Iterator ei = sm.entrySet().iterator(); Map.Entry e; e = (Map.Entry)(ei.next()); assertEquals(two, e.getKey()); assertEquals("B", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(three, e.getKey()); assertEquals("C", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(four, e.getKey()); assertEquals("D", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); assertFalse(i.hasNext()); SortedMap ssm = sm.tailMap(four); assertEquals(four, ssm.firstKey()); assertEquals(five, ssm.lastKey()); assertEquals("D", ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, map.size()); } /** * clear removes all pairs */ public void testDescendingClear() { ConcurrentNavigableMap map = dmap5(); map.clear(); assertEquals(map.size(), 0); } /** * Maps with same contents are equal */ public void testDescendingEquals() { ConcurrentNavigableMap map1 = dmap5(); ConcurrentNavigableMap map2 = dmap5(); assertEquals(map1, map2); assertEquals(map2, map1); map1.clear(); assertFalse(map1.equals(map2)); assertFalse(map2.equals(map1)); } /** * containsKey returns true for contained key */ public void testDescendingContainsKey() { ConcurrentNavigableMap map = dmap5(); assertTrue(map.containsKey(m1)); assertFalse(map.containsKey(zero)); } /** * containsValue returns true for held values */ public void testDescendingContainsValue() { ConcurrentNavigableMap map = dmap5(); assertTrue(map.containsValue("A")); assertFalse(map.containsValue("Z")); } /** * get returns the correct element at the given key, * or null if not present */ public void testDescendingGet() { ConcurrentNavigableMap map = dmap5(); assertEquals("A", (String)map.get(m1)); ConcurrentNavigableMap empty = dmap0(); assertNull(empty.get(m1)); } /** * isEmpty is true of empty map and false for non-empty */ public void testDescendingIsEmpty() { ConcurrentNavigableMap empty = dmap0(); ConcurrentNavigableMap map = dmap5(); assertTrue(empty.isEmpty()); assertFalse(map.isEmpty()); } /** * firstKey returns first key */ public void testDescendingFirstKey() { ConcurrentNavigableMap map = dmap5(); assertEquals(m1, map.firstKey()); } /** * lastKey returns last key */ public void testDescendingLastKey() { ConcurrentNavigableMap map = dmap5(); assertEquals(m5, map.lastKey()); } /** * keySet returns a Set containing all the keys */ public void testDescendingKeySet() { ConcurrentNavigableMap map = dmap5(); Set s = map.keySet(); assertEquals(5, s.size()); assertTrue(s.contains(m1)); assertTrue(s.contains(m2)); assertTrue(s.contains(m3)); assertTrue(s.contains(m4)); assertTrue(s.contains(m5)); } /** * keySet is ordered */ public void testDescendingKeySetOrder() { ConcurrentNavigableMap map = dmap5(); Set s = map.keySet(); Iterator i = s.iterator(); Integer last = (Integer)i.next(); assertEquals(last, m1); while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) > 0); last = k; } } /** * values collection contains all values */ public void testDescendingValues() { ConcurrentNavigableMap map = dmap5(); Collection s = map.values(); assertEquals(5, s.size()); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * keySet.toArray returns contains all keys */ public void testDescendingAscendingKeySetToArray() { ConcurrentNavigableMap map = dmap5(); Set s = map.keySet(); Object[] ar = s.toArray(); assertTrue(s.containsAll(Arrays.asList(ar))); assertEquals(5, ar.length); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); } /** * descendingkeySet.toArray returns contains all keys */ public void testDescendingDescendingKeySetToArray() { ConcurrentNavigableMap map = dmap5(); Set s = map.descendingKeySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); assertTrue(s.containsAll(Arrays.asList(ar))); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); } /** * Values.toArray contains all values */ public void testDescendingValuesToArray() { ConcurrentNavigableMap map = dmap5(); Collection v = map.values(); Object[] ar = v.toArray(); ArrayList s = new ArrayList(Arrays.asList(ar)); assertEquals(5, ar.length); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); } /** * entrySet contains all pairs */ public void testDescendingEntrySet() { ConcurrentNavigableMap map = dmap5(); Set s = map.entrySet(); assertEquals(5, s.size()); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); assertTrue( (e.getKey().equals(m1) && e.getValue().equals("A")) || (e.getKey().equals(m2) && e.getValue().equals("B")) || (e.getKey().equals(m3) && e.getValue().equals("C")) || (e.getKey().equals(m4) && e.getValue().equals("D")) || (e.getKey().equals(m5) && e.getValue().equals("E"))); } } /** * putAll adds all key-value pairs from the given map */ public void testDescendingPutAll() { ConcurrentNavigableMap empty = dmap0(); ConcurrentNavigableMap map = dmap5(); empty.putAll(map); assertEquals(5, empty.size()); assertTrue(empty.containsKey(m1)); assertTrue(empty.containsKey(m2)); assertTrue(empty.containsKey(m3)); assertTrue(empty.containsKey(m4)); assertTrue(empty.containsKey(m5)); } /** * putIfAbsent works when the given key is not present */ public void testDescendingPutIfAbsent() { ConcurrentNavigableMap map = dmap5(); map.putIfAbsent(six, "Z"); assertTrue(map.containsKey(six)); } /** * putIfAbsent does not add the pair if the key is already present */ public void testDescendingPutIfAbsent2() { ConcurrentNavigableMap map = dmap5(); assertEquals("A", map.putIfAbsent(m1, "Z")); } /** * replace fails when the given key is not present */ public void testDescendingReplace() { ConcurrentNavigableMap map = dmap5(); assertNull(map.replace(six, "Z")); assertFalse(map.containsKey(six)); } /** * replace succeeds if the key is already present */ public void testDescendingReplace2() { ConcurrentNavigableMap map = dmap5(); assertNotNull(map.replace(m1, "Z")); assertEquals("Z", map.get(m1)); } /** * replace value fails when the given key not mapped to expected value */ public void testDescendingReplaceValue() { ConcurrentNavigableMap map = dmap5(); assertEquals("A", map.get(m1)); assertFalse(map.replace(m1, "Z", "Z")); assertEquals("A", map.get(m1)); } /** * replace value succeeds when the given key mapped to expected value */ public void testDescendingReplaceValue2() { ConcurrentNavigableMap map = dmap5(); assertEquals("A", map.get(m1)); assertTrue(map.replace(m1, "A", "Z")); assertEquals("Z", map.get(m1)); } /** * remove removes the correct key-value pair from the map */ public void testDescendingRemove() { ConcurrentNavigableMap map = dmap5(); map.remove(m5); assertEquals(4, map.size()); assertFalse(map.containsKey(m5)); } /** * remove(key,value) removes only if pair present */ public void testDescendingRemove2() { ConcurrentNavigableMap map = dmap5(); assertTrue(map.containsKey(m5)); assertEquals("E", map.get(m5)); map.remove(m5, "E"); assertEquals(4, map.size()); assertFalse(map.containsKey(m5)); map.remove(m4, "A"); assertEquals(4, map.size()); assertTrue(map.containsKey(m4)); } /** * lowerEntry returns preceding entry. */ public void testDescendingLowerEntry() { ConcurrentNavigableMap map = dmap5(); Map.Entry e1 = map.lowerEntry(m3); assertEquals(m2, e1.getKey()); Map.Entry e2 = map.lowerEntry(m6); assertEquals(m5, e2.getKey()); Map.Entry e3 = map.lowerEntry(m1); assertNull(e3); Map.Entry e4 = map.lowerEntry(zero); assertNull(e4); } /** * higherEntry returns next entry. */ public void testDescendingHigherEntry() { ConcurrentNavigableMap map = dmap5(); Map.Entry e1 = map.higherEntry(m3); assertEquals(m4, e1.getKey()); Map.Entry e2 = map.higherEntry(zero); assertEquals(m1, e2.getKey()); Map.Entry e3 = map.higherEntry(m5); assertNull(e3); Map.Entry e4 = map.higherEntry(m6); assertNull(e4); } /** * floorEntry returns preceding entry. */ public void testDescendingFloorEntry() { ConcurrentNavigableMap map = dmap5(); Map.Entry e1 = map.floorEntry(m3); assertEquals(m3, e1.getKey()); Map.Entry e2 = map.floorEntry(m6); assertEquals(m5, e2.getKey()); Map.Entry e3 = map.floorEntry(m1); assertEquals(m1, e3.getKey()); Map.Entry e4 = map.floorEntry(zero); assertNull(e4); } /** * ceilingEntry returns next entry. */ public void testDescendingCeilingEntry() { ConcurrentNavigableMap map = dmap5(); Map.Entry e1 = map.ceilingEntry(m3); assertEquals(m3, e1.getKey()); Map.Entry e2 = map.ceilingEntry(zero); assertEquals(m1, e2.getKey()); Map.Entry e3 = map.ceilingEntry(m5); assertEquals(m5, e3.getKey()); Map.Entry e4 = map.ceilingEntry(m6); assertNull(e4); } /** * pollFirstEntry returns entries in order */ public void testDescendingPollFirstEntry() { ConcurrentNavigableMap map = dmap5(); Map.Entry e = map.pollFirstEntry(); assertEquals(m1, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(m2, e.getKey()); map.put(m1, "A"); e = map.pollFirstEntry(); assertEquals(m1, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(m3, e.getKey()); map.remove(m4); e = map.pollFirstEntry(); assertEquals(m5, e.getKey()); try { e.setValue("A"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollFirstEntry(); assertNull(e); } /** * pollLastEntry returns entries in order */ public void testDescendingPollLastEntry() { ConcurrentNavigableMap map = dmap5(); Map.Entry e = map.pollLastEntry(); assertEquals(m5, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(m4, e.getKey()); map.put(m5, "E"); e = map.pollLastEntry(); assertEquals(m5, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(m3, e.getKey()); map.remove(m2); e = map.pollLastEntry(); assertEquals(m1, e.getKey()); try { e.setValue("E"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollLastEntry(); assertNull(e); } /** * size returns the correct values */ public void testDescendingSize() { ConcurrentNavigableMap map = dmap5(); ConcurrentNavigableMap empty = dmap0(); assertEquals(0, empty.size()); assertEquals(5, map.size()); } /** * toString contains toString of elements */ public void testDescendingToString() { ConcurrentNavigableMap map = dmap5(); String s = map.toString(); for (int i = 1; i <= 5; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } // Exception testDescendings /** * get(null) of empty map throws NPE */ public void testDescendingGet_NullPointerException() { try { ConcurrentNavigableMap c = dmap5(); c.get(null); shouldThrow(); } catch (NullPointerException success) {} } /** * containsKey(null) of empty map throws NPE */ public void testDescendingContainsKey_NullPointerException() { try { ConcurrentNavigableMap c = dmap5(); c.containsKey(null); shouldThrow(); } catch (NullPointerException success) {} } /** * containsValue(null) throws NPE */ public void testDescendingContainsValue_NullPointerException() { try { ConcurrentNavigableMap c = dmap0(); c.containsValue(null); shouldThrow(); } catch (NullPointerException success) {} } /** * put(null,x) throws NPE */ public void testDescendingPut1_NullPointerException() { try { ConcurrentNavigableMap c = dmap5(); c.put(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * putIfAbsent(null, x) throws NPE */ public void testDescendingPutIfAbsent1_NullPointerException() { try { ConcurrentNavigableMap c = dmap5(); c.putIfAbsent(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * replace(null, x) throws NPE */ public void testDescendingReplace_NullPointerException() { try { ConcurrentNavigableMap c = dmap5(); c.replace(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * replace(null, x, y) throws NPE */ public void testDescendingReplaceValue_NullPointerException() { try { ConcurrentNavigableMap c = dmap5(); c.replace(null, m1, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(null) throws NPE */ public void testDescendingRemove1_NullPointerException() { try { ConcurrentNavigableMap c = dmap5(); c.remove(null); shouldThrow(); } catch (NullPointerException success) {} } /** * remove(null, x) throws NPE */ public void testDescendingRemove2_NullPointerException() { try { ConcurrentNavigableMap c = dmap5(); c.remove(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} } /** * A deserialized map equals original */ public void testDescendingSerialization() throws Exception { ConcurrentNavigableMap q = dmap5(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); ConcurrentNavigableMap r = (ConcurrentNavigableMap)in.readObject(); assertEquals(q.size(), r.size()); assertTrue(q.equals(r)); assertTrue(r.equals(q)); } /** * subMap returns map with keys in requested range */ public void testDescendingSubMapContents() { ConcurrentNavigableMap map = dmap5(); SortedMap sm = map.subMap(m2, m4); assertEquals(m2, sm.firstKey()); assertEquals(m3, sm.lastKey()); assertEquals(2, sm.size()); assertFalse(sm.containsKey(m1)); assertTrue(sm.containsKey(m2)); assertTrue(sm.containsKey(m3)); assertFalse(sm.containsKey(m4)); assertFalse(sm.containsKey(m5)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); assertFalse(i.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(m2)); assertEquals(4, map.size()); assertEquals(1, sm.size()); assertEquals(m3, sm.firstKey()); assertEquals(m3, sm.lastKey()); assertEquals("C", sm.remove(m3)); assertTrue(sm.isEmpty()); assertEquals(3, map.size()); } public void testDescendingSubMapContents2() { ConcurrentNavigableMap map = dmap5(); SortedMap sm = map.subMap(m2, m3); assertEquals(1, sm.size()); assertEquals(m2, sm.firstKey()); assertEquals(m2, sm.lastKey()); assertFalse(sm.containsKey(m1)); assertTrue(sm.containsKey(m2)); assertFalse(sm.containsKey(m3)); assertFalse(sm.containsKey(m4)); assertFalse(sm.containsKey(m5)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); assertFalse(i.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(m2)); assertEquals(4, map.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertSame(sm.remove(m3), null); assertEquals(4, map.size()); } /** * headMap returns map with keys in requested range */ public void testDescendingHeadMapContents() { ConcurrentNavigableMap map = dmap5(); SortedMap sm = map.headMap(m4); assertTrue(sm.containsKey(m1)); assertTrue(sm.containsKey(m2)); assertTrue(sm.containsKey(m3)); assertFalse(sm.containsKey(m4)); assertFalse(sm.containsKey(m5)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(m1, k); k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, map.size()); assertEquals(m4, map.firstKey()); } /** * headMap returns map with keys in requested range */ public void testDescendingTailMapContents() { ConcurrentNavigableMap map = dmap5(); SortedMap sm = map.tailMap(m2); assertFalse(sm.containsKey(m1)); assertTrue(sm.containsKey(m2)); assertTrue(sm.containsKey(m3)); assertTrue(sm.containsKey(m4)); assertTrue(sm.containsKey(m5)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); k = (Integer)(i.next()); assertEquals(m4, k); k = (Integer)(i.next()); assertEquals(m5, k); assertFalse(i.hasNext()); Iterator ei = sm.entrySet().iterator(); Map.Entry e; e = (Map.Entry)(ei.next()); assertEquals(m2, e.getKey()); assertEquals("B", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(m3, e.getKey()); assertEquals("C", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(m4, e.getKey()); assertEquals("D", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(m5, e.getKey()); assertEquals("E", e.getValue()); assertFalse(i.hasNext()); SortedMap ssm = sm.tailMap(m4); assertEquals(m4, ssm.firstKey()); assertEquals(m5, ssm.lastKey()); assertEquals("D", ssm.remove(m4)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, map.size()); } } jsr166/src/test/tck/PriorityBlockingQueueTest.java0000644000000000000000000006134711560754737017362 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.io.*; public class PriorityBlockingQueueTest extends JSR166TestCase { public static class Generic extends BlockingQueueTest { protected BlockingQueue emptyCollection() { return new PriorityBlockingQueue(); } } public static class InitialCapacity extends BlockingQueueTest { protected BlockingQueue emptyCollection() { return new PriorityBlockingQueue(20); } } public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return newTestSuite(PriorityBlockingQueueTest.class, new Generic().testSuite(), new InitialCapacity().testSuite()); } private static final int NOCAP = Integer.MAX_VALUE; /** Sample Comparator */ static class MyReverseComparator implements Comparator { public int compare(Object x, Object y) { return ((Comparable)y).compareTo(x); } } /** * Create a queue of given size containing consecutive * Integers 0 ... n. */ private PriorityBlockingQueue populatedQueue(int n) { PriorityBlockingQueue q = new PriorityBlockingQueue(n); assertTrue(q.isEmpty()); for (int i = n-1; i >= 0; i-=2) assertTrue(q.offer(new Integer(i))); for (int i = (n & 1); i < n; i+=2) assertTrue(q.offer(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(NOCAP, q.remainingCapacity()); assertEquals(n, q.size()); return q; } /** * A new queue has unbounded capacity */ public void testConstructor1() { assertEquals(NOCAP, new PriorityBlockingQueue(SIZE).remainingCapacity()); } /** * Constructor throws IAE if capacity argument nonpositive */ public void testConstructor2() { try { PriorityBlockingQueue q = new PriorityBlockingQueue(0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { PriorityBlockingQueue q = new PriorityBlockingQueue(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws NPE */ public void testConstructor4() { try { Integer[] ints = new Integer[SIZE]; PriorityBlockingQueue q = new PriorityBlockingQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection with some null elements throws NPE */ public void testConstructor5() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); PriorityBlockingQueue q = new PriorityBlockingQueue(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements of collection used to initialize */ public void testConstructor6() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); PriorityBlockingQueue q = new PriorityBlockingQueue(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * The comparator used in constructor is used */ public void testConstructor7() { MyReverseComparator cmp = new MyReverseComparator(); PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE, cmp); assertEquals(cmp, q.comparator()); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); for (int i = SIZE-1; i >= 0; --i) assertEquals(ints[i], q.poll()); } /** * isEmpty is true before add, false after */ public void testEmpty() { PriorityBlockingQueue q = new PriorityBlockingQueue(2); assertTrue(q.isEmpty()); assertEquals(NOCAP, q.remainingCapacity()); q.add(one); assertFalse(q.isEmpty()); q.add(two); q.remove(); q.remove(); assertTrue(q.isEmpty()); } /** * remainingCapacity does not change when elements added or removed, * but size does */ public void testRemainingCapacity() { PriorityBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(NOCAP, q.remainingCapacity()); assertEquals(SIZE-i, q.size()); q.remove(); } for (int i = 0; i < SIZE; ++i) { assertEquals(NOCAP, q.remainingCapacity()); assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * offer(null) throws NPE */ public void testOfferNull() { try { PriorityBlockingQueue q = new PriorityBlockingQueue(1); q.offer(null); shouldThrow(); } catch (NullPointerException success) {} } /** * add(null) throws NPE */ public void testAddNull() { try { PriorityBlockingQueue q = new PriorityBlockingQueue(1); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Offer of comparable element succeeds */ public void testOffer() { PriorityBlockingQueue q = new PriorityBlockingQueue(1); assertTrue(q.offer(zero)); assertTrue(q.offer(one)); } /** * Offer of non-Comparable throws CCE */ public void testOfferNonComparable() { try { PriorityBlockingQueue q = new PriorityBlockingQueue(1); q.offer(new Object()); q.offer(new Object()); q.offer(new Object()); shouldThrow(); } catch (ClassCastException success) {} } /** * add of comparable succeeds */ public void testAdd() { PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); assertTrue(q.add(new Integer(i))); } } /** * addAll(null) throws NPE */ public void testAddAll1() { try { PriorityBlockingQueue q = new PriorityBlockingQueue(1); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll(this) throws IAE */ public void testAddAllSelf() { try { PriorityBlockingQueue q = populatedQueue(SIZE); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Queue contains all elements of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = SIZE-1; i >= 0; --i) ints[i] = new Integer(i); PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll()); } /** * put(null) throws NPE */ public void testPutNull() { try { PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); q.put(null); shouldThrow(); } catch (NullPointerException success) {} } /** * all elements successfully put are contained */ public void testPut() { PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); for (int i = 0; i < SIZE; ++i) { Integer I = new Integer(i); q.put(I); assertTrue(q.contains(I)); } assertEquals(SIZE, q.size()); } /** * put doesn't block waiting for take */ public void testPutWithTake() throws InterruptedException { final PriorityBlockingQueue q = new PriorityBlockingQueue(2); final int size = 4; Thread t = new Thread(new CheckedRunnable() { public void realRun() { for (int i = 0; i < size; i++) q.put(new Integer(0)); }}); t.start(); delay(SHORT_DELAY_MS); assertEquals(q.size(), size); q.take(); t.interrupt(); t.join(); } /** * timed offer does not time out */ public void testTimedOffer() throws InterruptedException { final PriorityBlockingQueue q = new PriorityBlockingQueue(2); Thread t = new Thread(new CheckedRunnable() { public void realRun() { q.put(new Integer(0)); q.put(new Integer(0)); assertTrue(q.offer(new Integer(0), SHORT_DELAY_MS, MILLISECONDS)); assertTrue(q.offer(new Integer(0), LONG_DELAY_MS, MILLISECONDS)); }}); t.start(); delay(SMALL_DELAY_MS); t.interrupt(); t.join(); } /** * take retrieves elements in priority order */ public void testTake() throws InterruptedException { PriorityBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } } /** * Take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { final PriorityBlockingQueue q = populatedQueue(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } try { q.take(); shouldThrow(); } catch (InterruptedException success) {} }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * poll succeeds unless empty */ public void testPoll() { PriorityBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll()); } assertNull(q.poll()); } /** * timed poll with zero timeout succeeds when non-empty, else times out */ public void testTimedPoll0() throws InterruptedException { PriorityBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll(0, MILLISECONDS)); } assertNull(q.poll(0, MILLISECONDS)); } /** * timed poll with nonzero timeout succeeds when non-empty, else times out */ public void testTimedPoll() throws InterruptedException { PriorityBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.poll(SHORT_DELAY_MS, MILLISECONDS)); } assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); } /** * Interrupted timed poll throws InterruptedException instead of * returning timeout status */ public void testInterruptedTimedPoll() throws InterruptedException { final BlockingQueue q = populatedQueue(SIZE); final CountDownLatch aboutToWait = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { long t0 = System.nanoTime(); assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); } long t0 = System.nanoTime(); aboutToWait.countDown(); try { q.poll(MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); } }}); aboutToWait.await(); waitForThreadToEnterWaitState(t, SMALL_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); } /** * peek returns next element, or null if empty */ public void testPeek() { PriorityBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.peek()); assertEquals(i, q.poll()); assertTrue(q.peek() == null || !q.peek().equals(i)); } assertNull(q.peek()); } /** * element returns next element, or throws NSEE if empty */ public void testElement() { PriorityBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.element()); assertEquals(i, q.poll()); } try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove removes next element, or throws NSEE if empty */ public void testRemove() { PriorityBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remove()); } try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { PriorityBlockingQueue q = populatedQueue(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { PriorityBlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.poll(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { PriorityBlockingQueue q = populatedQueue(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); q.add(one); assertFalse(q.isEmpty()); assertTrue(q.contains(one)); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { PriorityBlockingQueue q = populatedQueue(SIZE); PriorityBlockingQueue p = new PriorityBlockingQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { PriorityBlockingQueue q = populatedQueue(SIZE); PriorityBlockingQueue p = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.remove(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { PriorityBlockingQueue q = populatedQueue(SIZE); PriorityBlockingQueue p = populatedQueue(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.remove()); assertFalse(q.contains(I)); } } } /** * toArray contains all elements */ public void testToArray() throws InterruptedException { PriorityBlockingQueue q = populatedQueue(SIZE); Object[] o = q.toArray(); Arrays.sort(o); for (int i = 0; i < o.length; i++) assertSame(o[i], q.take()); } /** * toArray(a) contains all elements */ public void testToArray2() throws InterruptedException { PriorityBlockingQueue q = populatedQueue(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); Arrays.sort(ints); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.take()); } /** * toArray(null) throws NullPointerException */ public void testToArray_NullArg() { PriorityBlockingQueue q = populatedQueue(SIZE); try { q.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { PriorityBlockingQueue q = populatedQueue(SIZE); try { q.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} } /** * iterator iterates through all elements */ public void testIterator() { PriorityBlockingQueue q = populatedQueue(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * iterator.remove removes current element */ public void testIteratorRemove() { final PriorityBlockingQueue q = new PriorityBlockingQueue(3); q.add(new Integer(2)); q.add(new Integer(1)); q.add(new Integer(3)); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertEquals(it.next(), new Integer(2)); assertEquals(it.next(), new Integer(3)); assertFalse(it.hasNext()); } /** * toString contains toStrings of elements */ public void testToString() { PriorityBlockingQueue q = populatedQueue(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * offer transfers elements across Executor tasks */ public void testPollInExecutor() { final PriorityBlockingQueue q = new PriorityBlockingQueue(2); ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { assertNull(q.poll()); assertSame(one, q.poll(MEDIUM_DELAY_MS, MILLISECONDS)); assertTrue(q.isEmpty()); }}); executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { delay(SMALL_DELAY_MS); q.put(one); }}); joinPool(executor); } /** * A deserialized serialized queue has same elements */ public void testSerialization() throws Exception { PriorityBlockingQueue q = populatedQueue(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); PriorityBlockingQueue r = (PriorityBlockingQueue)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.remove(), r.remove()); } /** * drainTo(null) throws NPE */ public void testDrainToNull() { PriorityBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(null); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this) throws IAE */ public void testDrainToSelf() { PriorityBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c) empties queue into another collection c */ public void testDrainTo() { PriorityBlockingQueue q = populatedQueue(SIZE); ArrayList l = new ArrayList(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), SIZE); for (int i = 0; i < SIZE; ++i) assertEquals(l.get(i), new Integer(i)); q.add(zero); q.add(one); assertFalse(q.isEmpty()); assertTrue(q.contains(zero)); assertTrue(q.contains(one)); l.clear(); q.drainTo(l); assertEquals(q.size(), 0); assertEquals(l.size(), 2); for (int i = 0; i < 2; ++i) assertEquals(l.get(i), new Integer(i)); } /** * drainTo empties queue */ public void testDrainToWithActivePut() throws InterruptedException { final PriorityBlockingQueue q = populatedQueue(SIZE); Thread t = new Thread(new CheckedRunnable() { public void realRun() { q.put(new Integer(SIZE+1)); }}); t.start(); ArrayList l = new ArrayList(); q.drainTo(l); assertTrue(l.size() >= SIZE); for (int i = 0; i < SIZE; ++i) assertEquals(l.get(i), new Integer(i)); t.join(); assertTrue(q.size() + l.size() >= SIZE); } /** * drainTo(null, n) throws NPE */ public void testDrainToNullN() { PriorityBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(null, 0); shouldThrow(); } catch (NullPointerException success) {} } /** * drainTo(this, n) throws IAE */ public void testDrainToSelfN() { PriorityBlockingQueue q = populatedQueue(SIZE); try { q.drainTo(q, 0); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * drainTo(c, n) empties first min(n, size) elements of queue into c */ public void testDrainToN() { PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE*2); for (int i = 0; i < SIZE + 2; ++i) { for (int j = 0; j < SIZE; j++) assertTrue(q.offer(new Integer(j))); ArrayList l = new ArrayList(); q.drainTo(l, i); int k = (i < SIZE) ? i : SIZE; assertEquals(l.size(), k); assertEquals(q.size(), SIZE-k); for (int j = 0; j < k; ++j) assertEquals(l.get(j), new Integer(j)); while (q.poll() != null) ; } } } jsr166/src/test/tck/AtomicIntegerTest.java0000644000000000000000000001725611537741072015605 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.atomic.*; import java.io.*; public class AtomicIntegerTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicIntegerTest.class); } final int[] VALUES = { Integer.MIN_VALUE, -1, 0, 1, 42, Integer.MAX_VALUE, }; /** * constructor initializes to given value */ public void testConstructor() { AtomicInteger ai = new AtomicInteger(1); assertEquals(1,ai.get()); } /** * default constructed initializes to zero */ public void testConstructor2() { AtomicInteger ai = new AtomicInteger(); assertEquals(0,ai.get()); } /** * get returns the last value set */ public void testGetSet() { AtomicInteger ai = new AtomicInteger(1); assertEquals(1,ai.get()); ai.set(2); assertEquals(2,ai.get()); ai.set(-3); assertEquals(-3,ai.get()); } /** * get returns the last value lazySet in same thread */ public void testGetLazySet() { AtomicInteger ai = new AtomicInteger(1); assertEquals(1,ai.get()); ai.lazySet(2); assertEquals(2,ai.get()); ai.lazySet(-3); assertEquals(-3,ai.get()); } /** * compareAndSet succeeds in changing value if equal to expected else fails */ public void testCompareAndSet() { AtomicInteger ai = new AtomicInteger(1); assertTrue(ai.compareAndSet(1,2)); assertTrue(ai.compareAndSet(2,-4)); assertEquals(-4,ai.get()); assertFalse(ai.compareAndSet(-5,7)); assertEquals(-4,ai.get()); assertTrue(ai.compareAndSet(-4,7)); assertEquals(7,ai.get()); } /** * compareAndSet in one thread enables another waiting for value * to succeed */ public void testCompareAndSetInMultipleThreads() throws Exception { final AtomicInteger ai = new AtomicInteger(1); Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!ai.compareAndSet(2, 3)) Thread.yield(); }}); t.start(); assertTrue(ai.compareAndSet(1, 2)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertEquals(ai.get(), 3); } /** * repeated weakCompareAndSet succeeds in changing value when equal * to expected */ public void testWeakCompareAndSet() { AtomicInteger ai = new AtomicInteger(1); while (!ai.weakCompareAndSet(1,2)); while (!ai.weakCompareAndSet(2,-4)); assertEquals(-4,ai.get()); while (!ai.weakCompareAndSet(-4,7)); assertEquals(7,ai.get()); } /** * getAndSet returns previous value and sets to given value */ public void testGetAndSet() { AtomicInteger ai = new AtomicInteger(1); assertEquals(1,ai.getAndSet(0)); assertEquals(0,ai.getAndSet(-10)); assertEquals(-10,ai.getAndSet(1)); } /** * getAndAdd returns previous value and adds given value */ public void testGetAndAdd() { AtomicInteger ai = new AtomicInteger(1); assertEquals(1,ai.getAndAdd(2)); assertEquals(3,ai.get()); assertEquals(3,ai.getAndAdd(-4)); assertEquals(-1,ai.get()); } /** * getAndDecrement returns previous value and decrements */ public void testGetAndDecrement() { AtomicInteger ai = new AtomicInteger(1); assertEquals(1,ai.getAndDecrement()); assertEquals(0,ai.getAndDecrement()); assertEquals(-1,ai.getAndDecrement()); } /** * getAndIncrement returns previous value and increments */ public void testGetAndIncrement() { AtomicInteger ai = new AtomicInteger(1); assertEquals(1,ai.getAndIncrement()); assertEquals(2,ai.get()); ai.set(-2); assertEquals(-2,ai.getAndIncrement()); assertEquals(-1,ai.getAndIncrement()); assertEquals(0,ai.getAndIncrement()); assertEquals(1,ai.get()); } /** * addAndGet adds given value to current, and returns current value */ public void testAddAndGet() { AtomicInteger ai = new AtomicInteger(1); assertEquals(3,ai.addAndGet(2)); assertEquals(3,ai.get()); assertEquals(-1,ai.addAndGet(-4)); assertEquals(-1,ai.get()); } /** * decrementAndGet decrements and returns current value */ public void testDecrementAndGet() { AtomicInteger ai = new AtomicInteger(1); assertEquals(0,ai.decrementAndGet()); assertEquals(-1,ai.decrementAndGet()); assertEquals(-2,ai.decrementAndGet()); assertEquals(-2,ai.get()); } /** * incrementAndGet increments and returns current value */ public void testIncrementAndGet() { AtomicInteger ai = new AtomicInteger(1); assertEquals(2,ai.incrementAndGet()); assertEquals(2,ai.get()); ai.set(-2); assertEquals(-1,ai.incrementAndGet()); assertEquals(0,ai.incrementAndGet()); assertEquals(1,ai.incrementAndGet()); assertEquals(1,ai.get()); } /** * a deserialized serialized atomic holds same value */ public void testSerialization() throws Exception { AtomicInteger l = new AtomicInteger(); l.set(22); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); AtomicInteger r = (AtomicInteger) in.readObject(); assertEquals(l.get(), r.get()); } /** * toString returns current value. */ public void testToString() { AtomicInteger ai = new AtomicInteger(); assertEquals("0", ai.toString()); for (int x : VALUES) { ai.set(x); assertEquals(ai.toString(), Integer.toString(x)); } } /** * intValue returns current value. */ public void testIntValue() { AtomicInteger ai = new AtomicInteger(); assertEquals(0, ai.intValue()); for (int x : VALUES) { ai.set(x); assertEquals(x, ai.intValue()); } } /** * longValue returns current value. */ public void testLongValue() { AtomicInteger ai = new AtomicInteger(); assertEquals(0L, ai.longValue()); for (int x : VALUES) { ai.set(x); assertEquals((long)x, ai.longValue()); } } /** * floatValue returns current value. */ public void testFloatValue() { AtomicInteger ai = new AtomicInteger(); assertEquals(0.0f, ai.floatValue()); for (int x : VALUES) { ai.set(x); assertEquals((float)x, ai.floatValue()); } } /** * doubleValue returns current value. */ public void testDoubleValue() { AtomicInteger ai = new AtomicInteger(); assertEquals(0.0d, ai.doubleValue()); for (int x : VALUES) { ai.set(x); assertEquals((double)x, ai.doubleValue()); } } } jsr166/src/test/tck/BlockingQueueTest.java0000644000000000000000000001045411560754737015611 0ustar /* * Written by Doug Lea and Martin Buchholz with assistance from members * of JCP JSR-166 Expert Group and released to the public domain, as * explained at http://creativecommons.org/publicdomain/zero/1.0/ * * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; /** * Contains tests generally applicable to BlockingQueue implementations. */ public abstract class BlockingQueueTest extends JSR166TestCase { /* * This is the start of an attempt to refactor the tests for the * various related implementations of related interfaces without * too much duplicated code. junit does not really support such * testing. Here subclasses of TestCase not only contain tests, * but also configuration information that describes the * implementation class, most importantly how to instantiate * instances. */ /** Like suite(), but non-static */ public Test testSuite() { // TODO: filter the returned tests using the configuration // information provided by the subclass via protected methods. return new TestSuite(this.getClass()); } /** Returns an empty instance of the implementation class. */ protected abstract BlockingQueue emptyCollection(); /** * timed poll before a delayed offer fails; after offer succeeds; * on interruption throws */ public void testTimedPollWithOffer() throws InterruptedException { final BlockingQueue q = emptyCollection(); final CheckedBarrier barrier = new CheckedBarrier(2); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); barrier.await(); assertSame(zero, q.poll(MEDIUM_DELAY_MS, MILLISECONDS)); Thread.currentThread().interrupt(); try { q.poll(SHORT_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} barrier.await(); try { q.poll(MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} }}); barrier.await(); assertTrue(q.offer(zero, SHORT_DELAY_MS, MILLISECONDS)); barrier.await(); sleep(SHORT_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); } /** * take() blocks interruptibly when empty */ public void testTakeFromEmptyBlocksInterruptibly() throws InterruptedException { final BlockingQueue q = emptyCollection(); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { long t0 = System.nanoTime(); threadStarted.countDown(); try { q.take(); shouldThrow(); } catch (InterruptedException success) {} assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); }}); threadStarted.await(); delay(SHORT_DELAY_MS); assertTrue(t.isAlive()); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); } /** * take() throws InterruptedException immediately if interrupted * before waiting */ public void testTakeFromEmptyAfterInterrupt() throws InterruptedException { final BlockingQueue q = emptyCollection(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { long t0 = System.nanoTime(); Thread.currentThread().interrupt(); try { q.take(); shouldThrow(); } catch (InterruptedException success) {} assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); }}); awaitTermination(t, MEDIUM_DELAY_MS); } /** For debugging. */ public void XXXXtestFails() { fail(emptyCollection().getClass().toString()); } } jsr166/src/test/tck/ReentrantReadWriteLockTest.java0000644000000000000000000016112211561313576017426 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.locks.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.io.*; import java.util.*; public class ReentrantReadWriteLockTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ReentrantReadWriteLockTest.class); } /** * A runnable calling lockInterruptibly */ class InterruptibleLockRunnable extends CheckedRunnable { final ReentrantReadWriteLock lock; InterruptibleLockRunnable(ReentrantReadWriteLock l) { lock = l; } public void realRun() throws InterruptedException { lock.writeLock().lockInterruptibly(); } } /** * A runnable calling lockInterruptibly that expects to be * interrupted */ class InterruptedLockRunnable extends CheckedInterruptedRunnable { final ReentrantReadWriteLock lock; InterruptedLockRunnable(ReentrantReadWriteLock l) { lock = l; } public void realRun() throws InterruptedException { lock.writeLock().lockInterruptibly(); } } /** * Subclass to expose protected methods */ static class PublicReentrantReadWriteLock extends ReentrantReadWriteLock { PublicReentrantReadWriteLock() { super(); } PublicReentrantReadWriteLock(boolean fair) { super(fair); } public Thread getOwner() { return super.getOwner(); } public Collection getQueuedThreads() { return super.getQueuedThreads(); } public Collection getWaitingThreads(Condition c) { return super.getWaitingThreads(c); } } /** * Releases write lock, checking that it had a hold count of 1. */ void releaseWriteLock(PublicReentrantReadWriteLock lock) { ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock(); assertWriteLockedBy(lock, Thread.currentThread()); assertEquals(1, lock.getWriteHoldCount()); writeLock.unlock(); assertNotWriteLocked(lock); } /** * Spin-waits until lock.hasQueuedThread(t) becomes true. */ void waitForQueuedThread(PublicReentrantReadWriteLock lock, Thread t) { long startTime = System.nanoTime(); while (!lock.hasQueuedThread(t)) { if (millisElapsedSince(startTime) > LONG_DELAY_MS) throw new AssertionError("timed out"); Thread.yield(); } assertTrue(t.isAlive()); assertTrue(lock.getOwner() != t); } /** * Checks that lock is not write-locked. */ void assertNotWriteLocked(PublicReentrantReadWriteLock lock) { assertFalse(lock.isWriteLocked()); assertFalse(lock.isWriteLockedByCurrentThread()); assertFalse(lock.writeLock().isHeldByCurrentThread()); assertNull(lock.getOwner()); assertEquals(0, lock.getWriteHoldCount()); } /** * Checks that lock is write-locked by the given thread. */ void assertWriteLockedBy(PublicReentrantReadWriteLock lock, Thread t) { assertTrue(lock.isWriteLocked()); assertSame(t, lock.getOwner()); assertEquals(t == Thread.currentThread(), lock.isWriteLockedByCurrentThread()); assertEquals(t == Thread.currentThread(), lock.writeLock().isHeldByCurrentThread()); assertEquals(t == Thread.currentThread(), lock.getWriteHoldCount() > 0); assertEquals(0, lock.getReadLockCount()); } /** * Checks that condition c has no waiters. */ void assertHasNoWaiters(PublicReentrantReadWriteLock lock, Condition c) { assertHasWaiters(lock, c, new Thread[] {}); } /** * Checks that condition c has exactly the given waiter threads. */ void assertHasWaiters(PublicReentrantReadWriteLock lock, Condition c, Thread... threads) { lock.writeLock().lock(); assertEquals(threads.length > 0, lock.hasWaiters(c)); assertEquals(threads.length, lock.getWaitQueueLength(c)); assertEquals(threads.length == 0, lock.getWaitingThreads(c).isEmpty()); assertEquals(threads.length, lock.getWaitingThreads(c).size()); assertEquals(new HashSet(lock.getWaitingThreads(c)), new HashSet(Arrays.asList(threads))); lock.writeLock().unlock(); } /** * Constructor sets given fairness, and is in unlocked state */ public void testConstructor() { PublicReentrantReadWriteLock lock; lock = new PublicReentrantReadWriteLock(); assertFalse(lock.isFair()); assertNotWriteLocked(lock); assertEquals(0, lock.getReadLockCount()); lock = new PublicReentrantReadWriteLock(true); assertTrue(lock.isFair()); assertNotWriteLocked(lock); assertEquals(0, lock.getReadLockCount()); lock = new PublicReentrantReadWriteLock(false); assertFalse(lock.isFair()); assertNotWriteLocked(lock); assertEquals(0, lock.getReadLockCount()); } /** * write-locking and read-locking an unlocked lock succeed */ public void testLock() { PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); assertNotWriteLocked(lock); lock.writeLock().lock(); assertWriteLockedBy(lock, Thread.currentThread()); lock.writeLock().unlock(); assertNotWriteLocked(lock); assertEquals(0, lock.getReadLockCount()); lock.readLock().lock(); assertNotWriteLocked(lock); assertEquals(1, lock.getReadLockCount()); lock.readLock().unlock(); assertNotWriteLocked(lock); assertEquals(0, lock.getReadLockCount()); } /** * locking an unlocked fair lock succeeds */ public void testFairLock() { PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(true); assertNotWriteLocked(lock); lock.writeLock().lock(); assertWriteLockedBy(lock, Thread.currentThread()); lock.writeLock().unlock(); assertNotWriteLocked(lock); assertEquals(0, lock.getReadLockCount()); lock.readLock().lock(); assertNotWriteLocked(lock); assertEquals(1, lock.getReadLockCount()); lock.readLock().unlock(); assertNotWriteLocked(lock); assertEquals(0, lock.getReadLockCount()); } /** * getWriteHoldCount returns number of recursive holds */ public void testGetWriteHoldCount() { ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); for (int i = 1; i <= SIZE; i++) { lock.writeLock().lock(); assertEquals(i,lock.getWriteHoldCount()); } for (int i = SIZE; i > 0; i--) { lock.writeLock().unlock(); assertEquals(i-1,lock.getWriteHoldCount()); } } /** * WriteLock.getHoldCount returns number of recursive holds */ public void testGetHoldCount() { ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); for (int i = 1; i <= SIZE; i++) { lock.writeLock().lock(); assertEquals(i,lock.writeLock().getHoldCount()); } for (int i = SIZE; i > 0; i--) { lock.writeLock().unlock(); assertEquals(i-1,lock.writeLock().getHoldCount()); } } /** * getReadHoldCount returns number of recursive holds */ public void testGetReadHoldCount() { ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); for (int i = 1; i <= SIZE; i++) { lock.readLock().lock(); assertEquals(i,lock.getReadHoldCount()); } for (int i = SIZE; i > 0; i--) { lock.readLock().unlock(); assertEquals(i-1,lock.getReadHoldCount()); } } /** * write-unlocking an unlocked lock throws IllegalMonitorStateException */ public void testWriteUnlock_IllegalMonitorStateException() { ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); try { lock.writeLock().unlock(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * read-unlocking an unlocked lock throws IllegalMonitorStateException */ public void testReadUnlock_IllegalMonitorStateException() { ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); try { lock.readLock().unlock(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * write-lockInterruptibly is interruptible */ public void testWriteLockInterruptibly_Interrupted() throws Exception { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lock(); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lockInterruptibly(); }}); waitForQueuedThread(lock, t); t.interrupt(); awaitTermination(t); releaseWriteLock(lock); } /** * timed write-tryLock is interruptible */ public void testWriteTryLock_Interrupted() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lock(); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().tryLock(2 * LONG_DELAY_MS, MILLISECONDS); }}); waitForQueuedThread(lock, t); t.interrupt(); awaitTermination(t); releaseWriteLock(lock); } /** * read-lockInterruptibly is interruptible */ public void testReadLockInterruptibly_Interrupted() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lock(); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.readLock().lockInterruptibly(); }}); waitForQueuedThread(lock, t); t.interrupt(); awaitTermination(t); releaseWriteLock(lock); } /** * timed read-tryLock is interruptible */ public void testReadTryLock_Interrupted() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lock(); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.readLock().tryLock(2 * LONG_DELAY_MS, MILLISECONDS); }}); waitForQueuedThread(lock, t); t.interrupt(); awaitTermination(t); releaseWriteLock(lock); } /** * write-tryLock fails if locked */ public void testWriteTryLockWhenLocked() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { assertFalse(lock.writeLock().tryLock()); }}); awaitTermination(t); releaseWriteLock(lock); } /** * read-tryLock fails if locked */ public void testReadTryLockWhenLocked() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { assertFalse(lock.readLock().tryLock()); }}); awaitTermination(t); releaseWriteLock(lock); } /** * Multiple threads can hold a read lock when not write-locked */ public void testMultipleReadLocks() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.readLock().lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { assertTrue(lock.readLock().tryLock()); lock.readLock().unlock(); }}); awaitTermination(t); lock.readLock().unlock(); } /** * A writelock succeeds only after a reading thread unlocks */ public void testWriteAfterReadLock() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.readLock().lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { assertEquals(1, lock.getReadLockCount()); lock.writeLock().lock(); assertEquals(0, lock.getReadLockCount()); lock.writeLock().unlock(); }}); waitForQueuedThread(lock, t); assertNotWriteLocked(lock); assertEquals(1, lock.getReadLockCount()); lock.readLock().unlock(); assertEquals(0, lock.getReadLockCount()); awaitTermination(t); assertNotWriteLocked(lock); } /** * A writelock succeeds only after reading threads unlock */ public void testWriteAfterMultipleReadLocks() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.readLock().lock(); lock.readLock().lock(); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.readLock().lock(); assertEquals(3, lock.getReadLockCount()); lock.readLock().unlock(); }}); awaitTermination(t1); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() { assertEquals(2, lock.getReadLockCount()); lock.writeLock().lock(); assertEquals(0, lock.getReadLockCount()); lock.writeLock().unlock(); }}); waitForQueuedThread(lock, t2); assertNotWriteLocked(lock); assertEquals(2, lock.getReadLockCount()); lock.readLock().unlock(); lock.readLock().unlock(); assertEquals(0, lock.getReadLockCount()); awaitTermination(t2); assertNotWriteLocked(lock); } /** * A thread that tries to acquire a fair read lock (non-reentrantly) * will block if there is a waiting writer thread. */ public void testReaderWriterReaderFairFifo() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(true); final AtomicBoolean t1GotLock = new AtomicBoolean(false); lock.readLock().lock(); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() { assertEquals(1, lock.getReadLockCount()); lock.writeLock().lock(); assertEquals(0, lock.getReadLockCount()); t1GotLock.set(true); lock.writeLock().unlock(); }}); waitForQueuedThread(lock, t1); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() { assertEquals(1, lock.getReadLockCount()); lock.readLock().lock(); assertEquals(1, lock.getReadLockCount()); assertTrue(t1GotLock.get()); lock.readLock().unlock(); }}); waitForQueuedThread(lock, t2); assertTrue(t1.isAlive()); assertNotWriteLocked(lock); assertEquals(1, lock.getReadLockCount()); lock.readLock().unlock(); awaitTermination(t1); awaitTermination(t2); assertNotWriteLocked(lock); } /** * Readlocks succeed only after a writing thread unlocks */ public void testReadAfterWriteLock() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lock(); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.readLock().lock(); lock.readLock().unlock(); }}); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.readLock().lock(); lock.readLock().unlock(); }}); waitForQueuedThread(lock, t1); waitForQueuedThread(lock, t2); releaseWriteLock(lock); awaitTermination(t1); awaitTermination(t2); } /** * Read trylock succeeds if write locked by current thread */ public void testReadHoldingWriteLock() { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.writeLock().lock(); assertTrue(lock.readLock().tryLock()); lock.readLock().unlock(); lock.writeLock().unlock(); } /** * Read lock succeeds if write locked by current thread even if * other threads are waiting for readlock */ public void testReadHoldingWriteLock2() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lock(); lock.readLock().lock(); lock.readLock().unlock(); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.readLock().lock(); lock.readLock().unlock(); }}); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.readLock().lock(); lock.readLock().unlock(); }}); waitForQueuedThread(lock, t1); waitForQueuedThread(lock, t2); assertWriteLockedBy(lock, Thread.currentThread()); lock.readLock().lock(); lock.readLock().unlock(); releaseWriteLock(lock); awaitTermination(t1); awaitTermination(t2); } /** * Read lock succeeds if write locked by current thread even if * other threads are waiting for writelock */ public void testReadHoldingWriteLock3() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lock(); lock.readLock().lock(); lock.readLock().unlock(); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.writeLock().lock(); lock.writeLock().unlock(); }}); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.writeLock().lock(); lock.writeLock().unlock(); }}); waitForQueuedThread(lock, t1); waitForQueuedThread(lock, t2); assertWriteLockedBy(lock, Thread.currentThread()); lock.readLock().lock(); lock.readLock().unlock(); releaseWriteLock(lock); awaitTermination(t1); awaitTermination(t2); } /** * Write lock succeeds if write locked by current thread even if * other threads are waiting for writelock */ public void testWriteHoldingWriteLock4() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lock(); lock.writeLock().lock(); lock.writeLock().unlock(); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.writeLock().lock(); lock.writeLock().unlock(); }}); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.writeLock().lock(); lock.writeLock().unlock(); }}); waitForQueuedThread(lock, t1); waitForQueuedThread(lock, t2); assertWriteLockedBy(lock, Thread.currentThread()); assertEquals(1, lock.getWriteHoldCount()); lock.writeLock().lock(); assertWriteLockedBy(lock, Thread.currentThread()); assertEquals(2, lock.getWriteHoldCount()); lock.writeLock().unlock(); releaseWriteLock(lock); awaitTermination(t1); awaitTermination(t2); } /** * Fair Read trylock succeeds if write locked by current thread */ public void testReadHoldingWriteLockFair() { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); lock.writeLock().lock(); assertTrue(lock.readLock().tryLock()); lock.readLock().unlock(); lock.writeLock().unlock(); } /** * Fair Read lock succeeds if write locked by current thread even if * other threads are waiting for readlock */ public void testReadHoldingWriteLockFair2() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(true); lock.writeLock().lock(); lock.readLock().lock(); lock.readLock().unlock(); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.readLock().lock(); lock.readLock().unlock(); }}); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.readLock().lock(); lock.readLock().unlock(); }}); waitForQueuedThread(lock, t1); waitForQueuedThread(lock, t2); assertWriteLockedBy(lock, Thread.currentThread()); lock.readLock().lock(); lock.readLock().unlock(); releaseWriteLock(lock); awaitTermination(t1); awaitTermination(t2); } /** * Fair Read lock succeeds if write locked by current thread even if * other threads are waiting for writelock */ public void testReadHoldingWriteLockFair3() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(true); lock.writeLock().lock(); lock.readLock().lock(); lock.readLock().unlock(); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.writeLock().lock(); lock.writeLock().unlock(); }}); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.writeLock().lock(); lock.writeLock().unlock(); }}); waitForQueuedThread(lock, t1); waitForQueuedThread(lock, t2); assertWriteLockedBy(lock, Thread.currentThread()); lock.readLock().lock(); lock.readLock().unlock(); releaseWriteLock(lock); awaitTermination(t1); awaitTermination(t2); } /** * Fair Write lock succeeds if write locked by current thread even if * other threads are waiting for writelock */ public void testWriteHoldingWriteLockFair4() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(true); lock.writeLock().lock(); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.writeLock().lock(); lock.writeLock().unlock(); }}); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() { lock.writeLock().lock(); lock.writeLock().unlock(); }}); waitForQueuedThread(lock, t1); waitForQueuedThread(lock, t2); assertWriteLockedBy(lock, Thread.currentThread()); assertEquals(1, lock.getWriteHoldCount()); lock.writeLock().lock(); assertEquals(2, lock.getWriteHoldCount()); lock.writeLock().unlock(); lock.writeLock().lock(); lock.writeLock().unlock(); releaseWriteLock(lock); awaitTermination(t1); awaitTermination(t2); } /** * Read tryLock succeeds if readlocked but not writelocked */ public void testTryLockWhenReadLocked() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.readLock().lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { assertTrue(lock.readLock().tryLock()); lock.readLock().unlock(); }}); awaitTermination(t); lock.readLock().unlock(); } /** * write tryLock fails when readlocked */ public void testWriteTryLockWhenReadLocked() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.readLock().lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { assertFalse(lock.writeLock().tryLock()); }}); awaitTermination(t); lock.readLock().unlock(); } /** * Fair Read tryLock succeeds if readlocked but not writelocked */ public void testTryLockWhenReadLockedFair() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); lock.readLock().lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { assertTrue(lock.readLock().tryLock()); lock.readLock().unlock(); }}); awaitTermination(t); lock.readLock().unlock(); } /** * Fair write tryLock fails when readlocked */ public void testWriteTryLockWhenReadLockedFair() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); lock.readLock().lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { assertFalse(lock.writeLock().tryLock()); }}); awaitTermination(t); lock.readLock().unlock(); } /** * write timed tryLock times out if locked */ public void testWriteTryLock_Timeout() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.writeLock().lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long startTime = System.nanoTime(); long timeoutMillis = 10; assertFalse(lock.writeLock().tryLock(timeoutMillis, MILLISECONDS)); assertTrue(millisElapsedSince(startTime) >= timeoutMillis); }}); awaitTermination(t); assertTrue(lock.writeLock().isHeldByCurrentThread()); lock.writeLock().unlock(); } /** * read timed tryLock times out if write-locked */ public void testReadTryLock_Timeout() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.writeLock().lock(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long startTime = System.nanoTime(); long timeoutMillis = 10; assertFalse(lock.readLock().tryLock(timeoutMillis, MILLISECONDS)); assertTrue(millisElapsedSince(startTime) >= timeoutMillis); }}); awaitTermination(t); assertTrue(lock.writeLock().isHeldByCurrentThread()); lock.writeLock().unlock(); } /** * write lockInterruptibly succeeds if lock free else is interruptible */ public void testWriteLockInterruptibly() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lockInterruptibly(); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lockInterruptibly(); }}); waitForQueuedThread(lock, t); t.interrupt(); awaitTermination(t); releaseWriteLock(lock); } /** * read lockInterruptibly succeeds if lock free else is interruptible */ public void testReadLockInterruptibly() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); lock.writeLock().lockInterruptibly(); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.readLock().lockInterruptibly(); }}); waitForQueuedThread(lock, t); t.interrupt(); awaitTermination(t); releaseWriteLock(lock); } /** * Calling await without holding lock throws IllegalMonitorStateException */ public void testAwait_IllegalMonitor() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); try { c.await(); shouldThrow(); } catch (IllegalMonitorStateException success) {} try { c.await(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (IllegalMonitorStateException success) {} try { c.awaitNanos(100); shouldThrow(); } catch (IllegalMonitorStateException success) {} try { c.awaitUninterruptibly(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * Calling signal without holding lock throws IllegalMonitorStateException */ public void testSignal_IllegalMonitor() { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); try { c.signal(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * Calling signalAll without holding lock throws IllegalMonitorStateException */ public void testSignalAll_IllegalMonitor() { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); try { c.signalAll(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * awaitNanos without a signal times out */ public void testAwaitNanos_Timeout() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); lock.writeLock().lock(); long startTime = System.nanoTime(); long timeoutMillis = 10; long timeoutNanos = MILLISECONDS.toNanos(timeoutMillis); long nanosRemaining = c.awaitNanos(timeoutNanos); assertTrue(nanosRemaining <= 0); assertTrue(millisElapsedSince(startTime) >= timeoutMillis); lock.writeLock().unlock(); } /** * timed await without a signal times out */ public void testAwait_Timeout() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); lock.writeLock().lock(); long startTime = System.nanoTime(); long timeoutMillis = 10; assertFalse(c.await(timeoutMillis, MILLISECONDS)); assertTrue(millisElapsedSince(startTime) >= timeoutMillis); lock.writeLock().unlock(); } /** * awaitUntil without a signal times out */ public void testAwaitUntil_Timeout() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); lock.writeLock().lock(); long startTime = System.nanoTime(); long timeoutMillis = 10; java.util.Date d = new java.util.Date(); assertFalse(c.awaitUntil(new java.util.Date(d.getTime() + timeoutMillis))); assertTrue(millisElapsedSince(startTime) >= timeoutMillis); lock.writeLock().unlock(); } /** * await returns when signalled */ public void testAwait() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lock(); locked.countDown(); c.await(); lock.writeLock().unlock(); }}); locked.await(); lock.writeLock().lock(); assertHasWaiters(lock, c, t); c.signal(); assertHasNoWaiters(lock, c); assertTrue(t.isAlive()); lock.writeLock().unlock(); awaitTermination(t); } /** * awaitUninterruptibly doesn't abort on interrupt */ public void testAwaitUninterruptibly() throws InterruptedException { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { lock.writeLock().lock(); locked.countDown(); c.awaitUninterruptibly(); assertTrue(Thread.interrupted()); lock.writeLock().unlock(); }}); locked.await(); lock.writeLock().lock(); lock.writeLock().unlock(); t.interrupt(); long timeoutMillis = 10; assertThreadJoinTimesOut(t, timeoutMillis); lock.writeLock().lock(); c.signal(); lock.writeLock().unlock(); awaitTermination(t); } /** * await is interruptible */ public void testAwait_Interrupt() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lock(); assertWriteLockedBy(lock, Thread.currentThread()); assertHasNoWaiters(lock, c); locked.countDown(); try { c.await(); } finally { assertWriteLockedBy(lock, Thread.currentThread()); assertHasNoWaiters(lock, c); lock.writeLock().unlock(); assertFalse(Thread.interrupted()); } }}); locked.await(); assertHasWaiters(lock, c, t); t.interrupt(); awaitTermination(t); assertNotWriteLocked(lock); } /** * awaitNanos is interruptible */ public void testAwaitNanos_Interrupt() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lock(); assertWriteLockedBy(lock, Thread.currentThread()); assertHasNoWaiters(lock, c); locked.countDown(); try { c.awaitNanos(MILLISECONDS.toNanos(2 * LONG_DELAY_MS)); } finally { assertWriteLockedBy(lock, Thread.currentThread()); assertHasNoWaiters(lock, c); lock.writeLock().unlock(); assertFalse(Thread.interrupted()); } }}); locked.await(); assertHasWaiters(lock, c, t); t.interrupt(); awaitTermination(t); assertNotWriteLocked(lock); } /** * awaitUntil is interruptible */ public void testAwaitUntil_Interrupt() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lock(); assertWriteLockedBy(lock, Thread.currentThread()); assertHasNoWaiters(lock, c); locked.countDown(); java.util.Date d = new java.util.Date(); try { c.awaitUntil(new java.util.Date(d.getTime() + 2 * LONG_DELAY_MS)); } finally { assertWriteLockedBy(lock, Thread.currentThread()); assertHasNoWaiters(lock, c); lock.writeLock().unlock(); assertFalse(Thread.interrupted()); } }}); locked.await(); assertHasWaiters(lock, c, t); t.interrupt(); awaitTermination(t); assertNotWriteLocked(lock); } /** * signalAll wakes up all threads */ public void testSignalAll() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final CountDownLatch locked = new CountDownLatch(2); final Lock writeLock = lock.writeLock(); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { writeLock.lock(); locked.countDown(); c.await(); writeLock.unlock(); }}); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { writeLock.lock(); locked.countDown(); c.await(); writeLock.unlock(); }}); locked.await(); writeLock.lock(); assertHasWaiters(lock, c, t1, t2); c.signalAll(); assertHasNoWaiters(lock, c); writeLock.unlock(); awaitTermination(t1); awaitTermination(t2); } /** * signal wakes up waiting threads in FIFO order. */ public void testSignalWakesFifo() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final CountDownLatch locked1 = new CountDownLatch(1); final CountDownLatch locked2 = new CountDownLatch(1); final Lock writeLock = lock.writeLock(); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { writeLock.lock(); locked1.countDown(); c.await(); writeLock.unlock(); }}); locked1.await(); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { writeLock.lock(); locked2.countDown(); c.await(); writeLock.unlock(); }}); locked2.await(); writeLock.lock(); assertHasWaiters(lock, c, t1, t2); assertFalse(lock.hasQueuedThreads()); c.signal(); assertHasWaiters(lock, c, t2); assertTrue(lock.hasQueuedThread(t1)); assertFalse(lock.hasQueuedThread(t2)); c.signal(); assertHasNoWaiters(lock, c); assertTrue(lock.hasQueuedThread(t1)); assertTrue(lock.hasQueuedThread(t2)); writeLock.unlock(); awaitTermination(t1); awaitTermination(t2); } /** * await after multiple reentrant locking preserves lock count */ public void testAwaitLockCount() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final CountDownLatch locked = new CountDownLatch(2); Thread t1 = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lock(); assertWriteLockedBy(lock, Thread.currentThread()); assertEquals(1, lock.writeLock().getHoldCount()); locked.countDown(); c.await(); assertWriteLockedBy(lock, Thread.currentThread()); assertEquals(1, lock.writeLock().getHoldCount()); lock.writeLock().unlock(); }}); Thread t2 = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lock(); lock.writeLock().lock(); assertWriteLockedBy(lock, Thread.currentThread()); assertEquals(2, lock.writeLock().getHoldCount()); locked.countDown(); c.await(); assertWriteLockedBy(lock, Thread.currentThread()); assertEquals(2, lock.writeLock().getHoldCount()); lock.writeLock().unlock(); lock.writeLock().unlock(); }}); locked.await(); lock.writeLock().lock(); assertHasWaiters(lock, c, t1, t2); c.signalAll(); assertHasNoWaiters(lock, c); lock.writeLock().unlock(); awaitTermination(t1); awaitTermination(t2); } /** * A serialized lock deserializes as unlocked */ public void testSerialization() throws Exception { ReentrantReadWriteLock l = new ReentrantReadWriteLock(); l.readLock().lock(); l.readLock().unlock(); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); ReentrantReadWriteLock r = (ReentrantReadWriteLock) in.readObject(); r.readLock().lock(); r.readLock().unlock(); } /** * hasQueuedThreads reports whether there are waiting threads */ public void testHasQueuedThreads() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertFalse(lock.hasQueuedThreads()); lock.writeLock().lock(); assertFalse(lock.hasQueuedThreads()); t1.start(); waitForQueuedThread(lock, t1); assertTrue(lock.hasQueuedThreads()); t2.start(); waitForQueuedThread(lock, t2); assertTrue(lock.hasQueuedThreads()); t1.interrupt(); awaitTermination(t1); assertTrue(lock.hasQueuedThreads()); lock.writeLock().unlock(); awaitTermination(t2); assertFalse(lock.hasQueuedThreads()); } /** * hasQueuedThread(null) throws NPE */ public void testHasQueuedThreadNPE() { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); try { lock.hasQueuedThread(null); shouldThrow(); } catch (NullPointerException success) {} } /** * hasQueuedThread reports whether a thread is queued. */ public void testHasQueuedThread() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertFalse(lock.hasQueuedThread(t1)); assertFalse(lock.hasQueuedThread(t2)); lock.writeLock().lock(); t1.start(); waitForQueuedThread(lock, t1); assertTrue(lock.hasQueuedThread(t1)); assertFalse(lock.hasQueuedThread(t2)); t2.start(); waitForQueuedThread(lock, t2); assertTrue(lock.hasQueuedThread(t1)); assertTrue(lock.hasQueuedThread(t2)); t1.interrupt(); awaitTermination(t1); assertFalse(lock.hasQueuedThread(t1)); assertTrue(lock.hasQueuedThread(t2)); lock.writeLock().unlock(); awaitTermination(t2); assertFalse(lock.hasQueuedThread(t1)); assertFalse(lock.hasQueuedThread(t2)); } /** * getQueueLength reports number of waiting threads */ public void testGetQueueLength() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertEquals(0, lock.getQueueLength()); lock.writeLock().lock(); t1.start(); waitForQueuedThread(lock, t1); assertEquals(1, lock.getQueueLength()); t2.start(); waitForQueuedThread(lock, t2); assertEquals(2, lock.getQueueLength()); t1.interrupt(); awaitTermination(t1); assertEquals(1, lock.getQueueLength()); lock.writeLock().unlock(); awaitTermination(t2); assertEquals(0, lock.getQueueLength()); } /** * getQueuedThreads includes waiting threads */ public void testGetQueuedThreads() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); Thread t1 = new Thread(new InterruptedLockRunnable(lock)); Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); assertTrue(lock.getQueuedThreads().isEmpty()); lock.writeLock().lock(); assertTrue(lock.getQueuedThreads().isEmpty()); t1.start(); waitForQueuedThread(lock, t1); assertEquals(1, lock.getQueuedThreads().size()); assertTrue(lock.getQueuedThreads().contains(t1)); t2.start(); waitForQueuedThread(lock, t2); assertEquals(2, lock.getQueuedThreads().size()); assertTrue(lock.getQueuedThreads().contains(t1)); assertTrue(lock.getQueuedThreads().contains(t2)); t1.interrupt(); awaitTermination(t1); assertFalse(lock.getQueuedThreads().contains(t1)); assertTrue(lock.getQueuedThreads().contains(t2)); assertEquals(1, lock.getQueuedThreads().size()); lock.writeLock().unlock(); awaitTermination(t2); assertTrue(lock.getQueuedThreads().isEmpty()); } /** * hasWaiters throws NPE if null */ public void testHasWaitersNPE() { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); try { lock.hasWaiters(null); shouldThrow(); } catch (NullPointerException success) {} } /** * getWaitQueueLength throws NPE if null */ public void testGetWaitQueueLengthNPE() { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); try { lock.getWaitQueueLength(null); shouldThrow(); } catch (NullPointerException success) {} } /** * getWaitingThreads throws NPE if null */ public void testGetWaitingThreadsNPE() { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); try { lock.getWaitingThreads(null); shouldThrow(); } catch (NullPointerException success) {} } /** * hasWaiters throws IllegalArgumentException if not owned */ public void testHasWaitersIAE() { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final ReentrantReadWriteLock lock2 = new ReentrantReadWriteLock(); try { lock2.hasWaiters(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * hasWaiters throws IllegalMonitorStateException if not locked */ public void testHasWaitersIMSE() { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); try { lock.hasWaiters(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * getWaitQueueLength throws IllegalArgumentException if not owned */ public void testGetWaitQueueLengthIAE() { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final ReentrantReadWriteLock lock2 = new ReentrantReadWriteLock(); try { lock2.getWaitQueueLength(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * getWaitQueueLength throws IllegalMonitorStateException if not locked */ public void testGetWaitQueueLengthIMSE() { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); try { lock.getWaitQueueLength(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * getWaitingThreads throws IllegalArgumentException if not owned */ public void testGetWaitingThreadsIAE() { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final PublicReentrantReadWriteLock lock2 = new PublicReentrantReadWriteLock(); try { lock2.getWaitingThreads(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * getWaitingThreads throws IllegalMonitorStateException if not locked */ public void testGetWaitingThreadsIMSE() { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); try { lock.getWaitingThreads(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * hasWaiters returns true when a thread is waiting, else false */ public void testHasWaiters() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lock(); assertHasNoWaiters(lock, c); assertFalse(lock.hasWaiters(c)); locked.countDown(); c.await(); assertHasNoWaiters(lock, c); assertFalse(lock.hasWaiters(c)); lock.writeLock().unlock(); }}); locked.await(); lock.writeLock().lock(); assertHasWaiters(lock, c, t); assertTrue(lock.hasWaiters(c)); c.signal(); assertHasNoWaiters(lock, c); assertFalse(lock.hasWaiters(c)); lock.writeLock().unlock(); awaitTermination(t); assertHasNoWaiters(lock, c); } /** * getWaitQueueLength returns number of waiting threads */ public void testGetWaitQueueLength() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final CountDownLatch locked = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lock(); assertEquals(0, lock.getWaitQueueLength(c)); locked.countDown(); c.await(); lock.writeLock().unlock(); }}); locked.await(); lock.writeLock().lock(); assertHasWaiters(lock, c, t); assertEquals(1, lock.getWaitQueueLength(c)); c.signal(); assertHasNoWaiters(lock, c); assertEquals(0, lock.getWaitQueueLength(c)); lock.writeLock().unlock(); awaitTermination(t); } /** * getWaitingThreads returns only and all waiting threads */ public void testGetWaitingThreads() throws InterruptedException { final PublicReentrantReadWriteLock lock = new PublicReentrantReadWriteLock(); final Condition c = lock.writeLock().newCondition(); final CountDownLatch locked1 = new CountDownLatch(1); final CountDownLatch locked2 = new CountDownLatch(1); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lock(); assertTrue(lock.getWaitingThreads(c).isEmpty()); locked1.countDown(); c.await(); lock.writeLock().unlock(); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { lock.writeLock().lock(); assertFalse(lock.getWaitingThreads(c).isEmpty()); locked2.countDown(); c.await(); lock.writeLock().unlock(); }}); lock.writeLock().lock(); assertTrue(lock.getWaitingThreads(c).isEmpty()); lock.writeLock().unlock(); t1.start(); locked1.await(); t2.start(); locked2.await(); lock.writeLock().lock(); assertTrue(lock.hasWaiters(c)); assertTrue(lock.getWaitingThreads(c).contains(t1)); assertTrue(lock.getWaitingThreads(c).contains(t2)); assertEquals(2, lock.getWaitingThreads(c).size()); c.signalAll(); assertHasNoWaiters(lock, c); lock.writeLock().unlock(); awaitTermination(t1); awaitTermination(t2); assertHasNoWaiters(lock, c); } /** * toString indicates current lock state */ public void testToString() { ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); String us = lock.toString(); assertTrue(us.indexOf("Write locks = 0") >= 0); assertTrue(us.indexOf("Read locks = 0") >= 0); lock.writeLock().lock(); String ws = lock.toString(); assertTrue(ws.indexOf("Write locks = 1") >= 0); assertTrue(ws.indexOf("Read locks = 0") >= 0); lock.writeLock().unlock(); lock.readLock().lock(); lock.readLock().lock(); String rs = lock.toString(); assertTrue(rs.indexOf("Write locks = 0") >= 0); assertTrue(rs.indexOf("Read locks = 2") >= 0); } /** * readLock.toString indicates current lock state */ public void testReadLockToString() { ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); String us = lock.readLock().toString(); assertTrue(us.indexOf("Read locks = 0") >= 0); lock.readLock().lock(); lock.readLock().lock(); String rs = lock.readLock().toString(); assertTrue(rs.indexOf("Read locks = 2") >= 0); } /** * writeLock.toString indicates current lock state */ public void testWriteLockToString() { ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); String us = lock.writeLock().toString(); assertTrue(us.indexOf("Unlocked") >= 0); lock.writeLock().lock(); String ls = lock.writeLock().toString(); assertTrue(ls.indexOf("Locked") >= 0); } } jsr166/src/test/tck/ExchangerTest.java0000644000000000000000000001124311560754737014755 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; public class ExchangerTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ExchangerTest.class); } /** * exchange exchanges objects across two threads */ public void testExchange() throws InterruptedException { final Exchanger e = new Exchanger(); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertSame(one, e.exchange(two)); assertSame(two, e.exchange(one)); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertSame(two, e.exchange(one)); assertSame(one, e.exchange(two)); }}); t1.start(); t2.start(); t1.join(); t2.join(); } /** * timed exchange exchanges objects across two threads */ public void testTimedExchange() throws InterruptedException { final Exchanger e = new Exchanger(); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws Exception { assertSame(one, e.exchange(two, SHORT_DELAY_MS, MILLISECONDS)); assertSame(two, e.exchange(one, SHORT_DELAY_MS, MILLISECONDS)); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws Exception { assertSame(two, e.exchange(one, SHORT_DELAY_MS, MILLISECONDS)); assertSame(one, e.exchange(two, SHORT_DELAY_MS, MILLISECONDS)); }}); t1.start(); t2.start(); t1.join(); t2.join(); } /** * interrupt during wait for exchange throws IE */ public void testExchange_InterruptedException() throws InterruptedException { final Exchanger e = new Exchanger(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { e.exchange(one); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * interrupt during wait for timed exchange throws IE */ public void testTimedExchange_InterruptedException() throws InterruptedException { final Exchanger e = new Exchanger(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws Exception { e.exchange(null, SMALL_DELAY_MS, MILLISECONDS); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * timeout during wait for timed exchange throws TOE */ public void testExchange_TimeOutException() throws InterruptedException { final Exchanger e = new Exchanger(); Thread t = new ThreadShouldThrow(TimeoutException.class) { public void realRun() throws Exception { e.exchange(null, SHORT_DELAY_MS, MILLISECONDS); }}; t.start(); t.join(); } /** * If one exchanging thread is interrupted, another succeeds. */ public void testReplacementAfterExchange() throws InterruptedException { final Exchanger e = new Exchanger(); Thread t1 = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { assertSame(two, e.exchange(one)); e.exchange(two); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertSame(one, e.exchange(two)); delay(SMALL_DELAY_MS); assertSame(three, e.exchange(one)); }}); Thread t3 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { delay(SMALL_DELAY_MS); assertSame(one, e.exchange(three)); }}); t1.start(); t2.start(); t3.start(); delay(SHORT_DELAY_MS); t1.interrupt(); t1.join(); t2.join(); t3.join(); } } jsr166/src/test/tck/TimeUnitTest.java0000644000000000000000000004055211537741073014605 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.concurrent.*; import java.io.*; public class TimeUnitTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(TimeUnitTest.class); } // (loops to 88888 check increments at all time divisions.) /** * convert correctly converts sample values across the units */ public void testConvert() { for (long t = 0; t < 88888; ++t) { assertEquals(t*60*60*24, TimeUnit.SECONDS.convert(t, TimeUnit.DAYS)); assertEquals(t*60*60, TimeUnit.SECONDS.convert(t, TimeUnit.HOURS)); assertEquals(t*60, TimeUnit.SECONDS.convert(t, TimeUnit.MINUTES)); assertEquals(t, TimeUnit.SECONDS.convert(t, TimeUnit.SECONDS)); assertEquals(t, TimeUnit.SECONDS.convert(1000L*t, TimeUnit.MILLISECONDS)); assertEquals(t, TimeUnit.SECONDS.convert(1000000L*t, TimeUnit.MICROSECONDS)); assertEquals(t, TimeUnit.SECONDS.convert(1000000000L*t, TimeUnit.NANOSECONDS)); assertEquals(1000L*t*60*60*24, TimeUnit.MILLISECONDS.convert(t, TimeUnit.DAYS)); assertEquals(1000L*t*60*60, TimeUnit.MILLISECONDS.convert(t, TimeUnit.HOURS)); assertEquals(1000L*t*60, TimeUnit.MILLISECONDS.convert(t, TimeUnit.MINUTES)); assertEquals(1000L*t, TimeUnit.MILLISECONDS.convert(t, TimeUnit.SECONDS)); assertEquals(t, TimeUnit.MILLISECONDS.convert(t, TimeUnit.MILLISECONDS)); assertEquals(t, TimeUnit.MILLISECONDS.convert(1000L*t, TimeUnit.MICROSECONDS)); assertEquals(t, TimeUnit.MILLISECONDS.convert(1000000L*t, TimeUnit.NANOSECONDS)); assertEquals(1000000L*t*60*60*24, TimeUnit.MICROSECONDS.convert(t, TimeUnit.DAYS)); assertEquals(1000000L*t*60*60, TimeUnit.MICROSECONDS.convert(t, TimeUnit.HOURS)); assertEquals(1000000L*t*60, TimeUnit.MICROSECONDS.convert(t, TimeUnit.MINUTES)); assertEquals(1000000L*t, TimeUnit.MICROSECONDS.convert(t, TimeUnit.SECONDS)); assertEquals(1000L*t, TimeUnit.MICROSECONDS.convert(t, TimeUnit.MILLISECONDS)); assertEquals(t, TimeUnit.MICROSECONDS.convert(t, TimeUnit.MICROSECONDS)); assertEquals(t, TimeUnit.MICROSECONDS.convert(1000L*t, TimeUnit.NANOSECONDS)); assertEquals(1000000000L*t*60*60*24, TimeUnit.NANOSECONDS.convert(t, TimeUnit.DAYS)); assertEquals(1000000000L*t*60*60, TimeUnit.NANOSECONDS.convert(t, TimeUnit.HOURS)); assertEquals(1000000000L*t*60, TimeUnit.NANOSECONDS.convert(t, TimeUnit.MINUTES)); assertEquals(1000000000L*t, TimeUnit.NANOSECONDS.convert(t, TimeUnit.SECONDS)); assertEquals(1000000L*t, TimeUnit.NANOSECONDS.convert(t, TimeUnit.MILLISECONDS)); assertEquals(1000L*t, TimeUnit.NANOSECONDS.convert(t, TimeUnit.MICROSECONDS)); assertEquals(t, TimeUnit.NANOSECONDS.convert(t, TimeUnit.NANOSECONDS)); } } /** * toNanos correctly converts sample values in different units to * nanoseconds */ public void testToNanos() { for (long t = 0; t < 88888; ++t) { assertEquals(t*1000000000L*60*60*24, TimeUnit.DAYS.toNanos(t)); assertEquals(t*1000000000L*60*60, TimeUnit.HOURS.toNanos(t)); assertEquals(t*1000000000L*60, TimeUnit.MINUTES.toNanos(t)); assertEquals(1000000000L*t, TimeUnit.SECONDS.toNanos(t)); assertEquals(1000000L*t, TimeUnit.MILLISECONDS.toNanos(t)); assertEquals(1000L*t, TimeUnit.MICROSECONDS.toNanos(t)); assertEquals(t, TimeUnit.NANOSECONDS.toNanos(t)); } } /** * toMicros correctly converts sample values in different units to * microseconds */ public void testToMicros() { for (long t = 0; t < 88888; ++t) { assertEquals(t*1000000L*60*60*24, TimeUnit.DAYS.toMicros(t)); assertEquals(t*1000000L*60*60, TimeUnit.HOURS.toMicros(t)); assertEquals(t*1000000L*60, TimeUnit.MINUTES.toMicros(t)); assertEquals(1000000L*t, TimeUnit.SECONDS.toMicros(t)); assertEquals(1000L*t, TimeUnit.MILLISECONDS.toMicros(t)); assertEquals(t, TimeUnit.MICROSECONDS.toMicros(t)); assertEquals(t, TimeUnit.NANOSECONDS.toMicros(t*1000L)); } } /** * toMillis correctly converts sample values in different units to * milliseconds */ public void testToMillis() { for (long t = 0; t < 88888; ++t) { assertEquals(t*1000L*60*60*24, TimeUnit.DAYS.toMillis(t)); assertEquals(t*1000L*60*60, TimeUnit.HOURS.toMillis(t)); assertEquals(t*1000L*60, TimeUnit.MINUTES.toMillis(t)); assertEquals(1000L*t, TimeUnit.SECONDS.toMillis(t)); assertEquals(t, TimeUnit.MILLISECONDS.toMillis(t)); assertEquals(t, TimeUnit.MICROSECONDS.toMillis(t*1000L)); assertEquals(t, TimeUnit.NANOSECONDS.toMillis(t*1000000L)); } } /** * toSeconds correctly converts sample values in different units to * seconds */ public void testToSeconds() { for (long t = 0; t < 88888; ++t) { assertEquals(t*60*60*24, TimeUnit.DAYS.toSeconds(t)); assertEquals(t*60*60, TimeUnit.HOURS.toSeconds(t)); assertEquals(t*60, TimeUnit.MINUTES.toSeconds(t)); assertEquals(t, TimeUnit.SECONDS.toSeconds(t)); assertEquals(t, TimeUnit.MILLISECONDS.toSeconds(t*1000L)); assertEquals(t, TimeUnit.MICROSECONDS.toSeconds(t*1000000L)); assertEquals(t, TimeUnit.NANOSECONDS.toSeconds(t*1000000000L)); } } /** * toMinutes correctly converts sample values in different units to * minutes */ public void testToMinutes() { for (long t = 0; t < 88888; ++t) { assertEquals(t*60*24, TimeUnit.DAYS.toMinutes(t)); assertEquals(t*60, TimeUnit.HOURS.toMinutes(t)); assertEquals(t, TimeUnit.MINUTES.toMinutes(t)); assertEquals(t, TimeUnit.SECONDS.toMinutes(t*60)); assertEquals(t, TimeUnit.MILLISECONDS.toMinutes(t*1000L*60)); assertEquals(t, TimeUnit.MICROSECONDS.toMinutes(t*1000000L*60)); assertEquals(t, TimeUnit.NANOSECONDS.toMinutes(t*1000000000L*60)); } } /** * toHours correctly converts sample values in different units to * hours */ public void testToHours() { for (long t = 0; t < 88888; ++t) { assertEquals(t*24, TimeUnit.DAYS.toHours(t)); assertEquals(t, TimeUnit.HOURS.toHours(t)); assertEquals(t, TimeUnit.MINUTES.toHours(t*60)); assertEquals(t, TimeUnit.SECONDS.toHours(t*60*60)); assertEquals(t, TimeUnit.MILLISECONDS.toHours(t*1000L*60*60)); assertEquals(t, TimeUnit.MICROSECONDS.toHours(t*1000000L*60*60)); assertEquals(t, TimeUnit.NANOSECONDS.toHours(t*1000000000L*60*60)); } } /** * toDays correctly converts sample values in different units to * days */ public void testToDays() { for (long t = 0; t < 88888; ++t) { assertEquals(t, TimeUnit.DAYS.toDays(t)); assertEquals(t, TimeUnit.HOURS.toDays(t*24)); assertEquals(t, TimeUnit.MINUTES.toDays(t*60*24)); assertEquals(t, TimeUnit.SECONDS.toDays(t*60*60*24)); assertEquals(t, TimeUnit.MILLISECONDS.toDays(t*1000L*60*60*24)); assertEquals(t, TimeUnit.MICROSECONDS.toDays(t*1000000L*60*60*24)); assertEquals(t, TimeUnit.NANOSECONDS.toDays(t*1000000000L*60*60*24)); } } /** * convert saturates positive too-large values to Long.MAX_VALUE * and negative to LONG.MIN_VALUE */ public void testConvertSaturate() { assertEquals(Long.MAX_VALUE, TimeUnit.NANOSECONDS.convert(Long.MAX_VALUE / 2, TimeUnit.SECONDS)); assertEquals(Long.MIN_VALUE, TimeUnit.NANOSECONDS.convert(-Long.MAX_VALUE / 4, TimeUnit.SECONDS)); assertEquals(Long.MAX_VALUE, TimeUnit.NANOSECONDS.convert(Long.MAX_VALUE / 2, TimeUnit.MINUTES)); assertEquals(Long.MIN_VALUE, TimeUnit.NANOSECONDS.convert(-Long.MAX_VALUE / 4, TimeUnit.MINUTES)); assertEquals(Long.MAX_VALUE, TimeUnit.NANOSECONDS.convert(Long.MAX_VALUE / 2, TimeUnit.HOURS)); assertEquals(Long.MIN_VALUE, TimeUnit.NANOSECONDS.convert(-Long.MAX_VALUE / 4, TimeUnit.HOURS)); assertEquals(Long.MAX_VALUE, TimeUnit.NANOSECONDS.convert(Long.MAX_VALUE / 2, TimeUnit.DAYS)); assertEquals(Long.MIN_VALUE, TimeUnit.NANOSECONDS.convert(-Long.MAX_VALUE / 4, TimeUnit.DAYS)); } /** * toNanos saturates positive too-large values to Long.MAX_VALUE * and negative to LONG.MIN_VALUE */ public void testToNanosSaturate() { assertEquals(Long.MAX_VALUE, TimeUnit.MILLISECONDS.toNanos(Long.MAX_VALUE / 2)); assertEquals(Long.MIN_VALUE, TimeUnit.MILLISECONDS.toNanos(-Long.MAX_VALUE / 3)); } /** * toString returns string containing common name of unit */ public void testToString() { String s = TimeUnit.SECONDS.toString(); assertTrue(s.indexOf("ECOND") >= 0); } /** * Timed wait without holding lock throws * IllegalMonitorStateException */ public void testTimedWait_IllegalMonitorException() throws Exception { Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { Object o = new Object(); TimeUnit tu = TimeUnit.MILLISECONDS; try { tu.timedWait(o,LONG_DELAY_MS); threadShouldThrow(); } catch (IllegalMonitorStateException success) {}}}); t.start(); Thread.sleep(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * timedWait throws InterruptedException when interrupted */ public void testTimedWait() throws InterruptedException { Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { Object o = new Object(); TimeUnit tu = TimeUnit.MILLISECONDS; synchronized (o) { tu.timedWait(o,MEDIUM_DELAY_MS); } }}); t.start(); Thread.sleep(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * timedJoin throws InterruptedException when interrupted */ public void testTimedJoin() throws InterruptedException { final Thread s = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { Thread.sleep(MEDIUM_DELAY_MS); }}); final Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { TimeUnit tu = TimeUnit.MILLISECONDS; tu.timedJoin(s, MEDIUM_DELAY_MS); }}); s.start(); t.start(); Thread.sleep(SHORT_DELAY_MS); t.interrupt(); t.join(); s.interrupt(); s.join(); } /** * timedSleep throws InterruptedException when interrupted */ public void testTimedSleep() throws InterruptedException { Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { TimeUnit tu = TimeUnit.MILLISECONDS; tu.sleep(MEDIUM_DELAY_MS); }}); t.start(); Thread.sleep(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * a deserialized serialized unit is the same instance */ public void testSerialization() throws Exception { TimeUnit q = TimeUnit.MILLISECONDS; ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); TimeUnit r = (TimeUnit)in.readObject(); assertSame(q, r); } } jsr166/src/test/tck/AbstractQueueTest.java0000644000000000000000000001101711537741072015610 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.io.*; public class AbstractQueueTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AbstractQueueTest.class); } static class Succeed extends AbstractQueue { public boolean offer(Integer x) { if (x == null) throw new NullPointerException(); return true; } public Integer peek() { return one; } public Integer poll() { return one; } public int size() { return 0; } public Iterator iterator() { return null; } // not needed } static class Fail extends AbstractQueue { public boolean offer(Integer x) { if (x == null) throw new NullPointerException(); return false; } public Integer peek() { return null; } public Integer poll() { return null; } public int size() { return 0; } public Iterator iterator() { return null; } // not needed } /** * add returns true if offer succeeds */ public void testAddS() { Succeed q = new Succeed(); assertTrue(q.add(two)); } /** * add throws ISE true if offer fails */ public void testAddF() { Fail q = new Fail(); try { q.add(one); shouldThrow(); } catch (IllegalStateException success) {} } /** * add throws NPE if offer does */ public void testAddNPE() { Succeed q = new Succeed(); try { q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * remove returns normally if poll succeeds */ public void testRemoveS() { Succeed q = new Succeed(); q.remove(); } /** * remove throws NSEE if poll returns null */ public void testRemoveF() { Fail q = new Fail(); try { q.remove(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * element returns normally if peek succeeds */ public void testElementS() { Succeed q = new Succeed(); q.element(); } /** * element throws NSEE if peek returns null */ public void testElementF() { Fail q = new Fail(); try { q.element(); shouldThrow(); } catch (NoSuchElementException success) {} } /** * addAll(null) throws NPE */ public void testAddAll1() { try { Succeed q = new Succeed(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll(this) throws IAE */ public void testAddAllSelf() { try { Succeed q = new Succeed(); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { Succeed q = new Succeed(); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { Succeed q = new Succeed(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll throws ISE if an add fails */ public void testAddAll4() { try { Fail q = new Fail(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (IllegalStateException success) {} } } jsr166/src/test/tck/ConcurrentSkipListSubSetTest.java0000644000000000000000000007522011537741072020001 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class ConcurrentSkipListSubSetTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ConcurrentSkipListSubSetTest.class); } static class MyReverseComparator implements Comparator { public int compare(Object x, Object y) { return ((Comparable)y).compareTo(x); } } /** * Create a set of given size containing consecutive * Integers 0 ... n. */ private NavigableSet populatedSet(int n) { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.isEmpty()); for (int i = n-1; i >= 0; i-=2) assertTrue(q.add(new Integer(i))); for (int i = (n & 1); i < n; i+=2) assertTrue(q.add(new Integer(i))); assertTrue(q.add(new Integer(-n))); assertTrue(q.add(new Integer(n))); NavigableSet s = q.subSet(new Integer(0), true, new Integer(n), false); assertFalse(s.isEmpty()); assertEquals(n, s.size()); return s; } /** * Create set of first 5 ints */ private NavigableSet set5() { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.isEmpty()); q.add(one); q.add(two); q.add(three); q.add(four); q.add(five); q.add(zero); q.add(seven); NavigableSet s = q.subSet(one, true, seven, false); assertEquals(5, s.size()); return s; } /** * Create set of first 5 negative ints */ private NavigableSet dset5() { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.isEmpty()); q.add(m1); q.add(m2); q.add(m3); q.add(m4); q.add(m5); NavigableSet s = q.descendingSet(); assertEquals(5, s.size()); return s; } private static NavigableSet set0() { ConcurrentSkipListSet set = new ConcurrentSkipListSet(); assertTrue(set.isEmpty()); return set.tailSet(m1, true); } private static NavigableSet dset0() { ConcurrentSkipListSet set = new ConcurrentSkipListSet(); assertTrue(set.isEmpty()); return set; } /** * A new set has unbounded capacity */ public void testConstructor1() { assertEquals(0, set0().size()); } /** * isEmpty is true before add, false after */ public void testEmpty() { NavigableSet q = set0(); assertTrue(q.isEmpty()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.add(new Integer(2)); q.pollFirst(); q.pollFirst(); assertTrue(q.isEmpty()); } /** * size changes when elements added and removed */ public void testSize() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.pollFirst(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * add(null) throws NPE */ public void testAddNull() { try { NavigableSet q = set0(); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Add of comparable element succeeds */ public void testAdd() { NavigableSet q = set0(); assertTrue(q.add(six)); } /** * Add of duplicate element fails */ public void testAddDup() { NavigableSet q = set0(); assertTrue(q.add(six)); assertFalse(q.add(six)); } /** * Add of non-Comparable throws CCE */ public void testAddNonComparable() { try { NavigableSet q = set0(); q.add(new Object()); q.add(new Object()); q.add(new Object()); shouldThrow(); } catch (ClassCastException success) {} } /** * addAll(null) throws NPE */ public void testAddAll1() { try { NavigableSet q = set0(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { NavigableSet q = set0(); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { NavigableSet q = set0(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i+SIZE); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Set contains all elements of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(SIZE-1- i); NavigableSet q = set0(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(new Integer(i), q.pollFirst()); } /** * poll succeeds unless empty */ public void testPoll() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst()); } assertNull(q.pollFirst()); } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { NavigableSet q = populatedSet(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.pollFirst(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { NavigableSet q = populatedSet(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { NavigableSet q = populatedSet(SIZE); NavigableSet p = set0(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { NavigableSet q = populatedSet(SIZE); NavigableSet p = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.pollFirst(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { NavigableSet q = populatedSet(SIZE); NavigableSet p = populatedSet(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.pollFirst()); assertFalse(q.contains(I)); } } } /** * lower returns preceding element */ public void testLower() { NavigableSet q = set5(); Object e1 = q.lower(three); assertEquals(two, e1); Object e2 = q.lower(six); assertEquals(five, e2); Object e3 = q.lower(one); assertNull(e3); Object e4 = q.lower(zero); assertNull(e4); } /** * higher returns next element */ public void testHigher() { NavigableSet q = set5(); Object e1 = q.higher(three); assertEquals(four, e1); Object e2 = q.higher(zero); assertEquals(one, e2); Object e3 = q.higher(five); assertNull(e3); Object e4 = q.higher(six); assertNull(e4); } /** * floor returns preceding element */ public void testFloor() { NavigableSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); } /** * ceiling returns next element */ public void testCeiling() { NavigableSet q = set5(); Object e1 = q.ceiling(three); assertEquals(three, e1); Object e2 = q.ceiling(zero); assertEquals(one, e2); Object e3 = q.ceiling(five); assertEquals(five, e3); Object e4 = q.ceiling(six); assertNull(e4); } /** * toArray contains all elements in sorted order */ public void testToArray() { NavigableSet q = populatedSet(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) assertSame(o[i], q.pollFirst()); } /** * toArray(a) contains all elements in sorted order */ public void testToArray2() { NavigableSet q = populatedSet(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.pollFirst()); } /** * iterator iterates through all elements */ public void testIterator() { NavigableSet q = populatedSet(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * iterator of empty set has no elements */ public void testEmptyIterator() { NavigableSet q = set0(); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, 0); } /** * iterator.remove removes current element */ public void testIteratorRemove() { final NavigableSet q = set0(); q.add(new Integer(2)); q.add(new Integer(1)); q.add(new Integer(3)); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertEquals(it.next(), new Integer(2)); assertEquals(it.next(), new Integer(3)); assertFalse(it.hasNext()); } /** * toString contains toStrings of elements */ public void testToString() { NavigableSet q = populatedSet(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * A deserialized serialized set has same elements */ public void testSerialization() throws Exception { NavigableSet q = populatedSet(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); NavigableSet r = (NavigableSet)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.pollFirst(), r.pollFirst()); } /** * subSet returns set with keys in requested range */ public void testSubSetContents() { NavigableSet set = set5(); SortedSet sm = set.subSet(two, four); assertEquals(two, sm.first()); assertEquals(three, sm.last()); assertEquals(2, sm.size()); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(two)); assertEquals(4, set.size()); assertEquals(1, sm.size()); assertEquals(three, sm.first()); assertEquals(three, sm.last()); assertTrue(sm.remove(three)); assertTrue(sm.isEmpty()); assertEquals(3, set.size()); } public void testSubSetContents2() { NavigableSet set = set5(); SortedSet sm = set.subSet(two, three); assertEquals(1, sm.size()); assertEquals(two, sm.first()); assertEquals(two, sm.last()); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertFalse(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(two)); assertEquals(4, set.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertFalse(sm.remove(three)); assertEquals(4, set.size()); } /** * headSet returns set with keys in requested range */ public void testHeadSetContents() { NavigableSet set = set5(); SortedSet sm = set.headSet(four); assertTrue(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(one, k); k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, set.size()); assertEquals(four, set.first()); } /** * tailSet returns set with keys in requested range */ public void testTailSetContents() { NavigableSet set = set5(); SortedSet sm = set.tailSet(two); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertTrue(sm.contains(four)); assertTrue(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); k = (Integer)(i.next()); assertEquals(four, k); k = (Integer)(i.next()); assertEquals(five, k); assertFalse(i.hasNext()); SortedSet ssm = sm.tailSet(four); assertEquals(four, ssm.first()); assertEquals(five, ssm.last()); assertTrue(ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, set.size()); } /** * size changes when elements added and removed */ public void testDescendingSize() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.pollFirst(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * add(null) throws NPE */ public void testDescendingAddNull() { try { NavigableSet q = dset0(); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Add of comparable element succeeds */ public void testDescendingAdd() { NavigableSet q = dset0(); assertTrue(q.add(m6)); } /** * Add of duplicate element fails */ public void testDescendingAddDup() { NavigableSet q = dset0(); assertTrue(q.add(m6)); assertFalse(q.add(m6)); } /** * Add of non-Comparable throws CCE */ public void testDescendingAddNonComparable() { try { NavigableSet q = dset0(); q.add(new Object()); q.add(new Object()); q.add(new Object()); shouldThrow(); } catch (ClassCastException success) {} } /** * addAll(null) throws NPE */ public void testDescendingAddAll1() { try { NavigableSet q = dset0(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testDescendingAddAll2() { try { NavigableSet q = dset0(); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testDescendingAddAll3() { try { NavigableSet q = dset0(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i+SIZE); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Set contains all elements of successful addAll */ public void testDescendingAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(SIZE-1- i); NavigableSet q = dset0(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(new Integer(i), q.pollFirst()); } /** * poll succeeds unless empty */ public void testDescendingPoll() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst()); } assertNull(q.pollFirst()); } /** * remove(x) removes x and returns true if present */ public void testDescendingRemoveElement() { NavigableSet q = populatedSet(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.remove(new Integer(i))); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.remove(new Integer(i))); assertFalse(q.remove(new Integer(i+1))); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testDescendingContains() { NavigableSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.pollFirst(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testDescendingClear() { NavigableSet q = populatedSet(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testDescendingContainsAll() { NavigableSet q = populatedSet(SIZE); NavigableSet p = dset0(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testDescendingRetainAll() { NavigableSet q = populatedSet(SIZE); NavigableSet p = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.pollFirst(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testDescendingRemoveAll() { for (int i = 1; i < SIZE; ++i) { NavigableSet q = populatedSet(SIZE); NavigableSet p = populatedSet(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.pollFirst()); assertFalse(q.contains(I)); } } } /** * lower returns preceding element */ public void testDescendingLower() { NavigableSet q = dset5(); Object e1 = q.lower(m3); assertEquals(m2, e1); Object e2 = q.lower(m6); assertEquals(m5, e2); Object e3 = q.lower(m1); assertNull(e3); Object e4 = q.lower(zero); assertNull(e4); } /** * higher returns next element */ public void testDescendingHigher() { NavigableSet q = dset5(); Object e1 = q.higher(m3); assertEquals(m4, e1); Object e2 = q.higher(zero); assertEquals(m1, e2); Object e3 = q.higher(m5); assertNull(e3); Object e4 = q.higher(m6); assertNull(e4); } /** * floor returns preceding element */ public void testDescendingFloor() { NavigableSet q = dset5(); Object e1 = q.floor(m3); assertEquals(m3, e1); Object e2 = q.floor(m6); assertEquals(m5, e2); Object e3 = q.floor(m1); assertEquals(m1, e3); Object e4 = q.floor(zero); assertNull(e4); } /** * ceiling returns next element */ public void testDescendingCeiling() { NavigableSet q = dset5(); Object e1 = q.ceiling(m3); assertEquals(m3, e1); Object e2 = q.ceiling(zero); assertEquals(m1, e2); Object e3 = q.ceiling(m5); assertEquals(m5, e3); Object e4 = q.ceiling(m6); assertNull(e4); } /** * toArray contains all elements */ public void testDescendingToArray() { NavigableSet q = populatedSet(SIZE); Object[] o = q.toArray(); Arrays.sort(o); for (int i = 0; i < o.length; i++) assertEquals(o[i], q.pollFirst()); } /** * toArray(a) contains all elements */ public void testDescendingToArray2() { NavigableSet q = populatedSet(SIZE); Integer[] ints = new Integer[SIZE]; assertSame(ints, q.toArray(ints)); Arrays.sort(ints); for (int i = 0; i < ints.length; i++) assertEquals(ints[i], q.pollFirst()); } /** * iterator iterates through all elements */ public void testDescendingIterator() { NavigableSet q = populatedSet(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * iterator of empty set has no elements */ public void testDescendingEmptyIterator() { NavigableSet q = dset0(); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, 0); } /** * iterator.remove removes current element */ public void testDescendingIteratorRemove() { final NavigableSet q = dset0(); q.add(new Integer(2)); q.add(new Integer(1)); q.add(new Integer(3)); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertEquals(it.next(), new Integer(2)); assertEquals(it.next(), new Integer(3)); assertFalse(it.hasNext()); } /** * toString contains toStrings of elements */ public void testDescendingToString() { NavigableSet q = populatedSet(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * A deserialized serialized set has same elements */ public void testDescendingSerialization() throws Exception { NavigableSet q = populatedSet(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); NavigableSet r = (NavigableSet)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.pollFirst(), r.pollFirst()); } /** * subSet returns set with keys in requested range */ public void testDescendingSubSetContents() { NavigableSet set = dset5(); SortedSet sm = set.subSet(m2, m4); assertEquals(m2, sm.first()); assertEquals(m3, sm.last()); assertEquals(2, sm.size()); assertFalse(sm.contains(m1)); assertTrue(sm.contains(m2)); assertTrue(sm.contains(m3)); assertFalse(sm.contains(m4)); assertFalse(sm.contains(m5)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(m2)); assertEquals(4, set.size()); assertEquals(1, sm.size()); assertEquals(m3, sm.first()); assertEquals(m3, sm.last()); assertTrue(sm.remove(m3)); assertTrue(sm.isEmpty()); assertEquals(3, set.size()); } public void testDescendingSubSetContents2() { NavigableSet set = dset5(); SortedSet sm = set.subSet(m2, m3); assertEquals(1, sm.size()); assertEquals(m2, sm.first()); assertEquals(m2, sm.last()); assertFalse(sm.contains(m1)); assertTrue(sm.contains(m2)); assertFalse(sm.contains(m3)); assertFalse(sm.contains(m4)); assertFalse(sm.contains(m5)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(m2)); assertEquals(4, set.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertFalse(sm.remove(m3)); assertEquals(4, set.size()); } /** * headSet returns set with keys in requested range */ public void testDescendingHeadSetContents() { NavigableSet set = dset5(); SortedSet sm = set.headSet(m4); assertTrue(sm.contains(m1)); assertTrue(sm.contains(m2)); assertTrue(sm.contains(m3)); assertFalse(sm.contains(m4)); assertFalse(sm.contains(m5)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(m1, k); k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, set.size()); assertEquals(m4, set.first()); } /** * tailSet returns set with keys in requested range */ public void testDescendingTailSetContents() { NavigableSet set = dset5(); SortedSet sm = set.tailSet(m2); assertFalse(sm.contains(m1)); assertTrue(sm.contains(m2)); assertTrue(sm.contains(m3)); assertTrue(sm.contains(m4)); assertTrue(sm.contains(m5)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(m2, k); k = (Integer)(i.next()); assertEquals(m3, k); k = (Integer)(i.next()); assertEquals(m4, k); k = (Integer)(i.next()); assertEquals(m5, k); assertFalse(i.hasNext()); SortedSet ssm = sm.tailSet(m4); assertEquals(m4, ssm.first()); assertEquals(m5, ssm.last()); assertTrue(ssm.remove(m4)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, set.size()); } } jsr166/src/test/tck/LockSupportTest.java0000644000000000000000000003121711561033410015314 0ustar /* * Written by Doug Lea and Martin Buchholz with assistance from * members of JCP JSR-166 Expert Group and released to the public * domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.locks.*; public class LockSupportTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(LockSupportTest.class); } /** * park is released by subsequent unpark */ public void testParkBeforeUnpark() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { threadStarted.countDown(); LockSupport.park(); }}); threadStarted.await(); delay(SHORT_DELAY_MS); LockSupport.unpark(t); awaitTermination(t, MEDIUM_DELAY_MS); } /** * parkUntil is released by subsequent unpark */ public void testParkUntilBeforeUnpark() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { long d = new Date().getTime() + LONG_DELAY_MS; long nanos = LONG_DELAY_MS * 1000L * 1000L; long t0 = System.nanoTime(); threadStarted.countDown(); LockSupport.parkUntil(d); assertTrue(System.nanoTime() - t0 < nanos); }}); threadStarted.await(); delay(SHORT_DELAY_MS); LockSupport.unpark(t); awaitTermination(t, MEDIUM_DELAY_MS); } /** * parkNanos is released by subsequent unpark */ public void testParkNanosBeforeUnpark() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { long nanos = LONG_DELAY_MS * 1000L * 1000L; long t0 = System.nanoTime(); threadStarted.countDown(); LockSupport.parkNanos(nanos); assertTrue(System.nanoTime() - t0 < nanos); }}); threadStarted.await(); delay(SHORT_DELAY_MS); LockSupport.unpark(t); awaitTermination(t, MEDIUM_DELAY_MS); } /** * park is released by preceding unpark */ public void testParkAfterUnpark() throws Exception { final CountDownLatch threadStarted = new CountDownLatch(1); final AtomicBoolean unparked = new AtomicBoolean(false); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); while (!unparked.get()) Thread.yield(); LockSupport.park(); }}); threadStarted.await(); LockSupport.unpark(t); unparked.set(true); awaitTermination(t, MEDIUM_DELAY_MS); } /** * parkUntil is released by preceding unpark */ public void testParkUntilAfterUnpark() throws Exception { final CountDownLatch threadStarted = new CountDownLatch(1); final AtomicBoolean unparked = new AtomicBoolean(false); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); while (!unparked.get()) Thread.yield(); long d = new Date().getTime() + LONG_DELAY_MS; long nanos = LONG_DELAY_MS * 1000L * 1000L; long t0 = System.nanoTime(); LockSupport.parkUntil(d); assertTrue(System.nanoTime() - t0 < nanos); }}); threadStarted.await(); LockSupport.unpark(t); unparked.set(true); awaitTermination(t, MEDIUM_DELAY_MS); } /** * parkNanos is released by preceding unpark */ public void testParkNanosAfterUnpark() throws Exception { final CountDownLatch threadStarted = new CountDownLatch(1); final AtomicBoolean unparked = new AtomicBoolean(false); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); while (!unparked.get()) Thread.yield(); long nanos = LONG_DELAY_MS * 1000L * 1000L; long t0 = System.nanoTime(); LockSupport.parkNanos(nanos); assertTrue(System.nanoTime() - t0 < nanos); }}); threadStarted.await(); LockSupport.unpark(t); unparked.set(true); awaitTermination(t, MEDIUM_DELAY_MS); } /** * park is released by subsequent interrupt */ public void testParkBeforeInterrupt() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { assertFalse(Thread.currentThread().isInterrupted()); threadStarted.countDown(); do { LockSupport.park(); // park may return spuriously } while (! Thread.currentThread().isInterrupted()); }}); threadStarted.await(); delay(SHORT_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); } /** * parkUntil is released by subsequent interrupt */ public void testParkUntilBeforeInterrupt() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { long d = new Date().getTime() + LONG_DELAY_MS; long nanos = LONG_DELAY_MS * 1000L * 1000L; long t0 = System.nanoTime(); assertFalse(Thread.currentThread().isInterrupted()); threadStarted.countDown(); do { LockSupport.parkUntil(d); // parkUntil may return spuriously } while (! Thread.currentThread().isInterrupted()); assertTrue(System.nanoTime() - t0 < nanos); }}); threadStarted.await(); delay(SHORT_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); } /** * parkNanos is released by subsequent interrupt */ public void testParkNanosBeforeInterrupt() throws InterruptedException { final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { long nanos = LONG_DELAY_MS * 1000L * 1000L; long t0 = System.nanoTime(); assertFalse(Thread.currentThread().isInterrupted()); threadStarted.countDown(); do { LockSupport.parkNanos(nanos); // parkNanos may return spuriously } while (! Thread.currentThread().isInterrupted()); assertTrue(System.nanoTime() - t0 < nanos); }}); threadStarted.await(); delay(SHORT_DELAY_MS); t.interrupt(); awaitTermination(t, MEDIUM_DELAY_MS); } /** * park is released by preceding interrupt */ public void testParkAfterInterrupt() throws Exception { final CountDownLatch threadStarted = new CountDownLatch(1); final AtomicBoolean unparked = new AtomicBoolean(false); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); while (!unparked.get()) Thread.yield(); assertTrue(Thread.currentThread().isInterrupted()); LockSupport.park(); assertTrue(Thread.currentThread().isInterrupted()); }}); threadStarted.await(); t.interrupt(); unparked.set(true); awaitTermination(t, MEDIUM_DELAY_MS); } /** * parkUntil is released by preceding interrupt */ public void testParkUntilAfterInterrupt() throws Exception { final CountDownLatch threadStarted = new CountDownLatch(1); final AtomicBoolean unparked = new AtomicBoolean(false); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); while (!unparked.get()) Thread.yield(); long d = new Date().getTime() + LONG_DELAY_MS; long nanos = LONG_DELAY_MS * 1000L * 1000L; long t0 = System.nanoTime(); assertTrue(Thread.currentThread().isInterrupted()); LockSupport.parkUntil(d); assertTrue(System.nanoTime() - t0 < nanos); assertTrue(Thread.currentThread().isInterrupted()); }}); threadStarted.await(); t.interrupt(); unparked.set(true); awaitTermination(t, MEDIUM_DELAY_MS); } /** * parkNanos is released by preceding interrupt */ public void testParkNanosAfterInterrupt() throws Exception { final CountDownLatch threadStarted = new CountDownLatch(1); final AtomicBoolean unparked = new AtomicBoolean(false); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws Exception { threadStarted.countDown(); while (!unparked.get()) Thread.yield(); long nanos = LONG_DELAY_MS * 1000L * 1000L; long t0 = System.nanoTime(); assertTrue(Thread.currentThread().isInterrupted()); LockSupport.parkNanos(nanos); assertTrue(System.nanoTime() - t0 < nanos); assertTrue(Thread.currentThread().isInterrupted()); }}); threadStarted.await(); t.interrupt(); unparked.set(true); awaitTermination(t, MEDIUM_DELAY_MS); } /** * parkNanos times out if not unparked */ public void testParkNanosTimesOut() throws InterruptedException { Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { for (;;) { long timeoutNanos = SHORT_DELAY_MS * 1000L * 1000L; long t0 = System.nanoTime(); LockSupport.parkNanos(timeoutNanos); // parkNanos may return spuriously if (System.nanoTime() - t0 >= timeoutNanos) return; } }}); awaitTermination(t, MEDIUM_DELAY_MS); } /** * parkUntil times out if not unparked */ public void testParkUntilTimesOut() throws InterruptedException { Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { for (;;) { long d = new Date().getTime() + SHORT_DELAY_MS; // beware of rounding long timeoutNanos = (SHORT_DELAY_MS - 1) * 1000L * 1000L; long t0 = System.nanoTime(); LockSupport.parkUntil(d); // parkUntil may return spuriously if (System.nanoTime() - t0 >= timeoutNanos) return; } }}); awaitTermination(t, MEDIUM_DELAY_MS); } /** * getBlocker(null) throws NullPointerException */ public void testGetBlockerNull() { try { LockSupport.getBlocker(null); shouldThrow(); } catch (NullPointerException success) {} } /** * parkUntil(0) returns immediately. * * Requires hotspot fix for: * 6763959 java.util.concurrent.locks.LockSupport.parkUntil(0) blocks forever * which is in jdk7-b118 and 6u25. */ public void testParkUntil0Returns() throws InterruptedException { Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { LockSupport.parkUntil(0L); }}); awaitTermination(t); } } jsr166/src/test/tck/ConcurrentSkipListSetTest.java0000644000000000000000000007262611551675514017341 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import java.io.*; public class ConcurrentSkipListSetTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ConcurrentSkipListSetTest.class); } static class MyReverseComparator implements Comparator { public int compare(Object x, Object y) { return ((Comparable)y).compareTo(x); } } /** * Create a set of given size containing consecutive * Integers 0 ... n. */ private ConcurrentSkipListSet populatedSet(int n) { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.isEmpty()); for (int i = n-1; i >= 0; i-=2) assertTrue(q.add(new Integer(i))); for (int i = (n & 1); i < n; i+=2) assertTrue(q.add(new Integer(i))); assertFalse(q.isEmpty()); assertEquals(n, q.size()); return q; } /** * Create set of first 5 ints */ private ConcurrentSkipListSet set5() { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.isEmpty()); q.add(one); q.add(two); q.add(three); q.add(four); q.add(five); assertEquals(5, q.size()); return q; } /** * A new set has unbounded capacity */ public void testConstructor1() { assertEquals(0, new ConcurrentSkipListSet().size()); } /** * Initializing from null Collection throws NPE */ public void testConstructor3() { try { ConcurrentSkipListSet q = new ConcurrentSkipListSet((Collection)null); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection of null elements throws NPE */ public void testConstructor4() { try { Integer[] ints = new Integer[SIZE]; ConcurrentSkipListSet q = new ConcurrentSkipListSet(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Initializing from Collection with some null elements throws NPE */ public void testConstructor5() { try { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); ConcurrentSkipListSet q = new ConcurrentSkipListSet(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Set contains all elements of collection used to initialize */ public void testConstructor6() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); ConcurrentSkipListSet q = new ConcurrentSkipListSet(Arrays.asList(ints)); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.pollFirst()); } /** * The comparator used in constructor is used */ public void testConstructor7() { MyReverseComparator cmp = new MyReverseComparator(); ConcurrentSkipListSet q = new ConcurrentSkipListSet(cmp); assertEquals(cmp, q.comparator()); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); for (int i = SIZE-1; i >= 0; --i) assertEquals(ints[i], q.pollFirst()); } /** * isEmpty is true before add, false after */ public void testEmpty() { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.isEmpty()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.add(new Integer(2)); q.pollFirst(); q.pollFirst(); assertTrue(q.isEmpty()); } /** * size changes when elements added and removed */ public void testSize() { ConcurrentSkipListSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE-i, q.size()); q.pollFirst(); } for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.size()); q.add(new Integer(i)); } } /** * add(null) throws NPE */ public void testAddNull() { try { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); q.add(null); shouldThrow(); } catch (NullPointerException success) {} } /** * Add of comparable element succeeds */ public void testAdd() { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.add(zero)); assertTrue(q.add(one)); } /** * Add of duplicate element fails */ public void testAddDup() { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.add(zero)); assertFalse(q.add(zero)); } /** * Add of non-Comparable throws CCE */ public void testAddNonComparable() { try { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); q.add(new Object()); q.add(new Object()); q.add(new Object()); shouldThrow(); } catch (ClassCastException success) {} } /** * addAll(null) throws NPE */ public void testAddAll1() { try { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with null elements throws NPE */ public void testAddAll2() { try { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after * possibly adding some elements */ public void testAddAll3() { try { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } /** * Set contains all elements of successful addAll */ public void testAddAll5() { Integer[] empty = new Integer[0]; Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(SIZE-1-i); ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertFalse(q.addAll(Arrays.asList(empty))); assertTrue(q.addAll(Arrays.asList(ints))); for (int i = 0; i < SIZE; ++i) assertEquals(i, q.pollFirst()); } /** * pollFirst succeeds unless empty */ public void testPollFirst() { ConcurrentSkipListSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.pollFirst()); } assertNull(q.pollFirst()); } /** * pollLast succeeds unless empty */ public void testPollLast() { ConcurrentSkipListSet q = populatedSet(SIZE); for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, q.pollLast()); } assertNull(q.pollFirst()); } /** * remove(x) removes x and returns true if present */ public void testRemoveElement() { ConcurrentSkipListSet q = populatedSet(SIZE); for (int i = 1; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i-1)); } for (int i = 0; i < SIZE; i+=2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i+1)); assertFalse(q.contains(i+1)); } assertTrue(q.isEmpty()); } /** * contains(x) reports true when elements added but not yet removed */ public void testContains() { ConcurrentSkipListSet q = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { assertTrue(q.contains(new Integer(i))); q.pollFirst(); assertFalse(q.contains(new Integer(i))); } } /** * clear removes all elements */ public void testClear() { ConcurrentSkipListSet q = populatedSet(SIZE); q.clear(); assertTrue(q.isEmpty()); assertEquals(0, q.size()); q.add(new Integer(1)); assertFalse(q.isEmpty()); q.clear(); assertTrue(q.isEmpty()); } /** * containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { ConcurrentSkipListSet q = populatedSet(SIZE); ConcurrentSkipListSet p = new ConcurrentSkipListSet(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } /** * retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { ConcurrentSkipListSet q = populatedSet(SIZE); ConcurrentSkipListSet p = populatedSet(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE-i, q.size()); p.pollFirst(); } } /** * removeAll(c) removes only those elements of c and reports true if changed */ public void testRemoveAll() { for (int i = 1; i < SIZE; ++i) { ConcurrentSkipListSet q = populatedSet(SIZE); ConcurrentSkipListSet p = populatedSet(i); assertTrue(q.removeAll(p)); assertEquals(SIZE-i, q.size()); for (int j = 0; j < i; ++j) { Integer I = (Integer)(p.pollFirst()); assertFalse(q.contains(I)); } } } /** * lower returns preceding element */ public void testLower() { ConcurrentSkipListSet q = set5(); Object e1 = q.lower(three); assertEquals(two, e1); Object e2 = q.lower(six); assertEquals(five, e2); Object e3 = q.lower(one); assertNull(e3); Object e4 = q.lower(zero); assertNull(e4); } /** * higher returns next element */ public void testHigher() { ConcurrentSkipListSet q = set5(); Object e1 = q.higher(three); assertEquals(four, e1); Object e2 = q.higher(zero); assertEquals(one, e2); Object e3 = q.higher(five); assertNull(e3); Object e4 = q.higher(six); assertNull(e4); } /** * floor returns preceding element */ public void testFloor() { ConcurrentSkipListSet q = set5(); Object e1 = q.floor(three); assertEquals(three, e1); Object e2 = q.floor(six); assertEquals(five, e2); Object e3 = q.floor(one); assertEquals(one, e3); Object e4 = q.floor(zero); assertNull(e4); } /** * ceiling returns next element */ public void testCeiling() { ConcurrentSkipListSet q = set5(); Object e1 = q.ceiling(three); assertEquals(three, e1); Object e2 = q.ceiling(zero); assertEquals(one, e2); Object e3 = q.ceiling(five); assertEquals(five, e3); Object e4 = q.ceiling(six); assertNull(e4); } /** * toArray contains all elements in sorted order */ public void testToArray() { ConcurrentSkipListSet q = populatedSet(SIZE); Object[] o = q.toArray(); for (int i = 0; i < o.length; i++) assertSame(o[i], q.pollFirst()); } /** * toArray(a) contains all elements in sorted order */ public void testToArray2() { ConcurrentSkipListSet q = populatedSet(SIZE); Integer[] ints = new Integer[SIZE]; Integer[] array = q.toArray(ints); assertSame(ints, array); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.pollFirst()); } /** * iterator iterates through all elements */ public void testIterator() { ConcurrentSkipListSet q = populatedSet(SIZE); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, SIZE); } /** * iterator of empty set has no elements */ public void testEmptyIterator() { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); int i = 0; Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } assertEquals(i, 0); } /** * iterator.remove removes current element */ public void testIteratorRemove() { final ConcurrentSkipListSet q = new ConcurrentSkipListSet(); q.add(new Integer(2)); q.add(new Integer(1)); q.add(new Integer(3)); Iterator it = q.iterator(); it.next(); it.remove(); it = q.iterator(); assertEquals(it.next(), new Integer(2)); assertEquals(it.next(), new Integer(3)); assertFalse(it.hasNext()); } /** * toString contains toStrings of elements */ public void testToString() { ConcurrentSkipListSet q = populatedSet(SIZE); String s = q.toString(); for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * A deserialized serialized set has same elements */ public void testSerialization() throws Exception { ConcurrentSkipListSet q = populatedSet(SIZE); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(q); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); ConcurrentSkipListSet r = (ConcurrentSkipListSet)in.readObject(); assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.pollFirst(), r.pollFirst()); } /** * subSet returns set with keys in requested range */ public void testSubSetContents() { ConcurrentSkipListSet set = set5(); SortedSet sm = set.subSet(two, four); assertEquals(two, sm.first()); assertEquals(three, sm.last()); assertEquals(2, sm.size()); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(two)); assertEquals(4, set.size()); assertEquals(1, sm.size()); assertEquals(three, sm.first()); assertEquals(three, sm.last()); assertTrue(sm.remove(three)); assertTrue(sm.isEmpty()); assertEquals(3, set.size()); } public void testSubSetContents2() { ConcurrentSkipListSet set = set5(); SortedSet sm = set.subSet(two, three); assertEquals(1, sm.size()); assertEquals(two, sm.first()); assertEquals(two, sm.last()); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertFalse(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); assertFalse(i.hasNext()); Iterator j = sm.iterator(); j.next(); j.remove(); assertFalse(set.contains(two)); assertEquals(4, set.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); assertFalse(sm.remove(three)); assertEquals(4, set.size()); } /** * headSet returns set with keys in requested range */ public void testHeadSetContents() { ConcurrentSkipListSet set = set5(); SortedSet sm = set.headSet(four); assertTrue(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertFalse(sm.contains(four)); assertFalse(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(one, k); k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, set.size()); assertEquals(four, set.first()); } /** * tailSet returns set with keys in requested range */ public void testTailSetContents() { ConcurrentSkipListSet set = set5(); SortedSet sm = set.tailSet(two); assertFalse(sm.contains(one)); assertTrue(sm.contains(two)); assertTrue(sm.contains(three)); assertTrue(sm.contains(four)); assertTrue(sm.contains(five)); Iterator i = sm.iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); k = (Integer)(i.next()); assertEquals(four, k); k = (Integer)(i.next()); assertEquals(five, k); assertFalse(i.hasNext()); SortedSet ssm = sm.tailSet(four); assertEquals(four, ssm.first()); assertEquals(five, ssm.last()); assertTrue(ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, set.size()); } Random rnd = new Random(666); BitSet bs; /** * Subsets of subsets subdivide correctly */ public void testRecursiveSubSets() throws Exception { int setSize = expensiveTests ? 1000 : 100; Class cl = ConcurrentSkipListSet.class; NavigableSet set = newSet(cl); bs = new BitSet(setSize); populate(set, setSize); check(set, 0, setSize - 1, true); check(set.descendingSet(), 0, setSize - 1, false); mutateSet(set, 0, setSize - 1); check(set, 0, setSize - 1, true); check(set.descendingSet(), 0, setSize - 1, false); bashSubSet(set.subSet(0, true, setSize, false), 0, setSize - 1, true); } static NavigableSet newSet(Class cl) throws Exception { NavigableSet result = (NavigableSet) cl.newInstance(); assertEquals(result.size(), 0); assertFalse(result.iterator().hasNext()); return result; } void populate(NavigableSet set, int limit) { for (int i = 0, n = 2 * limit / 3; i < n; i++) { int element = rnd.nextInt(limit); put(set, element); } } void mutateSet(NavigableSet set, int min, int max) { int size = set.size(); int rangeSize = max - min + 1; // Remove a bunch of entries directly for (int i = 0, n = rangeSize / 2; i < n; i++) { remove(set, min - 5 + rnd.nextInt(rangeSize + 10)); } // Remove a bunch of entries with iterator for (Iterator it = set.iterator(); it.hasNext(); ) { if (rnd.nextBoolean()) { bs.clear(it.next()); it.remove(); } } // Add entries till we're back to original size while (set.size() < size) { int element = min + rnd.nextInt(rangeSize); assertTrue(element >= min && element<= max); put(set, element); } } void mutateSubSet(NavigableSet set, int min, int max) { int size = set.size(); int rangeSize = max - min + 1; // Remove a bunch of entries directly for (int i = 0, n = rangeSize / 2; i < n; i++) { remove(set, min - 5 + rnd.nextInt(rangeSize + 10)); } // Remove a bunch of entries with iterator for (Iterator it = set.iterator(); it.hasNext(); ) { if (rnd.nextBoolean()) { bs.clear(it.next()); it.remove(); } } // Add entries till we're back to original size while (set.size() < size) { int element = min - 5 + rnd.nextInt(rangeSize + 10); if (element >= min && element<= max) { put(set, element); } else { try { set.add(element); shouldThrow(); } catch (IllegalArgumentException success) {} } } } void put(NavigableSet set, int element) { if (set.add(element)) bs.set(element); } void remove(NavigableSet set, int element) { if (set.remove(element)) bs.clear(element); } void bashSubSet(NavigableSet set, int min, int max, boolean ascending) { check(set, min, max, ascending); check(set.descendingSet(), min, max, !ascending); mutateSubSet(set, min, max); check(set, min, max, ascending); check(set.descendingSet(), min, max, !ascending); // Recurse if (max - min < 2) return; int midPoint = (min + max) / 2; // headSet - pick direction and endpoint inclusion randomly boolean incl = rnd.nextBoolean(); NavigableSet hm = set.headSet(midPoint, incl); if (ascending) { if (rnd.nextBoolean()) bashSubSet(hm, min, midPoint - (incl ? 0 : 1), true); else bashSubSet(hm.descendingSet(), min, midPoint - (incl ? 0 : 1), false); } else { if (rnd.nextBoolean()) bashSubSet(hm, midPoint + (incl ? 0 : 1), max, false); else bashSubSet(hm.descendingSet(), midPoint + (incl ? 0 : 1), max, true); } // tailSet - pick direction and endpoint inclusion randomly incl = rnd.nextBoolean(); NavigableSet tm = set.tailSet(midPoint,incl); if (ascending) { if (rnd.nextBoolean()) bashSubSet(tm, midPoint + (incl ? 0 : 1), max, true); else bashSubSet(tm.descendingSet(), midPoint + (incl ? 0 : 1), max, false); } else { if (rnd.nextBoolean()) { bashSubSet(tm, min, midPoint - (incl ? 0 : 1), false); } else { bashSubSet(tm.descendingSet(), min, midPoint - (incl ? 0 : 1), true); } } // subSet - pick direction and endpoint inclusion randomly int rangeSize = max - min + 1; int[] endpoints = new int[2]; endpoints[0] = min + rnd.nextInt(rangeSize); endpoints[1] = min + rnd.nextInt(rangeSize); Arrays.sort(endpoints); boolean lowIncl = rnd.nextBoolean(); boolean highIncl = rnd.nextBoolean(); if (ascending) { NavigableSet sm = set.subSet( endpoints[0], lowIncl, endpoints[1], highIncl); if (rnd.nextBoolean()) bashSubSet(sm, endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), true); else bashSubSet(sm.descendingSet(), endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), false); } else { NavigableSet sm = set.subSet( endpoints[1], highIncl, endpoints[0], lowIncl); if (rnd.nextBoolean()) bashSubSet(sm, endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), false); else bashSubSet(sm.descendingSet(), endpoints[0] + (lowIncl ? 0 : 1), endpoints[1] - (highIncl ? 0 : 1), true); } } /** * min and max are both inclusive. If max < min, interval is empty. */ void check(NavigableSet set, final int min, final int max, final boolean ascending) { class ReferenceSet { int lower(int element) { return ascending ? lowerAscending(element) : higherAscending(element); } int floor(int element) { return ascending ? floorAscending(element) : ceilingAscending(element); } int ceiling(int element) { return ascending ? ceilingAscending(element) : floorAscending(element); } int higher(int element) { return ascending ? higherAscending(element) : lowerAscending(element); } int first() { return ascending ? firstAscending() : lastAscending(); } int last() { return ascending ? lastAscending() : firstAscending(); } int lowerAscending(int element) { return floorAscending(element - 1); } int floorAscending(int element) { if (element < min) return -1; else if (element > max) element = max; // BitSet should support this! Test would run much faster while (element >= min) { if (bs.get(element)) return element; element--; } return -1; } int ceilingAscending(int element) { if (element < min) element = min; else if (element > max) return -1; int result = bs.nextSetBit(element); return result > max ? -1 : result; } int higherAscending(int element) { return ceilingAscending(element + 1); } private int firstAscending() { int result = ceilingAscending(min); return result > max ? -1 : result; } private int lastAscending() { int result = floorAscending(max); return result < min ? -1 : result; } } ReferenceSet rs = new ReferenceSet(); // Test contents using containsElement int size = 0; for (int i = min; i <= max; i++) { boolean bsContainsI = bs.get(i); assertEquals(bsContainsI, set.contains(i)); if (bsContainsI) size++; } assertEquals(set.size(), size); // Test contents using contains elementSet iterator int size2 = 0; int previousElement = -1; for (int element : set) { assertTrue(bs.get(element)); size2++; assertTrue(previousElement < 0 || (ascending ? element - previousElement > 0 : element - previousElement < 0)); previousElement = element; } assertEquals(size2, size); // Test navigation ops for (int element = min - 1; element <= max + 1; element++) { assertEq(set.lower(element), rs.lower(element)); assertEq(set.floor(element), rs.floor(element)); assertEq(set.higher(element), rs.higher(element)); assertEq(set.ceiling(element), rs.ceiling(element)); } // Test extrema if (set.size() != 0) { assertEq(set.first(), rs.first()); assertEq(set.last(), rs.last()); } else { assertEq(rs.first(), -1); assertEq(rs.last(), -1); try { set.first(); shouldThrow(); } catch (NoSuchElementException success) {} try { set.last(); shouldThrow(); } catch (NoSuchElementException success) {} } } static void assertEq(Integer i, int j) { if (i == null) assertEquals(j, -1); else assertEquals((int) i, j); } static boolean eq(Integer i, int j) { return i == null ? j == -1 : i == j; } } jsr166/src/test/tck/ForkJoinTaskTest.java0000644000000000000000000015214611537741072015415 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.ExecutionException; import java.util.concurrent.CancellationException; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.ForkJoinWorkerThread; import java.util.concurrent.RecursiveAction; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; import java.util.HashSet; import junit.framework.*; public class ForkJoinTaskTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ForkJoinTaskTest.class); } // Runs with "mainPool" use > 1 thread. singletonPool tests use 1 static final int mainPoolSize = Math.max(2, Runtime.getRuntime().availableProcessors()); private static ForkJoinPool mainPool() { return new ForkJoinPool(mainPoolSize); } private static ForkJoinPool singletonPool() { return new ForkJoinPool(1); } private static ForkJoinPool asyncSingletonPool() { return new ForkJoinPool(1, ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true); } private void testInvokeOnPool(ForkJoinPool pool, RecursiveAction a) { try { assertFalse(a.isDone()); assertFalse(a.isCompletedNormally()); assertFalse(a.isCompletedAbnormally()); assertFalse(a.isCancelled()); assertNull(a.getException()); assertNull(a.getRawResult()); assertNull(pool.invoke(a)); assertTrue(a.isDone()); assertTrue(a.isCompletedNormally()); assertFalse(a.isCompletedAbnormally()); assertFalse(a.isCancelled()); assertNull(a.getException()); assertNull(a.getRawResult()); } finally { joinPool(pool); } } void checkNotDone(ForkJoinTask a) { assertFalse(a.isDone()); assertFalse(a.isCompletedNormally()); assertFalse(a.isCompletedAbnormally()); assertFalse(a.isCancelled()); assertNull(a.getException()); assertNull(a.getRawResult()); try { a.get(0L, SECONDS); shouldThrow(); } catch (TimeoutException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } } void checkCompletedNormally(ForkJoinTask a) { checkCompletedNormally(a, null); } void checkCompletedNormally(ForkJoinTask a, T expected) { assertTrue(a.isDone()); assertFalse(a.isCancelled()); assertTrue(a.isCompletedNormally()); assertFalse(a.isCompletedAbnormally()); assertNull(a.getException()); assertSame(expected, a.getRawResult()); { Thread.currentThread().interrupt(); long t0 = System.nanoTime(); assertSame(expected, a.join()); assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); Thread.interrupted(); } { Thread.currentThread().interrupt(); long t0 = System.nanoTime(); a.quietlyJoin(); // should be no-op assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); Thread.interrupted(); } assertFalse(a.cancel(false)); assertFalse(a.cancel(true)); try { assertSame(expected, a.get()); } catch (Throwable fail) { threadUnexpectedException(fail); } try { assertSame(expected, a.get(5L, SECONDS)); } catch (Throwable fail) { threadUnexpectedException(fail); } } void checkCancelled(ForkJoinTask a) { assertTrue(a.isDone()); assertTrue(a.isCancelled()); assertFalse(a.isCompletedNormally()); assertTrue(a.isCompletedAbnormally()); assertTrue(a.getException() instanceof CancellationException); assertNull(a.getRawResult()); assertTrue(a.cancel(false)); assertTrue(a.cancel(true)); try { Thread.currentThread().interrupt(); a.join(); shouldThrow(); } catch (CancellationException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } Thread.interrupted(); { long t0 = System.nanoTime(); a.quietlyJoin(); // should be no-op assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); } try { a.get(); shouldThrow(); } catch (CancellationException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } try { a.get(5L, SECONDS); shouldThrow(); } catch (CancellationException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } } void checkCompletedAbnormally(ForkJoinTask a, Throwable t) { assertTrue(a.isDone()); assertFalse(a.isCancelled()); assertFalse(a.isCompletedNormally()); assertTrue(a.isCompletedAbnormally()); assertSame(t.getClass(), a.getException().getClass()); assertNull(a.getRawResult()); assertFalse(a.cancel(false)); assertFalse(a.cancel(true)); try { Thread.currentThread().interrupt(); a.join(); shouldThrow(); } catch (Throwable expected) { assertSame(t.getClass(), expected.getClass()); } Thread.interrupted(); { long t0 = System.nanoTime(); a.quietlyJoin(); // should be no-op assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); } try { a.get(); shouldThrow(); } catch (ExecutionException success) { assertSame(t.getClass(), success.getCause().getClass()); } catch (Throwable fail) { threadUnexpectedException(fail); } try { a.get(5L, SECONDS); shouldThrow(); } catch (ExecutionException success) { assertSame(t.getClass(), success.getCause().getClass()); } catch (Throwable fail) { threadUnexpectedException(fail); } } /* * Testing coverage notes: * * To test extension methods and overrides, most tests use * BinaryAsyncAction extension class that processes joins * differently than supplied Recursive forms. */ public static final class FJException extends RuntimeException { FJException() { super(); } } abstract static class BinaryAsyncAction extends ForkJoinTask { private volatile int controlState; static final AtomicIntegerFieldUpdater controlStateUpdater = AtomicIntegerFieldUpdater.newUpdater(BinaryAsyncAction.class, "controlState"); private BinaryAsyncAction parent; private BinaryAsyncAction sibling; protected BinaryAsyncAction() { } public final Void getRawResult() { return null; } protected final void setRawResult(Void mustBeNull) { } public final void linkSubtasks(BinaryAsyncAction x, BinaryAsyncAction y) { x.parent = y.parent = this; x.sibling = y; y.sibling = x; } protected void onComplete(BinaryAsyncAction x, BinaryAsyncAction y) { } protected boolean onException() { return true; } public void linkAndForkSubtasks(BinaryAsyncAction x, BinaryAsyncAction y) { linkSubtasks(x, y); y.fork(); x.fork(); } private void completeThis() { super.complete(null); } private void completeThisExceptionally(Throwable ex) { super.completeExceptionally(ex); } public final void complete() { BinaryAsyncAction a = this; for (;;) { BinaryAsyncAction s = a.sibling; BinaryAsyncAction p = a.parent; a.sibling = null; a.parent = null; a.completeThis(); if (p == null || p.compareAndSetControlState(0, 1)) break; try { p.onComplete(a, s); } catch (Throwable rex) { p.completeExceptionally(rex); return; } a = p; } } public final void completeExceptionally(Throwable ex) { BinaryAsyncAction a = this; while (!a.isCompletedAbnormally()) { a.completeThisExceptionally(ex); BinaryAsyncAction s = a.sibling; if (s != null) s.cancel(false); if (!a.onException() || (a = a.parent) == null) break; } } public final BinaryAsyncAction getParent() { return parent; } public BinaryAsyncAction getSibling() { return sibling; } public void reinitialize() { parent = sibling = null; super.reinitialize(); } protected final int getControlState() { return controlState; } protected final boolean compareAndSetControlState(int expect, int update) { return controlStateUpdater.compareAndSet(this, expect, update); } protected final void setControlState(int value) { controlState = value; } protected final void incrementControlState() { controlStateUpdater.incrementAndGet(this); } protected final void decrementControlState() { controlStateUpdater.decrementAndGet(this); } } static final class AsyncFib extends BinaryAsyncAction { int number; public AsyncFib(int n) { this.number = n; } public final boolean exec() { AsyncFib f = this; int n = f.number; if (n > 1) { while (n > 1) { AsyncFib p = f; AsyncFib r = new AsyncFib(n - 2); f = new AsyncFib(--n); p.linkSubtasks(r, f); r.fork(); } f.number = n; } f.complete(); return false; } protected void onComplete(BinaryAsyncAction x, BinaryAsyncAction y) { number = ((AsyncFib)x).number + ((AsyncFib)y).number; } } static final class FailingAsyncFib extends BinaryAsyncAction { int number; public FailingAsyncFib(int n) { this.number = n; } public final boolean exec() { FailingAsyncFib f = this; int n = f.number; if (n > 1) { while (n > 1) { FailingAsyncFib p = f; FailingAsyncFib r = new FailingAsyncFib(n - 2); f = new FailingAsyncFib(--n); p.linkSubtasks(r, f); r.fork(); } f.number = n; } f.complete(); return false; } protected void onComplete(BinaryAsyncAction x, BinaryAsyncAction y) { completeExceptionally(new FJException()); } } /** * invoke returns when task completes normally. * isCompletedAbnormally and isCancelled return false for normally * completed tasks; getRawResult returns null. */ public void testInvoke() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertNull(f.invoke()); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * quietlyInvoke task returns when task completes normally. * isCompletedAbnormally and isCancelled return false for normally * completed tasks */ public void testQuietlyInvoke() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); f.quietlyInvoke(); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * join of a forked task returns when task completes */ public void testForkJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertNull(f.join()); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * get of a forked task returns when task completes */ public void testForkGet() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertNull(f.get()); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * timed get of a forked task returns when task completes */ public void testForkTimedGet() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertNull(f.get(LONG_DELAY_MS, MILLISECONDS)); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * timed get with null time unit throws NPE */ public void testForkTimedGetNPE() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); try { f.get(5L, null); shouldThrow(); } catch (NullPointerException success) {} }}; testInvokeOnPool(mainPool(), a); } /** * quietlyJoin of a forked task returns when task completes */ public void testForkQuietlyJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); f.quietlyJoin(); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * helpQuiesce returns when tasks are complete. * getQueuedTaskCount returns 0 when quiescent */ public void testForkHelpQuiesce() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); f.helpQuiesce(); assertEquals(21, f.number); assertEquals(0, getQueuedTaskCount()); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * invoke task throws exception when task completes abnormally */ public void testAbnormalInvoke() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib f = new FailingAsyncFib(8); try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); } /** * quietlyInvoke task returns when task completes abnormally */ public void testAbnormalQuietlyInvoke() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib f = new FailingAsyncFib(8); f.quietlyInvoke(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); }}; testInvokeOnPool(mainPool(), a); } /** * join of a forked task throws exception when task completes abnormally */ public void testAbnormalForkJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib f = new FailingAsyncFib(8); assertSame(f, f.fork()); try { f.join(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); } /** * get of a forked task throws exception when task completes abnormally */ public void testAbnormalForkGet() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { FailingAsyncFib f = new FailingAsyncFib(8); assertSame(f, f.fork()); try { f.get(); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } }}; testInvokeOnPool(mainPool(), a); } /** * timed get of a forked task throws exception when task completes abnormally */ public void testAbnormalForkTimedGet() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { FailingAsyncFib f = new FailingAsyncFib(8); assertSame(f, f.fork()); try { f.get(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } }}; testInvokeOnPool(mainPool(), a); } /** * quietlyJoin of a forked task returns when task completes abnormally */ public void testAbnormalForkQuietlyJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib f = new FailingAsyncFib(8); assertSame(f, f.fork()); f.quietlyJoin(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); }}; testInvokeOnPool(mainPool(), a); } /** * invoke task throws exception when task cancelled */ public void testCancelledInvoke() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertTrue(f.cancel(true)); try { f.invoke(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(mainPool(), a); } /** * join of a forked task throws exception when task cancelled */ public void testCancelledForkJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.join(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(mainPool(), a); } /** * get of a forked task throws exception when task cancelled */ public void testCancelledForkGet() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { AsyncFib f = new AsyncFib(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.get(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(mainPool(), a); } /** * timed get of a forked task throws exception when task cancelled */ public void testCancelledForkTimedGet() throws Exception { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { AsyncFib f = new AsyncFib(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.get(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(mainPool(), a); } /** * quietlyJoin of a forked task returns when task cancelled */ public void testCancelledForkQuietlyJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); f.quietlyJoin(); checkCancelled(f); }}; testInvokeOnPool(mainPool(), a); } /** * getPool of executing task returns its pool */ public void testGetPool() { final ForkJoinPool mainPool = mainPool(); RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { assertSame(mainPool, getPool()); }}; testInvokeOnPool(mainPool, a); } /** * getPool of non-FJ task returns null */ public void testGetPool2() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { assertNull(getPool()); }}; assertNull(a.invoke()); } /** * inForkJoinPool of executing task returns true */ public void testInForkJoinPool() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { assertTrue(inForkJoinPool()); }}; testInvokeOnPool(mainPool(), a); } /** * inForkJoinPool of non-FJ task returns false */ public void testInForkJoinPool2() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { assertFalse(inForkJoinPool()); }}; assertNull(a.invoke()); } /** * setRawResult(null) succeeds */ public void testSetRawResult() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { setRawResult(null); assertNull(getRawResult()); }}; assertNull(a.invoke()); } /** * invoke task throws exception after invoking completeExceptionally */ public void testCompleteExceptionally() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); f.completeExceptionally(new FJException()); try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(t1, t2) invokes all task arguments */ public void testInvokeAll2() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); AsyncFib g = new AsyncFib(9); invokeAll(f, g); assertEquals(21, f.number); assertEquals(34, g.number); checkCompletedNormally(f); checkCompletedNormally(g); }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(tasks) with 1 argument invokes task */ public void testInvokeAll1() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); invokeAll(f); checkCompletedNormally(f); assertEquals(21, f.number); }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(tasks) with > 2 argument invokes tasks */ public void testInvokeAll3() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); AsyncFib g = new AsyncFib(9); AsyncFib h = new AsyncFib(7); invokeAll(f, g, h); assertEquals(21, f.number); assertEquals(34, g.number); assertEquals(13, h.number); checkCompletedNormally(f); checkCompletedNormally(g); checkCompletedNormally(h); }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(collection) invokes all tasks in the collection */ public void testInvokeAllCollection() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); AsyncFib g = new AsyncFib(9); AsyncFib h = new AsyncFib(7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); invokeAll(set); assertEquals(21, f.number); assertEquals(34, g.number); assertEquals(13, h.number); checkCompletedNormally(f); checkCompletedNormally(g); checkCompletedNormally(h); }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(tasks) with any null task throws NPE */ public void testInvokeAllNPE() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); AsyncFib g = new AsyncFib(9); AsyncFib h = null; try { invokeAll(f, g, h); shouldThrow(); } catch (NullPointerException success) {} }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(t1, t2) throw exception if any task does */ public void testAbnormalInvokeAll2() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); FailingAsyncFib g = new FailingAsyncFib(9); try { invokeAll(f, g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(tasks) with 1 argument throws exception if task does */ public void testAbnormalInvokeAll1() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib g = new FailingAsyncFib(9); try { invokeAll(g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(tasks) with > 2 argument throws exception if any task does */ public void testAbnormalInvokeAll3() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); FailingAsyncFib g = new FailingAsyncFib(9); AsyncFib h = new AsyncFib(7); try { invokeAll(f, g, h); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(collection) throws exception if any task does */ public void testAbnormalInvokeAllCollection() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib f = new FailingAsyncFib(8); AsyncFib g = new AsyncFib(9); AsyncFib h = new AsyncFib(7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); try { invokeAll(set); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); } /** * tryUnfork returns true for most recent unexecuted task, * and suppresses execution */ public void testTryUnfork() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib g = new AsyncFib(9); assertSame(g, g.fork()); AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertTrue(f.tryUnfork()); helpQuiesce(); checkNotDone(f); checkCompletedNormally(g); }}; testInvokeOnPool(singletonPool(), a); } /** * getSurplusQueuedTaskCount returns > 0 when * there are more tasks than threads */ public void testGetSurplusQueuedTaskCount() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib h = new AsyncFib(7); assertSame(h, h.fork()); AsyncFib g = new AsyncFib(9); assertSame(g, g.fork()); AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertTrue(getSurplusQueuedTaskCount() > 0); helpQuiesce(); assertEquals(0, getSurplusQueuedTaskCount()); checkCompletedNormally(f); checkCompletedNormally(g); checkCompletedNormally(h); }}; testInvokeOnPool(singletonPool(), a); } /** * peekNextLocalTask returns most recent unexecuted task. */ public void testPeekNextLocalTask() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib g = new AsyncFib(9); assertSame(g, g.fork()); AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertSame(f, peekNextLocalTask()); assertNull(f.join()); checkCompletedNormally(f); helpQuiesce(); checkCompletedNormally(g); }}; testInvokeOnPool(singletonPool(), a); } /** * pollNextLocalTask returns most recent unexecuted task without * executing it */ public void testPollNextLocalTask() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib g = new AsyncFib(9); assertSame(g, g.fork()); AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertSame(f, pollNextLocalTask()); helpQuiesce(); checkNotDone(f); assertEquals(34, g.number); checkCompletedNormally(g); }}; testInvokeOnPool(singletonPool(), a); } /** * pollTask returns an unexecuted task without executing it */ public void testPollTask() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib g = new AsyncFib(9); assertSame(g, g.fork()); AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertSame(f, pollTask()); helpQuiesce(); checkNotDone(f); checkCompletedNormally(g); }}; testInvokeOnPool(singletonPool(), a); } /** * peekNextLocalTask returns least recent unexecuted task in async mode */ public void testPeekNextLocalTaskAsync() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib g = new AsyncFib(9); assertSame(g, g.fork()); AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertSame(g, peekNextLocalTask()); assertNull(f.join()); helpQuiesce(); checkCompletedNormally(f); assertEquals(34, g.number); checkCompletedNormally(g); }}; testInvokeOnPool(asyncSingletonPool(), a); } /** * pollNextLocalTask returns least recent unexecuted task without * executing it, in async mode */ public void testPollNextLocalTaskAsync() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib g = new AsyncFib(9); assertSame(g, g.fork()); AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertSame(g, pollNextLocalTask()); helpQuiesce(); assertEquals(21, f.number); checkCompletedNormally(f); checkNotDone(g); }}; testInvokeOnPool(asyncSingletonPool(), a); } /** * pollTask returns an unexecuted task without executing it, in * async mode */ public void testPollTaskAsync() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib g = new AsyncFib(9); assertSame(g, g.fork()); AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertSame(g, pollTask()); helpQuiesce(); assertEquals(21, f.number); checkCompletedNormally(f); checkNotDone(g); }}; testInvokeOnPool(asyncSingletonPool(), a); } // versions for singleton pools /** * invoke returns when task completes normally. * isCompletedAbnormally and isCancelled return false for normally * completed tasks; getRawResult returns null. */ public void testInvokeSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertNull(f.invoke()); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(singletonPool(), a); } /** * quietlyInvoke task returns when task completes normally. * isCompletedAbnormally and isCancelled return false for normally * completed tasks */ public void testQuietlyInvokeSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); f.quietlyInvoke(); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(singletonPool(), a); } /** * join of a forked task returns when task completes */ public void testForkJoinSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertNull(f.join()); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(singletonPool(), a); } /** * get of a forked task returns when task completes */ public void testForkGetSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertNull(f.get()); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(singletonPool(), a); } /** * timed get of a forked task returns when task completes */ public void testForkTimedGetSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); assertNull(f.get(LONG_DELAY_MS, MILLISECONDS)); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(singletonPool(), a); } /** * timed get with null time unit throws NPE */ public void testForkTimedGetNPESingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); try { f.get(5L, null); shouldThrow(); } catch (NullPointerException success) {} }}; testInvokeOnPool(singletonPool(), a); } /** * quietlyJoin of a forked task returns when task completes */ public void testForkQuietlyJoinSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); f.quietlyJoin(); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(singletonPool(), a); } /** * helpQuiesce returns when tasks are complete. * getQueuedTaskCount returns 0 when quiescent */ public void testForkHelpQuiesceSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); f.helpQuiesce(); assertEquals(0, getQueuedTaskCount()); assertEquals(21, f.number); checkCompletedNormally(f); }}; testInvokeOnPool(singletonPool(), a); } /** * invoke task throws exception when task completes abnormally */ public void testAbnormalInvokeSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib f = new FailingAsyncFib(8); try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(singletonPool(), a); } /** * quietlyInvoke task returns when task completes abnormally */ public void testAbnormalQuietlyInvokeSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib f = new FailingAsyncFib(8); f.quietlyInvoke(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); }}; testInvokeOnPool(singletonPool(), a); } /** * join of a forked task throws exception when task completes abnormally */ public void testAbnormalForkJoinSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib f = new FailingAsyncFib(8); assertSame(f, f.fork()); try { f.join(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(singletonPool(), a); } /** * get of a forked task throws exception when task completes abnormally */ public void testAbnormalForkGetSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { FailingAsyncFib f = new FailingAsyncFib(8); assertSame(f, f.fork()); try { f.get(); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } }}; testInvokeOnPool(singletonPool(), a); } /** * timed get of a forked task throws exception when task completes abnormally */ public void testAbnormalForkTimedGetSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { FailingAsyncFib f = new FailingAsyncFib(8); assertSame(f, f.fork()); try { f.get(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } }}; testInvokeOnPool(singletonPool(), a); } /** * quietlyJoin of a forked task returns when task completes abnormally */ public void testAbnormalForkQuietlyJoinSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib f = new FailingAsyncFib(8); assertSame(f, f.fork()); f.quietlyJoin(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); }}; testInvokeOnPool(singletonPool(), a); } /** * invoke task throws exception when task cancelled */ public void testCancelledInvokeSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertTrue(f.cancel(true)); try { f.invoke(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(singletonPool(), a); } /** * join of a forked task throws exception when task cancelled */ public void testCancelledForkJoinSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.join(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(singletonPool(), a); } /** * get of a forked task throws exception when task cancelled */ public void testCancelledForkGetSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { AsyncFib f = new AsyncFib(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.get(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(singletonPool(), a); } /** * timed get of a forked task throws exception when task cancelled */ public void testCancelledForkTimedGetSingleton() throws Exception { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { AsyncFib f = new AsyncFib(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.get(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(singletonPool(), a); } /** * quietlyJoin of a forked task returns when task cancelled */ public void testCancelledForkQuietlyJoinSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); f.quietlyJoin(); checkCancelled(f); }}; testInvokeOnPool(singletonPool(), a); } /** * invoke task throws exception after invoking completeExceptionally */ public void testCompleteExceptionallySingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); f.completeExceptionally(new FJException()); try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(singletonPool(), a); } /** * invokeAll(t1, t2) invokes all task arguments */ public void testInvokeAll2Singleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); AsyncFib g = new AsyncFib(9); invokeAll(f, g); assertEquals(21, f.number); assertEquals(34, g.number); checkCompletedNormally(f); checkCompletedNormally(g); }}; testInvokeOnPool(singletonPool(), a); } /** * invokeAll(tasks) with 1 argument invokes task */ public void testInvokeAll1Singleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); invokeAll(f); checkCompletedNormally(f); assertEquals(21, f.number); }}; testInvokeOnPool(singletonPool(), a); } /** * invokeAll(tasks) with > 2 argument invokes tasks */ public void testInvokeAll3Singleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); AsyncFib g = new AsyncFib(9); AsyncFib h = new AsyncFib(7); invokeAll(f, g, h); assertEquals(21, f.number); assertEquals(34, g.number); assertEquals(13, h.number); checkCompletedNormally(f); checkCompletedNormally(g); checkCompletedNormally(h); }}; testInvokeOnPool(singletonPool(), a); } /** * invokeAll(collection) invokes all tasks in the collection */ public void testInvokeAllCollectionSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); AsyncFib g = new AsyncFib(9); AsyncFib h = new AsyncFib(7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); invokeAll(set); assertEquals(21, f.number); assertEquals(34, g.number); assertEquals(13, h.number); checkCompletedNormally(f); checkCompletedNormally(g); checkCompletedNormally(h); }}; testInvokeOnPool(singletonPool(), a); } /** * invokeAll(tasks) with any null task throws NPE */ public void testInvokeAllNPESingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); AsyncFib g = new AsyncFib(9); AsyncFib h = null; try { invokeAll(f, g, h); shouldThrow(); } catch (NullPointerException success) {} }}; testInvokeOnPool(singletonPool(), a); } /** * invokeAll(t1, t2) throw exception if any task does */ public void testAbnormalInvokeAll2Singleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); FailingAsyncFib g = new FailingAsyncFib(9); try { invokeAll(f, g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(singletonPool(), a); } /** * invokeAll(tasks) with 1 argument throws exception if task does */ public void testAbnormalInvokeAll1Singleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib g = new FailingAsyncFib(9); try { invokeAll(g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(singletonPool(), a); } /** * invokeAll(tasks) with > 2 argument throws exception if any task does */ public void testAbnormalInvokeAll3Singleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { AsyncFib f = new AsyncFib(8); FailingAsyncFib g = new FailingAsyncFib(9); AsyncFib h = new AsyncFib(7); try { invokeAll(f, g, h); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(singletonPool(), a); } /** * invokeAll(collection) throws exception if any task does */ public void testAbnormalInvokeAllCollectionSingleton() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingAsyncFib f = new FailingAsyncFib(8); AsyncFib g = new AsyncFib(9); AsyncFib h = new AsyncFib(7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); try { invokeAll(set); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(singletonPool(), a); } } jsr166/src/test/tck/AtomicLongFieldUpdaterTest.java0000644000000000000000000002157011537741072017372 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import java.util.concurrent.atomic.*; import junit.framework.*; import java.util.*; public class AtomicLongFieldUpdaterTest extends JSR166TestCase { volatile long x = 0; int z; long w; public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AtomicLongFieldUpdaterTest.class); } /** * Construction with non-existent field throws RuntimeException */ public void testConstructor() { try { AtomicLongFieldUpdater a = AtomicLongFieldUpdater.newUpdater (AtomicLongFieldUpdaterTest.class, "y"); shouldThrow(); } catch (RuntimeException success) {} } /** * construction with field not of given type throws RuntimeException */ public void testConstructor2() { try { AtomicLongFieldUpdater a = AtomicLongFieldUpdater.newUpdater (AtomicLongFieldUpdaterTest.class, "z"); shouldThrow(); } catch (RuntimeException success) {} } /** * construction with non-volatile field throws RuntimeException */ public void testConstructor3() { try { AtomicLongFieldUpdater a = AtomicLongFieldUpdater.newUpdater (AtomicLongFieldUpdaterTest.class, "w"); shouldThrow(); } catch (RuntimeException success) {} } /** * get returns the last value set or assigned */ public void testGetSet() { AtomicLongFieldUpdater a; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.get(this)); a.set(this,2); assertEquals(2,a.get(this)); a.set(this,-3); assertEquals(-3,a.get(this)); } /** * get returns the last value lazySet by same thread */ public void testGetLazySet() { AtomicLongFieldUpdater a; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.get(this)); a.lazySet(this,2); assertEquals(2,a.get(this)); a.lazySet(this,-3); assertEquals(-3,a.get(this)); } /** * compareAndSet succeeds in changing value if equal to expected else fails */ public void testCompareAndSet() { AtomicLongFieldUpdater a; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertTrue(a.compareAndSet(this,1,2)); assertTrue(a.compareAndSet(this,2,-4)); assertEquals(-4,a.get(this)); assertFalse(a.compareAndSet(this,-5,7)); assertEquals(-4,a.get(this)); assertTrue(a.compareAndSet(this,-4,7)); assertEquals(7,a.get(this)); } /** * compareAndSet in one thread enables another waiting for value * to succeed */ public void testCompareAndSetInMultipleThreads() throws Exception { x = 1; final AtomicLongFieldUpdatera; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } Thread t = new Thread(new CheckedRunnable() { public void realRun() { while (!a.compareAndSet(AtomicLongFieldUpdaterTest.this, 2, 3)) Thread.yield(); }}); t.start(); assertTrue(a.compareAndSet(this, 1, 2)); t.join(LONG_DELAY_MS); assertFalse(t.isAlive()); assertEquals(a.get(this), 3); } /** * repeated weakCompareAndSet succeeds in changing value when equal * to expected */ public void testWeakCompareAndSet() { AtomicLongFieldUpdater a; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; while (!a.weakCompareAndSet(this,1,2)); while (!a.weakCompareAndSet(this,2,-4)); assertEquals(-4,a.get(this)); while (!a.weakCompareAndSet(this,-4,7)); assertEquals(7,a.get(this)); } /** * getAndSet returns previous value and sets to given value */ public void testGetAndSet() { AtomicLongFieldUpdater a; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.getAndSet(this, 0)); assertEquals(0,a.getAndSet(this,-10)); assertEquals(-10,a.getAndSet(this,1)); } /** * getAndAdd returns previous value and adds given value */ public void testGetAndAdd() { AtomicLongFieldUpdater a; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.getAndAdd(this,2)); assertEquals(3,a.get(this)); assertEquals(3,a.getAndAdd(this,-4)); assertEquals(-1,a.get(this)); } /** * getAndDecrement returns previous value and decrements */ public void testGetAndDecrement() { AtomicLongFieldUpdater a; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.getAndDecrement(this)); assertEquals(0,a.getAndDecrement(this)); assertEquals(-1,a.getAndDecrement(this)); } /** * getAndIncrement returns previous value and increments */ public void testGetAndIncrement() { AtomicLongFieldUpdater a; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(1,a.getAndIncrement(this)); assertEquals(2,a.get(this)); a.set(this,-2); assertEquals(-2,a.getAndIncrement(this)); assertEquals(-1,a.getAndIncrement(this)); assertEquals(0,a.getAndIncrement(this)); assertEquals(1,a.get(this)); } /** * addAndGet adds given value to current, and returns current value */ public void testAddAndGet() { AtomicLongFieldUpdater a; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(3,a.addAndGet(this,2)); assertEquals(3,a.get(this)); assertEquals(-1,a.addAndGet(this,-4)); assertEquals(-1,a.get(this)); } /** * decrementAndGet decrements and returns current value */ public void testDecrementAndGet() { AtomicLongFieldUpdater a; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(0,a.decrementAndGet(this)); assertEquals(-1,a.decrementAndGet(this)); assertEquals(-2,a.decrementAndGet(this)); assertEquals(-2,a.get(this)); } /** * incrementAndGet increments and returns current value */ public void testIncrementAndGet() { AtomicLongFieldUpdater a; try { a = AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdaterTest.class, "x"); } catch (RuntimeException ok) { return; } x = 1; assertEquals(2,a.incrementAndGet(this)); assertEquals(2,a.get(this)); a.set(this,-2); assertEquals(-1,a.incrementAndGet(this)); assertEquals(0,a.incrementAndGet(this)); assertEquals(1,a.incrementAndGet(this)); assertEquals(1,a.get(this)); } } jsr166/src/test/tck/AbstractQueuedSynchronizerTest.java0000644000000000000000000007762411561022501020374 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.concurrent.locks.*; import java.io.*; public class AbstractQueuedSynchronizerTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(AbstractQueuedSynchronizerTest.class); } /** * A simple mutex class, adapted from the * AbstractQueuedSynchronizer javadoc. Exclusive acquire tests * exercise this as a sample user extension. Other * methods/features of AbstractQueuedSynchronizerTest are tested * via other test classes, including those for ReentrantLock, * ReentrantReadWriteLock, and Semaphore */ static class Mutex extends AbstractQueuedSynchronizer { public boolean isHeldExclusively() { return getState() == 1; } public boolean tryAcquire(int acquires) { assertEquals(1, acquires); return compareAndSetState(0, 1); } public boolean tryRelease(int releases) { if (getState() == 0) throw new IllegalMonitorStateException(); setState(0); return true; } public AbstractQueuedSynchronizer.ConditionObject newCondition() { return new AbstractQueuedSynchronizer.ConditionObject(); } } /** * A simple latch class, to test shared mode. */ static class BooleanLatch extends AbstractQueuedSynchronizer { public boolean isSignalled() { return getState() != 0; } public int tryAcquireShared(int ignore) { return isSignalled() ? 1 : -1; } public boolean tryReleaseShared(int ignore) { setState(1); return true; } } /** * A runnable calling acquireInterruptibly that does not expect to * be interrupted. */ class InterruptibleSyncRunnable extends CheckedRunnable { final Mutex sync; InterruptibleSyncRunnable(Mutex l) { sync = l; } public void realRun() throws InterruptedException { sync.acquireInterruptibly(1); } } /** * A runnable calling acquireInterruptibly that expects to be * interrupted. */ class InterruptedSyncRunnable extends CheckedInterruptedRunnable { final Mutex sync; InterruptedSyncRunnable(Mutex l) { sync = l; } public void realRun() throws InterruptedException { sync.acquireInterruptibly(1); } } /** * isHeldExclusively is false upon construction */ public void testIsHeldExclusively() { Mutex rl = new Mutex(); assertFalse(rl.isHeldExclusively()); } /** * acquiring released sync succeeds */ public void testAcquire() { Mutex rl = new Mutex(); rl.acquire(1); assertTrue(rl.isHeldExclusively()); rl.release(1); assertFalse(rl.isHeldExclusively()); } /** * tryAcquire on an released sync succeeds */ public void testTryAcquire() { Mutex rl = new Mutex(); assertTrue(rl.tryAcquire(1)); assertTrue(rl.isHeldExclusively()); rl.release(1); } /** * hasQueuedThreads reports whether there are waiting threads */ public void testhasQueuedThreads() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertFalse(sync.hasQueuedThreads()); sync.acquire(1); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.hasQueuedThreads()); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.hasQueuedThreads()); t1.interrupt(); delay(SHORT_DELAY_MS); assertTrue(sync.hasQueuedThreads()); sync.release(1); delay(SHORT_DELAY_MS); assertFalse(sync.hasQueuedThreads()); t1.join(); t2.join(); } /** * isQueued(null) throws NPE */ public void testIsQueuedNPE() { final Mutex sync = new Mutex(); try { sync.isQueued(null); shouldThrow(); } catch (NullPointerException success) {} } /** * isQueued reports whether a thread is queued. */ public void testIsQueued() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertFalse(sync.isQueued(t1)); assertFalse(sync.isQueued(t2)); sync.acquire(1); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.isQueued(t1)); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.isQueued(t1)); assertTrue(sync.isQueued(t2)); t1.interrupt(); delay(SHORT_DELAY_MS); assertFalse(sync.isQueued(t1)); assertTrue(sync.isQueued(t2)); sync.release(1); delay(SHORT_DELAY_MS); assertFalse(sync.isQueued(t1)); delay(SHORT_DELAY_MS); assertFalse(sync.isQueued(t2)); t1.join(); t2.join(); } /** * getFirstQueuedThread returns first waiting thread or null if none */ public void testGetFirstQueuedThread() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertNull(sync.getFirstQueuedThread()); sync.acquire(1); t1.start(); delay(SHORT_DELAY_MS); assertEquals(t1, sync.getFirstQueuedThread()); t2.start(); delay(SHORT_DELAY_MS); assertEquals(t1, sync.getFirstQueuedThread()); t1.interrupt(); delay(SHORT_DELAY_MS); delay(SHORT_DELAY_MS); assertEquals(t2, sync.getFirstQueuedThread()); sync.release(1); delay(SHORT_DELAY_MS); assertNull(sync.getFirstQueuedThread()); t1.join(); t2.join(); } /** * hasContended reports false if no thread has ever blocked, else true */ public void testHasContended() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertFalse(sync.hasContended()); sync.acquire(1); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); t1.interrupt(); delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); sync.release(1); delay(SHORT_DELAY_MS); assertTrue(sync.hasContended()); t1.join(); t2.join(); } /** * getQueuedThreads includes waiting threads */ public void testGetQueuedThreads() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertTrue(sync.getQueuedThreads().isEmpty()); sync.acquire(1); assertTrue(sync.getQueuedThreads().isEmpty()); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getQueuedThreads().contains(t1)); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getQueuedThreads().contains(t1)); assertTrue(sync.getQueuedThreads().contains(t2)); t1.interrupt(); delay(SHORT_DELAY_MS); assertFalse(sync.getQueuedThreads().contains(t1)); assertTrue(sync.getQueuedThreads().contains(t2)); sync.release(1); delay(SHORT_DELAY_MS); assertTrue(sync.getQueuedThreads().isEmpty()); t1.join(); t2.join(); } /** * getExclusiveQueuedThreads includes waiting threads */ public void testGetExclusiveQueuedThreads() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertTrue(sync.getExclusiveQueuedThreads().isEmpty()); sync.acquire(1); assertTrue(sync.getExclusiveQueuedThreads().isEmpty()); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getExclusiveQueuedThreads().contains(t1)); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getExclusiveQueuedThreads().contains(t1)); assertTrue(sync.getExclusiveQueuedThreads().contains(t2)); t1.interrupt(); delay(SHORT_DELAY_MS); assertFalse(sync.getExclusiveQueuedThreads().contains(t1)); assertTrue(sync.getExclusiveQueuedThreads().contains(t2)); sync.release(1); delay(SHORT_DELAY_MS); assertTrue(sync.getExclusiveQueuedThreads().isEmpty()); t1.join(); t2.join(); } /** * getSharedQueuedThreads does not include exclusively waiting threads */ public void testGetSharedQueuedThreads() throws InterruptedException { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); assertTrue(sync.getSharedQueuedThreads().isEmpty()); sync.acquire(1); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t1.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t2.start(); delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t1.interrupt(); delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); sync.release(1); delay(SHORT_DELAY_MS); assertTrue(sync.getSharedQueuedThreads().isEmpty()); t1.join(); t2.join(); } /** * tryAcquireNanos is interruptible. */ public void testInterruptedException2() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { sync.tryAcquireNanos(1, MILLISECONDS.toNanos(MEDIUM_DELAY_MS)); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } /** * TryAcquire on exclusively held sync fails */ public void testTryAcquireWhenSynced() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new CheckedRunnable() { public void realRun() { assertFalse(sync.tryAcquire(1)); }}); t.start(); t.join(); sync.release(1); } /** * tryAcquireNanos on an exclusively held sync times out */ public void testAcquireNanos_Timeout() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { long nanos = MILLISECONDS.toNanos(SHORT_DELAY_MS); assertFalse(sync.tryAcquireNanos(1, nanos)); }}); t.start(); t.join(); sync.release(1); } /** * getState is true when acquired and false when not */ public void testGetState() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquire(1); assertTrue(sync.isHeldExclusively()); sync.release(1); assertFalse(sync.isHeldExclusively()); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); delay(SMALL_DELAY_MS); sync.release(1); }}); t.start(); delay(SHORT_DELAY_MS); assertTrue(sync.isHeldExclusively()); t.join(); assertFalse(sync.isHeldExclusively()); } /** * acquireInterruptibly is interruptible. */ public void testAcquireInterruptibly1() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new InterruptedSyncRunnable(sync)); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); delay(SHORT_DELAY_MS); sync.release(1); t.join(); } /** * acquireInterruptibly succeeds when released, else is interruptible */ public void testAcquireInterruptibly2() throws InterruptedException { final Mutex sync = new Mutex(); sync.acquireInterruptibly(1); Thread t = new Thread(new InterruptedSyncRunnable(sync)); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); assertTrue(sync.isHeldExclusively()); t.join(); } /** * owns is true for a condition created by sync else false */ public void testOwns() { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); final Mutex sync2 = new Mutex(); assertTrue(sync.owns(c)); assertFalse(sync2.owns(c)); } /** * Calling await without holding sync throws IllegalMonitorStateException */ public void testAwait_IllegalMonitor() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); try { c.await(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * Calling signal without holding sync throws IllegalMonitorStateException */ public void testSignal_IllegalMonitor() { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); try { c.signal(); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * awaitNanos without a signal times out */ public void testAwaitNanos_Timeout() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); sync.acquire(1); long t = c.awaitNanos(100); assertTrue(t <= 0); sync.release(1); } /** * Timed await without a signal times out */ public void testAwait_Timeout() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); sync.acquire(1); assertFalse(c.await(SHORT_DELAY_MS, MILLISECONDS)); sync.release(1); } /** * awaitUntil without a signal times out */ public void testAwaitUntil_Timeout() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); sync.acquire(1); java.util.Date d = new java.util.Date(); assertFalse(c.awaitUntil(new java.util.Date(d.getTime() + 10))); sync.release(1); } /** * await returns when signalled */ public void testAwait() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); c.await(); sync.release(1); }}); t.start(); delay(SHORT_DELAY_MS); sync.acquire(1); c.signal(); sync.release(1); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * hasWaiters throws NPE if null */ public void testHasWaitersNPE() { final Mutex sync = new Mutex(); try { sync.hasWaiters(null); shouldThrow(); } catch (NullPointerException success) {} } /** * getWaitQueueLength throws NPE if null */ public void testGetWaitQueueLengthNPE() { final Mutex sync = new Mutex(); try { sync.getWaitQueueLength(null); shouldThrow(); } catch (NullPointerException success) {} } /** * getWaitingThreads throws NPE if null */ public void testGetWaitingThreadsNPE() { final Mutex sync = new Mutex(); try { sync.getWaitingThreads(null); shouldThrow(); } catch (NullPointerException success) {} } /** * hasWaiters throws IAE if not owned */ public void testHasWaitersIAE() { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); final Mutex sync2 = new Mutex(); try { sync2.hasWaiters(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * hasWaiters throws IMSE if not synced */ public void testHasWaitersIMSE() { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); try { sync.hasWaiters(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * getWaitQueueLength throws IAE if not owned */ public void testGetWaitQueueLengthIAE() { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); final Mutex sync2 = new Mutex(); try { sync2.getWaitQueueLength(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * getWaitQueueLength throws IMSE if not synced */ public void testGetWaitQueueLengthIMSE() { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); try { sync.getWaitQueueLength(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * getWaitingThreads throws IAE if not owned */ public void testGetWaitingThreadsIAE() { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); final Mutex sync2 = new Mutex(); try { sync2.getWaitingThreads(c); shouldThrow(); } catch (IllegalArgumentException success) {} } /** * getWaitingThreads throws IMSE if not synced */ public void testGetWaitingThreadsIMSE() { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); try { sync.getWaitingThreads(c); shouldThrow(); } catch (IllegalMonitorStateException success) {} } /** * hasWaiters returns true when a thread is waiting, else false */ public void testHasWaiters() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertEquals(0, sync.getWaitQueueLength(c)); c.await(); sync.release(1); }}); t.start(); delay(SHORT_DELAY_MS); sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertEquals(1, sync.getWaitQueueLength(c)); c.signal(); sync.release(1); delay(SHORT_DELAY_MS); sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertEquals(0, sync.getWaitQueueLength(c)); sync.release(1); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * getWaitQueueLength returns number of waiting threads */ public void testGetWaitQueueLength() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertEquals(0, sync.getWaitQueueLength(c)); c.await(); sync.release(1); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertEquals(1, sync.getWaitQueueLength(c)); c.await(); sync.release(1); }}); t1.start(); delay(SHORT_DELAY_MS); t2.start(); delay(SHORT_DELAY_MS); sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertEquals(2, sync.getWaitQueueLength(c)); c.signalAll(); sync.release(1); delay(SHORT_DELAY_MS); sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertEquals(0, sync.getWaitQueueLength(c)); sync.release(1); t1.join(SHORT_DELAY_MS); t2.join(SHORT_DELAY_MS); assertFalse(t1.isAlive()); assertFalse(t2.isAlive()); } /** * getWaitingThreads returns only and all waiting threads */ public void testGetWaitingThreads() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); assertTrue(sync.getWaitingThreads(c).isEmpty()); c.await(); sync.release(1); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); assertFalse(sync.getWaitingThreads(c).isEmpty()); c.await(); sync.release(1); }}); sync.acquire(1); assertTrue(sync.getWaitingThreads(c).isEmpty()); sync.release(1); t1.start(); delay(SHORT_DELAY_MS); t2.start(); delay(SHORT_DELAY_MS); sync.acquire(1); assertTrue(sync.hasWaiters(c)); assertTrue(sync.getWaitingThreads(c).contains(t1)); assertTrue(sync.getWaitingThreads(c).contains(t2)); c.signalAll(); sync.release(1); delay(SHORT_DELAY_MS); sync.acquire(1); assertFalse(sync.hasWaiters(c)); assertTrue(sync.getWaitingThreads(c).isEmpty()); sync.release(1); t1.join(SHORT_DELAY_MS); t2.join(SHORT_DELAY_MS); assertFalse(t1.isAlive()); assertFalse(t2.isAlive()); } /** * awaitUninterruptibly doesn't abort on interrupt */ public void testAwaitUninterruptibly() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedRunnable() { public void realRun() { sync.acquire(1); c.awaitUninterruptibly(); sync.release(1); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); sync.acquire(1); c.signal(); sync.release(1); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * await is interruptible */ public void testAwait_Interrupt() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); c.await(); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * awaitNanos is interruptible */ public void testAwaitNanos_Interrupt() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); c.awaitNanos(MILLISECONDS.toNanos(LONG_DELAY_MS)); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * awaitUntil is interruptible */ public void testAwaitUntil_Interrupt() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); java.util.Date d = new java.util.Date(); c.awaitUntil(new java.util.Date(d.getTime() + 10000)); }}); t.start(); delay(SHORT_DELAY_MS); t.interrupt(); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } /** * signalAll wakes up all threads */ public void testSignalAll() throws InterruptedException { final Mutex sync = new Mutex(); final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); Thread t1 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); c.await(); sync.release(1); }}); Thread t2 = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { sync.acquire(1); c.await(); sync.release(1); }}); t1.start(); t2.start(); delay(SHORT_DELAY_MS); sync.acquire(1); c.signalAll(); sync.release(1); t1.join(SHORT_DELAY_MS); t2.join(SHORT_DELAY_MS); assertFalse(t1.isAlive()); assertFalse(t2.isAlive()); } /** * toString indicates current state */ public void testToString() { Mutex sync = new Mutex(); String us = sync.toString(); assertTrue(us.indexOf("State = 0") >= 0); sync.acquire(1); String ls = sync.toString(); assertTrue(ls.indexOf("State = 1") >= 0); } /** * A serialized AQS deserializes with current state */ public void testSerialization() throws Exception { Mutex l = new Mutex(); l.acquire(1); assertTrue(l.isHeldExclusively()); ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); out.writeObject(l); out.close(); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); Mutex r = (Mutex) in.readObject(); assertTrue(r.isHeldExclusively()); } /** * tryReleaseShared setting state changes getState */ public void testGetStateWithReleaseShared() { final BooleanLatch l = new BooleanLatch(); assertFalse(l.isSignalled()); l.releaseShared(0); assertTrue(l.isSignalled()); } /** * releaseShared has no effect when already signalled */ public void testReleaseShared() { final BooleanLatch l = new BooleanLatch(); assertFalse(l.isSignalled()); l.releaseShared(0); assertTrue(l.isSignalled()); l.releaseShared(0); assertTrue(l.isSignalled()); } /** * acquireSharedInterruptibly returns after release, but not before */ public void testAcquireSharedInterruptibly() throws InterruptedException { final BooleanLatch l = new BooleanLatch(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(l.isSignalled()); l.acquireSharedInterruptibly(0); assertTrue(l.isSignalled()); }}); t.start(); assertFalse(l.isSignalled()); delay(SHORT_DELAY_MS); l.releaseShared(0); assertTrue(l.isSignalled()); t.join(); } /** * acquireSharedTimed returns after release */ public void testAcquireSharedTimed() throws InterruptedException { final BooleanLatch l = new BooleanLatch(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(l.isSignalled()); long nanos = MILLISECONDS.toNanos(MEDIUM_DELAY_MS); assertTrue(l.tryAcquireSharedNanos(0, nanos)); assertTrue(l.isSignalled()); }}); t.start(); assertFalse(l.isSignalled()); delay(SHORT_DELAY_MS); l.releaseShared(0); assertTrue(l.isSignalled()); t.join(); } /** * acquireSharedInterruptibly throws IE if interrupted before released */ public void testAcquireSharedInterruptibly_InterruptedException() throws InterruptedException { final BooleanLatch l = new BooleanLatch(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { assertFalse(l.isSignalled()); l.acquireSharedInterruptibly(0); }}); t.start(); assertFalse(l.isSignalled()); t.interrupt(); t.join(); } /** * acquireSharedTimed throws IE if interrupted before released */ public void testAcquireSharedNanos_InterruptedException() throws InterruptedException { final BooleanLatch l = new BooleanLatch(); Thread t = new Thread(new CheckedInterruptedRunnable() { public void realRun() throws InterruptedException { assertFalse(l.isSignalled()); long nanos = MILLISECONDS.toNanos(SMALL_DELAY_MS); l.tryAcquireSharedNanos(0, nanos); }}); t.start(); delay(SHORT_DELAY_MS); assertFalse(l.isSignalled()); t.interrupt(); t.join(); } /** * acquireSharedTimed times out if not released before timeout */ public void testAcquireSharedNanos_Timeout() throws InterruptedException { final BooleanLatch l = new BooleanLatch(); Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { assertFalse(l.isSignalled()); long nanos = MILLISECONDS.toNanos(SMALL_DELAY_MS); assertFalse(l.tryAcquireSharedNanos(0, nanos)); }}); t.start(); delay(SHORT_DELAY_MS); assertFalse(l.isSignalled()); t.join(); } } jsr166/src/test/tck/RecursiveActionTest.java0000644000000000000000000011613511537741073016155 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import junit.framework.*; import java.util.concurrent.CancellationException; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ExecutionException; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.ForkJoinWorkerThread; import java.util.concurrent.RecursiveAction; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import static java.util.concurrent.TimeUnit.SECONDS; import java.util.HashSet; public class RecursiveActionTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(RecursiveActionTest.class); } private static ForkJoinPool mainPool() { return new ForkJoinPool(); } private static ForkJoinPool singletonPool() { return new ForkJoinPool(1); } private static ForkJoinPool asyncSingletonPool() { return new ForkJoinPool(1, ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true); } private void testInvokeOnPool(ForkJoinPool pool, RecursiveAction a) { try { checkNotDone(a); assertNull(pool.invoke(a)); checkCompletedNormally(a); } finally { joinPool(pool); } } void checkNotDone(RecursiveAction a) { assertFalse(a.isDone()); assertFalse(a.isCompletedNormally()); assertFalse(a.isCompletedAbnormally()); assertFalse(a.isCancelled()); assertNull(a.getException()); assertNull(a.getRawResult()); if (! ForkJoinTask.inForkJoinPool()) { Thread.currentThread().interrupt(); try { a.get(); shouldThrow(); } catch (InterruptedException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } Thread.currentThread().interrupt(); try { a.get(5L, SECONDS); shouldThrow(); } catch (InterruptedException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } } try { a.get(0L, SECONDS); shouldThrow(); } catch (TimeoutException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } } void checkCompletedNormally(RecursiveAction a) { assertTrue(a.isDone()); assertFalse(a.isCancelled()); assertTrue(a.isCompletedNormally()); assertFalse(a.isCompletedAbnormally()); assertNull(a.getException()); assertNull(a.getRawResult()); assertNull(a.join()); assertFalse(a.cancel(false)); assertFalse(a.cancel(true)); try { assertNull(a.get()); } catch (Throwable fail) { threadUnexpectedException(fail); } try { assertNull(a.get(5L, SECONDS)); } catch (Throwable fail) { threadUnexpectedException(fail); } } void checkCancelled(RecursiveAction a) { assertTrue(a.isDone()); assertTrue(a.isCancelled()); assertFalse(a.isCompletedNormally()); assertTrue(a.isCompletedAbnormally()); assertTrue(a.getException() instanceof CancellationException); assertNull(a.getRawResult()); try { a.join(); shouldThrow(); } catch (CancellationException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } try { a.get(); shouldThrow(); } catch (CancellationException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } try { a.get(5L, SECONDS); shouldThrow(); } catch (CancellationException success) { } catch (Throwable fail) { threadUnexpectedException(fail); } } void checkCompletedAbnormally(RecursiveAction a, Throwable t) { assertTrue(a.isDone()); assertFalse(a.isCancelled()); assertFalse(a.isCompletedNormally()); assertTrue(a.isCompletedAbnormally()); assertSame(t.getClass(), a.getException().getClass()); assertNull(a.getRawResult()); assertFalse(a.cancel(false)); assertFalse(a.cancel(true)); try { a.join(); shouldThrow(); } catch (Throwable expected) { assertSame(expected.getClass(), t.getClass()); } try { a.get(); shouldThrow(); } catch (ExecutionException success) { assertSame(t.getClass(), success.getCause().getClass()); } catch (Throwable fail) { threadUnexpectedException(fail); } try { a.get(5L, SECONDS); shouldThrow(); } catch (ExecutionException success) { assertSame(t.getClass(), success.getCause().getClass()); } catch (Throwable fail) { threadUnexpectedException(fail); } } public static final class FJException extends RuntimeException { public FJException() { super(); } public FJException(Throwable cause) { super(cause); } } // A simple recursive action for testing final class FibAction extends CheckedRecursiveAction { final int number; int result; FibAction(int n) { number = n; } public void realCompute() { int n = number; if (n <= 1) result = n; else { FibAction f1 = new FibAction(n - 1); FibAction f2 = new FibAction(n - 2); invokeAll(f1, f2); result = f1.result + f2.result; } } } // A recursive action failing in base case static final class FailingFibAction extends RecursiveAction { final int number; int result; FailingFibAction(int n) { number = n; } public void compute() { int n = number; if (n <= 1) throw new FJException(); else { FailingFibAction f1 = new FailingFibAction(n - 1); FailingFibAction f2 = new FailingFibAction(n - 2); invokeAll(f1, f2); result = f1.result + f2.result; } } } /** * invoke returns when task completes normally. * isCompletedAbnormally and isCancelled return false for normally * completed tasks. getRawResult of a RecursiveAction returns null; */ public void testInvoke() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); assertNull(f.invoke()); assertEquals(21, f.result); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * quietlyInvoke task returns when task completes normally. * isCompletedAbnormally and isCancelled return false for normally * completed tasks */ public void testQuietlyInvoke() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); f.quietlyInvoke(); assertEquals(21, f.result); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * join of a forked task returns when task completes */ public void testForkJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); assertSame(f, f.fork()); assertNull(f.join()); assertEquals(21, f.result); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * join/quietlyJoin of a forked task succeeds in the presence of interrupts */ public void testJoinIgnoresInterrupts() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); final Thread myself = Thread.currentThread(); // test join() assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); assertNull(f.join()); Thread.interrupted(); assertEquals(21, f.result); checkCompletedNormally(f); f.reinitialize(); f.cancel(true); assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); try { f.join(); shouldThrow(); } catch (CancellationException success) { Thread.interrupted(); checkCancelled(f); } f.reinitialize(); f.completeExceptionally(new FJException()); assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); try { f.join(); shouldThrow(); } catch (FJException success) { Thread.interrupted(); checkCompletedAbnormally(f, success); } // test quietlyJoin() f.reinitialize(); assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); f.quietlyJoin(); Thread.interrupted(); assertEquals(21, f.result); checkCompletedNormally(f); f.reinitialize(); f.cancel(true); assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); f.quietlyJoin(); Thread.interrupted(); checkCancelled(f); f.reinitialize(); f.completeExceptionally(new FJException()); assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); f.quietlyJoin(); Thread.interrupted(); checkCompletedAbnormally(f, f.getException()); }}; testInvokeOnPool(mainPool(), a); a.reinitialize(); testInvokeOnPool(singletonPool(), a); } /** * join/quietlyJoin of a forked task when not in ForkJoinPool * succeeds in the presence of interrupts */ public void testJoinIgnoresInterruptsOutsideForkJoinPool() { final SynchronousQueue sq = new SynchronousQueue(); RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws InterruptedException { FibAction[] fibActions = new FibAction[6]; for (int i = 0; i < fibActions.length; i++) fibActions[i] = new FibAction(8); fibActions[1].cancel(false); fibActions[2].completeExceptionally(new FJException()); fibActions[4].cancel(true); fibActions[5].completeExceptionally(new FJException()); for (int i = 0; i < fibActions.length; i++) fibActions[i].fork(); sq.put(fibActions); helpQuiesce(); }}; Runnable r = new CheckedRunnable() { public void realRun() throws InterruptedException { FibAction[] fibActions = sq.take(); FibAction f; final Thread myself = Thread.currentThread(); // test join() ------------ f = fibActions[0]; assertFalse(ForkJoinTask.inForkJoinPool()); myself.interrupt(); assertTrue(myself.isInterrupted()); assertNull(f.join()); assertTrue(Thread.interrupted()); assertEquals(21, f.result); checkCompletedNormally(f); f = fibActions[1]; myself.interrupt(); assertTrue(myself.isInterrupted()); try { f.join(); shouldThrow(); } catch (CancellationException success) { assertTrue(Thread.interrupted()); checkCancelled(f); } f = fibActions[2]; myself.interrupt(); assertTrue(myself.isInterrupted()); try { f.join(); shouldThrow(); } catch (FJException success) { assertTrue(Thread.interrupted()); checkCompletedAbnormally(f, success); } // test quietlyJoin() --------- f = fibActions[3]; myself.interrupt(); assertTrue(myself.isInterrupted()); f.quietlyJoin(); assertTrue(Thread.interrupted()); assertEquals(21, f.result); checkCompletedNormally(f); f = fibActions[4]; myself.interrupt(); assertTrue(myself.isInterrupted()); f.quietlyJoin(); assertTrue(Thread.interrupted()); checkCancelled(f); f = fibActions[5]; myself.interrupt(); assertTrue(myself.isInterrupted()); f.quietlyJoin(); assertTrue(Thread.interrupted()); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); }}; Thread t; t = newStartedThread(r); testInvokeOnPool(mainPool(), a); awaitTermination(t, LONG_DELAY_MS); a.reinitialize(); t = newStartedThread(r); testInvokeOnPool(singletonPool(), a); awaitTermination(t, LONG_DELAY_MS); } /** * get of a forked task returns when task completes */ public void testForkGet() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { FibAction f = new FibAction(8); assertSame(f, f.fork()); assertNull(f.get()); assertEquals(21, f.result); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * timed get of a forked task returns when task completes */ public void testForkTimedGet() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { FibAction f = new FibAction(8); assertSame(f, f.fork()); assertNull(f.get(5L, SECONDS)); assertEquals(21, f.result); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * timed get with null time unit throws NPE */ public void testForkTimedGetNPE() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { FibAction f = new FibAction(8); assertSame(f, f.fork()); try { f.get(5L, null); shouldThrow(); } catch (NullPointerException success) {} }}; testInvokeOnPool(mainPool(), a); } /** * quietlyJoin of a forked task returns when task completes */ public void testForkQuietlyJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); assertSame(f, f.fork()); f.quietlyJoin(); assertEquals(21, f.result); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * helpQuiesce returns when tasks are complete. * getQueuedTaskCount returns 0 when quiescent */ public void testForkHelpQuiesce() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); assertSame(f, f.fork()); f.helpQuiesce(); assertEquals(21, f.result); assertEquals(0, getQueuedTaskCount()); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * invoke task throws exception when task completes abnormally */ public void testAbnormalInvoke() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingFibAction f = new FailingFibAction(8); try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); } /** * quietlyInvoke task returns when task completes abnormally */ public void testAbnormalQuietlyInvoke() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingFibAction f = new FailingFibAction(8); f.quietlyInvoke(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); }}; testInvokeOnPool(mainPool(), a); } /** * join of a forked task throws exception when task completes abnormally */ public void testAbnormalForkJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingFibAction f = new FailingFibAction(8); assertSame(f, f.fork()); try { f.join(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); } /** * get of a forked task throws exception when task completes abnormally */ public void testAbnormalForkGet() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { FailingFibAction f = new FailingFibAction(8); assertSame(f, f.fork()); try { f.get(); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } }}; testInvokeOnPool(mainPool(), a); } /** * timed get of a forked task throws exception when task completes abnormally */ public void testAbnormalForkTimedGet() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { FailingFibAction f = new FailingFibAction(8); assertSame(f, f.fork()); try { f.get(5L, TimeUnit.SECONDS); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } }}; testInvokeOnPool(mainPool(), a); } /** * quietlyJoin of a forked task returns when task completes abnormally */ public void testAbnormalForkQuietlyJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingFibAction f = new FailingFibAction(8); assertSame(f, f.fork()); f.quietlyJoin(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); }}; testInvokeOnPool(mainPool(), a); } /** * invoke task throws exception when task cancelled */ public void testCancelledInvoke() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); assertTrue(f.cancel(true)); try { f.invoke(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(mainPool(), a); } /** * join of a forked task throws exception when task cancelled */ public void testCancelledForkJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.join(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(mainPool(), a); } /** * get of a forked task throws exception when task cancelled */ public void testCancelledForkGet() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { FibAction f = new FibAction(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.get(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(mainPool(), a); } /** * timed get of a forked task throws exception when task cancelled */ public void testCancelledForkTimedGet() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() throws Exception { FibAction f = new FibAction(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.get(5L, SECONDS); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; testInvokeOnPool(mainPool(), a); } /** * quietlyJoin of a forked task returns when task cancelled */ public void testCancelledForkQuietlyJoin() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); f.quietlyJoin(); checkCancelled(f); }}; testInvokeOnPool(mainPool(), a); } /** * getPool of executing task returns its pool */ public void testGetPool() { final ForkJoinPool mainPool = mainPool(); RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { assertSame(mainPool, getPool()); }}; testInvokeOnPool(mainPool, a); } /** * getPool of non-FJ task returns null */ public void testGetPool2() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { assertNull(getPool()); }}; assertNull(a.invoke()); } /** * inForkJoinPool of executing task returns true */ public void testInForkJoinPool() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { assertTrue(inForkJoinPool()); }}; testInvokeOnPool(mainPool(), a); } /** * inForkJoinPool of non-FJ task returns false */ public void testInForkJoinPool2() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { assertFalse(inForkJoinPool()); }}; assertNull(a.invoke()); } /** * getPool of current thread in pool returns its pool */ public void testWorkerGetPool() { final ForkJoinPool mainPool = mainPool(); RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { ForkJoinWorkerThread w = (ForkJoinWorkerThread) Thread.currentThread(); assertSame(mainPool, w.getPool()); }}; testInvokeOnPool(mainPool, a); } /** * getPoolIndex of current thread in pool returns 0 <= value < poolSize */ public void testWorkerGetPoolIndex() { final ForkJoinPool mainPool = mainPool(); RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { ForkJoinWorkerThread w = (ForkJoinWorkerThread) Thread.currentThread(); assertTrue(w.getPoolIndex() >= 0); // pool size can shrink after assigning index, so cannot check // assertTrue(w.getPoolIndex() < mainPool.getPoolSize()); }}; testInvokeOnPool(mainPool, a); } /** * setRawResult(null) succeeds */ public void testSetRawResult() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { setRawResult(null); assertNull(getRawResult()); }}; assertNull(a.invoke()); } /** * A reinitialized task may be re-invoked */ public void testReinitialize() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); checkNotDone(f); for (int i = 0; i < 3; i++) { assertNull(f.invoke()); assertEquals(21, f.result); checkCompletedNormally(f); f.reinitialize(); checkNotDone(f); } }}; testInvokeOnPool(mainPool(), a); } /** * invoke task throws exception after invoking completeExceptionally */ public void testCompleteExceptionally() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); f.completeExceptionally(new FJException()); try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); } /** * invoke task suppresses execution invoking complete */ public void testComplete() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); f.complete(null); assertNull(f.invoke()); assertEquals(0, f.result); checkCompletedNormally(f); }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(t1, t2) invokes all task arguments */ public void testInvokeAll2() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); FibAction g = new FibAction(9); invokeAll(f, g); checkCompletedNormally(f); assertEquals(21, f.result); checkCompletedNormally(g); assertEquals(34, g.result); }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(tasks) with 1 argument invokes task */ public void testInvokeAll1() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); invokeAll(f); checkCompletedNormally(f); assertEquals(21, f.result); }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(tasks) with > 2 argument invokes tasks */ public void testInvokeAll3() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); FibAction g = new FibAction(9); FibAction h = new FibAction(7); invokeAll(f, g, h); assertTrue(f.isDone()); assertTrue(g.isDone()); assertTrue(h.isDone()); checkCompletedNormally(f); assertEquals(21, f.result); checkCompletedNormally(g); assertEquals(34, g.result); checkCompletedNormally(g); assertEquals(13, h.result); }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(collection) invokes all tasks in the collection */ public void testInvokeAllCollection() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); FibAction g = new FibAction(9); FibAction h = new FibAction(7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); invokeAll(set); assertTrue(f.isDone()); assertTrue(g.isDone()); assertTrue(h.isDone()); checkCompletedNormally(f); assertEquals(21, f.result); checkCompletedNormally(g); assertEquals(34, g.result); checkCompletedNormally(g); assertEquals(13, h.result); }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(tasks) with any null task throws NPE */ public void testInvokeAllNPE() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); FibAction g = new FibAction(9); FibAction h = null; try { invokeAll(f, g, h); shouldThrow(); } catch (NullPointerException success) {} }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(t1, t2) throw exception if any task does */ public void testAbnormalInvokeAll2() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); FailingFibAction g = new FailingFibAction(9); try { invokeAll(f, g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(tasks) with 1 argument throws exception if task does */ public void testAbnormalInvokeAll1() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingFibAction g = new FailingFibAction(9); try { invokeAll(g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(tasks) with > 2 argument throws exception if any task does */ public void testAbnormalInvokeAll3() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction f = new FibAction(8); FailingFibAction g = new FailingFibAction(9); FibAction h = new FibAction(7); try { invokeAll(f, g, h); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(mainPool(), a); } /** * invokeAll(collection) throws exception if any task does */ public void testAbnormalInvokeAllCollection() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FailingFibAction f = new FailingFibAction(8); FibAction g = new FibAction(9); FibAction h = new FibAction(7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); try { invokeAll(set); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); } /** * tryUnfork returns true for most recent unexecuted task, * and suppresses execution */ public void testTryUnfork() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction g = new FibAction(9); assertSame(g, g.fork()); FibAction f = new FibAction(8); assertSame(f, f.fork()); assertTrue(f.tryUnfork()); helpQuiesce(); checkNotDone(f); checkCompletedNormally(g); }}; testInvokeOnPool(singletonPool(), a); } /** * getSurplusQueuedTaskCount returns > 0 when * there are more tasks than threads */ public void testGetSurplusQueuedTaskCount() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction h = new FibAction(7); assertSame(h, h.fork()); FibAction g = new FibAction(9); assertSame(g, g.fork()); FibAction f = new FibAction(8); assertSame(f, f.fork()); assertTrue(getSurplusQueuedTaskCount() > 0); helpQuiesce(); assertEquals(0, getSurplusQueuedTaskCount()); checkCompletedNormally(f); checkCompletedNormally(g); checkCompletedNormally(h); }}; testInvokeOnPool(singletonPool(), a); } /** * peekNextLocalTask returns most recent unexecuted task. */ public void testPeekNextLocalTask() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction g = new FibAction(9); assertSame(g, g.fork()); FibAction f = new FibAction(8); assertSame(f, f.fork()); assertSame(f, peekNextLocalTask()); assertNull(f.join()); checkCompletedNormally(f); helpQuiesce(); checkCompletedNormally(f); checkCompletedNormally(g); }}; testInvokeOnPool(singletonPool(), a); } /** * pollNextLocalTask returns most recent unexecuted task * without executing it */ public void testPollNextLocalTask() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction g = new FibAction(9); assertSame(g, g.fork()); FibAction f = new FibAction(8); assertSame(f, f.fork()); assertSame(f, pollNextLocalTask()); helpQuiesce(); checkNotDone(f); checkCompletedNormally(g); }}; testInvokeOnPool(singletonPool(), a); } /** * pollTask returns an unexecuted task without executing it */ public void testPollTask() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction g = new FibAction(9); assertSame(g, g.fork()); FibAction f = new FibAction(8); assertSame(f, f.fork()); assertSame(f, pollTask()); helpQuiesce(); checkNotDone(f); checkCompletedNormally(g); }}; testInvokeOnPool(singletonPool(), a); } /** * peekNextLocalTask returns least recent unexecuted task in async mode */ public void testPeekNextLocalTaskAsync() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction g = new FibAction(9); assertSame(g, g.fork()); FibAction f = new FibAction(8); assertSame(f, f.fork()); assertSame(g, peekNextLocalTask()); assertNull(f.join()); helpQuiesce(); checkCompletedNormally(f); checkCompletedNormally(g); }}; testInvokeOnPool(asyncSingletonPool(), a); } /** * pollNextLocalTask returns least recent unexecuted task without * executing it, in async mode */ public void testPollNextLocalTaskAsync() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction g = new FibAction(9); assertSame(g, g.fork()); FibAction f = new FibAction(8); assertSame(f, f.fork()); assertSame(g, pollNextLocalTask()); helpQuiesce(); checkCompletedNormally(f); checkNotDone(g); }}; testInvokeOnPool(asyncSingletonPool(), a); } /** * pollTask returns an unexecuted task without executing it, in * async mode */ public void testPollTaskAsync() { RecursiveAction a = new CheckedRecursiveAction() { public void realCompute() { FibAction g = new FibAction(9); assertSame(g, g.fork()); FibAction f = new FibAction(8); assertSame(f, f.fork()); assertSame(g, pollTask()); helpQuiesce(); checkCompletedNormally(f); checkNotDone(g); }}; testInvokeOnPool(asyncSingletonPool(), a); } } jsr166/src/test/extra166y/0000755000000000000000000000000011652013242012312 5ustar jsr166/src/test/extra166y/CombineDemo.java0000644000000000000000000002352511537741070015356 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import java.util.*; class CombineDemo { static final Random rng = new Random(); static final long NPS = (1000L * 1000 * 1000); static ForkJoinPool fjpool = new ForkJoinPool(); static int reps = 16; static final long maxValue = 1 << 12; public static void main(String[] args) throws Exception { int n = 1 << 20; Long[] a = new Long[n]; ParallelArray pa = ParallelArray.createUsingHandoff(a, fjpool); System.out.printf("Using %d Longs, %d replications\n", n, reps); seqSelectTest(pa); selectTest(pa); seqRemoveTest(pa); removeTest(pa); seqUniqTest(pa); parUniqTest(pa); sortUniqTest(pa); seqFindTest(pa); parFindTest(pa); fjpool.shutdown(); } static int nresets = 0; static void reset(ParallelArray pa) { pa.replaceWithGeneratedValue(rlg); if (nresets++ == 0) System.out.println(pa.summary()); } static void resetToEvens(ParallelArray pa) { pa.replaceWithMappedIndex(evens); } static class Evens implements Ops.IntToObject { public Long op(int i) { return Long.valueOf((long)(i << 1)); } } static class IsOdd implements Ops.Predicate { public boolean op(Long x) { return (x.longValue() & 1) != 0; } } static class IsEven implements Ops.Predicate { public boolean op(Long x) { return (x.longValue() & 1) == 0; } } static final IsOdd isOdd = new IsOdd(); static final IsEven isEven = new IsEven(); static final Evens evens = new Evens(); static void parUniqTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); ParallelArray u = pa.allUniqueElements(); elapsed += System.nanoTime() - last; u.sort(); checkSorted(u); } double de = (double)(elapsed) / NPS; System.out.printf("Uniq time %7.3f\n", de); } static void seqUniqTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); Long[] u = seqUnique(pa.getArray()); elapsed += System.nanoTime() - last; ParallelArray pu = ParallelArray.createUsingHandoff(u, fjpool); pu.sort(); checkSorted(pu); } double de = (double)(elapsed) / NPS; System.out.printf("Seq Uniq time: %7.3f\n", de); } static void sortUniqTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); ParallelArray u = pa.all(); u.sort(); u.removeConsecutiveDuplicates(); elapsed += System.nanoTime() - last; checkSorted(u); } double de = (double)(elapsed) / NPS; System.out.printf("Par Uniq Sort time : %7.3f\n", de); } static void removeTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; ParallelArray u = pa.all(); last = System.nanoTime(); u.removeAll(isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != evenSize) throw new Error(usize + " should be " + evenSize); Long a = u.withFilter(isOdd).any(); if (a != null) throw new Error("found " + a); } double de = (double)(elapsed) / NPS; System.out.printf("RemoveAll time : %7.3f\n", de); } static void seqRemoveTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; ParallelArray u = pa.all(); last = System.nanoTime(); seqRemoveAll(u, isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != evenSize) throw new Error(usize + " should be " + evenSize); Long a = u.withFilter(isOdd).any(); if (a != null) throw new Error("found " + a); } double de = (double)(elapsed) / NPS; System.out.printf("Seq RemoveAll time : %7.3f\n", de); } static void selectTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; last = System.nanoTime(); ParallelArray u = pa.withFilter(isOdd).all(); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != oddSize) throw new Error(usize + " should be " + evenSize); Long a = u.withFilter(isEven).any(); if (a != null) throw new Error("found " + a); } double de = (double)(elapsed) / NPS; System.out.printf("SelectAll time : %7.3f\n", de); } static void seqSelectTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; last = System.nanoTime(); ArrayList u = seqSelectAll(pa, isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != oddSize) throw new Error(usize + " should be " + evenSize); } double de = (double)(elapsed) / NPS; System.out.printf("Seq SelectAll time : %7.3f\n", de); } static void parFindTest(ParallelArray pa) { Random rng = new Random(); int n = pa.size(); long last; long elapsed = 0; resetToEvens(pa); last = System.nanoTime(); for (int i = 0; i < reps * 16; ++i) { int rnd = rng.nextInt(n * 2); boolean expect = (rnd & 1) == 0; Long t = Long.valueOf(rnd); boolean contains = pa.indexOf(t) >= 0; if (expect != contains) throw new Error(); } elapsed += System.nanoTime() - last; double de = (double)(elapsed) / NPS; System.out.printf("Par index time : %7.3f\n", de); } static void seqFindTest(ParallelArray pa) { List pal = pa.asList(); Random rng = new Random(); int n = pa.size(); long last; long elapsed = 0; resetToEvens(pa); last = System.nanoTime(); for (int i = 0; i < reps * 16; ++i) { int rnd = rng.nextInt(n * 2); boolean expect = (rnd & 1) == 0; Long t = Long.valueOf(rnd); boolean contains = pal.indexOf(t) >= 0; if (expect != contains) throw new Error(); } elapsed += System.nanoTime() - last; double de = (double)(elapsed) / NPS; System.out.printf("Seq index time : %7.3f\n", de); } // ............ static void seqRemoveAll(ParallelArray pa, Ops.Predicate selector) { Long[] a = pa.getArray(); int n = pa.size(); int k = 0; for (int i = 0; i < n; ++i) { Long x = a[i]; if (!selector.op(x)) a[k++] = x; } for (int j = k; j < n; ++j) a[j] = null; pa.setLimit(k); } static ArrayList seqSelectAll(ParallelArray pa, Ops.Predicate selector) { ArrayList al = new ArrayList(); Long[] a = pa.getArray(); int n = pa.size(); for (int i = 0; i < n; ++i) { Long x = a[i]; if (selector.op(x)) al.add(x); } return al; } static Long[] seqUnique(Long[] a) { int n = a.length; HashSet m = new HashSet(n); for (int i = 0; i < n; ++i) m.add(a[i]); int ul = m.size(); Long[] u = new Long[ul]; int k = 0; for (Long e : m) u[k++] = e; return u; } static void checkSorted(ParallelArray pa) { int n = pa.size(); for (int i = 0; i < n - 1; i++) { if (pa.get(i).compareTo(pa.get(i+1)) >= 0) { throw new Error("Unsorted at " + i + ": " + pa.get(i) + " / " + pa.get(i+1)); } } } static final class RandomLongGenerator implements Ops.Generator { public Long op() { return new Long(ThreadLocalRandom.current().nextLong(maxValue)); } } static final RandomLongGenerator rlg = new RandomLongGenerator(); } jsr166/src/test/extra166y/FilterDemo.java0000644000000000000000000001050611537741070015222 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import java.util.*; import java.util.concurrent.*; public class FilterDemo { static final int NCPU = Runtime.getRuntime().availableProcessors(); /** * Sequential version, for performance comparison */ static List seqFilter(T[] list, Ops.Predicate pred) { ArrayList result = new ArrayList(); int n = list.length; for (int i = 0; i < n; ++i) { T x = list[i]; if (pred.op(x)) result.add(x); } return result; } /** * Slow/dumb prime check */ static final class IsPrime implements Ops.Predicate { public boolean op(Rand r) { long n = r.seed; if ((n & 1) == 0) return false; int bound = (int)(Math.sqrt(n)); for (int i = 3; i <= bound; i += 2) if (n % i == 0) return false; return true; } } /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static final class NextRand implements Ops.Procedure { public void op(Rand r) { r.next(); } } public static void main(String[] args) throws Exception { int n = 1 << 9; Rand[] array = new Rand[n]; for (int i = 0; i < n; ++i) array[i] = new Rand(i); final IsPrime pred = new IsPrime(); final NextRand nextRand = new NextRand(); long last, now; double elapsed; last = System.nanoTime(); List seqResult = null; int resultLength = -1; boolean checked = false; for (int k = 0; k < 2; ++k) { List result = seqFilter(array, pred); now = System.nanoTime(); if (resultLength < 0) { resultLength = result.size(); seqResult = result; } else if (resultLength != result.size()) throw new Error("wrong result size"); elapsed = (double)(now - last) / NPS; last = now; System.out.printf("seq: %7.3f\n", elapsed); // for (Rand r : array) r.next(); } int pass = 0; int ps = 2; ForkJoinPool fjp = new ForkJoinPool(); ParallelArray pa = ParallelArray.createUsingHandoff(array, fjp); for (;;) { last = System.nanoTime(); for (int k = 0; k < 4; ++k) { List result = pa.withFilter(pred).all().asList(); now = System.nanoTime(); if (!checked) { checked = true; if (!result.equals(seqResult)) throw new Error("res" + result + " seq" + seqResult); } elapsed = (double)(now - last) / NPS; last = now; System.out.printf("ps %2d: %7.3f\n", ps, elapsed); } if (pass == 0) { if (ps >= NCPU) pass = 1; else ps <<= 1; } else { if (ps == 1) break; else ps >>>= 1; } // pa.apply(nextRand); // fjp.setParallelism(ps); } fjp.shutdownNow(); fjp.awaitTermination(1, TimeUnit.SECONDS); } /** * Unsynchronized version of java.util.Random algorithm. */ static final class Rand { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; private long seed; Rand(long s) { seed = s; next(); next(); } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } public String toString() { return String.valueOf(seed); } } } jsr166/src/test/extra166y/SortDemo.java0000644000000000000000000000440311537741070014723 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import java.util.*; class SortDemo { static final Random rng = new Random(); static final long NPS = (1000L * 1000 * 1000); public static void main (String[] args) throws Exception { int n = 1 << 22; int sreps = 4; int reps = 20; Long[] a = new Long[n]; ForkJoinPool fjpool = new ForkJoinPool(); ParallelArray pa = ParallelArray.createUsingHandoff(a, fjpool); System.out.printf("Parallel Sort %d Longs, %d replications\n", n, reps); for (int i = 0; i < reps; ++i) { pa.replaceWithGeneratedValue(rlg); parSort(pa); if (i == 0) checkSorted(a); } System.out.printf("Sequential Sort %d Longs, %d replications\n", n, sreps); for (int i = 0; i < sreps; ++i) { pa.replaceWithGeneratedValue(rlg); seqSort(a); if (i == 0) checkSorted(a); } System.out.println(fjpool); fjpool.shutdown(); } static void seqSort(Long[] a) { long last = System.nanoTime(); java.util.Arrays.sort(a); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("java.util.Arrays.sort time: %7.3f\n", elapsed); } static void parSort(ParallelArray pa) { long last = System.nanoTime(); pa.sort(); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("ParallelArray.sort time: %7.3f\n", elapsed); } static void checkSorted(Long[] a) { int n = a.length; for (int i = 0; i < n - 1; i++) { if (a[i].compareTo(a[i+1]) > 0) { throw new Error("Unsorted at " + i + ": " + a[i] + " / " + a[i+1]); } } } static final class RandomLongGenerator implements Ops.Generator { public Long op() { return new Long(ThreadLocalRandom.current().nextLong()); } } static final RandomLongGenerator rlg = new RandomLongGenerator(); } jsr166/src/test/extra166y/LongMapReduceDemo.java0000644000000000000000000001061711537741070016465 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.*; public class LongMapReduceDemo { static final int NCPU = Runtime.getRuntime().availableProcessors(); static final Random rng = new Random(); /** * Sequential version, for performance comparison */ static long seqMapReduce(long[] array, LongOp mapper, LongReducer reducer, long base) { long n = array.length; long x = base; for (int i = 0; i < n; ++i) x = reducer.op(x, mapper.op(array[i])); return x; } // sample functions static final class GetNext implements LongOp { public long op(long seed) { long x = seed; x ^= x << 13; x ^= x >>> 7; x ^= (x << 17); x ^= x << 13; x ^= x >>> 7; x ^= (x << 17); x ^= x << 13; x ^= x >>> 7; x ^= (x << 17); x ^= x << 13; x ^= x >>> 7; x ^= (x << 17); return x; } } static final class Accum implements LongReducer { public long op(long x, long y) { return x + y; } } /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); public static void main(String[] args) throws Exception { int n = 1 << 18; int reps = 1 << 10; long[] array = new long[n]; for (int i = 0; i < n; ++i) array[i] = i + 1L; ForkJoinPool fjp = new ForkJoinPool(); ParallelLongArray pa = ParallelLongArray.createUsingHandoff(array, fjp); final GetNext getNext = new GetNext(); final Accum accum = new Accum(); final long zero = 0L; long last, now; double elapsed; for (int j = 0; j < 2; ++j) { long rseed = rng.nextLong(); resetSeeds(array, rseed); long seqsum = 0; last = System.nanoTime(); for (int k = 0; k < reps; ++k) { seqsum += seqMapReduce(array, getNext, accum, zero); long tmp = array[k]; array[k] = array[n - k - 1]; array[n - k - 1] = tmp; } now = System.nanoTime(); elapsed = (double)(now - last) / NPS; last = now; System.out.printf("sequential: %7.3f\n", elapsed); for (int i = NCPU; i >= 1; i >>>= 1) { resetSeeds(array, rseed); long sum = 0; last = System.nanoTime(); for (int k = 0; k < reps; ++k) { sum += pa.withMapping(getNext).reduce(accum, zero); long tmp = array[k]; array[k] = array[n - k - 1]; array[n - k - 1] = tmp; } now = System.nanoTime(); elapsed = (double)(now - last) / NPS; last = now; System.out.printf("poolSize %3d: %7.3f\n", fjp.getParallelism(), elapsed); if (sum != seqsum) throw new Error("checksum"); } for (int i = 2; i <= NCPU; i <<= 1) { resetSeeds(array, rseed); long sum = 0; // fjp.setParallelism(i); last = System.nanoTime(); for (int k = 0; k < reps; ++k) { sum += pa.withMapping(getNext).reduce(accum, zero); long tmp = array[k]; array[k] = array[n - k - 1]; array[n - k - 1] = tmp; } now = System.nanoTime(); elapsed = (double)(now - last) / NPS; last = now; System.out.printf("poolSize %3d: %7.3f\n", fjp.getParallelism(), elapsed); if (sum != seqsum) throw new Error("checksum"); } } fjp.shutdownNow(); fjp.awaitTermination(1, TimeUnit.SECONDS); Thread.sleep(100); } static void resetSeeds(long[] array, long s) { for (int i = 0; i < array.length; ++i) array[i] = s++; } } jsr166/src/test/extra166y/LongCombineDemo.java0000644000000000000000000002335111537741070016173 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import java.util.*; class LongCombineDemo { static final Random rng = new Random(); static final long NPS = (1000L * 1000 * 1000); static ForkJoinPool fjpool = new ForkJoinPool(); static int reps = 16; static final long maxValue = 1 << 12; public static void main(String[] args) throws Exception { int n = 1 << 20; long[] a = new long[n]; ParallelLongArray pa = ParallelLongArray.createUsingHandoff(a, fjpool); long[] b = new long[n]; ParallelLongArray pb = ParallelLongArray.createUsingHandoff(b, fjpool); System.out.printf("Using %d Longs, %d replications\n", n, reps); seqSelectTest(pa); selectTest(pa); seqRemoveTest(pa); removeTest(pa); seqUniqTest(pa); parUniqTest(pa); sortUniqTest(pa); seqFindTest(pa); parFindTest(pa); fjpool.shutdown(); } static int nresets = 0; static void reset(ParallelLongArray pa) { pa.replaceWithGeneratedValue(CommonOps.longRandom(maxValue)); if (nresets++ == 0) System.out.println(pa.summary()); } static void resetToEvens(ParallelLongArray pa) { pa.replaceWithMappedIndex(evens); } static class Evens implements Ops.IntToLong { public long op(int i) { return ((long)(i << 1)); } } static class Less implements Ops.BinaryLongPredicate { public boolean op(long a, long b) { return a < b; } } static class IsOdd implements Ops.LongPredicate { public boolean op(long x) { return (x & 1) != 0; } } static class IsEven implements Ops.LongPredicate { public boolean op(long x) { return (x & 1) == 0; } } static final Less less = new Less(); static final IsOdd isOdd = new IsOdd(); static final IsEven isEven = new IsEven(); static final Evens evens = new Evens(); static void parUniqTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); ParallelLongArray u = pa.allUniqueElements(); elapsed += System.nanoTime() - last; u.sort(); checkSorted(u); } double de = (double)(elapsed) / NPS; System.out.printf("Uniq time %7.3f\n", de); } static void seqUniqTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); long[] u = seqUnique(pa.getArray()); elapsed += System.nanoTime() - last; ParallelLongArray pu = ParallelLongArray.createUsingHandoff(u, fjpool); pu.sort(); checkSorted(pu); } double de = (double)(elapsed) / NPS; System.out.printf("Seq Uniq time: %7.3f\n", de); } static void sortUniqTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); ParallelLongArray u = pa.all(); u.sort(); u.removeConsecutiveDuplicates(); elapsed += System.nanoTime() - last; checkSorted(u); } double de = (double)(elapsed) / NPS; System.out.printf("Par Uniq Sort time : %7.3f\n", de); } static void removeTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; ParallelLongArray u = pa.all(); last = System.nanoTime(); u.removeAll(isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != evenSize) throw new Error(usize + " should be " + evenSize); int ai = u.withFilter(isOdd).anyIndex(); if (ai >= 0) throw new Error("found " + ai); } double de = (double)(elapsed) / NPS; System.out.printf("RemoveAll time : %7.3f\n", de); } static void seqRemoveTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; ParallelLongArray u = pa.all(); last = System.nanoTime(); seqRemoveAll(u, isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != evenSize) throw new Error(usize + " should be " + evenSize); int ai = u.withFilter(isOdd).anyIndex(); if (ai >= 0) throw new Error("found " + ai); } double de = (double)(elapsed) / NPS; System.out.printf("Seq RemoveAll time : %7.3f\n", de); } static void selectTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; last = System.nanoTime(); ParallelLongArray u = pa.withFilter(isOdd).all(); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != oddSize) throw new Error(usize + " should be " + evenSize); int ai = u.withFilter(isEven).anyIndex(); if (ai >= 0) throw new Error("found " + ai); } double de = (double)(elapsed) / NPS; System.out.printf("SelectAll time : %7.3f\n", de); } static void seqSelectTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; last = System.nanoTime(); ArrayList u = seqSelectAll(pa, isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != oddSize) throw new Error(usize + " should be " + evenSize); } double de = (double)(elapsed) / NPS; System.out.printf("Seq SelectAll time : %7.3f\n", de); } static void parFindTest(ParallelLongArray pa) { Random rng = new Random(); int n = pa.size(); long last; long elapsed = 0; resetToEvens(pa); last = System.nanoTime(); for (int i = 0; i < reps * 16; ++i) { int rnd = rng.nextInt(n * 2); boolean expect = (rnd & 1) == 0; long t = (long)(rnd); boolean contains = pa.indexOf(t) >= 0; if (expect != contains) throw new Error(); } elapsed += System.nanoTime() - last; double de = (double)(elapsed) / NPS; System.out.printf("Par index time : %7.3f\n", de); } static void seqFindTest(ParallelLongArray pa) { List pal = pa.asList(); Random rng = new Random(); int n = pa.size(); long last; long elapsed = 0; resetToEvens(pa); last = System.nanoTime(); for (int i = 0; i < reps * 16; ++i) { int rnd = rng.nextInt(n * 2); boolean expect = (rnd & 1) == 0; long t = (long)(rnd); boolean contains = pal.indexOf(t) >= 0; if (expect != contains) throw new Error(); } elapsed += System.nanoTime() - last; double de = (double)(elapsed) / NPS; System.out.printf("Seq index time : %7.3f\n", de); } static void seqRemoveAll(ParallelLongArray pa, Ops.LongPredicate selector) { long[] a = pa.getArray(); int n = pa.size(); int k = 0; for (int i = 0; i < n; ++i) { long x = a[i]; if (!selector.op(x)) a[k++] = x; } pa.setLimit(k); } static ArrayList seqSelectAll(ParallelLongArray pa, Ops.LongPredicate selector) { ArrayList al = new ArrayList(); long[] a = pa.getArray(); int n = pa.size(); for (int i = 0; i < n; ++i) { long x = a[i]; if (selector.op(x)) al.add(Long.valueOf(x)); } return al; } static long[] seqUnique(long[] a) { int n = a.length; HashSet m = new HashSet(n); for (int i = 0; i < n; ++i) m.add(Long.valueOf(a[i])); int ul = m.size(); long[] u = new long[ul]; int k = 0; for (Long e : m) u[k++] = e; return u; } static void checkSorted(ParallelLongArray pa) { int n = pa.size(); for (int i = 0; i < n - 1; i++) { if (pa.get(i) >= pa.get(i+1)) { throw new Error("Unsorted at " + i + ": " + pa.get(i) + " / " + pa.get(i+1)); } } } } jsr166/src/test/extra166y/LongCumulateDemo.java0000644000000000000000000000653711537741070016405 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.*; public class LongCumulateDemo { static final int NCPU = Runtime.getRuntime().availableProcessors(); /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static final boolean reportSteals = false; public static void main(String[] args) throws Exception { int n = 1 << 19; int reps = 1 << 8; int tests = 2; long[] array = new long[n]; long last, now; double elapsed; for (int j = 0; j < tests; ++j) { seqFill(array); last = System.nanoTime(); for (int k = 0; k < reps; ++k) { seqCumulate(array); if (j == 0 && k == 0) check(array); } now = System.nanoTime(); elapsed = (double)(now - last) / (NPS); System.out.printf("seq : %9.5f\n", elapsed); } for (int sweeps = 0; sweeps < 2; ++sweeps) { for (int i = 2; i <= NCPU; i <<= 1) { ForkJoinPool fjp = new ForkJoinPool(i); oneRun(fjp, array, i, reps, tests); fjp.shutdown(); } for (int i = NCPU; i >= 1; i >>>= 1) { ForkJoinPool fjp = new ForkJoinPool(i); oneRun(fjp, array, i, reps, tests); fjp.shutdown(); } } } static void oneRun(ForkJoinPool fjp, long[] array, int nthreads, int reps, int tests) throws Exception { ParallelLongArray pa = ParallelLongArray.createUsingHandoff(array, fjp); long last, now; long steals = fjp.getStealCount(); // long syncs = fjp.getSyncCount(); for (int j = 0; j < tests; ++j) { pa.replaceWithValue(1); last = System.nanoTime(); for (int k = 0; k < reps; ++k) { pa.cumulateSum(); if (j == 0 && k == 0) check(array); } now = System.nanoTime(); double elapsed = (double)(now - last) / (NPS); last = now; System.out.printf("ps %2d: %9.5f", nthreads, elapsed); if (reportSteals) { long sc = fjp.getStealCount(); long scount = (sc - steals) / reps; steals = sc; System.out.printf(" Steals:%6d", scount); } System.out.println(); } Thread.sleep(100); } static void check(long[] array) { for (int i = 0; i < array.length; ++i) { long sum = i + 1; if (array[i] != sum) { System.out.println("i: " + i + " sum: " + sum + " element:" + array[i]); throw new Error(); } } } static void seqFill(long[] array) { for (int i = 0; i < array.length; ++i) array[i] = 1; } static long seqCumulate(long[] array) { long sum = 0; for (int i = 0; i < array.length; ++i) sum = array[i] += sum; return sum; } } jsr166/src/test/extra166y/ParallelArrayAsListTest.java0000644000000000000000000003415611537741070017712 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ import junit.framework.*; import java.util.*; import java.util.concurrent.*; import jsr166y.*; import extra166y.*; import java.io.*; public class ParallelArrayAsListTest extends JSR166TestCase{ public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(ParallelArrayAsListTest.class); } static List populatedArray(int n) { List a = ParallelArray.createEmpty(n, Object.class, ParallelArray.defaultExecutor()).asList(); assertTrue(a.isEmpty()); for (int i = 0; i < n; ++i) a.add(new Integer(i)); assertFalse(a.isEmpty()); assertEquals(n, a.size()); return a; } static List emptyArray() { List a = ParallelArray.createEmpty(1, Object.class, ParallelArray.defaultExecutor()).asList(); return a; } /** * a new list is empty */ public void testConstructor() { List a = ParallelArray.createEmpty(1, Object.class, ParallelArray.defaultExecutor()).asList(); assertTrue(a.isEmpty()); } /** * new list contains all elements of initializing array */ public void testConstructor2() { Integer[] ints = new Integer[SIZE]; for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); List a = ParallelArray.createUsingHandoff(ints, ParallelArray.defaultExecutor()).asList(); for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], a.get(i)); } /** * addAll adds each element from the given collection */ public void testAddAll() { List full = populatedArray(3); Vector v = new Vector(); v.add(three); v.add(four); v.add(five); full.addAll(v); assertEquals(6, full.size()); } /** * clear removes all elements from the list */ public void testClear() { List full = populatedArray(SIZE); full.clear(); assertEquals(0, full.size()); } /** * contains is true for added elements */ public void testContains() { List full = populatedArray(3); assertTrue(full.contains(one)); assertFalse(full.contains(five)); } /** * adding at an index places it in the indicated index */ public void testAddIndex() { List full = populatedArray(3); full.add(0, m1); assertEquals(4, full.size()); assertEquals(m1, full.get(0)); assertEquals(zero, full.get(1)); full.add(2, m2); assertEquals(5, full.size()); assertEquals(m2, full.get(2)); assertEquals(two, full.get(4)); } /** * lists with same elements are equal and have same hashCode */ public void testEquals() { List a = populatedArray(3); List b = populatedArray(3); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); a.add(m1); assertFalse(a.equals(b)); assertFalse(b.equals(a)); b.add(m1); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); } /** * containsAll returns true for collection with subset of elements */ public void testContainsAll() { List full = populatedArray(3); Vector v = new Vector(); v.add(one); v.add(two); assertTrue(full.containsAll(v)); v.add(six); assertFalse(full.containsAll(v)); } /** * get returns the value at the given index */ public void testGet() { List full = populatedArray(3); assertEquals(0, ((Integer)full.get(0)).intValue()); } /** * indexOf gives the index for the given object */ public void testIndexOf() { List full = populatedArray(3); assertEquals(1, full.indexOf(one)); assertEquals(-1, full.indexOf("puppies")); } /** * isEmpty returns true when empty, else false */ public void testIsEmpty() { List empty = emptyArray(); List full = populatedArray(SIZE); assertTrue(empty.isEmpty()); assertFalse(full.isEmpty()); } /** * iterator() returns an iterator containing the elements of the list */ public void testIterator() { List full = populatedArray(SIZE); Iterator i = full.iterator(); int j; for (j = 0; i.hasNext(); j++) assertEquals(j, ((Integer)i.next()).intValue()); assertEquals(SIZE, j); } /** * iterator.remove removes element */ public void testIteratorRemove() { List full = populatedArray(SIZE); Iterator it = full.iterator(); Object first = full.get(0); it.next(); it.remove(); assertFalse(full.contains(first)); } /** * toString contains toString of elements */ public void testToString() { List full = populatedArray(3); String s = full.toString(); for (int i = 0; i < 3; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } } /** * lastIndexOf returns the index for the given object */ public void testLastIndexOf1() { List full = populatedArray(3); full.add(one); full.add(three); assertEquals(3, full.lastIndexOf(one)); assertEquals(-1, full.lastIndexOf(six)); } /** * listIterator traverses all elements */ public void testListIterator1() { List full = populatedArray(SIZE); ListIterator i = full.listIterator(); int j; for (j = 0; i.hasNext(); j++) assertEquals(j, ((Integer)i.next()).intValue()); assertEquals(SIZE, j); } /** * listIterator only returns those elements after the given index */ public void testListIterator2() { List full = populatedArray(3); ListIterator i = full.listIterator(1); int j; for (j = 0; i.hasNext(); j++) assertEquals(j+1, ((Integer)i.next()).intValue()); assertEquals(2, j); } /** * remove removes and returns the object at the given index */ public void testRemove() { List full = populatedArray(3); assertEquals(two, full.remove(2)); assertEquals(2, full.size()); } /** * removeAll removes all elements from the given collection */ public void testRemoveAll() { List full = populatedArray(3); Vector v = new Vector(); v.add(one); v.add(two); full.removeAll(v); assertEquals(1, full.size()); } /** * set changes the element at the given index */ public void testSet() { List full = populatedArray(3); assertEquals(two, full.set(2, four)); assertEquals(4, ((Integer)full.get(2)).intValue()); } /** * size returns the number of elements */ public void testSize() { List empty = emptyArray(); List full = populatedArray(SIZE); assertEquals(SIZE, full.size()); assertEquals(0, empty.size()); } /** * toArray returns an Object array containing all elements from the list */ public void testToArray() { List full = populatedArray(3); Object[] o = full.toArray(); assertEquals(3, o.length); assertEquals(0, ((Integer)o[0]).intValue()); assertEquals(1, ((Integer)o[1]).intValue()); assertEquals(2, ((Integer)o[2]).intValue()); } /** * toArray returns an Integer array containing all elements from * the list */ public void testToArray2() { List full = populatedArray(3); Integer[] i = new Integer[3]; i = (Integer[])full.toArray(i); assertEquals(3, i.length); assertEquals(0, i[0].intValue()); assertEquals(1, i[1].intValue()); assertEquals(2, i[2].intValue()); } /** * sublists contains elements at indexes offset from their base */ public void testSubList() { List a = populatedArray(10); assertTrue(a.subList(1,1).isEmpty()); for (int j = 0; j < 9; ++j) { for (int i = j ; i < 10; ++i) { List b = a.subList(j,i); for (int k = j; k < i; ++k) { assertEquals(new Integer(k), b.get(k-j)); } } } List s = a.subList(2, 5); assertEquals(s.size(), 3); s.set(2, m1); assertEquals(a.get(4), m1); s.clear(); assertEquals(a.size(), 7); } // Exception tests /** * toArray throws an ArrayStoreException when the given array * can not store the objects inside the list */ public void testToArray_ArrayStoreException() { try { List c = emptyArray(); c.add("zfasdfsdf"); c.add("asdadasd"); c.toArray(new Long[5]); shouldThrow(); } catch (ArrayStoreException e) {} } /** * get throws an IndexOutOfBoundsException on a negative index */ public void testGet1_IndexOutOfBoundsException() { try { List c = emptyArray(); c.get(-1); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * get throws an IndexOutOfBoundsException on a too high index */ public void testGet2_IndexOutOfBoundsException() { try { List c = emptyArray(); c.add("asdasd"); c.add("asdad"); c.get(100); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * set throws an IndexOutOfBoundsException on a negative index */ public void testSet1_IndexOutOfBoundsException() { try { List c = emptyArray(); c.set(-1,"qwerty"); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * set throws an IndexOutOfBoundsException on a too high index */ public void testSet2() { try { List c = emptyArray(); c.add("asdasd"); c.add("asdad"); c.set(100, "qwerty"); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * add throws an IndexOutOfBoundsException on a negative index */ public void testAdd1_IndexOutOfBoundsException() { try { List c = emptyArray(); c.add(-1,"qwerty"); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * add throws an IndexOutOfBoundsException on a too high index */ public void testAdd2_IndexOutOfBoundsException() { try { List c = emptyArray(); c.add("asdasd"); c.add("asdasdasd"); c.add(100, "qwerty"); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * remove throws an IndexOutOfBoundsException on a negative index */ public void testRemove1_IndexOutOfBounds() { try { List c = emptyArray(); c.remove(-1); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * remove throws an IndexOutOfBoundsException on a too high index */ public void testRemove2_IndexOutOfBounds() { try { List c = emptyArray(); c.add("asdasd"); c.add("adasdasd"); c.remove(100); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * addAll throws an IndexOutOfBoundsException on a negative index */ public void testAddAll1_IndexOutOfBoundsException() { try { List c = emptyArray(); c.addAll(-1,new LinkedList()); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * addAll throws an IndexOutOfBoundsException on a too high index */ public void testAddAll2_IndexOutOfBoundsException() { try { List c = emptyArray(); c.add("asdasd"); c.add("asdasdasd"); c.addAll(100, new LinkedList()); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * listIterator throws an IndexOutOfBoundsException on a negative index */ public void testListIterator1_IndexOutOfBoundsException() { try { List c = emptyArray(); c.listIterator(-1); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * listIterator throws an IndexOutOfBoundsException on a too high index */ public void testListIterator2_IndexOutOfBoundsException() { try { List c = emptyArray(); c.add("adasd"); c.add("asdasdas"); c.listIterator(100); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * subList throws an IndexOutOfBoundsException on a negative index */ public void testSubList1_IndexOutOfBoundsException() { try { List c = emptyArray(); c.subList(-1,100); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * subList throws an IndexOutOfBoundsException on a too high index */ public void testSubList2_IndexOutOfBoundsException() { try { List c = emptyArray(); c.add("asdasd"); c.subList(1,100); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } /** * subList throws IndexOutOfBoundsException when the second index * is lower then the first */ public void testSubList3_IndexOutOfBoundsException() { try { List c = emptyArray(); c.subList(3,1); shouldThrow(); } catch (IndexOutOfBoundsException e) {} } } jsr166/src/test/extra166y/FindAnyDemo.java0000644000000000000000000000772711537741070015340 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import java.util.*; import java.util.concurrent.*; public class FindAnyDemo { static final int NCPU = Runtime.getRuntime().availableProcessors(); /** * Sequential version, for performance comparison */ static int seqIndexOf(T[] array, Ops.Predicate pred) { int n = array.length; for (int i = 0; i < n; ++i) { T x = array[i]; if (pred.op(x)) return i; } return -1; } /** * Slow/dumb prime check */ static class IsPrime implements Ops.Predicate { public boolean op(Rand r) { long n = r.seed; int bound = (int)(Math.sqrt(n)); if (bound >= 3) { for (int i = 3; i <= bound; ++i) if ((n & 1) == 0 || n % i == 0) return false; } return true; } } /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static class NextRand implements Ops.Procedure { public void op(Rand r) { r.next(); } } public static void main(String[] args) throws Exception { int n = 1 << 20; ArrayList list = new ArrayList(n); long rs = 256203225; for (int i = 0; i < n >>> 1; ++i) list.add(new Rand(rs+=3)); list.add(new Rand(256203221)); for (int i = n >>> 1; i < n >>> 1; ++i) list.add(new Rand(rs+=3)); Rand[] array = list.toArray(new Rand[0]); final IsPrime pred = new IsPrime(); long last, now; double elapsed; boolean present = false; for (int k = 0; k < 2; ++k) { last = System.nanoTime(); for (int reps = 0; reps < 9; ++reps) { int result = seqIndexOf(array, pred); if (k == 0 && reps == 0) present = result != -1; else if (present != (result != -1)) throw new Error("Inconsistent result"); } now = System.nanoTime(); elapsed = (double)(now - last) / NPS; last = now; System.out.printf("seq: %7.3f\n", elapsed); } Thread.sleep(100); ForkJoinPool fjp = new ForkJoinPool(); ParallelArray pa = ParallelArray.createUsingHandoff(array, fjp); for (int i = 1; i <= NCPU; i <<= 1) { last = System.nanoTime(); for (int k = 0; k < 2; ++k) { for (int reps = 0; reps < 9; ++reps) { int result = pa.withFilter(pred).anyIndex(); if (present != (result != -1)) throw new Error("Inconsistent result"); } now = System.nanoTime(); elapsed = (double)(now - last) / NPS; last = now; System.out.printf("ps %2d: %7.3f\n", i, elapsed); } } fjp.shutdownNow(); fjp.awaitTermination(1, TimeUnit.SECONDS); } /** * Unsynchronized version of java.util.Random algorithm. */ static final class Rand { private static final long multiplier = 0x5DEECE66DL; private static final long addend = 0xBL; private static final long mask = (1L << 48) - 1; private long seed; Rand(long s) { seed = s; // next(); // next(); } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } public String toString() { return String.valueOf(seed); } } } jsr166/src/test/extra166y/DoubleCumulateDemo.java0000644000000000000000000000707611537741070016717 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.*; public class DoubleCumulateDemo { static final int NCPU = Runtime.getRuntime().availableProcessors(); /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); static boolean check = false; // true; public static void main(String[] args) throws Exception { check = args.length > 0; int n = 1 << 19; int reps = 1 << 9; int tests = 4; double[] array = new double[n]; long last, now; double elapsed; for (int j = 0; j < tests; ++j) { fill(array); last = System.nanoTime(); for (int k = 0; k < reps; ++k) { seqCumulate(array); if (k == 0 && check) check(array); } now = System.nanoTime(); elapsed = (double)(now - last) / (NPS); System.out.printf("seq : %9.5f\n", elapsed); } for (int sweeps = 0; sweeps < 2; ++sweeps) { for (int i = 2; i <= NCPU; i <<= 1) { ForkJoinPool fjp = new ForkJoinPool(i); oneRun(fjp, array, i, reps, tests); fjp.shutdown(); } for (int i = NCPU; i >= 1; i >>>= 1) { ForkJoinPool fjp = new ForkJoinPool(i); oneRun(fjp, array, i, reps, tests); fjp.shutdown(); } } } static void oneRun(ForkJoinPool fjp, double[] array, int nthreads, int reps, int tests) throws Exception { ParallelDoubleArray pa = ParallelDoubleArray.createUsingHandoff(array, fjp); long last, now; long steals = fjp.getStealCount(); // long syncs = fjp.getSyncCount(); for (int j = 0; j < tests; ++j) { fill(array); last = System.nanoTime(); for (int k = 0; k < reps; ++k) { pa.cumulateSum(); if (k == 0 && check) check(array); } now = System.nanoTime(); double elapsed = (double)(now - last) / (NPS); last = now; long sc = fjp.getStealCount(); long scount = (sc - steals) / reps; steals = sc; // long tc = fjp.getSyncCount(); // long tcount = (tc - syncs) / reps; // syncs = tc; // System.out.printf("ps %2d: %9.5f Steals:%6d Syncs %6d\n", nthreads, elapsed, scount, tcount); System.out.printf("ps %2d: %9.5f Steals:%6d\n", nthreads, elapsed, scount); } Thread.sleep(100); } static void check(double[] array) { for (int i = 0; i < array.length; ++i) { double sum = i + 1; if (array[i] != sum) { System.out.println("i: " + i + " sum: " + sum + " element:" + array[i]); throw new Error(); } } // System.out.print("*"); } static void fill(double[] array) { for (int i = 0; i < array.length; ++i) array[i] = 1; } static double seqCumulate(double[] array) { double sum = 0; for (int i = 0; i < array.length; ++i) sum = array[i] += sum; return sum; } } jsr166/src/test/extra166y/LongSetOpsDemo.java0000644000000000000000000002272111537741070016034 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import java.util.*; class LongSetOpsDemo { static final Random rng = new Random(); static final long NPS = (1000L * 1000 * 1000); static ForkJoinPool fjpool = new ForkJoinPool(); static int reps = 16; static final long maxValue = 1 << 12; public static void main(String[] args) throws Exception { int n = 1 << 20; long[] a = new long[n]; ParallelLongArray pa = ParallelLongArray.createUsingHandoff(a, fjpool); System.out.printf("Using %d Longs, %d replications\n", n, reps); seqSelectTest(pa); selectTest(pa); seqRemoveTest(pa); removeTest(pa); seqUniqTest(pa); parUniqTest(pa); sortUniqTest(pa); seqFindTest(pa); parFindTest(pa); fjpool.shutdown(); } static int nresets = 0; static void reset(ParallelLongArray pa) { pa.replaceWithGeneratedValue(CommonOps.longRandom(maxValue)); if (nresets++ == 0) System.out.println(pa.summary()); } static void resetToEvens(ParallelLongArray pa) { pa.replaceWithMappedIndex(evens); } static class Evens implements Ops.IntToLong { public long op(int i) { return ((long)(i << 1)); } } static class IsOdd implements Ops.LongPredicate { public boolean op(long x) { return (x & 1) != 0; } } static class IsEven implements Ops.LongPredicate { public boolean op(long x) { return (x & 1) == 0; } } static final IsOdd isOdd = new IsOdd(); static final IsEven isEven = new IsEven(); static final Evens evens = new Evens(); static void parUniqTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); ParallelLongArray u = pa.allUniqueElements(); elapsed += System.nanoTime() - last; u.sort(); checkSorted(u); } double de = (double)(elapsed) / NPS; System.out.printf("Uniq time %7.3f\n", de); } static void seqUniqTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); long[] u = seqUnique(pa.getArray()); elapsed += System.nanoTime() - last; ParallelLongArray pu = ParallelLongArray.createUsingHandoff(u, fjpool); pu.sort(); checkSorted(pu); } double de = (double)(elapsed) / NPS; System.out.printf("Seq Uniq time: %7.3f\n", de); } static void sortUniqTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); ParallelLongArray u = pa.all(); u.sort(); u.removeConsecutiveDuplicates(); elapsed += System.nanoTime() - last; checkSorted(u); } double de = (double)(elapsed) / NPS; System.out.printf("Par Uniq Sort time : %7.3f\n", de); } static void removeTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; ParallelLongArray u = pa.all(); last = System.nanoTime(); u.removeAll(isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != evenSize) throw new Error(usize + " should be " + evenSize); int ai = u.withFilter(isOdd).anyIndex(); if (ai >= 0) throw new Error("found " + ai); } double de = (double)(elapsed) / NPS; System.out.printf("RemoveAll time : %7.3f\n", de); } static void seqRemoveTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; ParallelLongArray u = pa.all(); last = System.nanoTime(); seqRemoveAll(u, isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != evenSize) throw new Error(usize + " should be " + evenSize); int ai = u.withFilter(isOdd).anyIndex(); if (ai >= 0) throw new Error("found " + ai); } double de = (double)(elapsed) / NPS; System.out.printf("Seq RemoveAll time : %7.3f\n", de); } static void selectTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; last = System.nanoTime(); ParallelLongArray u = pa.withFilter(isOdd).all(); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != oddSize) throw new Error(usize + " should be " + evenSize); int ai = u.withFilter(isEven).anyIndex(); if (ai >= 0) throw new Error("found " + ai); } double de = (double)(elapsed) / NPS; System.out.printf("SelectAll time : %7.3f\n", de); } static void seqSelectTest(ParallelLongArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; last = System.nanoTime(); ArrayList u = seqSelectAll(pa, isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != oddSize) throw new Error(usize + " should be " + evenSize); } double de = (double)(elapsed) / NPS; System.out.printf("Seq SelectAll time : %7.3f\n", de); } static void parFindTest(ParallelLongArray pa) { Random rng = new Random(); int n = pa.size(); long last; long elapsed = 0; resetToEvens(pa); last = System.nanoTime(); for (int i = 0; i < reps * 16; ++i) { int rnd = rng.nextInt(n * 2); boolean expect = (rnd & 1) == 0; long t = (long)(rnd); boolean contains = pa.indexOf(t) >= 0; if (expect != contains) throw new Error(); } elapsed += System.nanoTime() - last; double de = (double)(elapsed) / NPS; System.out.printf("Par index time : %7.3f\n", de); } static void seqFindTest(ParallelLongArray pa) { List pal = pa.asList(); Random rng = new Random(); int n = pa.size(); long last; long elapsed = 0; resetToEvens(pa); last = System.nanoTime(); for (int i = 0; i < reps * 16; ++i) { int rnd = rng.nextInt(n * 2); boolean expect = (rnd & 1) == 0; long t = (long)(rnd); boolean contains = pal.indexOf(t) >= 0; if (expect != contains) throw new Error(); } elapsed += System.nanoTime() - last; double de = (double)(elapsed) / NPS; System.out.printf("Seq index time : %7.3f\n", de); } static void seqRemoveAll(ParallelLongArray pa, Ops.LongPredicate selector) { long[] a = pa.getArray(); int n = pa.size(); int k = 0; for (int i = 0; i < n; ++i) { long x = a[i]; if (!selector.op(x)) a[k++] = x; } pa.setLimit(k); } static ArrayList seqSelectAll(ParallelLongArray pa, Ops.LongPredicate selector) { ArrayList al = new ArrayList(); long[] a = pa.getArray(); int n = pa.size(); for (int i = 0; i < n; ++i) { long x = a[i]; if (selector.op(x)) al.add(Long.valueOf(x)); } return al; } static long[] seqUnique(long[] a) { int n = a.length; HashSet m = new HashSet(n); for (int i = 0; i < n; ++i) m.add(Long.valueOf(a[i])); int ul = m.size(); long[] u = new long[ul]; int k = 0; for (Long e : m) u[k++] = e; return u; } static void checkSorted(ParallelLongArray pa) { int n = pa.size(); for (int i = 0; i < n - 1; i++) { if (pa.get(i) >= pa.get(i+1)) { throw new Error("Unsorted at " + i + ": " + pa.get(i) + " / " + pa.get(i+1)); } } } } jsr166/src/test/extra166y/ApplyDemo.java0000644000000000000000000000570211537741070015064 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import java.util.*; import java.util.concurrent.*; public class ApplyDemo { static final int NCPU = Runtime.getRuntime().availableProcessors(); /** * Sequential version, for performance comparison */ static void seqApply(T[] array, Ops.Procedure f) { int n = array.length; for (int i = 0; i < n; ++i) f.op(array[i]); } /** * A sample procedure to apply */ static final class Proc implements Ops.Procedure { public void op(Rand x) { for (int k = 0; k < (1 << 10); ++k) x.next(); } } /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); public static void main(String[] args) throws Exception { test(); test(); } public static void test() throws Exception { int n = 1 << 18; Rand[] array = new Rand[n]; for (int i = 0; i < n; ++i) array[i] = new Rand(i); final Proc proc = new Proc(); long last, now; double elapsed; last = System.nanoTime(); for (int k = 0; k < 2; ++k) { for (int j = 0; j < (1 << 3); ++j) seqApply(array, proc); now = System.nanoTime(); elapsed = (double)(now - last) / NPS; last = now; System.out.printf("seq: %7.3f\n", elapsed); } for (int i = 1; i <= NCPU; i <<= 1) { ForkJoinPool fjp = new ForkJoinPool(i); ParallelArray pa = ParallelArray.createUsingHandoff(array, fjp); last = System.nanoTime(); for (int k = 0; k < 2; ++k) { for (int j = 0; j < (1 << 3); ++j) pa.apply(proc); now = System.nanoTime(); elapsed = (double)(now - last) / NPS; last = now; System.out.printf("ps %2d: %7.3f\n", fjp.getParallelism(), elapsed); } fjp.shutdownNow(); fjp.awaitTermination(1, TimeUnit.SECONDS); Thread.sleep(10); } int sum = 0; for (int i = 0; i < array.length; ++i) sum += array[i].seed; if (sum == 0) System.out.print(" "); } /** * Unsynchronized version of java.util.Random algorithm. */ static final class Rand { static final long multiplier = 0x5DEECE66DL; static final long addend = 0xBL; static final long mask = (1L << 48) - 1; long seed; Rand(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } } } jsr166/src/test/extra166y/ScalarLongSortDemo.java0000644000000000000000000000357511537741070016702 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import java.util.*; class ScalarLongSortDemo { static final long NPS = (1000L * 1000 * 1000); public static void main (String[] args) throws Exception { int n = 1 << 22; int sreps = 4; int reps = 10; System.out.printf("Sorting %d longs, %d replications\n", n, sreps); long[] a = new long[n]; ForkJoinPool fjpool = new ForkJoinPool(); ParallelLongArray pa = ParallelLongArray.createUsingHandoff(a, fjpool); long max = 1234567890123L; for (int i = 0; i < sreps; ++i) { pa.replaceWithGeneratedValue(CommonOps.longRandom(max++)); long last = System.nanoTime(); java.util.Arrays.sort(a); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("java.util.Arrays.sort time: %7.3f\n", elapsed); if (i == 0) checkSorted(a); } System.out.printf("Sorting %d longs, %d replications\n", n, reps); for (int i = 0; i < reps; ++i) { pa.replaceWithGeneratedValue(CommonOps.longRandom(max++)); long last = System.nanoTime(); pa.sort(); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("ParallelLongArray.sort time: %7.3f\n", elapsed); if (i == 0) checkSorted(a); } fjpool.shutdown(); } static void checkSorted(long[] a) { int n = a.length; for (int i = 0; i < n - 1; i++) { if (a[i] > a[i+1]) { throw new Error("Unsorted at " + i + ": " + a[i] + " / " + a[i+1]); } } } } jsr166/src/test/extra166y/ParallelArraySortDemo.java0000644000000000000000000000415211537741070017400 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import java.util.*; class ParallelArraySortDemo { static final Random rng = new Random(); static final long NPS = (1000L * 1000 * 1000); public static void main(String[] args) throws Exception { int n = 1 << 20; int reps = 9; System.out.printf("Sorting %d Longs, %d replications\n", n, reps); Long[] a = new Long[n]; randomFill(a); for (int i = 0; i < reps; ++i) { long last = System.nanoTime(); java.util.Arrays.sort(a); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("java.util.Arrays.sort time: %7.3f\n", elapsed); checkSorted(a); shuffle(a); // System.gc(); } ForkJoinPool fjpool = new ForkJoinPool(); ParallelArray pa = ParallelArray.createUsingHandoff(a, fjpool); for (int i = 0; i < reps; ++i) { long last = System.nanoTime(); pa.sort(); double elapsed = (double)(System.nanoTime() - last) / NPS; System.out.printf("ArrayTasks.sort time: %7.3f\n", elapsed); checkSorted(a); shuffle(a); // System.gc(); } fjpool.shutdown(); } static void checkSorted(Long[] a) { int n = a.length; for (int i = 0; i < n - 1; i++) { if (a[i].compareTo(a[i+1]) > 0) { throw new Error("Unsorted at " + i + ": " + a[i] + " / " + a[i+1]); } } } static void randomFill(Long[] a) { for (int i = 0; i < a.length; ++i) a[i] = new Long(rng.nextLong()); } static void shuffle(Long[] a) { int n = a.length; for (int i = n; i > 1; --i) { int r = rng.nextInt(i); Long t = a[i-1]; a[i-1] = a[r]; a[r] = t; } } } jsr166/src/test/extra166y/MapReduceDemo.java0000644000000000000000000001105011537741070015635 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import java.util.*; import java.util.concurrent.*; public class MapReduceDemo { static final int NCPU = Runtime.getRuntime().availableProcessors(); static final Random rng = new Random(); /** * Sequential version, for performance comparison */ static U seqMapReduce(T[] array, Ops.Op mapper, Ops.Reducer reducer, U base) { int n = array.length; U x = base; for (int i = 0; i < n; ++i) x = reducer.op(x, mapper.op(array[i])); return x; } // sample functions static final class GetNext implements Ops.Op { public Long op(Rand x) { return x.next(); } } static final class Accum implements Ops.Reducer { public Long op(Long a, Long b) { long x = a; long y = b; return x + y; } } /** for time conversion */ static final long NPS = (1000L * 1000 * 1000); public static void main(String[] args) throws Exception { int n = 1 << 18; int reps = 1 << 8; Rand[] array = new Rand[n]; for (int i = 0; i < n; ++i) array[i] = new Rand(i+1); ForkJoinPool fjp = new ForkJoinPool(); ParallelArray pa = ParallelArray.createUsingHandoff(array, fjp); final GetNext getNext = new GetNext(); final Accum accum = new Accum(); final Long zero = Long.valueOf(0); long last, now; double elapsed; for (int j = 0; j < 2; ++j) { long rseed = rng.nextLong(); resetSeeds(array, rseed); long seqsum = 0; last = System.nanoTime(); for (int k = 0; k < reps; ++k) { seqsum += seqMapReduce(array, getNext, accum, zero); Rand tmp = array[k]; array[k] = array[n - k - 1]; array[n - k - 1] = tmp; } now = System.nanoTime(); elapsed = (double)(now - last) / NPS; last = now; System.out.printf("sequential: %7.3f\n", elapsed); for (int i = 2; i <= NCPU; i <<= 1) { resetSeeds(array, rseed); long sum = 0; // fjp.setParallelism(i); last = System.nanoTime(); for (int k = 0; k < reps; ++k) { sum += pa.withMapping(getNext).reduce(accum, zero); Rand tmp = array[k]; array[k] = array[n - k - 1]; array[n - k - 1] = tmp; } now = System.nanoTime(); elapsed = (double)(now - last) / NPS; last = now; System.out.printf("poolSize %3d: %7.3f\n", fjp.getParallelism(), elapsed); if (sum != seqsum) throw new Error("checksum"); } for (int i = NCPU; i >= 1; i >>>= 1) { resetSeeds(array, rseed); long sum = 0; // fjp.setParallelism(i); last = System.nanoTime(); for (int k = 0; k < reps; ++k) { sum += pa.withMapping(getNext).reduce(accum, zero); Rand tmp = array[k]; array[k] = array[n - k - 1]; array[n - k - 1] = tmp; } now = System.nanoTime(); elapsed = (double)(now - last) / NPS; last = now; System.out.printf("poolSize %3d: %7.3f\n", fjp.getParallelism(), elapsed); if (sum != seqsum) throw new Error("checksum"); } } fjp.shutdownNow(); fjp.awaitTermination(1, TimeUnit.SECONDS); Thread.sleep(100); } static void resetSeeds(Rand[] array, long s) { for (int i = 0; i < array.length; ++i) array[i].seed = s++; } /** * Xorshift Random algorithm. */ public static final class Rand { private long seed; Rand(long s) { seed = s; } public long next() { long x = seed; x ^= x << 13; x ^= x >>> 7; x ^= (x << 17); seed = x; return x; } } } jsr166/src/test/extra166y/SetOpsDemo.java0000644000000000000000000002366411537741070015223 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ import jsr166y.*; import extra166y.*; import java.util.*; class SetOpsDemo { static final Random rng = new Random(); static final long NPS = (1000L * 1000 * 1000); static ForkJoinPool fjpool = new ForkJoinPool(); static int reps = 16; static final long maxValue = 1 << 12; public static void main(String[] args) throws Exception { int n = 1 << 20; Long[] a = new Long[n]; ParallelArray pa = ParallelArray.createUsingHandoff(a, fjpool); System.out.printf("Using %d Longs, %d replications\n", n, reps); for (int iters = 0; iters < 3; ++iters) { seqSelectTest(pa); selectTest(pa); seqRemoveTest(pa); removeTest(pa); seqUniqTest(pa); parUniqTest(pa); sortUniqTest(pa); seqFindTest(pa); parFindTest(pa); } fjpool.shutdown(); } static int nresets = 0; static void reset(ParallelArray pa) { pa.replaceWithGeneratedValue(rlg); if (nresets++ == 0) System.out.println(pa.summary()); } static void resetToEvens(ParallelArray pa) { pa.replaceWithMappedIndex(evens); } static class Evens implements Ops.IntToObject { public Long op(int i) { return Long.valueOf((long)(i << 1)); } } static class IsOdd implements Ops.Predicate { public boolean op(Long x) { return (x.longValue() & 1) != 0; } } static class IsEven implements Ops.Predicate { public boolean op(Long x) { return (x.longValue() & 1) == 0; } } static final IsOdd isOdd = new IsOdd(); static final IsEven isEven = new IsEven(); static final Evens evens = new Evens(); static void parUniqTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); ParallelArray u = pa.allUniqueElements(); elapsed += System.nanoTime() - last; u.sort(); checkSorted(u); } double de = (double)(elapsed) / NPS; System.out.printf("Uniq time %7.3f\n", de); } static void seqUniqTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); Long[] u = seqUnique(pa.getArray()); elapsed += System.nanoTime() - last; ParallelArray pu = ParallelArray.createUsingHandoff(u, fjpool); pu.sort(); checkSorted(pu); } double de = (double)(elapsed) / NPS; System.out.printf("Seq Uniq time: %7.3f\n", de); } static void sortUniqTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); last = System.nanoTime(); ParallelArray u = pa.all(); u.sort(); u.removeConsecutiveDuplicates(); elapsed += System.nanoTime() - last; checkSorted(u); } double de = (double)(elapsed) / NPS; System.out.printf("Par Uniq Sort time : %7.3f\n", de); } static void removeTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; ParallelArray u = pa.all(); last = System.nanoTime(); u.removeAll(isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != evenSize) throw new Error(usize + " should be " + evenSize); Long a = u.withFilter(isOdd).any(); if (a != null) throw new Error("found " + a); } double de = (double)(elapsed) / NPS; System.out.printf("RemoveAll time : %7.3f\n", de); } static void seqRemoveTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; ParallelArray u = pa.all(); last = System.nanoTime(); seqRemoveAll(u, isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != evenSize) throw new Error(usize + " should be " + evenSize); Long a = u.withFilter(isOdd).any(); if (a != null) throw new Error("found " + a); } double de = (double)(elapsed) / NPS; System.out.printf("Seq RemoveAll time : %7.3f\n", de); } static void selectTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; last = System.nanoTime(); ParallelArray u = pa.withFilter(isOdd).all(); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != oddSize) throw new Error(usize + " should be " + evenSize); Long a = u.withFilter(isEven).any(); if (a != null) throw new Error("found " + a); } double de = (double)(elapsed) / NPS; System.out.printf("SelectAll time : %7.3f\n", de); } static void seqSelectTest(ParallelArray pa) { int n = pa.size(); long last; long elapsed = 0; for (int i = 0; i < reps; ++i) { reset(pa); int psize = pa.size(); int oddSize = pa.withFilter(isOdd).size(); int evenSize = psize - oddSize; last = System.nanoTime(); ArrayList u = seqSelectAll(pa, isOdd); elapsed += System.nanoTime() - last; int usize = u.size(); if (usize != oddSize) throw new Error(usize + " should be " + evenSize); } double de = (double)(elapsed) / NPS; System.out.printf("Seq SelectAll time : %7.3f\n", de); } static void parFindTest(ParallelArray pa) { Random rng = new Random(); int n = pa.size(); long last; long elapsed = 0; resetToEvens(pa); last = System.nanoTime(); for (int i = 0; i < reps * 16; ++i) { int rnd = rng.nextInt(n * 2); boolean expect = (rnd & 1) == 0; Long t = Long.valueOf(rnd); boolean contains = pa.indexOf(t) >= 0; if (expect != contains) throw new Error(); } elapsed += System.nanoTime() - last; double de = (double)(elapsed) / NPS; System.out.printf("Par index time : %7.3f\n", de); } static void seqFindTest(ParallelArray pa) { List pal = pa.asList(); Random rng = new Random(); int n = pa.size(); long last; long elapsed = 0; resetToEvens(pa); last = System.nanoTime(); for (int i = 0; i < reps * 16; ++i) { int rnd = rng.nextInt(n * 2); boolean expect = (rnd & 1) == 0; Long t = Long.valueOf(rnd); boolean contains = pal.indexOf(t) >= 0; if (expect != contains) throw new Error(); } elapsed += System.nanoTime() - last; double de = (double)(elapsed) / NPS; System.out.printf("Seq index time : %7.3f\n", de); } // ............ static void seqRemoveAll(ParallelArray pa, Ops.Predicate selector) { Long[] a = pa.getArray(); int n = pa.size(); int k = 0; for (int i = 0; i < n; ++i) { Long x = a[i]; if (!selector.op(x)) a[k++] = x; } for (int j = k; j < n; ++j) a[j] = null; pa.setLimit(k); } static ArrayList seqSelectAll(ParallelArray pa, Ops.Predicate selector) { ArrayList al = new ArrayList(); Long[] a = pa.getArray(); int n = pa.size(); for (int i = 0; i < n; ++i) { Long x = a[i]; if (selector.op(x)) al.add(x); } return al; } static Long[] seqUnique(Long[] a) { int n = a.length; HashSet m = new HashSet(n); for (int i = 0; i < n; ++i) m.add(a[i]); int ul = m.size(); Long[] u = new Long[ul]; int k = 0; for (Long e : m) u[k++] = e; return u; } static void checkSorted(ParallelArray pa) { int n = pa.size(); for (int i = 0; i < n - 1; i++) { if (pa.get(i).compareTo(pa.get(i+1)) >= 0) { throw new Error("Unsorted at " + i + ": " + pa.get(i) + " / " + pa.get(i+1)); } } } static final class RandomLongGenerator implements Ops.Generator { public Long op() { return new Long(ThreadLocalRandom.current().nextLong(maxValue)); } } static final RandomLongGenerator rlg = new RandomLongGenerator(); } jsr166/src/loops/0000755000000000000000000000000011652013242010716 5ustar jsr166/src/loops/ALoops.java0000644000000000000000000003166711460217246013002 0ustar import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.*; import java.util.*; public final class ALoops { static final ExecutorService pool = Executors.newCachedThreadPool(); static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); static boolean print = false; static int iters = 2000000; static int mask = 0; static long loopTime = Long.MAX_VALUE; static final long NCPU = Runtime.getRuntime().availableProcessors(); public static void main(String[] args) throws Exception { int maxThreads = 100; if (args.length > 0) maxThreads = Integer.parseInt(args[0]); if (args.length > 1) mask = Integer.parseInt(args[1]); System.out.println("Running ALoops.main with these values:"); System.out.println("Mask: " + mask + " CPUs: " + NCPU + " Iters: " + iters + " MaxThreads: " + maxThreads); System.out.println("\n"); warmup(); print = true; for (int m = 1; m <= 256; m <<= 1) { mask = m - 1; System.out.println("Mask: " + mask + " CPUs: " + NCPU + " Iters: " + iters + " MaxThreads: " + maxThreads); int k = 1; for (int i = 1; i <= maxThreads;) { System.out.println("Threads: " + i); new Loop(1).test(); if (i <= 4) new CASLoop(i).test(); new ReentrantLockLoop(i).test(); new LockLoop(i).test(); new MutexLoop(i).test(); if (i == k) { k = i << 1; i = i + (i >>> 1); } else i = k; } } pool.shutdown(); } static void warmup() throws Exception { for (int i = 0; i < 30; ++i) new Loop(1).test(); for (int i = 0; i < 30; ++i) new CASLoop(1).test(); for (int i = 0; i < 30; ++i) new MutexLoop(1).test(); for (int i = 0; i < 30; ++i) new ReentrantLockLoop(1).test(); for (int i = 0; i < 30; ++i) new LockLoop(1).test(); for (int i = 0; i < 30; ++i) new Loop(1).test(); } private static int nextRandom(int x) { int t = (x % 127773) * 16807 - (x / 127773) * 2836; return (t > 0) ? t : t + 0x7fffffff; } private static double ratio(int n, long t) { double s = 1.0 / (1.0 + (double) mask); double ns = 1.0 - s; double seq = loopTime * s * n; double ideal; if (n <= NCPU) ideal = seq + loopTime * ns; else ideal = seq + loopTime * ns * n / NCPU; return (double)t / ideal; } private static void printTimes(String label, long tpi, double ratio) { if (print) { System.out.println(label + "\t" + LoopHelpers.rightJustify(tpi) + " \t" + ratio); } } private static void useResult(int r) { if (r == 0) // avoid overoptimization System.out.println("useless result: " + r); try { Thread.sleep(100); } catch (InterruptedException ex) {} } static final class Loop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; Loop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); long time = timer.getTime(); if (nthreads == 1 && time < loopTime) loopTime = time; long tpi = time / ((long)iters * nthreads); printTimes("Loop", tpi, 0.0); useResult(result); } public final void run() { try { barrier.await(); int x = v; int n = iters; while (n-- > 0) { if ((x & mask) == 0) { v = x = nextRandom(v); } else x = nextRandom(x); } barrier.await(); result += x + v; } catch (Exception ie) { return; } } } static final class ReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final ReentrantLock lock = new ReentrantLock(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; ReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); long time = timer.getTime(); long tpi = (time - loopTime) / ((long)iters * nthreads); double ratio = ratio(nthreads, time); printTimes("RL", tpi, ratio); useResult(result); } public final void run() { try { barrier.await(); int x = v; final ReentrantLock lock = this.lock; int n = iters; int m = mask; while (n-- > 0) { if ((x & m) == 0) { lock.lock(); v = x = nextRandom(v); lock.unlock(); } else x = nextRandom(x); } barrier.await(); result += x + v; } catch (Exception ie) { return; } } } static final class LockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; LockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); long time = timer.getTime(); long tpi = (time - loopTime) / (((long)iters) * nthreads); double ratio = ratio(nthreads, time); printTimes("Sync", tpi, ratio); useResult(result); } public final void run() { try { barrier.await(); int x = v; int n = iters; int m = mask; while (n-- > 0) { if ((x & m) == 0) { synchronized (this) { v = x = nextRandom(v); } } else x = nextRandom(x); } barrier.await(); result += x + v; } catch (Exception ie) { return; } } } static final class MutexLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final Mutex lock = new Mutex(); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; MutexLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); long time = timer.getTime(); long tpi = (time - loopTime) / ((long)iters * nthreads); double ratio = ratio(nthreads, time); printTimes("Mutex", tpi, ratio); useResult(result); } public final void run() { try { barrier.await(); int x = v; final Mutex lock = this.lock; int n = iters; int m = mask; while (n-- > 0) { if ((x & m) == 0) { lock.lock(); v = x = nextRandom(v); lock.unlock(); } else x = nextRandom(x); } barrier.await(); result += x + v; } catch (Exception ie) { return; } } } static final class FairReentrantLockLoop implements Runnable { private int v = rng.next(); private volatile int result = 17; private final ReentrantLock lock = new ReentrantLock(true); private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; FairReentrantLockLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); long time = timer.getTime(); long tpi = (time - loopTime) / (((long)iters) * nthreads); double ratio = ratio(nthreads, time); printTimes("FairRL", tpi, ratio); useResult(result); } public final void run() { try { barrier.await(); int x = v; final ReentrantLock lock = this.lock; int n = iters; int m = mask; while (n-- > 0) { if ((x & m) == 0) { lock.lock(); v = x = nextRandom(v); lock.unlock(); } else x = nextRandom(x); } barrier.await(); result += x + v; } catch (Exception ie) { return; } } } static final class CASLoop implements Runnable { private final AtomicInteger v = new AtomicInteger(rng.next()); private volatile int result = 17; private final LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); private final CyclicBarrier barrier; private final int nthreads; private volatile int readBarrier; CASLoop(int nthreads) { this.nthreads = nthreads; barrier = new CyclicBarrier(nthreads+1, timer); } final void test() throws Exception { for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); long time = timer.getTime(); long tpi = (time - loopTime) / ((long)iters * nthreads); double ratio = ratio(nthreads, time); printTimes("CAS", tpi, ratio); useResult(result); } public final void run() { try { barrier.await(); int x = v.get(); int n = iters; int m = mask; while (n > 0) { if ((x & m) == 0) { int oldx = v.get(); int newx = nextRandom(oldx); if (v.compareAndSet(oldx, newx)) { x = newx; --n; } } else { x = nextRandom(x); --n; } } barrier.await(); result += x + v.get(); } catch (Exception ie) { return; } } } } jsr166/src/loops/TimeUnitLoops.java0000644000000000000000000000331610165015637014347 0ustar import java.util.concurrent.*; import java.util.Random; public class TimeUnitLoops { static final LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom(); /** * False value allows aggressive inlining of cvt() calls from * test(). True value prevents any inlining, requiring virtual * method dispatch. */ static final boolean PREVENT_INLINING = true; // The following all are used by inlining prevention clause: static int index = 0; static final int NUNITS = 100; static final TimeUnit[] units = new TimeUnit[NUNITS]; static { TimeUnit[] v = TimeUnit.values(); for (int i = 0; i < NUNITS; ++i) units[i] = v[rng.next() % v.length]; } public static void main(String[] args) throws Exception { long start = System.currentTimeMillis(); long s = 0; for (int i = 0; i < 100; ++i) { s += test(); if (s == start) System.out.println(" "); } long end = System.currentTimeMillis(); System.out.println("Time: " + (end - start) + " ms"); } static long test() { long sum = 0; int x = rng.next(); for (int i = 0; i < 1000000; ++i) { long l = (long)x + (long)x; sum += cvt(l, TimeUnit.SECONDS); sum += TimeUnit.MILLISECONDS.toMicros(l+2); sum += cvt(l+17, TimeUnit.NANOSECONDS); sum += cvt(l+42, TimeUnit.MILLISECONDS); x = LoopHelpers.compute4(x); } return sum + x; } static long cvt(long d, TimeUnit u) { if (PREVENT_INLINING) { u = units[index]; index = (index+1) % NUNITS; } return u.toNanos(d); } } jsr166/src/loops/Mutex.java0000644000000000000000000000377111551700072012675 0ustar import java.io.ObjectInputStream; import java.io.IOException; import java.util.concurrent.*; import java.util.concurrent.locks.*; class Mutex implements Lock, java.io.Serializable { // Our internal helper class private static class Sync extends AbstractQueuedSynchronizer { // Report whether in locked state protected boolean isHeldExclusively() { return getState() == 1; } // Acquire the lock if state is zero public boolean tryAcquire(int acquires) { assert acquires == 1; // Otherwise unused return compareAndSetState(0, 1); } // Release the lock by setting state to zero protected boolean tryRelease(int releases) { assert releases == 1; // Otherwise unused if (getState() == 0) throw new IllegalMonitorStateException(); setState(0); return true; } // Provide a Condition Condition newCondition() { return new ConditionObject(); } // Deserialize properly private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); setState(0); // reset to unlocked state } } // The sync object does all the hard work. We just forward to it. private final Sync sync = new Sync(); public void lock() { sync.acquire(1); } public boolean tryLock() { return sync.tryAcquire(1); } public void unlock() { sync.release(1); } public Condition newCondition() { return sync.newCondition(); } public boolean isLocked() { return sync.isHeldExclusively(); } public boolean hasQueuedThreads() { return sync.hasQueuedThreads(); } public void lockInterruptibly() throws InterruptedException { sync.acquireInterruptibly(1); } public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException { return sync.tryAcquireNanos(1, unit.toNanos(timeout)); } } jsr166/src/loops/LoopHelpers.java0000644000000000000000000000576211460217246014036 0ustar /** * Misc utilities in JSR166 performance tests */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; class LoopHelpers { static final SimpleRandom staticRNG = new SimpleRandom(); // Some mindless computation to do between synchronizations... /** * generates 32 bit pseudo-random numbers. * Adapted from http://www.snippets.org */ public static int compute1(int x) { int lo = 16807 * (x & 0xFFFF); int hi = 16807 * (x >>> 16); lo += (hi & 0x7FFF) << 16; if ((lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } lo += hi >>> 15; if (lo == 0 || (lo & 0x80000000) != 0) { lo &= 0x7fffffff; ++lo; } return lo; } /** * Computes a linear congruential random number a random number * of times. */ public static int compute2(int x) { int loops = (x >>> 4) & 7; while (loops-- > 0) { x = (x * 2147483647) % 16807; } return x; } /** * Yet another random number generator */ public static int compute3(int x) { int t = (x % 127773) * 16807 - (x / 127773) * 2836; return (t > 0) ? t : t + 0x7fffffff; } /** * Yet another random number generator */ public static int compute4(int x) { return x * 134775813 + 1; } /** * An actually useful random number generator, but unsynchronized. * Basically same as java.util.Random. */ public static class SimpleRandom { private final static long multiplier = 0x5DEECE66DL; private final static long addend = 0xBL; private final static long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong(1); private long seed = System.nanoTime() + seq.getAndIncrement(); public void setSeed(long s) { seed = s; } public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; } } public static class BarrierTimer implements Runnable { public volatile long startTime; public volatile long endTime; public void run() { long t = System.nanoTime(); if (startTime == 0) startTime = t; else endTime = t; } public void clear() { startTime = 0; endTime = 0; } public long getTime() { return endTime - startTime; } } public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; String num = Long.toString(n); if (num.length() >= field.length()) return num; StringBuffer b = new StringBuffer(field); b.replace(b.length()-num.length(), b.length(), num); return b.toString(); } } jsr166/src/extra166y/0000755000000000000000000000000011652013242011333 5ustar jsr166/src/extra166y/PAS.java0000644000000000000000000032214111537741066012642 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * Shared internal execution support for ParallelArray and * specializations. */ class PAS { private PAS() {} // all-static, non-instantiable /** Global default executor */ private static volatile ForkJoinPool defaultExecutor; /** Lock for on-demand initialization of defaultExecutor */ private static final Object poolLock = new Object(); static ForkJoinPool defaultExecutor() { ForkJoinPool p = defaultExecutor; // double-check if (p == null) { synchronized (poolLock) { p = defaultExecutor; if (p == null) { // use ceil(7/8 * ncpus) int nprocs = Runtime.getRuntime().availableProcessors(); int nthreads = nprocs - (nprocs >>> 3); defaultExecutor = p = new ForkJoinPool(nthreads); } } } return p; } /** * Base for most divide-and-conquer tasks used for computing * ParallelArray operations. Rather than pure recursion, it links * right-hand-sides and then joins up the tree, exploiting cases * where tasks aren't stolen. This generates and joins tasks with * a bit less overhead than pure recursive style -- there are only * as many tasks as leaves (no strictly internal nodes). * * Split control relies on pap.getThreshold(), which is * expected to err on the side of generating too many tasks. To * counterbalance, if a task pops off its own smallest subtask, it * directly runs its leaf action rather than possibly resplitting. * * There are, with a few exceptions, three flavors of each FJBase * subclass, prefixed FJO (object reference), FJD (double) and FJL * (long). */ static abstract class FJBase extends RecursiveAction { final AbstractParallelAnyArray pap; final int lo; final int hi; final FJBase next; // the next task that creator should join FJBase(AbstractParallelAnyArray pap, int lo, int hi, FJBase next) { this.pap = pap; this.lo = lo; this.hi = hi; this.next = next; } public final void compute() { int g = pap.getThreshold(); int l = lo; int h = hi; if (h - l > g) internalCompute(l, h, g); else atLeaf(l, h); } final void internalCompute(int l, int h, int g) { FJBase r = null; do { int rh = h; h = (l + h) >>> 1; (r = newSubtask(h, rh, r)).fork(); } while (h - l > g); atLeaf(l, h); do { if (r.tryUnfork()) r.atLeaf(r.lo, r.hi); else r.join(); onReduce(r); r = r.next; } while (r != null); } /** Leaf computation */ abstract void atLeaf(int l, int h); /** Operation performed after joining right subtask -- default noop */ void onReduce(FJBase right) {} /** Factory method to create new subtask, normally of current type */ abstract FJBase newSubtask(int l, int h, FJBase r); } // apply static final class FJOApply extends FJBase { final Procedure procedure; FJOApply(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, Procedure procedure) { super(pap, lo, hi, next); this.procedure = procedure; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOApply(pap, l, h, r, procedure); } void atLeaf(int l, int h) { pap.leafApply(l, h, procedure); } } static final class FJDApply extends FJBase { final DoubleProcedure procedure; FJDApply(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, DoubleProcedure procedure) { super(pap, lo, hi, next); this.procedure = procedure; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDApply(pap, l, h, r, procedure); } void atLeaf(int l, int h) { pap.leafApply(l, h, procedure); } } static final class FJLApply extends FJBase { final LongProcedure procedure; FJLApply(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, LongProcedure procedure) { super(pap, lo, hi, next); this.procedure = procedure; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLApply(pap, l, h, r, procedure); } void atLeaf(int l, int h) { pap.leafApply(l, h, procedure); } } // reduce static final class FJOReduce extends FJBase { final Reducer reducer; Object result; FJOReduce(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, Reducer reducer, Object base) { super(pap, lo, hi, next); this.reducer = reducer; this.result = base; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOReduce(pap, l, h, r, reducer, result); } void atLeaf(int l, int h) { result = pap.leafReduce(l, h, reducer, result); } void onReduce(FJBase right) { result = reducer.op(result, ((FJOReduce)right).result); } } static final class FJDReduce extends FJBase { final DoubleReducer reducer; double result; FJDReduce(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, DoubleReducer reducer, double base) { super(pap, lo, hi, next); this.reducer = reducer; this.result = base; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDReduce(pap, l, h, r, reducer, result); } void atLeaf(int l, int h) { result = pap.leafReduce(l, h, reducer, result); } void onReduce(FJBase right) { result = reducer.op(result, ((FJDReduce)right).result); } } static final class FJLReduce extends FJBase { final LongReducer reducer; long result; FJLReduce(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, LongReducer reducer, long base) { super(pap, lo, hi, next); this.reducer = reducer; this.result = base; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLReduce(pap, l, h, r, reducer, result); } void atLeaf(int l, int h) { result = pap.leafReduce(l, h, reducer, result); } void onReduce(FJBase right) { result = reducer.op(result, ((FJLReduce)right).result); } } // map static final class FJOMap extends FJBase { final Object[] dest; final int offset; FJOMap(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, Object[] dest, int offset) { super(pap, lo, hi, next); this.dest = dest; this.offset = offset; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOMap(pap, l, h, r, dest, offset); } void atLeaf(int l, int h) { pap.leafTransfer(l, h, dest, l + offset); } } static final class FJDMap extends FJBase { final double[] dest; final int offset; FJDMap(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, double[] dest, int offset) { super(pap, lo, hi, next); this.dest = dest; this.offset = offset; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDMap(pap, l, h, r, dest, offset); } void atLeaf(int l, int h) { pap.leafTransfer(l, h, dest, l + offset); } } static final class FJLMap extends FJBase { final long[] dest; final int offset; FJLMap(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, long[] dest, int offset) { super(pap, lo, hi, next); this.dest = dest; this.offset = offset; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLMap(pap, l, h, r, dest, offset); } void atLeaf(int l, int h) { pap.leafTransfer(l, h, dest, l + offset); } } // transform static final class FJOTransform extends FJBase { final Op op; FJOTransform(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, Op op) { super(pap, lo, hi, next); this.op = op; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOTransform(pap, l, h, r, op); } void atLeaf(int l, int h) { pap.leafTransform(l, h, op); } } static final class FJDTransform extends FJBase { final DoubleOp op; FJDTransform(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, DoubleOp op) { super(pap, lo, hi, next); this.op = op; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDTransform(pap, l, h, r, op); } void atLeaf(int l, int h) { pap.leafTransform(l, h, op); } } static final class FJLTransform extends FJBase { final LongOp op; FJLTransform(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, LongOp op) { super(pap, lo, hi, next); this.op = op; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLTransform(pap, l, h, r, op); } void atLeaf(int l, int h) { pap.leafTransform(l, h, op); } } // index map static final class FJOIndexMap extends FJBase { final IntToObject op; FJOIndexMap(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, IntToObject op) { super(pap, lo, hi, next); this.op = op; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOIndexMap(pap, l, h, r, op); } void atLeaf(int l, int h) { pap.leafIndexMap(l, h, op); } } static final class FJDIndexMap extends FJBase { final IntToDouble op; FJDIndexMap(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, IntToDouble op) { super(pap, lo, hi, next); this.op = op; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDIndexMap(pap, l, h, r, op); } void atLeaf(int l, int h) { pap.leafIndexMap(l, h, op); } } static final class FJLIndexMap extends FJBase { final IntToLong op; FJLIndexMap(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, IntToLong op) { super(pap, lo, hi, next); this.op = op; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLIndexMap(pap, l, h, r, op); } void atLeaf(int l, int h) { pap.leafIndexMap(l, h, op); } } // binary index map static final class FJOBinaryIndexMap extends FJBase { final IntAndObjectToObject op; FJOBinaryIndexMap(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, IntAndObjectToObject op) { super(pap, lo, hi, next); this.op = op; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOBinaryIndexMap(pap, l, h, r, op); } void atLeaf(int l, int h) { pap.leafBinaryIndexMap(l, h, op); } } static final class FJDBinaryIndexMap extends FJBase { final IntAndDoubleToDouble op; FJDBinaryIndexMap(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, IntAndDoubleToDouble op) { super(pap, lo, hi, next); this.op = op; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDBinaryIndexMap(pap, l, h, r, op); } void atLeaf(int l, int h) { pap.leafBinaryIndexMap(l, h, op); } } static final class FJLBinaryIndexMap extends FJBase { final IntAndLongToLong op; FJLBinaryIndexMap(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, IntAndLongToLong op) { super(pap, lo, hi, next); this.op = op; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLBinaryIndexMap(pap, l, h, r, op); } void atLeaf(int l, int h) { pap.leafBinaryIndexMap(l, h, op); } } // generate static final class FJOGenerate extends FJBase { final Generator generator; FJOGenerate(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, Generator generator) { super(pap, lo, hi, next); this.generator = generator; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOGenerate(pap, l, h, r, generator); } void atLeaf(int l, int h) { pap.leafGenerate(l, h, generator); } } static final class FJDGenerate extends FJBase { final DoubleGenerator generator; FJDGenerate(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, DoubleGenerator generator) { super(pap, lo, hi, next); this.generator = generator; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDGenerate(pap, l, h, r, generator); } void atLeaf(int l, int h) { pap.leafGenerate(l, h, generator); } } static final class FJLGenerate extends FJBase { final LongGenerator generator; FJLGenerate(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, LongGenerator generator) { super(pap, lo, hi, next); this.generator = generator; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLGenerate(pap, l, h, r, generator); } void atLeaf(int l, int h) { pap.leafGenerate(l, h, generator); } } // fill static final class FJOFill extends FJBase { final Object value; FJOFill(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, Object value) { super(pap, lo, hi, next); this.value = value; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOFill(pap, l, h, r, value); } void atLeaf(int l, int h) { pap.leafFill(l, h, value); } } static final class FJDFill extends FJBase { final double value; FJDFill(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, double value) { super(pap, lo, hi, next); this.value = value; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDFill(pap, l, h, r, value); } void atLeaf(int l, int h) { pap.leafFill(l, h, value); } } static final class FJLFill extends FJBase { final long value; FJLFill(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, long value) { super(pap, lo, hi, next); this.value = value; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLFill(pap, l, h, r, value); } void atLeaf(int l, int h) { pap.leafFill(l, h, value); } } // combine in place static final class FJOCombineInPlace extends FJBase { final Object[] other; final int otherOffset; final BinaryOp combiner; FJOCombineInPlace(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, Object[] other, int otherOffset, BinaryOp combiner) { super(pap, lo, hi, next); this.other = other; this.otherOffset = otherOffset; this.combiner = combiner; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOCombineInPlace (pap, l, h, r, other, otherOffset, combiner); } void atLeaf(int l, int h) { pap.leafCombineInPlace(l, h, other, otherOffset, combiner); } } static final class FJDCombineInPlace extends FJBase { final double[] other; final int otherOffset; final BinaryDoubleOp combiner; FJDCombineInPlace(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, double[] other, int otherOffset, BinaryDoubleOp combiner) { super(pap, lo, hi, next); this.other = other; this.otherOffset = otherOffset; this.combiner = combiner; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDCombineInPlace (pap, l, h, r, other, otherOffset, combiner); } void atLeaf(int l, int h) { pap.leafCombineInPlace(l, h, other, otherOffset, combiner); } } static final class FJLCombineInPlace extends FJBase { final long[] other; final int otherOffset; final BinaryLongOp combiner; FJLCombineInPlace(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, long[] other, int otherOffset, BinaryLongOp combiner) { super(pap, lo, hi, next); this.other = other; this.otherOffset = otherOffset; this.combiner = combiner; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLCombineInPlace (pap, l, h, r, other, otherOffset, combiner); } void atLeaf(int l, int h) { pap.leafCombineInPlace(l, h, other, otherOffset, combiner); } } static final class FJOPACombineInPlace extends FJBase { final ParallelArrayWithMapping other; final int otherOffset; final BinaryOp combiner; FJOPACombineInPlace(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, ParallelArrayWithMapping other, int otherOffset, BinaryOp combiner) { super(pap, lo, hi, next); this.other = other; this.otherOffset = otherOffset; this.combiner = combiner; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOPACombineInPlace (pap, l, h, r, other, otherOffset, combiner); } void atLeaf(int l, int h) { pap.leafCombineInPlace(l, h, other, otherOffset, combiner); } } static final class FJDPACombineInPlace extends FJBase { final ParallelDoubleArrayWithDoubleMapping other; final int otherOffset; final BinaryDoubleOp combiner; FJDPACombineInPlace(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, ParallelDoubleArrayWithDoubleMapping other, int otherOffset, BinaryDoubleOp combiner) { super(pap, lo, hi, next); this.other = other; this.otherOffset = otherOffset; this.combiner = combiner; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDPACombineInPlace (pap, l, h, r, other, otherOffset, combiner); } void atLeaf(int l, int h) { pap.leafCombineInPlace(l, h, other, otherOffset, combiner); } } static final class FJLPACombineInPlace extends FJBase { final ParallelLongArrayWithLongMapping other; final int otherOffset; final BinaryLongOp combiner; FJLPACombineInPlace(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, ParallelLongArrayWithLongMapping other, int otherOffset, BinaryLongOp combiner) { super(pap, lo, hi, next); this.other = other; this.otherOffset = otherOffset; this.combiner = combiner; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLPACombineInPlace (pap, l, h, r, other, otherOffset, combiner); } void atLeaf(int l, int h) { pap.leafCombineInPlace(l, h, other, otherOffset, combiner); } } // stats static final class FJOStats extends FJBase implements ParallelArray.SummaryStatistics { final Comparator comparator; public int size() { return size; } public Object min() { return min; } public Object max() { return max; } public int indexOfMin() { return indexOfMin; } public int indexOfMax() { return indexOfMax; } int size; Object min; Object max; int indexOfMin; int indexOfMax; FJOStats(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, Comparator comparator) { super(pap, lo, hi, next); this.comparator = comparator; this.indexOfMin = -1; this.indexOfMax = -1; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOStats(pap, l, h, r, comparator); } void onReduce(FJBase right) { FJOStats r = (FJOStats)right; size += r.size; updateMin(r.indexOfMin, r.min); updateMax(r.indexOfMax, r.max); } void updateMin(int i, Object x) { if (i >= 0 && (indexOfMin < 0 || comparator.compare(min, x) > 0)) { min = x; indexOfMin = i; } } void updateMax(int i, Object x) { if (i >= 0 && (indexOfMax < 0 || comparator.compare(max, x) < 0)) { max = x; indexOfMax = i; } } void atLeaf(int l, int h) { if (pap.hasFilter()) filteredAtLeaf(l, h); else { size = h - l; for (int i = l; i < h; ++i) { Object x = pap.oget(i); updateMin(i, x); updateMax(i, x); } } } void filteredAtLeaf(int l, int h) { for (int i = l; i < h; ++i) { if (pap.isSelected(i)) { Object x = pap.oget(i); ++size; updateMin(i, x); updateMax(i, x); } } } public String toString() { return "size: " + size + " min: " + min + " (index " + indexOfMin + ") max: " + max + " (index " + indexOfMax + ")"; } } static final class FJDStats extends FJBase implements ParallelDoubleArray.SummaryStatistics { final DoubleComparator comparator; public int size() { return size; } public double min() { return min; } public double max() { return max; } public double sum() { return sum; } public double average() { return sum / size; } public int indexOfMin() { return indexOfMin; } public int indexOfMax() { return indexOfMax; } int size; double min; double max; double sum; int indexOfMin; int indexOfMax; FJDStats(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, DoubleComparator comparator) { super(pap, lo, hi, next); this.comparator = comparator; this.indexOfMin = -1; this.indexOfMax = -1; this.min = Double.MAX_VALUE; this.max = -Double.MAX_VALUE; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDStats(pap, l, h, r, comparator); } void onReduce(FJBase right) { FJDStats r = (FJDStats)right; size += r.size; sum += r.sum; updateMin(r.indexOfMin, r.min); updateMax(r.indexOfMax, r.max); } void updateMin(int i, double x) { if (i >= 0 && (indexOfMin < 0 || comparator.compare(min, x) > 0)) { min = x; indexOfMin = i; } } void updateMax(int i, double x) { if (i >= 0 && (indexOfMax < 0 || comparator.compare(max, x) < 0)) { max = x; indexOfMax = i; } } void atLeaf(int l, int h) { if (pap.hasFilter()) filteredAtLeaf(l, h); else { size = h - l; for (int i = l; i < h; ++i) { double x = pap.dget(i); sum += x; updateMin(i, x); updateMax(i, x); } } } void filteredAtLeaf(int l, int h) { for (int i = l; i < h; ++i) { if (pap.isSelected(i)) { double x = pap.dget(i); ++size; sum += x; updateMin(i, x); updateMax(i, x); } } } public String toString() { return "size: " + size + " min: " + min + " (index " + indexOfMin + ") max: " + max + " (index " + indexOfMax + ") sum: " + sum; } } static final class FJLStats extends FJBase implements ParallelLongArray.SummaryStatistics { final LongComparator comparator; public int size() { return size; } public long min() { return min; } public long max() { return max; } public long sum() { return sum; } public double average() { return (double)sum / size; } public int indexOfMin() { return indexOfMin; } public int indexOfMax() { return indexOfMax; } int size; long min; long max; long sum; int indexOfMin; int indexOfMax; FJLStats(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, LongComparator comparator) { super(pap, lo, hi, next); this.comparator = comparator; this.indexOfMin = -1; this.indexOfMax = -1; this.min = Long.MAX_VALUE; this.max = Long.MIN_VALUE; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLStats(pap, l, h, r, comparator); } void onReduce(FJBase right) { FJLStats r = (FJLStats)right; size += r.size; sum += r.sum; updateMin(r.indexOfMin, r.min); updateMax(r.indexOfMax, r.max); } void updateMin(int i, long x) { if (i >= 0 && (indexOfMin < 0 || comparator.compare(min, x) > 0)) { min = x; indexOfMin = i; } } void updateMax(int i, long x) { if (i >= 0 && (indexOfMax < 0 || comparator.compare(max, x) < 0)) { max = x; indexOfMax = i; } } void atLeaf(int l, int h) { if (pap.hasFilter()) filteredAtLeaf(l, h); else { size = h - l; for (int i = l; i < h; ++i) { long x = pap.lget(i); sum += x; updateMin(i, x); updateMax(i, x); } } } void filteredAtLeaf(int l, int h) { for (int i = l; i < h; ++i) { if (pap.isSelected(i)) { long x = pap.lget(i); ++size; sum += x; updateMin(i, x); updateMax(i, x); } } } public String toString() { return "size: " + size + " min: " + min + " (index " + indexOfMin + ") max: " + max + " (index " + indexOfMax + ") sum: " + sum; } } // count static final class FJCountSelected extends FJBase { int count; FJCountSelected(AbstractParallelAnyArray pap, int lo, int hi, FJBase next) { super(pap, lo, hi, next); } FJBase newSubtask(int l, int h, FJBase r) { return new FJCountSelected(pap, l, h, r); } void onReduce(FJBase right) { count += ((FJCountSelected)right).count; } void atLeaf(int l, int h) { int n = 0; for (int i = l; i < h; ++i) { if (pap.isSelected(i)) ++n; } count = n; } } /** * Base for cancellable search tasks. Same idea as FJBase * but cancels tasks when result nonnegative. */ static abstract class FJSearchBase extends RecursiveAction { final AbstractParallelAnyArray pap; final int lo; final int hi; final FJSearchBase next; final AtomicInteger result; FJSearchBase(AbstractParallelAnyArray pap, int lo, int hi, FJSearchBase next, AtomicInteger result) { this.pap = pap; this.lo = lo; this.hi = hi; this.next = next; this.result = result; } public void compute() { if (result.get() >= 0) return; FJSearchBase r = null; int l = lo; int h = hi; int g = pap.getThreshold(); while (h - l > g) { int rh = h; h = (l + h) >>> 1; (r = newSubtask(h, rh, r)).fork(); } atLeaf(l, h); boolean stopping = false; while (r != null) { stopping |= result.get() >= 0; if (r.tryUnfork()) { if (!stopping) r.atLeaf(r.lo, r.hi); } else if (stopping) r.cancel(false); else r.join(); r = r.next; } } abstract FJSearchBase newSubtask(int l, int h, FJSearchBase r); abstract void atLeaf(int l, int h); } // select any static final class FJSelectAny extends FJSearchBase { FJSelectAny(AbstractParallelAnyArray pap, int lo, int hi, FJSearchBase next, AtomicInteger result) { super(pap, lo, hi, next, result); } FJSearchBase newSubtask(int l, int h, FJSearchBase r) { return new FJSelectAny(pap, l, h, r, result); } void atLeaf(int l, int h) { for (int i = l; i < h; ++i) { if (pap.isSelected(i)) { result.compareAndSet(-1, i); break; } else if (result.get() >= 0) break; } } } // index of static final class FJOIndexOf extends FJSearchBase { final Object target; FJOIndexOf(AbstractParallelAnyArray pap, int lo, int hi, FJSearchBase next, AtomicInteger result, Object target) { super(pap, lo, hi, next, result); this.target = target; } FJSearchBase newSubtask(int l, int h, FJSearchBase r) { return new FJOIndexOf(pap, l, h, r, result, target); } void atLeaf(int l, int h) { final Object[] array = pap.ogetArray(); if (array == null) return; for (int i = l; i < h; ++i) { if (target.equals(array[i])) { result.compareAndSet(-1, i); break; } else if (result.get() >= 0) break; } } } static final class FJDIndexOf extends FJSearchBase { final double target; FJDIndexOf(AbstractParallelAnyArray pap, int lo, int hi, FJSearchBase next, AtomicInteger result, double target) { super(pap, lo, hi, next, result); this.target = target; } FJSearchBase newSubtask(int l, int h, FJSearchBase r) { return new FJDIndexOf(pap, l, h, r, result, target); } void atLeaf(int l, int h) { final double[] array = pap.dgetArray(); if (array == null) return; for (int i = l; i < h; ++i) { if (target == (array[i])) { result.compareAndSet(-1, i); break; } else if (result.get() >= 0) break; } } } static final class FJLIndexOf extends FJSearchBase { final long target; FJLIndexOf(AbstractParallelAnyArray pap, int lo, int hi, FJSearchBase next, AtomicInteger result, long target) { super(pap, lo, hi, next, result); this.target = target; } FJSearchBase newSubtask(int l, int h, FJSearchBase r) { return new FJLIndexOf(pap, l, h, r, result, target); } void atLeaf(int l, int h) { final long[] array = pap.lgetArray(); if (array == null) return; for (int i = l; i < h; ++i) { if (target == (array[i])) { result.compareAndSet(-1, i); break; } else if (result.get() >= 0) break; } } } // select all /** * SelectAll proceeds in two passes. In the first phase, indices * of matching elements are recorded in indices array. In second * pass, once the size of results is known and result array is * constructed in driver, the matching elements are placed into * corresponding result positions. */ static final class FJSelectAll extends RecursiveAction { final FJSelectAllDriver driver; FJSelectAll left, right; final int lo; final int hi; int count; // number of matching elements int offset; boolean isInternal; // true if this is a non-leaf node final int threshold; FJSelectAll(FJSelectAllDriver driver, int lo, int hi) { this.driver = driver; this.lo = lo; this.hi = hi; this.threshold = driver.pap.getThreshold(); } public void compute() { int l = lo; int h = hi; FJSelectAllDriver d = driver; if (d.phase == 0) { AbstractParallelAnyArray p = d.pap; if (isInternal = (h - l > threshold)) internalPhase0(); else count = p.leafIndexSelected(l, h, true, d.indices); } else if (count != 0) { if (isInternal) internalPhase1(); else d.leafPhase1(l, l+count, offset); } } void internalPhase0() { int mid = (lo + hi) >>> 1; FJSelectAll l = new FJSelectAll(driver, lo, mid); FJSelectAll r = new FJSelectAll(driver, mid, hi); r.fork(); l.compute(); if (r.tryUnfork()) r.compute(); else r.join(); int ln = l.count; if (ln != 0) left = l; int rn = r.count; if (rn != 0) right = r; count = ln + rn; } void internalPhase1() { int k = offset; if (left != null) { int ln = left.count; left.offset = k; left.reinitialize(); if (right != null) { right.offset = k + ln; right.reinitialize(); right.fork(); left.compute(); if (right.tryUnfork()) right.compute(); else right.join(); } else left.compute(); } else if (right != null) { right.offset = k; right.compute(); } } } static abstract class FJSelectAllDriver extends RecursiveAction { final int[] indices; final AbstractParallelAnyArray pap; final int initialOffset; int phase; int resultSize; FJSelectAllDriver(AbstractParallelAnyArray pap, int initialOffset) { this.pap = pap; this.initialOffset = initialOffset; int n = pap.fence - pap.origin; indices = new int[n]; } public final void compute() { FJSelectAll r = new FJSelectAll(this, pap.origin, pap.fence); r.offset = initialOffset; r.compute(); createResults(resultSize = r.count); phase = 1; r.compute(); } abstract void createResults(int size); abstract void leafPhase1(int loIdx, int hiIdx, int offset); } static final class FJOSelectAllDriver extends FJSelectAllDriver { final Class elementType; Object[] results; FJOSelectAllDriver(AbstractParallelAnyArray pap, Class elementType) { super(pap, 0); this.elementType = elementType; } void createResults(int size) { results = (Object[])Array.newInstance(elementType, size); } void leafPhase1(int loIdx, int hiIdx, int offset) { pap.leafTransferByIndex(indices, loIdx, hiIdx, results, offset); } } static final class FJDSelectAllDriver extends FJSelectAllDriver { double[] results; FJDSelectAllDriver(AbstractParallelAnyArray pap) { super(pap, 0); } void createResults(int size) { results = new double[size]; } void leafPhase1(int loIdx, int hiIdx, int offset) { pap.leafTransferByIndex(indices, loIdx, hiIdx, results, offset); } } static final class FJLSelectAllDriver extends FJSelectAllDriver { long[] results; FJLSelectAllDriver(AbstractParallelAnyArray pap) { super(pap, 0); } void createResults(int size) { results = new long[size]; } void leafPhase1(int loIdx, int hiIdx, int offset) { pap.leafTransferByIndex(indices, loIdx, hiIdx, results, offset); } } static final class FJOAppendAllDriver extends FJSelectAllDriver { Object[] results; FJOAppendAllDriver(AbstractParallelAnyArray pap, int initialOffset, Object[] results) { super(pap, 0); this.results = results; } void createResults(int size) { int newSize = initialOffset + size; int oldLength = results.length; if (newSize > oldLength) { Class elementType = results.getClass().getComponentType(); Object[] r = (Object[])Array.newInstance(elementType, newSize); System.arraycopy(results, 0, r, 0, oldLength); results = r; } } void leafPhase1(int loIdx, int hiIdx, int offset) { pap.leafTransferByIndex(indices, loIdx, hiIdx, results, offset); } } static final class FJDAppendAllDriver extends FJSelectAllDriver { double[] results; FJDAppendAllDriver(AbstractParallelAnyArray pap, int initialOffset, double[] results) { super(pap, initialOffset); this.results = results; } void createResults(int size) { int newSize = initialOffset + size; int oldLength = results.length; if (newSize > oldLength) { double[] r = new double[newSize]; System.arraycopy(results, 0, r, 0, oldLength); results = r; } } void leafPhase1(int loIdx, int hiIdx, int offset) { pap.leafTransferByIndex(indices, loIdx, hiIdx, results, offset); } } static final class FJLAppendAllDriver extends FJSelectAllDriver { long[] results; FJLAppendAllDriver(AbstractParallelAnyArray pap, int initialOffset, long[] results) { super(pap, initialOffset); this.results = results; } void createResults(int size) { int newSize = initialOffset + size; int oldLength = results.length; if (newSize > oldLength) { long[] r = new long[newSize]; System.arraycopy(results, 0, r, 0, oldLength); results = r; } } void leafPhase1(int loIdx, int hiIdx, int offset) { pap.leafTransferByIndex(indices, loIdx, hiIdx, results, offset); } } /** * Root node for FJRemoveAll. Spawns subtasks and shifts elements * as indices become available, bypassing index array creation * when offsets are known. This differs from SelectAll mainly in * that data movement is all done by the driver rather than in a * second parallel pass. */ static final class FJRemoveAllDriver extends RecursiveAction { final AbstractParallelAnyArray pap; final int lo; final int hi; final int[] indices; int offset; final int threshold; FJRemoveAllDriver(AbstractParallelAnyArray pap, int lo, int hi) { this.pap = pap; this.lo = lo; this.hi = hi; this.indices = new int[hi - lo]; this.threshold = pap.getThreshold(); } public void compute() { FJRemoveAll r = null; int l = lo; int h = hi; int g = threshold; while (h - l > g) { int rh = h; h = (l + h) >>> 1; (r = new FJRemoveAll(pap, h, rh, r, indices)).fork(); } int k = pap.leafMoveSelected(l, h, l, false); while (r != null) { if (r.tryUnfork()) k = pap.leafMoveSelected(r.lo, r.hi, k, false); else { r.join(); int n = r.count; if (n != 0) pap.leafMoveByIndex(indices, r.lo, r.lo+n, k); k += n; FJRemoveAll rr = r.right; if (rr != null) k = inorderMove(rr, k); } r = r.next; } offset = k; } /** * Inorder traversal to move indexed elements across reachable * nodes. This guarantees that element shifts don't overwrite * those still being used by active subtasks. */ static int inorderMove(FJRemoveAll t, int index) { while (t != null) { int n = t.count; if (n != 0) t.pap.leafMoveByIndex(t.indices, t.lo, t.lo+n, index); index += n; FJRemoveAll p = t.next; if (p != null) index = inorderMove(p, index); t = t.right; } return index; } } /** * Basic FJ task for non-root FJRemoveAll nodes. Differs from * FJBase because it requires maintaining explicit right pointers so * FJRemoveAllDriver can traverse them */ static final class FJRemoveAll extends RecursiveAction { final AbstractParallelAnyArray pap; final int lo; final int hi; final FJRemoveAll next; final int[] indices; int count; FJRemoveAll right; final int threshold; FJRemoveAll(AbstractParallelAnyArray pap, int lo, int hi, FJRemoveAll next, int[] indices) { this.pap = pap; this.lo = lo; this.hi = hi; this.next = next; this.indices = indices; this.threshold = pap.getThreshold(); } public void compute() { FJRemoveAll r = null; int l = lo; int h = hi; int g = threshold; while (h - l > g) { int rh = h; h = (l + h) >>> 1; (r = new FJRemoveAll(pap, h, rh, r, indices)).fork(); } right = r; count = pap.leafIndexSelected(l, h, false, indices); while (r != null) { if (r.tryUnfork()) r.count = pap.leafIndexSelected (r.lo, r.hi, false, indices); else r.join(); r = r.next; } } } // unique elements static final class FJOUniquifier extends FJBase { final UniquifierTable table; int count; FJOUniquifier(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, UniquifierTable table) { super(pap, lo, hi, next); this.table = table; } FJBase newSubtask(int l, int h, FJBase r) { return new FJOUniquifier(pap, l, h, r, table); } void atLeaf(int l, int h) { count = table.addObjects(l, h); } void onReduce(FJBase right) { count += ((FJOUniquifier)right).count; } } static final class FJDUniquifier extends FJBase { final UniquifierTable table; int count; FJDUniquifier(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, UniquifierTable table) { super(pap, lo, hi, next); this.table = table; } FJBase newSubtask(int l, int h, FJBase r) { return new FJDUniquifier(pap, l, h, r, table); } void atLeaf(int l, int h) { count = table.addDoubles(l, h); } void onReduce(FJBase right) { count += ((FJDUniquifier)right).count; } } static final class FJLUniquifier extends FJBase { final UniquifierTable table; int count; FJLUniquifier(AbstractParallelAnyArray pap, int lo, int hi, FJBase next, UniquifierTable table) { super(pap, lo, hi, next); this.table = table; } FJBase newSubtask(int l, int h, FJBase r) { return new FJLUniquifier(pap, l, h, r, table); } void atLeaf(int l, int h) { count = table.addLongs(l, h); } void onReduce(FJBase right) { count += ((FJLUniquifier)right).count; } } /** * Base class of fixed-size hash tables for * uniquification. Opportunistically subclasses * AtomicLongArray. The high word of each slot is the cached * massaged hash of an element, and the low word contains its * index, plus one, to ensure that a zero tab entry means * empty. The mechanics for this are just folded into the * main addElements method. * Each leaf step places source array elements into table, * Even though this table undergoes a lot of contention when * elements are concurrently inserted by parallel threads, it is * generally faster to do this than to have separate tables and * then merge them. */ static final class UniquifierTable extends AtomicLongArray { final AbstractParallelAnyArray pap; final boolean byIdentity; UniquifierTable(int size, AbstractParallelAnyArray pap, boolean byIdentity) { super(tableSizeFor(size)); this.pap = pap; this.byIdentity = byIdentity; } /** Returns a good size for table */ static int tableSizeFor(int n) { int padded = n + (n >>> 1) + 1; if (padded < n) // int overflow throw new OutOfMemoryError(); int s = 8; while (s < padded) s <<= 1; return s; } // Same hashcode conditioning as HashMap static int hash(int h) { h ^= (h >>> 20) ^ (h >>> 12); return h ^ (h >>> 7) ^ (h >>> 4); } int addObjects(int lo, int hi) { boolean filtered = pap.hasFilter(); Object[] src = pap.ogetArray(); final int mask = length() - 1; int count = 0; for (int k = lo; k < hi; ++k) { Object x; if ((filtered && !pap.isSelected(k)) || (x = src[k]) == null) continue; int hc = byIdentity ? System.identityHashCode(x) : x.hashCode(); int hash = hash(hc); long entry = (((long)hash) << 32) + (k + 1); int idx = hash & mask; for (;;) { long d = get(idx); if (d != 0) { if ((int)(d >>> 32) == hash) { Object y = src[(int)((d-1) & 0x7fffffffL)]; if (x == y || (!byIdentity && x.equals(y))) break; } idx = (idx + 1) & mask; } else if (compareAndSet(idx, 0, entry)) { ++count; break; } } } return count; } int addDoubles(int lo, int hi) { boolean filtered = pap.hasFilter(); double[] src = pap.dgetArray(); final int mask = length() - 1; int count = 0; for (int k = lo; k < hi; ++k) { if (filtered && !pap.isSelected(k)) continue; double x = src[k]; long bits = Double.doubleToLongBits(x); int hash = hash((int)(bits ^ (bits >>> 32))); long entry = (((long)hash) << 32) + (k + 1); int idx = hash & mask; for (;;) { long d = get(idx); if (d != 0) { if ((int)(d >>> 32) == hash && x == src[(int)((d - 1) & 0x7fffffffL)]) break; idx = (idx + 1) & mask; } else if (compareAndSet(idx, 0, entry)) { ++count; break; } } } return count; } int addLongs(int lo, int hi) { boolean filtered = pap.hasFilter(); long[] src = pap.lgetArray(); final int mask = length() - 1; int count = 0; for (int k = lo; k < hi; ++k) { if (filtered && !pap.isSelected(k)) continue; long x = src[k]; int hash = hash((int)(x ^ (x >>> 32))); long entry = (((long)hash) << 32) + (k + 1); int idx = hash & mask; for (;;) { long d = get(idx); if (d != 0) { if ((int)(d >>> 32) == hash && x == src[(int)((d - 1) & 0x7fffffffL)]) break; idx = (idx + 1) & mask; } else if (compareAndSet(idx, 0, entry)) { ++count; break; } } } return count; } /** * Return new array holding all elements. */ Object[] uniqueObjects(int size) { Object[] src = pap.ogetArray(); Class sclass = src.getClass().getComponentType(); Object[] res = (Object[])Array.newInstance(sclass, size); int k = 0; int n = length(); for (int i = 0; i < n && k < size; ++i) { long d = get(i); if (d != 0) res[k++] = src[((int)((d - 1) & 0x7fffffffL))]; } return res; } double[] uniqueDoubles(int size) { double[] src = pap.dgetArray(); double[] res = new double[size]; int k = 0; int n = length(); for (int i = 0; i < n && k < size; ++i) { long d = get(i); if (d != 0) res[k++] = src[((int)((d - 1) & 0x7fffffffL))]; } return res; } long[] uniqueLongs(int size) { long[] src = pap.lgetArray(); long[] res = new long[size]; int k = 0; int n = length(); for (int i = 0; i < n && k < size; ++i) { long d = get(i); if (d != 0) res[k++] = src[((int)((d - 1) & 0x7fffffffL))]; } return res; } } /** * Sorter classes based mainly on CilkSort * Cilk: * Basic algorithm: * if array size is small, just use a sequential quicksort * Otherwise: * 1. Break array in half. * 2. For each half, * a. break the half in half (i.e., quarters), * b. sort the quarters * c. merge them together * 3. merge together the two halves. * * One reason for splitting in quarters is that this guarantees * that the final sort is in the main array, not the workspace * array. (workspace and main swap roles on each subsort step.) * Leaf-level sorts use a Sequential quicksort, that in turn uses * insertion sort if under threshold. Otherwise it uses median of * three to pick pivot, and loops rather than recurses along left * path. * * It is sad but true that sort and merge performance are * sensitive enough to inner comparison overhead to warrant * creating 6 versions (not just 3) -- one each for natural * comparisons vs supplied comparators. */ static final class FJOSorter extends RecursiveAction { final Comparator cmp; final Object[] a; // array to be sorted. final Object[] w; // workspace for merge final int origin; // origin of the part of array we deal with final int n; // Number of elements in (sub)arrays. final int gran; // split control FJOSorter(Comparator cmp, Object[] a, Object[] w, int origin, int n, int gran) { this.cmp = cmp; this.a = a; this.w = w; this.origin = origin; this.n = n; this.gran = gran; } public void compute() { int l = origin; int g = gran; if (n > g) { int h = n >>> 1; // half int q = n >>> 2; // lower quarter index int u = h + q; // upper quarter FJSubSorter ls = new FJSubSorter (new FJOSorter(cmp, a, w, l, q, g), new FJOSorter(cmp, a, w, l+q, h-q, g), new FJOMerger(cmp, a, w, l, q, l+q, h-q, l, g, null)); FJSubSorter rs = new FJSubSorter (new FJOSorter(cmp, a, w, l+h, q, g), new FJOSorter(cmp, a, w, l+u, n-u, g), new FJOMerger(cmp, a, w, l+h, q, l+u, n-u, l+h, g, null)); rs.fork(); ls.compute(); if (rs.tryUnfork()) rs.compute(); else rs.join(); new FJOMerger(cmp, w, a, l, h, l+h, n-h, l, g, null).compute(); } else Arrays.sort(a, l, l+n, cmp); } } static final class FJOCSorter extends RecursiveAction { final Comparable[] a; final Comparable[] w; final int origin; final int n; final int gran; FJOCSorter(Comparable[] a, Comparable[] w, int origin, int n, int gran) { this.a = a; this.w = w; this.origin = origin; this.n = n; this.gran = gran; } public void compute() { int l = origin; int g = gran; if (n > g) { int h = n >>> 1; int q = n >>> 2; int u = h + q; FJSubSorter ls = new FJSubSorter (new FJOCSorter(a, w, l, q, g), new FJOCSorter(a, w, l+q, h-q, g), new FJOCMerger(a, w, l, q, l+q, h-q, l, g, null)); FJSubSorter rs = new FJSubSorter (new FJOCSorter(a, w, l+h, q, g), new FJOCSorter(a, w, l+u, n-u, g), new FJOCMerger(a, w, l+h, q, l+u, n-u, l+h, g, null)); rs.fork(); ls.compute(); if (rs.tryUnfork()) rs.compute(); else rs.join(); new FJOCMerger(w, a, l, h, l+h, n-h, l, g, null).compute(); } else Arrays.sort(a, l, l+n); } } static final class FJDSorter extends RecursiveAction { final DoubleComparator cmp; final double[] a; final double[] w; final int origin; final int n; final int gran; FJDSorter(DoubleComparator cmp, double[] a, double[] w, int origin, int n, int gran) { this.cmp = cmp; this.a = a; this.w = w; this.origin = origin; this.n = n; this.gran = gran; } public void compute() { int l = origin; int g = gran; if (n > g) { int h = n >>> 1; int q = n >>> 2; int u = h + q; FJSubSorter ls = new FJSubSorter (new FJDSorter(cmp, a, w, l, q, g), new FJDSorter(cmp, a, w, l+q, h-q, g), new FJDMerger(cmp, a, w, l, q, l+q, h-q, l, g, null)); FJSubSorter rs = new FJSubSorter (new FJDSorter(cmp, a, w, l+h, q, g), new FJDSorter(cmp, a, w, l+u, n-u, g), new FJDMerger(cmp, a, w, l+h, q, l+u, n-u, l+h, g, null)); rs.fork(); ls.compute(); if (rs.tryUnfork()) rs.compute(); else rs.join(); new FJDMerger(cmp, w, a, l, h, l+h, n-h, l, g, null).compute(); } else dquickSort(a, cmp, l, l+n-1); } } static final class FJDCSorter extends RecursiveAction { final double[] a; final double[] w; final int origin; final int n; final int gran; FJDCSorter(double[] a, double[] w, int origin, int n, int gran) { this.a = a; this.w = w; this.origin = origin; this.n = n; this.gran = gran; } public void compute() { int l = origin; int g = gran; if (n > g) { int h = n >>> 1; int q = n >>> 2; int u = h + q; FJSubSorter ls = new FJSubSorter (new FJDCSorter(a, w, l, q, g), new FJDCSorter(a, w, l+q, h-q, g), new FJDCMerger(a, w, l, q, l+q, h-q, l, g, null)); FJSubSorter rs = new FJSubSorter (new FJDCSorter(a, w, l+h, q, g), new FJDCSorter(a, w, l+u, n-u, g), new FJDCMerger(a, w, l+h, q, l+u, n-u, l+h, g, null)); rs.fork(); ls.compute(); if (rs.tryUnfork()) rs.compute(); else rs.join(); new FJDCMerger(w, a, l, h, l+h, n-h, l, g, null).compute(); } else Arrays.sort(a, l, l+n); } } static final class FJLSorter extends RecursiveAction { final LongComparator cmp; final long[] a; final long[] w; final int origin; final int n; final int gran; FJLSorter(LongComparator cmp, long[] a, long[] w, int origin, int n, int gran) { this.cmp = cmp; this.a = a; this.w = w; this.origin = origin; this.n = n; this.gran = gran; } public void compute() { int l = origin; int g = gran; if (n > g) { int h = n >>> 1; int q = n >>> 2; int u = h + q; FJSubSorter ls = new FJSubSorter (new FJLSorter(cmp, a, w, l, q, g), new FJLSorter(cmp, a, w, l+q, h-q, g), new FJLMerger(cmp, a, w, l, q, l+q, h-q, l, g, null)); FJSubSorter rs = new FJSubSorter (new FJLSorter(cmp, a, w, l+h, q, g), new FJLSorter(cmp, a, w, l+u, n-u, g), new FJLMerger(cmp, a, w, l+h, q, l+u, n-u, l+h, g, null)); rs.fork(); ls.compute(); if (rs.tryUnfork()) rs.compute(); else rs.join(); new FJLMerger(cmp, w, a, l, h, l+h, n-h, l, g, null).compute(); } else lquickSort(a, cmp, l, l+n-1); } } static final class FJLCSorter extends RecursiveAction { final long[] a; final long[] w; final int origin; final int n; final int gran; FJLCSorter(long[] a, long[] w, int origin, int n, int gran) { this.a = a; this.w = w; this.origin = origin; this.n = n; this.gran = gran; } public void compute() { int l = origin; int g = gran; if (n > g) { int h = n >>> 1; int q = n >>> 2; int u = h + q; FJSubSorter ls = new FJSubSorter (new FJLCSorter(a, w, l, q, g), new FJLCSorter(a, w, l+q, h-q, g), new FJLCMerger(a, w, l, q, l+q, h-q, l, g, null)); FJSubSorter rs = new FJSubSorter (new FJLCSorter(a, w, l+h, q, g), new FJLCSorter(a, w, l+u, n-u, g), new FJLCMerger(a, w, l+h, q, l+u, n-u, l+h, g, null)); rs.fork(); ls.compute(); if (rs.tryUnfork()) rs.compute(); else rs.join(); new FJLCMerger(w, a, l, h, l+h, n-h, l, g, null).compute(); } else Arrays.sort(a, l, l+n); } } /** Utility class to sort half a partitioned array */ static final class FJSubSorter extends RecursiveAction { final RecursiveAction left; final RecursiveAction right; final RecursiveAction merger; FJSubSorter(RecursiveAction left, RecursiveAction right, RecursiveAction merger) { this.left = left; this.right = right; this.merger = merger; } public void compute() { right.fork(); left.invoke(); right.join(); merger.invoke(); } } /** * Perform merging for FJSorter. If big enough, splits Left * partition in half; finds the greatest point in Right partition * less than the beginning of the second half of Left via binary * search; and then, in parallel, merges left half of Left with * elements of Right up to split point, and merges right half of * Left with elements of R past split point. At leaf, it just * sequentially merges. This is all messy to code; sadly we need * six versions. */ static final class FJOMerger extends RecursiveAction { final Comparator cmp; final Object[] a; // partitioned array. final Object[] w; // Output array. final int lo; // relative origin of left side of a final int ln; // number of elements on left of a final int ro; // relative origin of right side of a final int rn; // number of elements on right of a final int wo; // origin for output final int gran; final FJOMerger next; FJOMerger(Comparator cmp, Object[] a, Object[] w, int lo, int ln, int ro, int rn, int wo, int gran, FJOMerger next) { this.cmp = cmp; this.a = a; this.w = w; this.lo = lo; this.ln = ln; this.ro = ro; this.rn = rn; this.wo = wo; this.gran = gran; this.next = next; } public void compute() { // spawn right subtasks FJOMerger rights = null; int nleft = ln; int nright = rn; while (nleft > gran) { int lh = nleft >>> 1; int splitIndex = lo + lh; Object split = a[splitIndex]; // binary search r for split int rl = 0; int rh = nright; while (rl < rh) { int mid = (rl + rh) >>> 1; if (cmp.compare(split, a[ro + mid]) <= 0) rh = mid; else rl = mid + 1; } (rights = new FJOMerger (cmp, a, w, splitIndex, nleft-lh, ro+rh, nright-rh, wo+lh+rh, gran, rights)).fork(); nleft = lh; nright = rh; } // sequentially merge int l = lo; int lFence = lo + nleft; int r = ro; int rFence = ro + nright; int k = wo; while (l < lFence && r < rFence) { Object al = a[l]; Object ar = a[r]; Object t; if (cmp.compare(al, ar) <= 0) {++l; t=al;} else {++r; t=ar;} w[k++] = t; } while (l < lFence) w[k++] = a[l++]; while (r < rFence) w[k++] = a[r++]; // join subtasks while (rights != null) { if (rights.tryUnfork()) rights.compute(); else rights.join(); rights = rights.next; } } } static final class FJOCMerger extends RecursiveAction { final Comparable[] a; final Comparable[] w; final int lo; final int ln; final int ro; final int rn; final int wo; final int gran; final FJOCMerger next; FJOCMerger(Comparable[] a, Comparable[] w, int lo, int ln, int ro, int rn, int wo, int gran, FJOCMerger next) { this.a = a; this.w = w; this.lo = lo; this.ln = ln; this.ro = ro; this.rn = rn; this.wo = wo; this.gran = gran; this.next = next; } public void compute() { FJOCMerger rights = null; int nleft = ln; int nright = rn; while (nleft > gran) { int lh = nleft >>> 1; int splitIndex = lo + lh; Comparable split = a[splitIndex]; int rl = 0; int rh = nright; while (rl < rh) { int mid = (rl + rh) >>> 1; if (split.compareTo(a[ro + mid]) <= 0) rh = mid; else rl = mid + 1; } (rights = new FJOCMerger (a, w, splitIndex, nleft-lh, ro+rh, nright-rh, wo+lh+rh, gran, rights)).fork(); nleft = lh; nright = rh; } int l = lo; int lFence = lo + nleft; int r = ro; int rFence = ro + nright; int k = wo; while (l < lFence && r < rFence) { Comparable al = a[l]; Comparable ar = a[r]; Comparable t; if (al.compareTo(ar) <= 0) {++l; t=al;} else {++r; t=ar; } w[k++] = t; } while (l < lFence) w[k++] = a[l++]; while (r < rFence) w[k++] = a[r++]; while (rights != null) { if (rights.tryUnfork()) rights.compute(); else rights.join(); rights = rights.next; } } } static final class FJDMerger extends RecursiveAction { final DoubleComparator cmp; final double[] a; final double[] w; final int lo; final int ln; final int ro; final int rn; final int wo; final int gran; final FJDMerger next; FJDMerger(DoubleComparator cmp, double[] a, double[] w, int lo, int ln, int ro, int rn, int wo, int gran, FJDMerger next) { this.cmp = cmp; this.a = a; this.w = w; this.lo = lo; this.ln = ln; this.ro = ro; this.rn = rn; this.wo = wo; this.gran = gran; this.next = next; } public void compute() { FJDMerger rights = null; int nleft = ln; int nright = rn; while (nleft > gran) { int lh = nleft >>> 1; int splitIndex = lo + lh; double split = a[splitIndex]; int rl = 0; int rh = nright; while (rl < rh) { int mid = (rl + rh) >>> 1; if (cmp.compare(split, a[ro + mid]) <= 0) rh = mid; else rl = mid + 1; } (rights = new FJDMerger (cmp, a, w, splitIndex, nleft-lh, ro+rh, nright-rh, wo+lh+rh, gran, rights)).fork(); nleft = lh; nright = rh; } int l = lo; int lFence = lo + nleft; int r = ro; int rFence = ro + nright; int k = wo; while (l < lFence && r < rFence) { double al = a[l]; double ar = a[r]; double t; if (cmp.compare(al, ar) <= 0) {++l; t=al;} else {++r; t=ar; } w[k++] = t; } while (l < lFence) w[k++] = a[l++]; while (r < rFence) w[k++] = a[r++]; while (rights != null) { if (rights.tryUnfork()) rights.compute(); else rights.join(); rights = rights.next; } } } static final class FJDCMerger extends RecursiveAction { final double[] a; final double[] w; final int lo; final int ln; final int ro; final int rn; final int wo; final int gran; final FJDCMerger next; FJDCMerger(double[] a, double[] w, int lo, int ln, int ro, int rn, int wo, int gran, FJDCMerger next) { this.a = a; this.w = w; this.lo = lo; this.ln = ln; this.ro = ro; this.rn = rn; this.wo = wo; this.gran = gran; this.next = next; } public void compute() { FJDCMerger rights = null; int nleft = ln; int nright = rn; while (nleft > gran) { int lh = nleft >>> 1; int splitIndex = lo + lh; double split = a[splitIndex]; int rl = 0; int rh = nright; while (rl < rh) { int mid = (rl + rh) >>> 1; if (split <= a[ro + mid]) rh = mid; else rl = mid + 1; } (rights = new FJDCMerger (a, w, splitIndex, nleft-lh, ro+rh, nright-rh, wo+lh+rh, gran, rights)).fork(); nleft = lh; nright = rh; } int l = lo; int lFence = lo + nleft; int r = ro; int rFence = ro + nright; int k = wo; while (l < lFence && r < rFence) { double al = a[l]; double ar = a[r]; double t; if (al <= ar) {++l; t=al;} else {++r; t=ar; } w[k++] = t; } while (l < lFence) w[k++] = a[l++]; while (r < rFence) w[k++] = a[r++]; while (rights != null) { if (rights.tryUnfork()) rights.compute(); else rights.join(); rights = rights.next; } } } static final class FJLMerger extends RecursiveAction { final LongComparator cmp; final long[] a; final long[] w; final int lo; final int ln; final int ro; final int rn; final int wo; final int gran; final FJLMerger next; FJLMerger(LongComparator cmp, long[] a, long[] w, int lo, int ln, int ro, int rn, int wo, int gran, FJLMerger next) { this.cmp = cmp; this.a = a; this.w = w; this.lo = lo; this.ln = ln; this.ro = ro; this.rn = rn; this.wo = wo; this.gran = gran; this.next = next; } public void compute() { FJLMerger rights = null; int nleft = ln; int nright = rn; while (nleft > gran) { int lh = nleft >>> 1; int splitIndex = lo + lh; long split = a[splitIndex]; int rl = 0; int rh = nright; while (rl < rh) { int mid = (rl + rh) >>> 1; if (cmp.compare(split, a[ro + mid]) <= 0) rh = mid; else rl = mid + 1; } (rights = new FJLMerger (cmp, a, w, splitIndex, nleft-lh, ro+rh, nright-rh, wo+lh+rh, gran, rights)).fork(); nleft = lh; nright = rh; } int l = lo; int lFence = lo + nleft; int r = ro; int rFence = ro + nright; int k = wo; while (l < lFence && r < rFence) { long al = a[l]; long ar = a[r]; long t; if (cmp.compare(al, ar) <= 0) {++l; t=al;} else {++r; t=ar;} w[k++] = t; } while (l < lFence) w[k++] = a[l++]; while (r < rFence) w[k++] = a[r++]; while (rights != null) { if (rights.tryUnfork()) rights.compute(); else rights.join(); rights = rights.next; } } } static final class FJLCMerger extends RecursiveAction { final long[] a; final long[] w; final int lo; final int ln; final int ro; final int rn; final int wo; final int gran; final FJLCMerger next; FJLCMerger(long[] a, long[] w, int lo, int ln, int ro, int rn, int wo, int gran, FJLCMerger next) { this.a = a; this.w = w; this.lo = lo; this.ln = ln; this.ro = ro; this.rn = rn; this.wo = wo; this.gran = gran; this.next = next; } public void compute() { FJLCMerger rights = null; int nleft = ln; int nright = rn; while (nleft > gran) { int lh = nleft >>> 1; int splitIndex = lo + lh; long split = a[splitIndex]; int rl = 0; int rh = nright; while (rl < rh) { int mid = (rl + rh) >>> 1; if (split <= a[ro + mid]) rh = mid; else rl = mid + 1; } (rights = new FJLCMerger (a, w, splitIndex, nleft-lh, ro+rh, nright-rh, wo+lh+rh, gran, rights)).fork(); nleft = lh; nright = rh; } int l = lo; int lFence = lo + nleft; int r = ro; int rFence = ro + nright; int k = wo; while (l < lFence && r < rFence) { long al = a[l]; long ar = a[r]; long t; if (al <= ar) {++l; t=al;} else {++r; t = ar;} w[k++] = t; } while (l < lFence) w[k++] = a[l++]; while (r < rFence) w[k++] = a[r++]; while (rights != null) { if (rights.tryUnfork()) rights.compute(); else rights.join(); rights = rights.next; } } } /** Cutoff for when to use insertion-sort instead of quicksort */ static final int INSERTION_SORT_THRESHOLD = 8; // versions of quicksort with comparators static void dquickSort(double[] a, DoubleComparator cmp, int lo, int hi) { for (;;) { if (hi - lo <= INSERTION_SORT_THRESHOLD) { for (int i = lo + 1; i <= hi; i++) { double t = a[i]; int j = i - 1; while (j >= lo && cmp.compare(t, a[j]) < 0) { a[j+1] = a[j]; --j; } a[j+1] = t; } return; } int mid = (lo + hi) >>> 1; if (cmp.compare(a[lo], a[mid]) > 0) { double t = a[lo]; a[lo] = a[mid]; a[mid] = t; } if (cmp.compare(a[mid], a[hi]) > 0) { double t = a[mid]; a[mid] = a[hi]; a[hi] = t; if (cmp.compare(a[lo], a[mid]) > 0) { double u = a[lo]; a[lo] = a[mid]; a[mid] = u; } } double pivot = a[mid]; int left = lo+1; int right = hi-1; boolean sameLefts = true; for (;;) { while (cmp.compare(pivot, a[right]) < 0) --right; int c; while (left < right && (c = cmp.compare(pivot, a[left])) >= 0) { if (c != 0) sameLefts = false; ++left; } if (left < right) { double t = a[left]; a[left] = a[right]; a[right] = t; --right; } else break; } if (sameLefts && right == hi - 1) return; if (left - lo <= hi - right) { dquickSort(a, cmp, lo, left); lo = left + 1; } else { dquickSort(a, cmp, right, hi); hi = left; } } } static void lquickSort(long[] a, LongComparator cmp, int lo, int hi) { for (;;) { if (hi - lo <= INSERTION_SORT_THRESHOLD) { for (int i = lo + 1; i <= hi; i++) { long t = a[i]; int j = i - 1; while (j >= lo && cmp.compare(t, a[j]) < 0) { a[j+1] = a[j]; --j; } a[j+1] = t; } return; } int mid = (lo + hi) >>> 1; if (cmp.compare(a[lo], a[mid]) > 0) { long t = a[lo]; a[lo] = a[mid]; a[mid] = t; } if (cmp.compare(a[mid], a[hi]) > 0) { long t = a[mid]; a[mid] = a[hi]; a[hi] = t; if (cmp.compare(a[lo], a[mid]) > 0) { long u = a[lo]; a[lo] = a[mid]; a[mid] = u; } } long pivot = a[mid]; int left = lo+1; int right = hi-1; boolean sameLefts = true; for (;;) { while (cmp.compare(pivot, a[right]) < 0) --right; int c; while (left < right && (c = cmp.compare(pivot, a[left])) >= 0) { if (c != 0) sameLefts = false; ++left; } if (left < right) { long t = a[left]; a[left] = a[right]; a[right] = t; --right; } else break; } if (sameLefts && right == hi - 1) return; if (left - lo <= hi - right) { lquickSort(a, cmp, lo, left); lo = left + 1; } else { lquickSort(a, cmp, right, hi); hi = left; } } } /** * Cumulative scan * * A basic version of scan is straightforward. * Keep dividing by two to threshold segment size, and then: * Pass 1: Create tree of partial sums for each segment * Pass 2: For each segment, cumulate with offset of left sibling * See G. Blelloch's http://www.cs.cmu.edu/~scandal/alg/scan.html * * This version improves performance within FJ framework mainly by * allowing second pass of ready left-hand sides to proceed even * if some right-hand side first passes are still executing. It * also combines first and second pass for leftmost segment, and * for cumulate (not precumulate) also skips first pass for * rightmost segment (whose result is not needed for second pass). * * To manage this, it relies on "phase" phase/state control field * maintaining bits CUMULATE, SUMMED, and FINISHED. CUMULATE is * main phase bit. When false, segments compute only their sum. * When true, they cumulate array elements. CUMULATE is set at * root at beginning of second pass and then propagated down. But * it may also be set earlier for subtrees with lo==origin (the * left spine of tree). SUMMED is a one bit join count. For leafs, * set when summed. For internal nodes, becomes true when one * child is summed. When second child finishes summing, it then * moves up tree to trigger cumulate phase. FINISHED is also a one * bit join count. For leafs, it is set when cumulated. For * internal nodes, it becomes true when one child is cumulated. * When second child finishes cumulating, it then moves up tree, * executing complete() at the root. * * This class maintains only the basic control logic. Subclasses * maintain the "in" and "out" fields, and *Ops classes perform * computations */ static abstract class FJScan extends ForkJoinTask { static final short CUMULATE = (short)1; static final short SUMMED = (short)2; static final short FINISHED = (short)4; final FJScan parent; final FJScanOp op; FJScan left, right; volatile int phase; // phase/state final int lo; final int hi; static final AtomicIntegerFieldUpdater phaseUpdater = AtomicIntegerFieldUpdater.newUpdater(FJScan.class, "phase"); FJScan(FJScan parent, FJScanOp op, int lo, int hi) { this.parent = parent; this.op = op; this.lo = lo; this.hi = hi; } public final Void getRawResult() { return null; } protected final void setRawResult(Void mustBeNull) { } /** Returns true if can CAS CUMULATE bit true */ final boolean transitionToCumulate() { int c; while (((c = phase) & CUMULATE) == 0) if (phaseUpdater.compareAndSet(this, c, c | CUMULATE)) return true; return false; } public final boolean exec() { if (hi - lo > op.threshold) { if (left == null) { // first pass int mid = (lo + hi) >>> 1; left = op.newSubtask(this, lo, mid); right = op.newSubtask(this, mid, hi); } boolean cumulate = (phase & CUMULATE) != 0; if (cumulate) op.pushDown(this, left, right); if (!cumulate || right.transitionToCumulate()) right.fork(); if (!cumulate || left.transitionToCumulate()) left.exec(); } else { int cb; for (;;) { // Establish action: sum, cumulate, or both int b = phase; if ((b & FINISHED) != 0) // already done return false; if ((b & CUMULATE) != 0) cb = FINISHED; else if (lo == op.origin) // combine leftmost cb = (SUMMED|FINISHED); else cb = SUMMED; if (phaseUpdater.compareAndSet(this, b, b|cb)) break; } if (cb == SUMMED) op.sumLeaf(lo, hi, this); else if (cb == FINISHED) op.cumulateLeaf(lo, hi, this); else if (cb == (SUMMED|FINISHED)) op.sumAndCumulateLeaf(lo, hi, this); // propagate up FJScan ch = this; FJScan par = parent; for (;;) { if (par == null) { if ((cb & FINISHED) != 0) ch.complete(null); break; } int pb = par.phase; if ((pb & cb & FINISHED) != 0) { // both finished ch = par; par = par.parent; } else if ((pb & cb & SUMMED) != 0) { // both summed op.pushUp(par, par.left, par.right); int refork = ((pb & CUMULATE) == 0 && par.lo == op.origin) ? CUMULATE : 0; int nextPhase = pb|cb|refork; if (pb == nextPhase || phaseUpdater.compareAndSet(par, pb, nextPhase)) { if (refork != 0) par.fork(); cb = SUMMED; // drop finished bit ch = par; par = par.parent; } } else if (phaseUpdater.compareAndSet(par, pb, pb|cb)) break; } } return false; } // no-op versions of methods to get/set in/out, overridden as // appropriate in subclasses Object ogetIn() { return null; } Object ogetOut() { return null; } void rsetIn(Object x) { } void rsetOut(Object x) { } double dgetIn() { return 0; } double dgetOut() { return 0; } void dsetIn(double x) { } void dsetOut(double x) { } long lgetIn() { return 0; } long lgetOut() { return 0; } void lsetIn(long x) { } void lsetOut(long x) { } } // Subclasses adding in/out fields of the appropriate type static final class FJOScan extends FJScan { Object in; Object out; FJOScan(FJScan parent, FJScanOp op, int lo, int hi) { super(parent, op, lo, hi); } Object ogetIn() { return in; } Object ogetOut() { return out; } void rsetIn(Object x) { in = x; } void rsetOut(Object x) { out = x; } } static final class FJDScan extends FJScan { double in; double out; FJDScan(FJScan parent, FJScanOp op, int lo, int hi) { super(parent, op, lo, hi); } double dgetIn() { return in; } double dgetOut() { return out; } void dsetIn(double x) { in = x; } void dsetOut(double x) { out = x; } } static final class FJLScan extends FJScan { long in; long out; FJLScan(FJScan parent, FJScanOp op, int lo, int hi) { super(parent, op, lo, hi); } long lgetIn() { return in; } long lgetOut() { return out; } void lsetIn(long x) { in = x; } void lsetOut(long x) { out = x; } } /** * Computational operations for FJScan */ static abstract class FJScanOp { final int threshold; final int origin; final int fence; FJScanOp(AbstractParallelAnyArray pap) { this.origin = pap.origin; this.fence = pap.fence; this.threshold = pap.computeThreshold(); } abstract void pushDown(FJScan parent, FJScan left, FJScan right); abstract void pushUp(FJScan parent, FJScan left, FJScan right); abstract void sumLeaf(int lo, int hi, FJScan f); abstract void cumulateLeaf(int lo, int hi, FJScan f); abstract void sumAndCumulateLeaf(int lo, int hi, FJScan f); abstract FJScan newSubtask(FJScan parent, int lo, int hi); } static abstract class FJOScanOp extends FJScanOp { final Object[] array; final Reducer reducer; final Object base; FJOScanOp(AbstractParallelAnyArray.OPap pap, Reducer reducer, Object base) { super(pap); this.array = pap.array; this.reducer = reducer; this.base = base; } final void pushDown(FJScan parent, FJScan left, FJScan right) { Object pin = parent.ogetIn(); left.rsetIn(pin); right.rsetIn(reducer.op(pin, left.ogetOut())); } final void pushUp(FJScan parent, FJScan left, FJScan right) { parent.rsetOut(reducer.op(left.ogetOut(), right.ogetOut())); } final FJScan newSubtask(FJScan parent, int lo, int hi) { FJOScan f = new FJOScan(parent, this, lo, hi); f.in = base; f.out = base; return f; } } static final class FJOCumulateOp extends FJOScanOp { FJOCumulateOp(AbstractParallelAnyArray.OPap pap, Reducer reducer, Object base) { super(pap, reducer, base); } void sumLeaf(int lo, int hi, FJScan f) { Object sum = base; if (hi != fence) { Object[] arr = array; for (int i = lo; i < hi; ++i) sum = reducer.op(sum, arr[i]); } f.rsetOut(sum); } void cumulateLeaf(int lo, int hi, FJScan f) { Object[] arr = array; Object sum = f.ogetIn(); for (int i = lo; i < hi; ++i) arr[i] = sum = reducer.op(sum, arr[i]); } void sumAndCumulateLeaf(int lo, int hi, FJScan f) { Object[] arr = array; Object sum = base; for (int i = lo; i < hi; ++i) arr[i] = sum = reducer.op(sum, arr[i]); f.rsetOut(sum); } } static final class FJOPrecumulateOp extends FJOScanOp { FJOPrecumulateOp(AbstractParallelAnyArray.OPap pap, Reducer reducer, Object base) { super(pap, reducer, base); } void sumLeaf(int lo, int hi, FJScan f) { Object[] arr = array; Object sum = base; for (int i = lo; i < hi; ++i) sum = reducer.op(sum, arr[i]); f.rsetOut(sum); } void cumulateLeaf(int lo, int hi, FJScan f) { Object[] arr = array; Object sum = f.ogetIn(); for (int i = lo; i < hi; ++i) { Object x = arr[i]; arr[i] = sum; sum = reducer.op(sum, x); } } void sumAndCumulateLeaf(int lo, int hi, FJScan f) { Object[] arr = array; Object sum = base; for (int i = lo; i < hi; ++i) { Object x = arr[i]; arr[i] = sum; sum = reducer.op(sum, x); } f.rsetOut(sum); } } static abstract class FJDScanOp extends FJScanOp { final double[] array; final DoubleReducer reducer; final double base; FJDScanOp(AbstractParallelAnyArray.DPap pap, DoubleReducer reducer, double base) { super(pap); this.array = pap.array; this.reducer = reducer; this.base = base; } final void pushDown(FJScan parent, FJScan left, FJScan right) { double pin = parent.dgetIn(); left.dsetIn(pin); right.dsetIn(reducer.op(pin, left.dgetOut())); } final void pushUp(FJScan parent, FJScan left, FJScan right) { parent.dsetOut(reducer.op(left.dgetOut(), right.dgetOut())); } final FJScan newSubtask(FJScan parent, int lo, int hi) { FJDScan f = new FJDScan(parent, this, lo, hi); f.in = base; f.out = base; return f; } } static final class FJDCumulateOp extends FJDScanOp { FJDCumulateOp(AbstractParallelAnyArray.DPap pap, DoubleReducer reducer, double base) { super(pap, reducer, base); } void sumLeaf(int lo, int hi, FJScan f) { double sum = base; if (hi != fence) { double[] arr = array; for (int i = lo; i < hi; ++i) sum = reducer.op(sum, arr[i]); } f.dsetOut(sum); } void cumulateLeaf(int lo, int hi, FJScan f) { double[] arr = array; double sum = f.dgetIn(); for (int i = lo; i < hi; ++i) arr[i] = sum = reducer.op(sum, arr[i]); } void sumAndCumulateLeaf(int lo, int hi, FJScan f) { double[] arr = array; double sum = base; for (int i = lo; i < hi; ++i) arr[i] = sum = reducer.op(sum, arr[i]); f.dsetOut(sum); } } static final class FJDPrecumulateOp extends FJDScanOp { FJDPrecumulateOp(AbstractParallelAnyArray.DPap pap, DoubleReducer reducer, double base) { super(pap, reducer, base); } void sumLeaf(int lo, int hi, FJScan f) { double[] arr = array; double sum = base; for (int i = lo; i < hi; ++i) sum = reducer.op(sum, arr[i]); f.dsetOut(sum); } void cumulateLeaf(int lo, int hi, FJScan f) { double[] arr = array; double sum = f.dgetIn(); for (int i = lo; i < hi; ++i) { double x = arr[i]; arr[i] = sum; sum = reducer.op(sum, x); } } void sumAndCumulateLeaf(int lo, int hi, FJScan f) { double[] arr = array; double sum = base; for (int i = lo; i < hi; ++i) { double x = arr[i]; arr[i] = sum; sum = reducer.op(sum, x); } f.dsetOut(sum); } } static abstract class FJLScanOp extends FJScanOp { final long[] array; final LongReducer reducer; final long base; FJLScanOp(AbstractParallelAnyArray.LPap pap, LongReducer reducer, long base) { super(pap); this.array = pap.array; this.reducer = reducer; this.base = base; } final void pushDown(FJScan parent, FJScan left, FJScan right) { long pin = parent.lgetIn(); left.lsetIn(pin); right.lsetIn(reducer.op(pin, left.lgetOut())); } final void pushUp(FJScan parent, FJScan left, FJScan right) { parent.lsetOut(reducer.op(left.lgetOut(), right.lgetOut())); } final FJScan newSubtask(FJScan parent, int lo, int hi) { FJLScan f = new FJLScan(parent, this, lo, hi); f.in = base; f.out = base; return f; } } static final class FJLCumulateOp extends FJLScanOp { FJLCumulateOp(AbstractParallelAnyArray.LPap pap, LongReducer reducer, long base) { super(pap, reducer, base); } void sumLeaf(int lo, int hi, FJScan f) { long sum = base; if (hi != fence) { long[] arr = array; for (int i = lo; i < hi; ++i) sum = reducer.op(sum, arr[i]); } f.lsetOut(sum); } void cumulateLeaf(int lo, int hi, FJScan f) { long[] arr = array; long sum = f.lgetIn(); for (int i = lo; i < hi; ++i) arr[i] = sum = reducer.op(sum, arr[i]); } void sumAndCumulateLeaf(int lo, int hi, FJScan f) { long[] arr = array; long sum = base; for (int i = lo; i < hi; ++i) arr[i] = sum = reducer.op(sum, arr[i]); f.lsetOut(sum); } } static final class FJLPrecumulateOp extends FJLScanOp { FJLPrecumulateOp(AbstractParallelAnyArray.LPap pap, LongReducer reducer, long base) { super(pap, reducer, base); } void sumLeaf(int lo, int hi, FJScan f) { long[] arr = array; long sum = base; for (int i = lo; i < hi; ++i) sum = reducer.op(sum, arr[i]); f.lsetOut(sum); } void cumulateLeaf(int lo, int hi, FJScan f) { long[] arr = array; long sum = f.lgetIn(); for (int i = lo; i < hi; ++i) { long x = arr[i]; arr[i] = sum; sum = reducer.op(sum, x); } } void sumAndCumulateLeaf(int lo, int hi, FJScan f) { long[] arr = array; long sum = base; for (int i = lo; i < hi; ++i) { long x = arr[i]; arr[i] = sum; sum = reducer.op(sum, x); } f.lsetOut(sum); } } // specialized versions for plus static abstract class FJDScanPlusOp extends FJScanOp { final double[] array; FJDScanPlusOp(AbstractParallelAnyArray.DPap pap) { super(pap); this.array = pap.array; } final void pushDown(FJScan parent, FJScan left, FJScan right) { double pin = parent.dgetIn(); left.dsetIn(pin); right.dsetIn(pin + left.dgetOut()); } final void pushUp(FJScan parent, FJScan left, FJScan right) { parent.dsetOut(left.dgetOut() + right.dgetOut()); } final FJScan newSubtask(FJScan parent, int lo, int hi) { FJDScan f = new FJDScan(parent, this, lo, hi); f.in = 0.0; f.out = 0.0; return f; } } static final class FJDCumulatePlusOp extends FJDScanPlusOp { FJDCumulatePlusOp(AbstractParallelAnyArray.DPap pap) { super(pap); } void sumLeaf(int lo, int hi, FJScan f) { double sum = 0.0; if (hi != fence) { double[] arr = array; for (int i = lo; i < hi; ++i) sum += arr[i]; } f.dsetOut(sum); } void cumulateLeaf(int lo, int hi, FJScan f) { double[] arr = array; double sum = f.dgetIn(); for (int i = lo; i < hi; ++i) arr[i] = sum += arr[i]; } void sumAndCumulateLeaf(int lo, int hi, FJScan f) { double[] arr = array; double sum = 0.0; for (int i = lo; i < hi; ++i) arr[i] = sum += arr[i]; f.dsetOut(sum); } } static final class FJDPrecumulatePlusOp extends FJDScanPlusOp { FJDPrecumulatePlusOp(AbstractParallelAnyArray.DPap pap) { super(pap); } void sumLeaf(int lo, int hi, FJScan f) { double[] arr = array; double sum = 0.0; for (int i = lo; i < hi; ++i) sum += arr[i]; f.dsetOut(sum); } void cumulateLeaf(int lo, int hi, FJScan f) { double[] arr = array; double sum = f.dgetIn(); for (int i = lo; i < hi; ++i) { double x = arr[i]; arr[i] = sum; sum += x; } } void sumAndCumulateLeaf(int lo, int hi, FJScan f) { double[] arr = array; double sum = 0.0; for (int i = lo; i < hi; ++i) { double x = arr[i]; arr[i] = sum; sum += x; } f.dsetOut(sum); } } static abstract class FJLScanPlusOp extends FJScanOp { final long[] array; FJLScanPlusOp(AbstractParallelAnyArray.LPap pap) { super(pap); this.array = pap.array; } final void pushDown(FJScan parent, FJScan left, FJScan right) { long pin = parent.lgetIn(); left.lsetIn(pin); right.lsetIn(pin + left.lgetOut()); } final void pushUp(FJScan parent, FJScan left, FJScan right) { parent.lsetOut(left.lgetOut() + right.lgetOut()); } final FJScan newSubtask(FJScan parent, int lo, int hi) { FJLScan f = new FJLScan(parent, this, lo, hi); f.in = 0L; f.out = 0L; return f; } } static final class FJLCumulatePlusOp extends FJLScanPlusOp { FJLCumulatePlusOp(AbstractParallelAnyArray.LPap pap) { super(pap); } void sumLeaf(int lo, int hi, FJScan f) { long sum = 0L; if (hi != fence) { long[] arr = array; for (int i = lo; i < hi; ++i) sum += arr[i]; } f.lsetOut(sum); } void cumulateLeaf(int lo, int hi, FJScan f) { long[] arr = array; long sum = f.lgetIn(); for (int i = lo; i < hi; ++i) arr[i] = sum += arr[i]; } void sumAndCumulateLeaf(int lo, int hi, FJScan f) { long[] arr = array; long sum = 0L; for (int i = lo; i < hi; ++i) arr[i] = sum += arr[i]; f.lsetOut(sum); } } static final class FJLPrecumulatePlusOp extends FJLScanPlusOp { FJLPrecumulatePlusOp(AbstractParallelAnyArray.LPap pap) { super(pap); } void sumLeaf(int lo, int hi, FJScan f) { long[] arr = array; long sum = 0L; for (int i = lo; i < hi; ++i) sum += arr[i]; f.lsetOut(sum); } void cumulateLeaf(int lo, int hi, FJScan f) { long[] arr = array; long sum = f.lgetIn(); for (int i = lo; i < hi; ++i) { long x = arr[i]; arr[i] = sum; sum += x; } } void sumAndCumulateLeaf(int lo, int hi, FJScan f) { long[] arr = array; long sum = 0L; for (int i = lo; i < hi; ++i) { long x = arr[i]; arr[i] = sum; sum += x; } f.lsetOut(sum); } } } jsr166/src/extra166y/ParallelDoubleArrayWithFilter.java0000644000000000000000000001507411537741066020113 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelDoubleArray that causes operations to apply * only to elements for which a selector returns true. * Instances of this class may be constructed only via prefix * methods of ParallelDoubleArray or its other prefix classes. */ public abstract class ParallelDoubleArrayWithFilter extends ParallelDoubleArrayWithDoubleMapping { ParallelDoubleArrayWithFilter (ForkJoinPool ex, int origin, int fence, double[] array) { super(ex, origin, fence, array); } /** * Replaces elements with the results of applying the given * op to their current values. * @param op the op * @return this (to simplify use in expressions) */ public ParallelDoubleArrayWithFilter replaceWithMapping(DoubleOp op) { ex.invoke(new PAS.FJDTransform(this, origin, fence, null, op)); return this; } /** * Replaces elements with the results of applying the given * op to their indices * @param op the op * @return this (to simplify use in expressions) */ public ParallelDoubleArrayWithFilter replaceWithMappedIndex(IntToDouble op) { ex.invoke(new PAS.FJDIndexMap(this, origin, fence, null, op)); return this; } /** * Replaces elements with the results of applying the given * mapping to each index and current element value * @param op the op * @return this (to simplify use in expressions) */ public ParallelDoubleArrayWithFilter replaceWithMappedIndex(IntAndDoubleToDouble op) { ex.invoke(new PAS.FJDBinaryIndexMap (this, origin, fence, null, op)); return this; } /** * Replaces elements with results of applying the given * generator. * @param generator the generator * @return this (to simplify use in expressions) */ public ParallelDoubleArrayWithFilter replaceWithGeneratedValue(DoubleGenerator generator) { ex.invoke(new PAS.FJDGenerate (this, origin, fence, null, generator)); return this; } /** * Replaces elements with the given value. * @param value the value * @return this (to simplify use in expressions) */ public ParallelDoubleArrayWithFilter replaceWithValue(double value) { ex.invoke(new PAS.FJDFill(this, origin, fence, null, value)); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement) * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) */ public ParallelDoubleArrayWithFilter replaceWithMapping(BinaryDoubleOp combiner, ParallelDoubleArrayWithDoubleMapping other) { ex.invoke(new PAS.FJDPACombineInPlace (this, origin, fence, null, other, other.origin - origin, combiner)); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement) * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) */ public ParallelDoubleArrayWithFilter replaceWithMapping (BinaryDoubleOp combiner, double[] other) { ex.invoke(new PAS.FJDCombineInPlace (this, origin, fence, null, other, -origin, combiner)); return this; } /** * Returns a new ParallelDoubleArray containing only unique * elements (that is, without any duplicates). * @return the new ParallelDoubleArray */ public ParallelDoubleArray allUniqueElements() { PAS.UniquifierTable tab = new PAS.UniquifierTable (fence - origin, this, false); PAS.FJDUniquifier f = new PAS.FJDUniquifier (this, origin, fence, null, tab); ex.invoke(f); double[] res = tab.uniqueDoubles(f.count); return new ParallelDoubleArray(ex, res); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the current selector (if * present) and the given selector returns true * @param selector the selector * @return operation prefix */ public abstract ParallelDoubleArrayWithFilter withFilter (DoublePredicate selector); /** * Returns an operation prefix that causes a method to operate * only on elements for which the current selector (if * present) and the given binary selector returns true * @param selector the selector * @return operation prefix */ public ParallelDoubleArrayWithFilter withFilter (BinaryDoublePredicate selector, ParallelDoubleArrayWithDoubleMapping other) { return withIndexedFilter(AbstractParallelAnyArray.indexedSelector(selector, other, origin)); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the current selector (if * present) and the given indexed selector returns true * @param selector the selector * @return operation prefix */ public abstract ParallelDoubleArrayWithFilter withIndexedFilter (IntAndDoublePredicate selector); /** * Returns true if all elements at the same relative positions * of this and other array are equal. * @param other the other array * @return true if equal */ public boolean hasAllEqualElements (ParallelDoubleArrayWithDoubleMapping other) { return withFilter(CommonOps.doubleInequalityPredicate(), other).anyIndex() < 0; } final void leafTransfer(int lo, int hi, double[] dest, int offset) { final double[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = (a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, double[] dest, int offset) { final double[] a = this.array; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = (a[indices[i]]); } final double dget(int i) { return this.array[i]; } } jsr166/src/extra166y/ParallelArray.java0000644000000000000000000013505411537741066014757 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * An array supporting parallel operations. * *

A ParallelArray maintains a {@link ForkJoinPool} and an * array in order to provide parallel aggregate operations. The main * operations are to apply some procedure to each element, to * map each element to a new element, to replace * each element, to select a subset of elements based on * matching a predicate or ranges of indices, and to reduce * all elements into a single value such as a sum. * *

A ParallelArray is constructed by allocating, using, or copying * an array, using one of the static factory methods {@link #create}, * {@link #createEmpty}, {@link #createUsingHandoff} and {@link * #createFromCopy}. Upon construction, the encapsulated array managed * by the ParallelArray must not be shared between threads without * external synchronization. In particular, as is the case with any * array, access by another thread of an element of a ParallelArray * while another operation is in progress has undefined effects. * *

The ForkJoinPool used to construct a ParallelArray can be * shared safely by other threads (and used in other * ParallelArrays). To avoid the overhead associated with creating * multiple executors, it is often a good idea to use the {@link * #defaultExecutor()} across all ParallelArrays. However, you might * choose to use different ones for the sake of controlling processor * usage, isolating faults, and/or ensuring progress. * *

A ParallelArray is not a List. It relies on random access across * array elements to support efficient parallel operations. However, * a ParallelArray can be viewed and manipulated as a List, via method * {@link ParallelArray#asList}. The asList view allows * incremental insertion and modification of elements while setting up * a ParallelArray, generally before using it for parallel * operations. Similarly, the list view may be useful when accessing * the results of computations in sequential contexts. A * ParallelArray may also be created using the elements of any other * Collection, by constructing from the array returned by the * Collection's toArray method. The effects of mutative * asList operations may also be achieved directly using * method {@link #setLimit} along with element-by-element access * methods {@link #get} and {@link #set}. * *

While ParallelArrays can be based on any kind of an object * array, including "boxed" types such as Long, parallel operations on * scalar "unboxed" type are likely to be substantially more * efficient. For this reason, classes {@link ParallelLongArray} and * {@link ParallelDoubleArray} are also supplied, and designed to * smoothly interoperate with ParallelArrays. You should also use a * ParallelLongArray for processing other integral scalar data * (int, short, etc). And similarly use a * ParallelDoubleArray for float data. (Further * specializations for these other types would add clutter without * significantly improving performance beyond that of the Long and * Double versions.) * *

Most usages of ParallelArray involve sets of operations prefixed * with range bounds, filters, and mappings (including mappings that * combine elements from other ParallelArrays), using * withBounds, withFilter, and withMapping, * respectively. For example, * aParallelArray.withFilter(aPredicate).all() creates a new * ParallelArray containing only those elements matching the * predicate. And for ParallelLongArrays a, b, and c, * a.withMapping(CommonOps.longAdder(),b).withMapping(CommonOps.longAdder(),c).min() * returns the minimum value of a[i]+b[i]+c[i] for all i. As * illustrated below, a mapping often represents accessing * some field or invoking some method of an element. These versions * are typically more efficient than performing selections, then * mappings, then other operations in multiple (parallel) steps. The * basic ideas and usages of filtering and mapping are similar to * those in database query systems such as SQL, but take a more * restrictive form. Series of filter and mapping prefixes may each * be cascaded, but all filter prefixes must precede all mapping * prefixes, to ensure efficient execution in a single parallel step. * In cases of combined mapping expressions, this rule is only * dynamically enforced. For example, pa.withMapping(op, * pb.withFilter(f)) will compile but throw an exception upon * execution because the filter precedes the mapping. * *

While series of filters and mappings are allowed, it is * usually more efficient to combine them into single filters or * mappings when possible. For example * pa.withMapping(addOne).withMapping(addOne) is generally * less efficient than pa.withMapping(addTwo). Methods * withIndexedFilter and withIndexedMapping may be * useful when combining such expressions. * *

This class includes some reductions, such as min, that * are commonly useful for most element types, as well as a combined * version, summary, that computes all of them in a single * parallel step, which is normally more efficient than computing each * in turn. * *

The methods in this class are designed to perform efficiently * with both large and small pools, even with single-thread pools on * uniprocessors. However, there is some overhead in parallelizing * operations, so short computations on small arrays might not execute * faster than sequential versions, and might even be slower. * *

Sample usages. * * The main difference between programming with plain arrays and * programming with aggregates is that you must separately define each * of the component functions on elements. For example, the following * returns the maximum Grade Point Average across all senior students, * given a (fictional) Student class: * *

 * import static Ops.*;
 * class StudentStatistics {
 *   ParallelArray<Student> students = ...
 *   // ...
 *   public double getMaxSeniorGpa() {
 *     return students.withFilter(isSenior).withMapping(gpaField).max();
 *   }
 *
 *   // helpers:
 *   static final class IsSenior implements Predicate<Student> {
 *     public boolean op(Student s) { return s.credits > 90; }
 *   }
 *   static final IsSenior isSenior = new IsSenior();
 *   static final class GpaField implements ObjectToDouble<Student> {
 *     public double op(Student s) { return s.gpa; }
 *   }
 *   static final GpaField gpaField = new GpaField();
 * }
 * 
* */ public class ParallelArray extends AbstractParallelAnyArray.OUPap implements Iterable { /* * See classes PAS and AbstractParallelAnyArray for most of the underlying parallel execution * code and explanation. */ /** * Returns a common default executor for use in ParallelArrays. * This executor arranges enough parallelism to use most, but not * necessarily all, of the available processors on this system. * @return the executor */ public static ForkJoinPool defaultExecutor() { return PAS.defaultExecutor(); } /** Lazily constructed list view */ AsList listView; /** * Constructor for use by subclasses to create a new ParallelArray * using the given executor, and initially using the supplied * array, with effective size bound by the given limit. This * constructor is designed to enable extensions via * subclassing. To create a ParallelArray, use {@link #create}, * {@link #createEmpty}, {@link #createUsingHandoff} or {@link * #createFromCopy}. * @param executor the executor * @param array the array * @param limit the upper bound limit */ protected ParallelArray(ForkJoinPool executor, T[] array, int limit) { super(executor, 0, limit, array); if (executor == null || array == null) throw new NullPointerException(); if (limit < 0 || limit > array.length) throw new IllegalArgumentException(); } /** * Trusted internal version of protected constructor. */ ParallelArray(ForkJoinPool executor, T[] array) { super(executor, 0, array.length, array); } /** * Creates a new ParallelArray using the given executor and * an array of the given size constructed using the * indicated base element type. * @param size the array size * @param elementType the type of the elements * @param executor the executor */ public static ParallelArray create (int size, Class elementType, ForkJoinPool executor) { T[] array = (T[])Array.newInstance(elementType, size); return new ParallelArray(executor, array, size); } /** * Creates a new ParallelArray initially using the given array and * executor. In general, the handed off array should not be used * for other purposes once constructing this ParallelArray. The * given array may be internally replaced by another array in the * course of methods that add or remove elements. * @param handoff the array * @param executor the executor */ public static ParallelArray createUsingHandoff (T[] handoff, ForkJoinPool executor) { return new ParallelArray(executor, handoff, handoff.length); } /** * Creates a new ParallelArray using the given executor and * initially holding copies of the given * source elements. * @param source the source of initial elements * @param executor the executor */ public static ParallelArray createFromCopy (T[] source, ForkJoinPool executor) { // For now, avoid copyOf so people can compile with Java5 int size = source.length; T[] array = (T[])Array.newInstance (source.getClass().getComponentType(), size); System.arraycopy(source, 0, array, 0, size); return new ParallelArray(executor, array, size); } /** * Creates a new ParallelArray using an array of the given size, * initially holding copies of the given source truncated or * padded with nulls to obtain the specified length. * @param source the source of initial elements * @param size the array size * @param executor the executor */ public static ParallelArray createFromCopy (int size, T[] source, ForkJoinPool executor) { // For now, avoid copyOf so people can compile with Java5 T[] array = (T[])Array.newInstance (source.getClass().getComponentType(), size); System.arraycopy(source, 0, array, 0, Math.min(source.length, size)); return new ParallelArray(executor, array, size); } /** * Creates a new ParallelArray using the given executor and an * array of the given size constructed using the indicated base * element type, but with an initial effective size of zero, * enabling incremental insertion via {@link ParallelArray#asList} * operations. * @param size the array size * @param elementType the type of the elements * @param executor the executor */ public static ParallelArray createEmpty (int size, Class elementType, ForkJoinPool executor) { T[] array = (T[])Array.newInstance(elementType, size); return new ParallelArray(executor, array, 0); } /** * Summary statistics for a possibly bounded, filtered, and/or * mapped ParallelArray. */ public static interface SummaryStatistics { /** Return the number of elements */ public int size(); /** Return the minimum element, or null if empty */ public T min(); /** Return the maximum element, or null if empty */ public T max(); /** Return the index of the minimum element, or -1 if empty */ public int indexOfMin(); /** Return the index of the maximum element, or -1 if empty */ public int indexOfMax(); } /** * Returns the executor used for computations * @return the executor */ public ForkJoinPool getExecutor() { return ex; } /** * Applies the given procedure to elements * @param procedure the procedure */ public void apply(Procedure procedure) { super.apply(procedure); } /** * Returns reduction of elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public T reduce(Reducer reducer, T base) { return super.reduce(reducer, base); } /** * Returns a new ParallelArray holding all elements * @return a new ParallelArray holding all elements */ public ParallelArray all() { return super.all(); } /** * Returns a new ParallelArray with the given element type holding * all elements * @param elementType the type of the elements * @return a new ParallelArray holding all elements */ public ParallelArray all(Class elementType) { return super.all(elementType); } /** * Replaces elements with the results of applying the given transform * to their current values. * @param op the op * @return this (to simplify use in expressions) */ public ParallelArray replaceWithMapping (Op op) { super.replaceWithMapping(op); return this; } /** * Replaces elements with the results of applying the given * mapping to their indices. * @param op the op * @return this (to simplify use in expressions) */ public ParallelArray replaceWithMappedIndex (IntToObject op) { super.replaceWithMappedIndex(op); return this; } /** * Replaces elements with the results of applying the given * mapping to each index and current element value * @param op the op * @return this (to simplify use in expressions) */ public ParallelArray replaceWithMappedIndex (IntAndObjectToObject op) { super.replaceWithMappedIndex(op); return this; } /** * Replaces elements with the results of applying the given * generator. * @param generator the generator * @return this (to simplify use in expressions) */ public ParallelArray replaceWithGeneratedValue (Generator generator) { super.replaceWithGeneratedValue(generator); return this; } /** * Replaces elements with the given value. * @param value the value * @return this (to simplify use in expressions) */ public ParallelArray replaceWithValue(T value) { super.replaceWithValue(value); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement) * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) */ public ParallelArray replaceWithMapping (BinaryOp combiner, ParallelArrayWithMapping other) { super.replaceWithMapping(combiner, other); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement) * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) */ public ParallelArray replaceWithMapping (BinaryOp combiner, T[] other) { super.replaceWithMapping(combiner, other); return this; } /** * Returns the index of some element equal to given target, * or -1 if not present * @param target the element to search for * @return the index or -1 if not present */ public int indexOf(T target) { return super.indexOf(target); } /** * Assuming this array is sorted, returns the index of an element * equal to given target, or -1 if not present. If the array * is not sorted, the results are undefined. * @param target the element to search for * @return the index or -1 if not present */ public int binarySearch(T target) { return super.binarySearch(target); } /** * Assuming this array is sorted with respect to the given * comparator, returns the index of an element equal to given * target, or -1 if not present. If the array is not sorted, the * results are undefined. * @param target the element to search for * @param comparator the comparator * @return the index or -1 if not present */ public int binarySearch(T target, Comparator comparator) { return super.binarySearch(target, comparator); } /** * Returns summary statistics, using the given comparator * to locate minimum and maximum elements. * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelArray.SummaryStatistics summary (Comparator comparator) { return super.summary(comparator); } /** * Returns summary statistics, assuming that all elements are * Comparables * @return the summary. */ public ParallelArray.SummaryStatistics summary() { return super.summary(); } /** * Returns the minimum element, or null if empty * @param comparator the comparator * @return minimum element, or null if empty */ public T min(Comparator comparator) { return super.min(comparator); } /** * Returns the minimum element, or null if empty, * assuming that all elements are Comparables * @return minimum element, or null if empty * @throws ClassCastException if any element is not Comparable. */ public T min() { return super.min(); } /** * Returns the maximum element, or null if empty * @param comparator the comparator * @return maximum element, or null if empty */ public T max(Comparator comparator) { return super.max(comparator); } /** * Returns the maximum element, or null if empty * assuming that all elements are Comparables * @return maximum element, or null if empty * @throws ClassCastException if any element is not Comparable. */ public T max() { return super.max(); } /** * Replaces each element with the running cumulation of applying * the given reducer. For example, if the contents are the numbers * 1, 2, 3, and the reducer operation adds numbers, then * after invocation of this method, the contents would be 1, * 3, 6 (that is, 1, 1+2, 1+2+3); * @param reducer the reducer * @param base the result for an empty array * @return this (to simplify use in expressions) */ public ParallelArray cumulate(Reducer reducer, T base) { super.cumulate(reducer, base); return this; } /** * Replaces each element with the cumulation of applying the given * reducer to all previous values, and returns the total * reduction. For example, if the contents are the numbers 1, * 2, 3, and the reducer operation adds numbers, then after * invocation of this method, the contents would be 0, 1, * 3 (that is, 0, 0+1, 0+1+2, and the return value * would be 6 (that is, 1+2+3); * @param reducer the reducer * @param base the result for an empty array * @return the total reduction */ public T precumulate(Reducer reducer, T base) { return (T)(super.precumulate(reducer, base)); } /** * Sorts the array. Unlike Arrays.sort, this sort does * not guarantee that elements with equal keys maintain their * relative position in the array. * @param comparator the comparator to use * @return this (to simplify use in expressions) */ public ParallelArray sort(Comparator comparator) { super.sort(comparator); return this; } /** * Sorts the array, assuming all elements are Comparable. Unlike * Arrays.sort, this sort does not guarantee that elements * with equal keys maintain their relative position in the array. * @throws ClassCastException if any element is not Comparable. * @return this (to simplify use in expressions) */ public ParallelArray sort() { super.sort(); return this; } /** * Returns a new ParallelArray containing only the non-null unique * elements of this array (that is, without any duplicates), using * each element's equals method to test for duplication. * @return the new ParallelArray */ public ParallelArray allUniqueElements() { return super.allUniqueElements(); } /** * Returns a new ParallelArray containing only the non-null unique * elements of this array (that is, without any duplicates), using * reference identity to test for duplication. * @return the new ParallelArray */ public ParallelArray allNonidenticalElements() { return super.allNonidenticalElements(); } /** * Removes from the array all elements for which the given * selector holds. * @param selector the selector * @return this (to simplify use in expressions) */ public ParallelArray removeAll(Predicate selector) { OFPap v = new OFPap(ex, 0, fence, array, selector); PAS.FJRemoveAllDriver f = new PAS.FJRemoveAllDriver(v, 0, fence); ex.invoke(f); removeSlotsAt(f.offset, fence); return this; } /** * Returns true if all elements at the same relative positions * of this and other array are equal. * @param other the other array * @return true if equal */ public boolean hasAllEqualElements (ParallelArrayWithMapping other) { return super.hasAllEqualElements(other); } /** * Returns true if all elements at the same relative positions * of this and other array are identical. * @param other the other array * @return true if equal */ public boolean hasAllIdenticalElements (ParallelArrayWithMapping other) { return super.hasAllIdenticalElements(other); } /** * Removes consecutive elements that are equal (or null), * shifting others leftward, and possibly decreasing size. This * method may be used after sorting to ensure that this * ParallelArray contains a set of unique elements. * @return this (to simplify use in expressions) */ public ParallelArray removeConsecutiveDuplicates() { // Sequential implementation for now int k = 0; int n = fence; Object[] arr = this.array; Object last = null; for (int i = k; i < n; ++i) { Object x = arr[i]; if (x != null && (last == null || !last.equals(x))) arr[k++] = last = x; } removeSlotsAt(k, n); return this; } /** * Removes null elements, shifting others leftward, and possibly * decreasing size. * @return this (to simplify use in expressions) */ public ParallelArray removeNulls() { // Sequential implementation for now int k = 0; int n = fence; Object[] arr = this.array; for (int i = k; i < n; ++i) { Object x = arr[i]; if (x != null) arr[k++] = x; } removeSlotsAt(k, n); return this; } /** * Equivalent to asList().addAll but specialized for array * arguments and likely to be more efficient. * @param other the elements to add * @return this (to simplify use in expressions) */ public ParallelArray addAll(T[] other) { int csize = other.length; int end = fence; insertSlotsAt(end, csize); System.arraycopy(other, 0, array, end, csize); return this; } /** * Appends all (possibly bounded, filtered, or mapped) elements of * the given ParallelArray, resizing and/or reallocating this * array if necessary. * @param other the elements to add * @return this (to simplify use in expressions) */ public ParallelArray addAll (ParallelArrayWithMapping other) { int end = fence; if (other.hasFilter()) { PAS.FJOAppendAllDriver r = new PAS.FJOAppendAllDriver (other, end, array); ex.invoke(r); array = (T[])(r.results); fence = end + r.resultSize; } else { int csize = other.size(); insertSlotsAt(end, csize); if (other.hasMap()) ex.invoke(new PAS.FJOMap(other, other.origin, other.fence, null, array, end - other.origin)); else System.arraycopy(other.array, 0, array, end, csize); } return this; } /** * Returns an operation prefix that causes a method to * operate only on the elements of the array between * firstIndex (inclusive) and upperBound (exclusive). * @param firstIndex the lower bound (inclusive) * @param upperBound the upper bound (exclusive) * @return operation prefix */ public ParallelArrayWithBounds withBounds (int firstIndex, int upperBound) { return super.withBounds(firstIndex, upperBound); } /** * Returns an operation prefix that causes a method to operate * only on the elements of the array for which the given selector * returns true * @param selector the selector * @return operation prefix */ public ParallelArrayWithFilter withFilter (Predicate selector) { return super.withFilter(selector); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the given binary selector returns * true * @param selector the selector * @return operation prefix */ public ParallelArrayWithFilter withFilter (BinaryPredicate selector, ParallelArrayWithMapping other) { return super.withFilter(selector, other); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the given indexed selector returns * true * @param selector the selector * @return operation prefix */ public ParallelArrayWithFilter withIndexedFilter (IntAndObjectPredicate selector) { return super.withIndexedFilter(selector); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public ParallelArrayWithMapping withMapping (Op op) { return super.withMapping(op); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public ParallelArrayWithDoubleMapping withMapping (ObjectToDouble op) { return super.withMapping(op); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public ParallelArrayWithLongMapping withMapping (ObjectToLong op) { return super.withMapping(op); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithMapping withMapping (BinaryOp combiner, ParallelArrayWithMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithMapping withMapping (ObjectAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithMapping withMapping (ObjectAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithDoubleMapping withMapping (ObjectAndObjectToDouble combiner, ParallelArrayWithMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithDoubleMapping withMapping (ObjectAndDoubleToDouble combiner, ParallelDoubleArrayWithDoubleMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithDoubleMapping withMapping (ObjectAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithLongMapping withMapping (ObjectAndObjectToLong combiner, ParallelArrayWithMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithLongMapping withMapping (ObjectAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithLongMapping withMapping (ObjectAndLongToLong combiner, ParallelLongArrayWithLongMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate on * mappings of this array using the given mapper that accepts as * arguments an element's current index and value, and produces a * new value. Index-based mappings allow parallel computation of * many common array operations. For example, you could create * function to average the values at the same index of multiple * arrays and apply it using this method. * @param mapper the mapper * @return operation prefix */ public ParallelArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return super.withIndexedMapping(mapper); } /** * Returns an operation prefix that causes a method to operate on * mappings of this array using the given mapper that accepts as * arguments an element's current index and value, and produces a * new value. * @param mapper the mapper * @return operation prefix */ public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return super.withIndexedMapping(mapper); } /** * Returns an operation prefix that causes a method to operate on * mappings of this array using the given mapper that accepts as * arguments an element's current index and value, and produces a * new value. * @param mapper the mapper * @return operation prefix */ public ParallelArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return super.withIndexedMapping(mapper); } /** * Returns an iterator stepping through each element of the array * up to the current limit. This iterator does not * support the remove operation. However, a full * ListIterator supporting add, remove, and set * operations is available via {@link #asList}. * @return an iterator stepping through each element. */ public Iterator iterator() { return new ParallelArrayIterator(array, fence); } static final class ParallelArrayIterator implements Iterator { int cursor; final T[] arr; final int hi; ParallelArrayIterator(T[] a, int limit) { arr = a; hi = limit; } public boolean hasNext() { return cursor < hi; } public T next() { if (cursor >= hi) throw new NoSuchElementException(); return arr[cursor++]; } public void remove() { throw new UnsupportedOperationException(); } } // List support /** * Returns a view of this ParallelArray as a List. This List has * the same structural and performance characteristics as {@link * ArrayList}, and may be used to modify, replace or extend the * bounds of the array underlying this ParallelArray. The methods * supported by this list view are not in general * implemented as parallel operations. This list is also not * itself thread-safe. In particular, performing list updates * while other parallel operations are in progress has undefined * (and surely undesired) effects. * @return a list view */ public List asList() { AsList lv = listView; if (lv == null) listView = lv = new AsList(); return lv; } /** * Returns the effective size of the underlying array. The * effective size is the current limit, if used (see {@link * #setLimit}), or the length of the array otherwise. * @return the effective size of array */ public int size() { return fence; } /** * Returns the element of the array at the given index * @param i the index * @return the element of the array at the given index */ public T get(int i) { return array[i]; } /** * Sets the element of the array at the given index to the given value * @param i the index * @param x the value */ public void set(int i, T x) { array[i] = x; } /** * Returns the underlying array used for computations * @return the array */ public T[] getArray() { return array; } /** * Equivalent to asList().toString() * @return a string representation */ public String toString() { return asList().toString(); } /** * Ensures that the underlying array can be accessed up to the * given upper bound, reallocating and copying the underlying * array to expand if necessary. Or, if the given limit is less * than the length of the underlying array, causes computations to * ignore elements past the given limit. * @param newLimit the new upper bound * @throws IllegalArgumentException if newLimit less than zero. */ public final void setLimit(int newLimit) { if (newLimit < 0) throw new IllegalArgumentException(); int cap = array.length; if (newLimit > cap) resizeArray(newLimit); fence = newLimit; } final void replaceElementsWith(T[] a) { System.arraycopy(a, 0, array, 0, a.length); fence = a.length; } final void resizeArray(int newCap) { int cap = array.length; if (newCap > cap) { Class elementType = array.getClass().getComponentType(); T[] a =(T[])Array.newInstance(elementType, newCap); System.arraycopy(array, 0, a, 0, cap); array = a; } } final void insertElementAt(int index, T e) { int hi = fence++; if (hi >= array.length) resizeArray((hi * 3)/2 + 1); if (hi > index) System.arraycopy(array, index, array, index+1, hi - index); array[index] = e; } final void appendElement(T e) { int hi = fence++; if (hi >= array.length) resizeArray((hi * 3)/2 + 1); array[hi] = e; } /** * Make len slots available at index */ final void insertSlotsAt(int index, int len) { if (len <= 0) return; int cap = array.length; int newSize = fence + len; if (cap < newSize) { cap = (cap * 3)/2 + 1; if (cap < newSize) cap = newSize; resizeArray(cap); } if (index < fence) System.arraycopy(array, index, array, index + len, fence - index); fence = newSize; } final void removeSlotAt(int index) { System.arraycopy(array, index + 1, array, index, fence - index - 1); array[--fence] = null; } final void removeSlotsAt(int fromIndex, int toIndex) { if (fromIndex < toIndex) { int size = fence; System.arraycopy(array, toIndex, array, fromIndex, size - toIndex); int newSize = size - (toIndex - fromIndex); fence = newSize; while (size > newSize) array[--size] = null; } } final int seqIndexOf(Object target) { T[] arr = array; int end = fence; if (target == null) { for (int i = 0; i < end; i++) if (arr[i] == null) return i; } else { for (int i = 0; i < end; i++) if (target.equals(arr[i])) return i; } return -1; } final int seqLastIndexOf(Object target) { T[] arr = array; int last = fence - 1; if (target == null) { for (int i = last; i >= 0; i--) if (arr[i] == null) return i; } else { for (int i = last; i >= 0; i--) if (target.equals(arr[i])) return i; } return -1; } final class ListIter implements ListIterator { int cursor; int lastRet; T[] arr; // cache array and bound int hi; ListIter(int lo) { this.cursor = lo; this.lastRet = -1; this.arr = ParallelArray.this.array; this.hi = ParallelArray.this.fence; } public boolean hasNext() { return cursor < hi; } public T next() { int i = cursor; if (i < 0 || i >= hi) throw new NoSuchElementException(); T next = arr[i]; lastRet = i; cursor = i + 1; return next; } public void remove() { int k = lastRet; if (k < 0) throw new IllegalStateException(); ParallelArray.this.removeSlotAt(k); hi = ParallelArray.this.fence; if (lastRet < cursor) cursor--; lastRet = -1; } public boolean hasPrevious() { return cursor > 0; } public T previous() { int i = cursor - 1; if (i < 0 || i >= hi) throw new NoSuchElementException(); T previous = arr[i]; lastRet = cursor = i; return previous; } public int nextIndex() { return cursor; } public int previousIndex() { return cursor - 1; } public void set(T e) { int i = lastRet; if (i < 0 || i >= hi) throw new NoSuchElementException(); arr[i] = e; } public void add(T e) { int i = cursor; ParallelArray.this.insertElementAt(i, e); arr = ParallelArray.this.array; hi = ParallelArray.this.fence; lastRet = -1; cursor = i + 1; } } final class AsList extends AbstractList implements RandomAccess { public T get(int i) { if (i >= fence) throw new IndexOutOfBoundsException(); return array[i]; } public T set(int i, T x) { if (i >= fence) throw new IndexOutOfBoundsException(); T[] arr = array; T t = arr[i]; arr[i] = x; return t; } public boolean isEmpty() { return fence == 0; } public int size() { return fence; } public Iterator iterator() { return new ListIter(0); } public ListIterator listIterator() { return new ListIter(0); } public ListIterator listIterator(int index) { if (index < 0 || index > fence) throw new IndexOutOfBoundsException(); return new ListIter(index); } public boolean add(T e) { appendElement(e); return true; } public void add(int index, T e) { if (index < 0 || index > fence) throw new IndexOutOfBoundsException(); insertElementAt(index, e); } public boolean addAll(Collection c) { int csize = c.size(); if (csize == 0) return false; int hi = fence; setLimit(hi + csize); T[] arr = array; for (T e : c) arr[hi++] = e; return true; } public boolean addAll(int index, Collection c) { if (index < 0 || index > fence) throw new IndexOutOfBoundsException(); int csize = c.size(); if (csize == 0) return false; insertSlotsAt(index, csize); T[] arr = array; for (T e : c) arr[index++] = e; return true; } public void clear() { T[] arr = array; for (int i = 0; i < fence; ++i) arr[i] = null; fence = 0; } public boolean remove(Object o) { int idx = seqIndexOf(o); if (idx < 0) return false; removeSlotAt(idx); return true; } public T remove(int index) { T oldValue = get(index); removeSlotAt(index); return oldValue; } public void removeRange(int fromIndex, int toIndex) { removeSlotsAt(fromIndex, toIndex); } public boolean contains(Object o) { return seqIndexOf(o) >= 0; } public int indexOf(Object o) { return seqIndexOf(o); } public int lastIndexOf(Object o) { return seqLastIndexOf(o); } public Object[] toArray() { int len = fence; Object[] a = new Object[len]; System.arraycopy(array, 0, a, 0, len); return a; } public V[] toArray(V a[]) { int len = fence; if (a.length < len) { Class elementType = a.getClass().getComponentType(); a =(V[])Array.newInstance(elementType, len); } System.arraycopy(array, 0, a, 0, len); if (a.length > len) a[len] = null; return a; } } } jsr166/src/extra166y/ParallelArrayWithBounds.java0000644000000000000000000000777011537741066016771 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelArray that causes operations to apply * only to elements within a given range. * Instances of this class may be constructed only via prefix * methods of ParallelArray or its other prefix classes. */ public abstract class ParallelArrayWithBounds extends ParallelArrayWithFilter { ParallelArrayWithBounds (ForkJoinPool ex, int origin, int fence, T[] array) { super(ex, origin, fence, array); } /** * Returns an operation prefix that causes a method to operate * only on the elements of the array between firstIndex * (inclusive) and upperBound (exclusive). The bound * arguments are relative to the current bounds. For example * pa.withBounds(2, 8).withBounds(3, 5) indexes the * 5th (= 2+3) and 6th elements of pa. However, indices * returned by methods such as indexOf are * with respect to the underlying ParallelArray. * @param firstIndex the lower bound (inclusive) * @param upperBound the upper bound (exclusive) * @return operation prefix */ public abstract ParallelArrayWithBounds withBounds (int firstIndex, int upperBound); /** * Returns the index of some element equal to given target, or * -1 if not present * @param target the element to search for * @return the index or -1 if not present */ public abstract int indexOf(T target); /** * Assuming this array is sorted, returns the index of an * element equal to given target, or -1 if not present. If the * array is not sorted, the results are undefined. * @param target the element to search for * @return the index or -1 if not present */ public abstract int binarySearch(T target); /** * Assuming this array is sorted with respect to the given * comparator, returns the index of an element equal to given * target, or -1 if not present. If the array is not sorted, * the results are undefined. * @param target the element to search for * @param comparator the comparator * @return the index or -1 if not present */ public abstract int binarySearch(T target, Comparator comparator); /** * Replaces each element with the running cumulation of applying * the given reducer. * @param reducer the reducer * @param base the result for an empty array * @return this (to simplify use in expressions) */ public abstract ParallelArrayWithBounds cumulate(Reducer reducer, T base); /** * Replaces each element with the cumulation of applying the given * reducer to all previous values, and returns the total * reduction. * @param reducer the reducer * @param base the result for an empty array * @return the total reduction */ public abstract T precumulate(Reducer reducer, T base); /** * Sorts the elements. * Unlike Arrays.sort, this sort does * not guarantee that elements with equal keys maintain their * relative position in the array. * @param cmp the comparator to use * @return this (to simplify use in expressions) */ public abstract ParallelArrayWithBounds sort(Comparator cmp); /** * Sorts the elements, assuming all elements are * Comparable. Unlike Arrays.sort, this sort does not * guarantee that elements with equal keys maintain their relative * position in the array. * @return this (to simplify use in expressions) * @throws ClassCastException if any element is not Comparable. */ public abstract ParallelArrayWithBounds sort(); } jsr166/src/extra166y/ParallelLongArrayWithDoubleMapping.java0000644000000000000000000003077511537741066021106 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelLongArray that causes operations to apply * to mappings of elements, not to the elements themselves. * Instances of this class may be constructed only via prefix * methods of ParallelLongArray or its other prefix classes. */ public abstract class ParallelLongArrayWithDoubleMapping extends AbstractParallelAnyArray.LPap { ParallelLongArrayWithDoubleMapping (ForkJoinPool ex, int origin, int fence, long[] array) { super(ex, origin, fence, array); } /** * Applies the given procedure * @param procedure the procedure */ public void apply(DoubleProcedure procedure) { ex.invoke(new PAS.FJDApply(this, origin, fence, null, procedure)); } /** * Returns reduction of mapped elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public double reduce(DoubleReducer reducer, double base) { PAS.FJDReduce f = new PAS.FJDReduce (this, origin, fence, null, reducer, base); ex.invoke(f); return f.result; } /** * Returns the minimum element, or Double.MAX_VALUE if empty * @return minimum element, or Double.MAX_VALUE if empty */ public double min() { return reduce(CommonOps.naturalDoubleMinReducer(), Double.MAX_VALUE); } /** * Returns the minimum element, or Double.MAX_VALUE if empty * @param comparator the comparator * @return minimum element, or Double.MAX_VALUE if empty */ public double min(DoubleComparator comparator) { return reduce(CommonOps.doubleMinReducer(comparator), Double.MAX_VALUE); } /** * Returns the maximum element, or -Double.MAX_VALUE if empty * @return maximum element, or -Double.MAX_VALUE if empty */ public double max() { return reduce(CommonOps.naturalDoubleMaxReducer(), -Double.MAX_VALUE); } /** * Returns the maximum element, or -Double.MAX_VALUE if empty * @param comparator the comparator * @return maximum element, or -Double.MAX_VALUE if empty */ public double max(DoubleComparator comparator) { return reduce(CommonOps.doubleMaxReducer(comparator), -Double.MAX_VALUE); } /** * Returns the sum of elements * @return the sum of elements */ public double sum() { return reduce(CommonOps.doubleAdder(), 0); } /** * Returns summary statistics * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelDoubleArray.SummaryStatistics summary (DoubleComparator comparator) { PAS.FJDStats f = new PAS.FJDStats (this, origin, fence, null, comparator); ex.invoke(f); return f; } /** * Returns summary statistics, using natural comparator * @return the summary. */ public ParallelDoubleArray.SummaryStatistics summary() { return summary(CommonOps.naturalDoubleComparator()); } /** * Returns a new ParallelDoubleArray holding mappings * @return a new ParallelDoubleArray holding mappings */ public ParallelDoubleArray all() { return new ParallelDoubleArray(ex, allDoubles()); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelLongArrayWithLongMapping withMapping (DoubleToLong op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelLongArrayWithDoubleMapping withMapping (DoubleOp op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelLongArrayWithMapping withMapping (DoubleToObject op); /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (DoubleAndObjectToObject combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (DoubleAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (DoubleAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (DoubleAndObjectToDouble combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (BinaryDoubleOp combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (DoubleAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (DoubleAndObjectToLong combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (DoubleAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (DoubleAndLongToLong combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelLongArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelLongArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper); /** * Returns an Iterable view to sequentially step through mapped * elements also obeying bound and filter constraints, without * performing computations to evaluate them in parallel * @return the Iterable view */ public Iterable sequentially() { return new SequentiallyAsDouble(); } } jsr166/src/extra166y/Ops.java0000644000000000000000000005331011537741066012757 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import java.util.*; /** * Interfaces and utilities declaring per-element operations used * within parallel methods on aggregates. This class provides type * names for all operation signatures accepting zero, one or two * arguments, and returning zero or one results, for parameterized * types, as well as specializations to int, long, * and double. In keeping with normal Java evaluation rules * that promote, for example short to int, operation * names for these smaller types are absent. * *

Preliminary release note: Some of the declarations in this * class are likely to be moved elsewhere in the JDK libraries * upon actual release, and most likely will not all nested in the * same class. * *

The naming conventions are as follows: *

    * *
  • The name of the single method declared in each interface is * simply op (short for "operate"). * *
  • An Op (short for "operation") maps a single argument to * a result. Example: negating a value. * *
  • The names for scalar ops accepting and returning the same type * are prefaced by their type name. * *
  • A BinaryOp maps two arguments to a result. Example: * dividing two numbers * *
  • A Reducer is an associative binary op * accepting and returning values of the same type; where op(a, op(b, * c)) should have the same result as op(op(a, b), c). Example: * adding two numbers. * *
  • Scalar binary ops accepting and returning the same type * include their type name. * *
  • Mixed-type operators are named just by their argument type * names. * *
  • A Generator takes no arguments and returns a result. * Examples: random number generators, builders * *
  • A Procedure accepts an argument but doesn't return a * result. Example: printing a value. An Action is a * Procedure that takes no arguments. * *
  • A Predicate accepts a value and returns a boolean indicator * that the argument obeys some property. Example: testing if a number is even. * *
  • A BinaryPredicate accepts two values and returns a * boolean indicator that the arguments obeys some relation. Example: * testing if two numbers are relatively prime. * *
  • Scalar versions of {@link Comparator} have the same properties * as the Object version -- returning negative, zero, or positive * if the first argument is less, equal, or greater than the second. * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
result = op(a) or * result = op(a,b)
* * * * * * * *
* arg types * result type * *
* a * b * int * long * double * Object * *
* * * * * * * *
* int * <none> * Ops.IntOp * Ops.IntToLong * Ops.IntToDouble * Ops.IntToObject * *
* * int * Ops.BinaryIntOp * Ops.IntAndIntToLong * Ops.IntAndIntToDouble * Ops.IntAndIntToObject * *
* * long * Ops.IntAndLongToInt * Ops.IntAndLongToLong * Ops.IntAndLongToDouble * Ops.IntAndLongToObject * *
* * double * Ops.IntAndDoubleToInt * Ops.IntAndDoubleToLong * Ops.IntAndDoubleToDouble * Ops.IntAndDoubleToObject * *
* * Object * Ops.IntAndObjectToInt * Ops.IntAndObjectToLong * Ops.IntAndObjectToDouble * Ops.IntAndObjectToObject * *
* * * * * * * *
* long * <none> * Ops.LongToInt * Ops.LongOp * Ops.LongToDouble * Ops.LongToObject * *
* * int * Ops.LongAndIntToInt * Ops.LongAndIntToLong * Ops.LongAndIntToDouble * Ops.LongAndIntToObject * *
* * long * Ops.LongAndLongToInt * Ops.BinaryLongOp * Ops.LongAndLongToDouble * Ops.LongAndLongToObject * *
* * double * Ops.LongAndDoubleToInt * Ops.LongAndDoubleToLong * Ops.LongAndDoubleToDouble * Ops.LongAndDoubleToObject * *
* * Object * Ops.LongAndObjectToInt * Ops.LongAndObjectToLong * Ops.LongAndObjectToDouble * Ops.LongAndObjectToObject * *
* * * * * * * *
* double * <none> * Ops.DoubleToInt * Ops.DoubleToLong * Ops.DoubleOp * Ops.DoubleToObject * *
* * int * Ops.DoubleAndIntToInt * Ops.DoubleAndIntToLong * Ops.DoubleAndIntToDouble * Ops.DoubleAndIntToObject * *
* * long * Ops.DoubleAndLongToInt * Ops.DoubleAndLongToLong * Ops.DoubleAndLongToDouble * Ops.DoubleAndLongToObject * *
* * double * Ops.DoubleAndDoubleToInt * Ops.DoubleAndDoubleToLong * Ops.BinaryDoubleOp * Ops.DoubleAndDoubleToObject *
* * Object * Ops.DoubleAndObjectToInt * Ops.DoubleAndObjectToLong * Ops.DoubleAndObjectToDouble * Ops.DoubleAndObjectToObject * *
* * * * * * * *
* Object * <none> * Ops.ObjectToInt * Ops.ObjectToLong * Ops.ObjectToDouble * Ops.Op * *
* * int * Ops.ObjectAndIntToInt * Ops.ObjectAndIntToLong * Ops.ObjectAndIntToDouble * Ops.ObjectAndIntToObject * *
* * long * Ops.ObjectAndLongToInt * Ops.ObjectAndLongToLong * Ops.ObjectAndLongToDouble * Ops.ObjectAndLongToObject * *
* * double * Ops.ObjectAndDoubleToInt * Ops.ObjectAndDoubleToLong * Ops.ObjectAndDoubleToDouble * Ops.ObjectAndDoubleToObject * *
* * Object * Ops.ObjectAndObjectToInt * Ops.ObjectAndObjectToLong * Ops.ObjectAndObjectToDouble * Ops.BinaryOp * *
* * * * * * *
* *

In addition to stated signatures, implementations of these * interfaces must work safely in parallel. In general, this means * methods should operate only on their arguments, and should not rely * on ThreadLocals, unsafely published globals, or other unsafe * constructions. Additionally, they should not block waiting for * synchronization. * *

This class is normally best used via import static. */ public class Ops { private Ops() {} // disable construction // Thanks to David Biesack for the above html table // You want to read/edit this with a wide editor panel public static interface Op { R op(A a);} public static interface BinaryOp { R op(A a, B b);} public static interface Predicate { boolean op(A a);} public static interface BinaryPredicate { boolean op(A a, B b);} public static interface Procedure { void op(A a);} public static interface Generator { R op();} public static interface Reducer extends BinaryOp{} public static interface IntOp { int op(int a);} public static interface BinaryIntOp { int op(int a, int b);} public static interface IntPredicate { boolean op(int a);} public static interface IntProcedure { void op(int a);} public static interface IntGenerator { int op();} public static interface BinaryIntPredicate { boolean op(int a, int b);} public static interface IntReducer extends BinaryIntOp{} public static interface IntComparator { int compare(int a, int b);} public static interface LongOp { long op(long a);} public static interface BinaryLongOp { long op(long a, long b);} public static interface LongPredicate { boolean op(long a);} public static interface BinaryLongPredicate { boolean op(long a, long b);} public static interface LongProcedure { void op(long a);} public static interface LongGenerator { long op();} public static interface LongReducer extends BinaryLongOp{} public static interface LongComparator { int compare(long a, long b);} public static interface DoubleOp { double op(double a);} public static interface BinaryDoubleOp { double op(double a, double b);} public static interface DoublePredicate { boolean op(double a);} public static interface BinaryDoublePredicate { boolean op(double a, double b);} public static interface DoubleProcedure { void op(double a);} public static interface DoubleGenerator { double op();} public static interface DoubleReducer extends BinaryDoubleOp{} public static interface DoubleComparator { int compare(double a, double b);} public static interface Action { void op();} // mixed mode ops public static interface IntToLong { long op(int a);} public static interface IntToDouble { double op(int a);} public static interface IntToObject { R op(int a);} public static interface LongToInt { int op(long a);} public static interface LongToDouble { double op(long a);} public static interface LongToObject { R op(long a);} public static interface DoubleToInt { int op(double a);} public static interface DoubleToLong { long op(double a);} public static interface DoubleToObject { R op(double a);} public static interface ObjectToInt { int op(A a);} public static interface ObjectToLong { long op(A a);} public static interface ObjectToDouble { double op(A a);} public static interface IntAndIntProcedure { void op(int a, int b);} public static interface IntAndIntToLong { long op(int a, int b);} public static interface IntAndIntToDouble { double op(int a, int b);} public static interface IntAndIntToObject { R op(int a, int b);} public static interface IntAndLongProcedure { void op(int a, long b);} public static interface IntAndLongPredicate { boolean op(int a, long b);} public static interface IntAndLongToInt { int op(int a, long b);} public static interface IntAndLongToLong { long op(int a, long b);} public static interface IntAndLongToDouble { double op(int a, long b);} public static interface IntAndLongToObject { R op(int a, long b);} public static interface IntAndDoubleProcedure { void op(int a, double b);} public static interface IntAndDoublePredicate { boolean op(int a, double b);} public static interface IntAndDoubleToInt { int op(int a, double b);} public static interface IntAndDoubleToLong { long op(int a, double b);} public static interface IntAndDoubleToDouble { double op(int a, double b);} public static interface IntAndDoubleToObject { R op(int a, double b);} public static interface IntAndObjectProcedure { void op(int a, A b);} public static interface IntAndObjectPredicate { boolean op(int a, A b);} public static interface IntAndObjectToInt { int op(int a, A b);} public static interface IntAndObjectToLong { long op(int a, A b);} public static interface IntAndObjectToDouble { double op(int a, A b);} public static interface IntAndObjectToObject { R op(int a, A b);} public static interface LongAndIntProcedure { void op(long a, int b);} public static interface LongAndIntPredicate { boolean op(long a, int b);} public static interface LongAndIntToInt { int op(long a, int b);} public static interface LongAndIntToLong { long op(long a, int b);} public static interface LongAndIntToDouble { double op(long a, int b);} public static interface LongAndIntToObject { R op(long a, int b);} public static interface LongAndLongProcedure { void op(long a, long b);} public static interface LongAndLongToInt { int op(long a, long b);} public static interface LongAndLongToDouble { double op(long a, long b);} public static interface LongAndLongToObject { R op(long a, long b);} public static interface LongAndDoubleProcedure { void op(long a, double b);} public static interface LongAndDoublePredicate { boolean op(long a, double b);} public static interface LongAndDoubleToInt { int op(long a, double b);} public static interface LongAndDoubleToLong { long op(long a, double b);} public static interface LongAndDoubleToDouble { double op(long a, double b);} public static interface LongAndDoubleToObject { R op(long a, double b);} public static interface LongAndObjectProcedure { void op(long a, A b);} public static interface LongAndObjectPredicate { boolean op(long a, A b);} public static interface LongAndObjectToInt { int op(long a, A b);} public static interface LongAndObjectToLong { long op(long a, A b);} public static interface LongAndObjectToDouble { double op(long a, A b);} public static interface LongAndObjectToObject { R op(long a, A b);} public static interface DoubleAndIntProcedure { void op(double a, int b);} public static interface DoubleAndIntPredicate { boolean op(double a, int b);} public static interface DoubleAndIntToInt { int op(double a, int b);} public static interface DoubleAndIntToLong { long op(double a, int b);} public static interface DoubleAndIntToDouble { double op(double a, int b);} public static interface DoubleAndIntToObject { R op(double a, int b);} public static interface DoubleAndLongProcedure { void op(double a, long b);} public static interface DoubleAndLongPredicate { boolean op(double a, long b);} public static interface DoubleAndLongToInt { int op(double a, long b);} public static interface DoubleAndLongToLong { long op(double a, long b);} public static interface DoubleAndLongToDouble { double op(double a, long b);} public static interface DoubleAndLongToObject { R op(double a, long b);} public static interface DoubleAndDoubleProcedure { void op(double a, double b);} public static interface DoubleAndDoubleToInt { int op(double a, double b);} public static interface DoubleAndDoubleToLong { long op(double a, double b);} public static interface DoubleAndDoubleToObject { R op(double a, double b);} public static interface DoubleAndObjectProcedure { void op(double a, A b);} public static interface DoubleAndObjectPredicate { boolean op(double a, A b);} public static interface DoubleAndObjectToInt { int op(double a, A b);} public static interface DoubleAndObjectToLong { long op(double a, A b);} public static interface DoubleAndObjectToDouble { double op(double a, A b);} public static interface DoubleAndObjectToObject { R op(double a, A b);} public static interface ObjectAndIntProcedure { void op(A a, int b);} public static interface ObjectAndIntPredicate { boolean op(A a, int b);} public static interface ObjectAndIntToInt { int op(A a, int b);} public static interface ObjectAndIntToLong { long op(A a, int b);} public static interface ObjectAndIntToDouble { double op(A a, int b);} public static interface ObjectAndIntToObject { R op(A a, int b);} public static interface ObjectAndLongProcedure { void op(A a, long b);} public static interface ObjectAndLongPredicate { boolean op(A a, long b);} public static interface ObjectAndLongToInt { int op(A a, long b);} public static interface ObjectAndLongToLong { long op(A a, long b);} public static interface ObjectAndLongToDouble { double op(A a, long b);} public static interface ObjectAndLongToObject { R op(A a, long b);} public static interface ObjectAndDoubleProcedure { void op(A a, double b);} public static interface ObjectAndDoublePredicate { boolean op(A a, double b);} public static interface ObjectAndDoubleToInt { int op(A a, double b);} public static interface ObjectAndDoubleToLong { long op(A a, double b);} public static interface ObjectAndDoubleToDouble { double op(A a, double b);} public static interface ObjectAndDoubleToObject { R op(A a, double b);} public static interface ObjectAndObjectProcedure{ void op(A a, B b);} public static interface ObjectAndObjectToInt { int op(A a, B b);} public static interface ObjectAndObjectToLong { long op(A a, B b);} public static interface ObjectAndObjectToDouble { double op(A a, B b);} } jsr166/src/extra166y/ParallelDoubleArrayWithLongMapping.java0000644000000000000000000003050011537741066021070 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelDoubleArray that causes operations to apply * to mappings of elements, not to the elements themselves. * Instances of this class may be constructed only via prefix * methods of ParallelDoubleArray or its other prefix classes. */ public abstract class ParallelDoubleArrayWithLongMapping extends AbstractParallelAnyArray.DPap { ParallelDoubleArrayWithLongMapping (ForkJoinPool ex, int origin, int fence, double[] array) { super(ex, origin, fence, array); } /** * Applies the given procedure * @param procedure the procedure */ public void apply(LongProcedure procedure) { ex.invoke(new PAS.FJLApply(this, origin, fence, null, procedure)); } /** * Returns reduction of mapped elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public long reduce(LongReducer reducer, long base) { PAS.FJLReduce f = new PAS.FJLReduce (this, origin, fence, null, reducer, base); ex.invoke(f); return f.result; } /** * Returns the minimum element, or Long.MAX_VALUE if empty * @return minimum element, or Long.MAX_VALUE if empty */ public long min() { return reduce(CommonOps.naturalLongMinReducer(), Long.MAX_VALUE); } /** * Returns the minimum element, or Long.MAX_VALUE if empty * @param comparator the comparator * @return minimum element, or Long.MAX_VALUE if empty */ public long min(LongComparator comparator) { return reduce(CommonOps.longMinReducer(comparator), Long.MAX_VALUE); } /** * Returns the maximum element, or Long.MIN_VALUE if empty * @return maximum element, or Long.MIN_VALUE if empty */ public long max() { return reduce(CommonOps.naturalLongMaxReducer(), Long.MIN_VALUE); } /** * Returns the maximum element, or Long.MIN_VALUE if empty * @param comparator the comparator * @return maximum element, or Long.MIN_VALUE if empty */ public long max(LongComparator comparator) { return reduce(CommonOps.longMaxReducer(comparator), Long.MIN_VALUE); } /** * Returns the sum of elements * @return the sum of elements */ public long sum() { return reduce(CommonOps.longAdder(), 0); } /** * Returns summary statistics * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelLongArray.SummaryStatistics summary (LongComparator comparator) { PAS.FJLStats f = new PAS.FJLStats (this, origin, fence, null, comparator); ex.invoke(f); return f; } /** * Returns summary statistics, using natural comparator * @return the summary. */ public ParallelLongArray.SummaryStatistics summary() { return summary(CommonOps.naturalLongComparator()); } /** * Returns a new ParallelLongArray holding mappings * @return a new ParallelLongArray holding mappings */ public ParallelLongArray all() { return new ParallelLongArray(ex, allLongs()); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelDoubleArrayWithDoubleMapping withMapping (LongToDouble op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelDoubleArrayWithLongMapping withMapping (LongOp op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelDoubleArrayWithMapping withMapping (LongToObject op); /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (LongAndObjectToObject combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping(AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (LongAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping(AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (LongAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping(AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithDoubleMapping withMapping (LongAndObjectToDouble combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping(AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithDoubleMapping withMapping (LongAndDoubleToDouble combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping(AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithDoubleMapping withMapping (LongAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping(AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (LongAndObjectToLong combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping(AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (LongAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping(AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (BinaryLongOp combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping(AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelDoubleArrayWithMapping withIndexedMapping (IntAndLongToObject mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper); /** * Returns an Iterable view to sequentially step through mapped * elements also obeying bound and filter constraints, without * performing computations to evaluate them in parallel * @return the Iterable view */ public Iterable sequentially() { return new SequentiallyAsLong(); } } jsr166/src/extra166y/CustomConcurrentHashMap.java0000644000000000000000000033541411537741066017005 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import java.lang.ref.*; import java.lang.reflect.*; import java.io.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; import sun.misc.Unsafe; /** * A {@link java.util.ConcurrentMap} supporting user-defined * equivalence comparisons, soft, weak, or strong keys and values, and * user-supplied computational methods for setting and updating * values. In particular:

* * Per-map settings are established in constructors, as in the * following usages (that assume static imports to simplify expression * of configuration parameters): * *
 * {@code
 * identityMap = new CustomConcurrentHashMap
 *     (STRONG, IDENTITY, STRONG, EQUALS, 0);
 * weakKeyMap = new CustomConcurrentHashMap
 *     (WEAK, IDENTITY, STRONG, EQUALS, 0);
 *     .weakKeys());
 * byNameMap = new CustomConcurrentHashMap
 *     (STRONG,
 *      new Equivalence() {
 *          public boolean equal(Person k, Object x) {
 *            return x instanceof Person && k.name.equals(((Person)x).name);
 *          }
 *          public int hash(Object x) {
 *             return (x instanceof Person) ? ((Person)x).name.hashCode() : 0;
 *          }
 *        },
 *      STRONG, EQUALS, 0);
 * }
 * 
* * The first usage above provides a replacement for {@link * java.util.IdentityHashMap}, and the second a replacement for {@link * java.util.WeakHashMap}, adding concurrency, asynchronous cleanup, * and identity-based equality for keys. The third usage * illustrates a map with a custom Equivalence that looks only at the * name field of a (fictional) Person class. * *

This class also includes nested class {@link KeySet} * that provides space-efficient Set views of maps, also supporting * method intern, which may be of use in canonicalizing * elements. * *

When used with (Weak or Soft) Reference keys and/or values, * elements that have asynchronously become null are * treated as absent from the map and (eventually) removed from maps * via a background thread common across all maps. Because of the * potential for asynchronous clearing of References, methods such as * containsValue have weaker guarantees than you might * expect even in the absence of other explicitly concurrent * operations. For example containsValue(value) may * return true even if value is no longer available upon * return from the method. * *

When Equivalences other than equality are used, the returned * collections may violate the specifications of Map and/or * Set interfaces, which mandate the use of the * equals method when comparing objects. The methods of this * class otherwise have properties similar to those of {@link * java.util.ConcurrentHashMap} under its default settings. To * adaptively maintain semantics and performance under varying * conditions, this class does not support load factor or * concurrency level parameters. This class does not permit null keys * or values. This class is serializable; however, serializing a map * that uses soft or weak references can give unpredictable results. * This class supports all optional operations of the {@code * ConcurrentMap} interface. It supports have weakly consistent * iteration: an iterator over one of the map's view collections * may reflect some, all or none of the changes made to the collection * after the iterator was created. * *

This class is a member of the * * Java Collections Framework. * * @param the type of keys maintained by this map * @param the type of mapped values */ public class CustomConcurrentHashMap extends AbstractMap implements ConcurrentMap, Serializable { private static final long serialVersionUID = 7249069246764182397L; /* * This class uses a similar approach as ConcurrentHashMap, but * makes different internal tradeoffs, mainly (1) We use more * segments, but lazily initialize them; and (2) Links connecting * nodes are not immutable, enabling unsplicing. These two * adjustments help improve concurrency in the face of heavier * per-element mechanics and the increased load due to reference * removal, while still keeping footprint etc reasonable. * * Additionally, because Reference keys/values may become null * asynchronously, we cannot ensure snapshot integrity in methods * such as containsValue, so do not try to obtain them (so, no * modCounts etc). * * Also, the volatility of Segment count vs table fields are * swapped, enabled by ensuring fences on new node assignments. */ /** * The strength of keys and values that may be held by * maps. strong denotes ordinary objects. weak and soft denote the * corresponding {@link java.lang.ref.Reference} types. */ public enum Strength { strong("Strong"), weak("Weak"), soft("Soft"); private final String name; Strength(String name) { this.name = name; } String getName() { return name; } }; /** The strength of ordinary references */ public static final Strength STRONG = Strength.strong; /** The strength of weak references */ public static final Strength WEAK = Strength.weak; /** The strength of soft references */ public static final Strength SOFT = Strength.soft; /** Config string for self-map (Set view) refs */ private static final String SELF_STRING = "Self"; /** Config string for int maps */ private static final String INT_STRING = "Int"; /** * An object performing equality comparisons, along with a hash * function consistent with this comparison. The type signatures * of the methods of this interface reflect those of {@link * java.util.Map}: While only elements of K may be * entered into a Map, any Object may be tested for * membership. Note that the performance of hash maps is heavily * dependent on the quality of hash functions. */ public static interface Equivalence { /** * Returns true if the given objects are considered equal. * This function must obey an equivalence relation: * equal(a, a) is always true, equal(a, b) implies equal(b, a), * and (equal(a, b) && equal(b, c) implies equal(a, c). * Note that the second argument need not be known to have * the same declared type as the first. * @param key a key in, or being placed in, the map * @param x an object queried for membership * @return true if considered equal */ boolean equal(K key, Object x); /** * Returns a hash value such that equal(a, b) implies * hash(a)==hash(b). * @param x an object queried for membership * @return a hash value */ int hash(Object x); } // builtin equivalences static final class EquivalenceUsingIdentity implements Equivalence, Serializable { private static final long serialVersionUID = 7259069246764182397L; public final boolean equal(Object a, Object b) { return a == b; } public final int hash(Object a) { return System.identityHashCode(a); } } static final class EquivalenceUsingEquals implements Equivalence, Serializable { private static final long serialVersionUID = 7259069247764182397L; public final boolean equal(Object a, Object b) { return a.equals(b); } public final int hash(Object a) { return a.hashCode(); } } /** * An Equivalence object performing identity-based comparisons * and using {@link System#identityHashCode} for hashing */ public static final Equivalence IDENTITY = new EquivalenceUsingIdentity(); /** * An Equivalence object performing {@link Object#equals} based comparisons * and using {@link Object#hashCode} hashing */ public static final Equivalence EQUALS = new EquivalenceUsingEquals(); /** * A function computing a mapping from the given key to a value, * or null if there is no mapping. */ public static interface MappingFunction { /** * Returns a value for the given key, or null if there is no * mapping. If this function throws an (unchecked) exception, * the exception is rethrown to its caller, and no mapping is * recorded. Because this function is invoked within * atomicity control, the computation should be short and * simple. The most common usage is to construct a new object * serving as an initial mapped value. * * @param key the (non-null) key * @return a value, or null if none */ V map(K key); } /** * A function computing a new mapping from the given key and its * current value to a new value, or null if there is * no mapping */ public static interface RemappingFunction { /** * Returns a new value for the given key and its current, or * null if there is no mapping. * @param key the key * @param value the current value, or null if none * @return a value, or null if none */ V remap(K key, V value); } /** * An object that may be subject to cleanup operations when * removed from a {@link java.lang.ref.ReferenceQueue} */ static interface Reclaimable { /** * The action taken upon removal of this object * from a ReferenceQueue. */ void onReclamation(); } /** * A factory for Nodes. */ static interface NodeFactory extends Serializable { /** * Creates and returns a Node using the given parameters. * * @param locator an opaque immutable locator for this node * @param key the (non-null) immutable key * @param value the (non-null) volatile value * @param cchm the table creating this node * @param linkage an opaque volatile linkage for maintaining this node */ Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage); } /** * An object maintaining a key-value mapping. Nodes provide * methods that are intended to used only by the map * creating the node. This includes methods used solely for * internal bookkeeping by maps, that must be treating opaquely by * implementation classes. (This requirement stems from the fact * that concrete implementations may be required to subclass * {@link java.lang.ref.Reference} or other classes, so a base * class cannot be established.) * * This interface uses raw types as the lesser of evils. * Otherwise we'd encounter almost as many unchecked casts when * nodes are used across sets, etc. */ static interface Node extends Reclaimable { /** * Returns the key established during the creation of this node. * Note: This method is named "get" rather than "getKey" * to simplify usage of Reference keys. * @return the key */ Object get(); /** * Returns the locator established during the creation of this node. * @return the locator */ int getLocator(); /** * Returns the value established during the creation of this * node or, if since updated, the value set by the most * recent call to setValue, or throws an exception if * value could not be computed * @return the value * @throws RuntimeException or Error if computeValue failed */ Object getValue(); /** * Nodes the value to be returned by the next call to getValue. * @param value the value */ void setValue(Object value); /** * Returns the linkage established during the creation of this * node or, if since updated, the linkage set by the most * recent call to setLinkage. * @return the linkage */ Node getLinkage(); /** * Records the linkage to be returned by the next call to getLinkage. * @param linkage the linkage */ void setLinkage(Node r); } /** * Each Segment holds a count and table corresponding to a segment * of the table. This class contains only those methods for * directly assigning these fields, which must only be called * while holding locks */ static final class Segment extends ReentrantLock { volatile Node[] table; int count; final void decrementCount() { if (--count == 0) table = null; } final void clearCount() { count = 0; table = null; } final void incrementCount() { ++count; } final Node[] getTableForTraversal() { return table; } final Node[] getTableForAdd(CustomConcurrentHashMap cchm) { int len; Node[] tab = table; if (tab == null || // 3/4 threshold ((len = tab.length) - (len >>> 2)) < count) return resizeTable(cchm); else return tab; } /** * See the similar code in ConcurrentHashMap for explanation */ final Node[] resizeTable(CustomConcurrentHashMap cchm) { Node[] oldTable = table; if (oldTable == null) return table = (Node[]) new Node[cchm.initialSegmentCapacity]; int oldCapacity = oldTable.length; if (oldCapacity >= MAX_SEGMENT_CAPACITY) return oldTable; Node[] newTable = (Node[])new Node[oldCapacity<<1]; int sizeMask = newTable.length - 1; NodeFactory fac = cchm.factory; for (int i = 0; i < oldCapacity ; i++) { Node e = oldTable[i]; if (e != null) { Node next = e.getLinkage(); int idx = e.getLocator() & sizeMask; // Single node on list if (next == null) newTable[idx] = e; else { // Reuse trailing consecutive sequence at same slot Node lastRun = e; int lastIdx = idx; for (Node last = next; last != null; last = last.getLinkage()) { int k = last.getLocator() & sizeMask; if (k != lastIdx) { lastIdx = k; lastRun = last; } } newTable[lastIdx] = lastRun; // Clone all remaining nodes for (Node p = e; p != lastRun; p = p.getLinkage()) { int ph = p.getLocator(); int k = ph & sizeMask; Object pk = p.get(); Object pv; if (pk == null || (pv = p.getValue()) == null) --count; else newTable[k] = fac.newNode(ph, pk, pv, cchm, newTable[k]); } } } } return table = newTable; } } // Hardwire 64 segments static final int SEGMENT_BITS = 6; static final int NSEGMENTS = 1 << SEGMENT_BITS; static final int SEGMENT_MASK = NSEGMENTS - 1; static final int SEGMENT_SHIFT = 32 - SEGMENT_BITS; static final int MIN_SEGMENT_CAPACITY = 4; static final int MAX_SEGMENT_CAPACITY = 1 << (32 - SEGMENT_BITS); /** * Applies a supplemental hash function to a given hashCode, which * defends against poor quality hash functions. This is critical * because we use power-of-two length hash tables, that otherwise * encounter collisions for hashCodes that do not differ in lower * or upper bits. */ static int spreadHash(int h) { // Spread bits to regularize both segment and index locations, // using variant of single-word Wang/Jenkins hash. h += (h << 15) ^ 0xffffcd7d; h ^= (h >>> 10); h += (h << 3); h ^= (h >>> 6); h += (h << 2) + (h << 14); return h ^ (h >>> 16); } /** * The segments, each of which acts as a hash table */ transient volatile Segment[] segments; /** * The factory for this map */ final NodeFactory factory; /** * Equivalence object for keys */ final Equivalence keyEquivalence; /** * Equivalence object for values */ final Equivalence valueEquivalence; /** * The initial size of Segment tables when they are first constructed */ final int initialSegmentCapacity; // Cached view objects transient Set keySet; transient Set> entrySet; transient Collection values; /** * Internal constructor to set factory, equivalences and segment * capacities, and to create segments array. */ CustomConcurrentHashMap(String ks, Equivalence keq, String vs, Equivalence veq, int expectedSize) { if (keq == null || veq == null) throw new NullPointerException(); this.keyEquivalence = keq; this.valueEquivalence = veq; // Reflectively assemble factory name String factoryName = CustomConcurrentHashMap.class.getName() + "$" + ks + "Key" + vs + "ValueNodeFactory"; try { this.factory = (NodeFactory) (Class.forName(factoryName).newInstance()); } catch (Exception ex) { throw new Error("Cannot instantiate " + factoryName); } int es = expectedSize; if (es == 0) this.initialSegmentCapacity = MIN_SEGMENT_CAPACITY; else { int sc = (int)((1L + (4L * es) / 3) >>> SEGMENT_BITS); if (sc < MIN_SEGMENT_CAPACITY) sc = MIN_SEGMENT_CAPACITY; int capacity = MIN_SEGMENT_CAPACITY; // ensure power of two while (capacity < sc) capacity <<= 1; if (capacity > MAX_SEGMENT_CAPACITY) capacity = MAX_SEGMENT_CAPACITY; this.initialSegmentCapacity = capacity; } this.segments = (Segment[])new Segment[NSEGMENTS]; } /** * Creates a new CustomConcurrentHashMap with the given parameters * @param keyStrength the strength for keys * @param keyEquivalence the Equivalence to use for keys * @param valueStrength the strength for values * @param valueEquivalence the Equivalence to use for values * @param expectedSize an estimate of the number of elements * that will be held in the map. If no estimate is known, * zero is an acceptable value. */ public CustomConcurrentHashMap(Strength keyStrength, Equivalence keyEquivalence, Strength valueStrength, Equivalence valueEquivalence, int expectedSize) { this(keyStrength.getName(), keyEquivalence, valueStrength.getName(), valueEquivalence, expectedSize); } /** * Creates a new CustomConcurrentHashMap with strong keys and * values, and equality-based equivalence. */ public CustomConcurrentHashMap() { this(STRONG, EQUALS, STRONG, EQUALS, 0); } /** * Returns a new map using Integer keys and the given value * parameters * @param valueStrength the strength for values * @param valueEquivalence the Equivalence to use for values * @param expectedSize an estimate of the number of elements * that will be held in the map. If no estimate is known, * zero is an acceptable value. * @return the map */ public static CustomConcurrentHashMap newIntKeyMap(Strength valueStrength, Equivalence valueEquivalence, int expectedSize) { return new CustomConcurrentHashMap (INT_STRING, EQUALS, valueStrength.getName(), valueEquivalence, expectedSize); } /** * Returns a new map using the given key parameters and Integer values * @param keyStrength the strength for keys * @param keyEquivalence the Equivalence to use for keys * @param expectedSize an estimate of the number of elements * that will be held in the map. If no estimate is known, * zero is an acceptable value. * @return the map */ public static CustomConcurrentHashMap newIntValueMap(Strength keyStrength, Equivalence keyEquivalence, int expectedSize) { return new CustomConcurrentHashMap (keyStrength.getName(), keyEquivalence, INT_STRING, EQUALS, expectedSize); } /** * Returns a new map using Integer keys and values * @param expectedSize an estimate of the number of elements * that will be held in the map. If no estimate is known, * zero is an acceptable value. * @return the map */ public static CustomConcurrentHashMap newIntKeyIntValueMap(int expectedSize) { return new CustomConcurrentHashMap (INT_STRING, EQUALS, INT_STRING, EQUALS, expectedSize); } /** * Returns the segment for traversing table for key with given hash * @param hash the hash code for the key * @return the segment, or null if not yet initialized */ final Segment getSegmentForTraversal(int hash) { return segments[(hash >>> SEGMENT_SHIFT) & SEGMENT_MASK]; } /** * Returns the segment for possibly inserting into the table * associated with given hash, constructing it if necessary. * @param hash the hash code for the key * @return the segment */ final Segment getSegmentForAdd(int hash) { Segment[] segs = segments; int index = (hash >>> SEGMENT_SHIFT) & SEGMENT_MASK; Segment seg = segs[index]; if (seg == null) { synchronized (segs) { seg = segs[index]; if (seg == null) { seg = new Segment(); // Fences.preStoreFence(seg); // segs[index] = seg; storeSegment(segs, index, seg); } } } return seg; } /** * Returns node for key, or null if none */ final Node findNode(Object key, int hash, Segment seg) { if (seg != null) { Node[] tab = seg.getTableForTraversal(); if (tab != null) { Node p = tab[hash & (tab.length - 1)]; while (p != null) { Object k = p.get(); if (k == key || (k != null && p.getLocator() == hash && keyEquivalence.equal((K)k, key))) return p; p = p.getLinkage(); } } } return null; } /** * Returns true if this map contains a key equivalent to * the given key with respect to this map's key Equivalence. * * @param key possible key * @return true if this map contains the specified key * @throws NullPointerException if the specified key is null */ public boolean containsKey(Object key) { if (key == null) throw new NullPointerException(); int hash = spreadHash(keyEquivalence.hash(key)); Segment seg = getSegmentForTraversal(hash); Node r = findNode(key, hash, seg); return r != null && r.getValue() != null; } /** * Returns the value associated with a key equivalent to the given * key with respect to this map's key Equivalence, or {@code null} * if no such mapping exists * * @param key possible key * @return the value associated with the key or null if * there is no mapping. * @throws NullPointerException if the specified key is null */ public V get(Object key) { if (key == null) throw new NullPointerException(); int hash = spreadHash(keyEquivalence.hash(key)); Segment seg = getSegmentForTraversal(hash); Node r = findNode(key, hash, seg); if (r == null) return null; return (V)(r.getValue()); } /** * Shared implementation for put, putIfAbsent */ final V doPut(K key, V value, boolean onlyIfNull) { if (key == null || value == null) throw new NullPointerException(); V oldValue = null; int hash = spreadHash(keyEquivalence.hash(key)); Segment seg = getSegmentForAdd(hash); seg.lock(); try { Node r = findNode(key, hash, seg); if (r != null) { oldValue = (V)(r.getValue()); if (!onlyIfNull || oldValue == null) r.setValue(value); } else { Node[] tab = seg.getTableForAdd(this); int i = hash & (tab.length - 1); r = factory.newNode(hash, key, value, this, tab[i]); // Fences.preStoreFence(r); // tab[i] = r; storeNode(tab, i, r); seg.incrementCount(); } } finally { seg.unlock(); } return oldValue; } /** * Maps the specified key to the specified value in this map. * * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key * @return the previous value associated with key, or * null if there was no mapping for key * @throws NullPointerException if the specified key or value is null */ public V put(K key, V value) { return doPut(key, value, false); } /** * {@inheritDoc} * * @return the previous value associated with the specified key, * or null if there was no mapping for the key * @throws NullPointerException if the specified key or value is null */ public V putIfAbsent(K key, V value) { return doPut(key, value, true); } /** * Copies all of the mappings from the specified map to this one. * These mappings replace any mappings that this map had for any * of the keys currently in the specified map. * * @param m mappings to be stored in this map */ public void putAll(Map m) { for (Map.Entry e : m.entrySet()) put(e.getKey(), e.getValue()); } /** * {@inheritDoc} * * @throws NullPointerException if any of the arguments are null */ public V replace(K key, V value) { if (key == null || value == null) throw new NullPointerException(); V oldValue = null; int hash = spreadHash(keyEquivalence.hash(key)); Segment seg = getSegmentForTraversal(hash); if (seg != null) { seg.lock(); try { Node r = findNode(key, hash, seg); if (r != null) { oldValue = (V)(r.getValue()); r.setValue(value); } } finally { seg.unlock(); } } return oldValue; } /** * {@inheritDoc} * * @return the previous value associated with the specified key, * or null if there was no mapping for the key * @throws NullPointerException if the specified key or value is null */ public boolean replace(K key, V oldValue, V newValue) { if (key == null || oldValue == null || newValue == null) throw new NullPointerException(); boolean replaced = false; int hash = spreadHash(keyEquivalence.hash(key)); Segment seg = getSegmentForTraversal(hash); if (seg != null) { seg.lock(); try { Node r = findNode(key, hash, seg); if (r != null) { V v = (V)(r.getValue()); if (v == oldValue || (v != null && valueEquivalence.equal(v, oldValue))) { r.setValue(newValue); replaced = true; } } } finally { seg.unlock(); } } return replaced; } /** * Removes the mapping for the specified key. * * @param key the key to remove * @return the previous value associated with key, or * null if there was no mapping for key * @throws NullPointerException if the specified key is null */ public V remove(Object key) { if (key == null) throw new NullPointerException(); V oldValue = null; int hash = spreadHash(keyEquivalence.hash(key)); Segment seg = getSegmentForTraversal(hash); if (seg != null) { seg.lock(); try { Node[] tab = seg.getTableForTraversal(); if (tab != null) { int i = hash & (tab.length - 1); Node pred = null; Node p = tab[i]; while (p != null) { Node n = p.getLinkage(); Object k = p.get(); if (k == key || (k != null && p.getLocator() == hash && keyEquivalence.equal((K)k, key))) { oldValue = (V)(p.getValue()); if (pred == null) tab[i] = n; else pred.setLinkage(n); seg.decrementCount(); break; } pred = p; p = n; } } } finally { seg.unlock(); } } return oldValue; } /** * {@inheritDoc} * * @throws NullPointerException if the specified key is null */ public boolean remove(Object key, Object value) { if (key == null) throw new NullPointerException(); if (value == null) return false; boolean removed = false; int hash = spreadHash(keyEquivalence.hash(key)); Segment seg = getSegmentForTraversal(hash); if (seg != null) { seg.lock(); try { Node[] tab = seg.getTableForTraversal(); if (tab != null) { int i = hash & (tab.length - 1); Node pred = null; Node p = tab[i]; while (p != null) { Node n = p.getLinkage(); Object k = p.get(); if (k == key || (k != null && p.getLocator() == hash && keyEquivalence.equal((K)k, key))) { V v = (V)(p.getValue()); if (v == value || (v != null && valueEquivalence.equal(v, value))) { if (pred == null) tab[i] = n; else pred.setLinkage(n); seg.decrementCount(); removed = true; } break; } pred = p; p = n; } } } finally { seg.unlock(); } } return removed; } /** * Remove node if its key or value are null */ final void removeIfReclaimed(Node r) { int hash = r.getLocator(); Segment seg = getSegmentForTraversal(hash); if (seg != null) { seg.lock(); try { Node[] tab = seg.getTableForTraversal(); if (tab != null) { // remove all reclaimed in list int i = hash & (tab.length - 1); Node pred = null; Node p = tab[i]; while (p != null) { Node n = p.getLinkage(); if (p.get() != null && p.getValue() != null) { pred = p; p = n; } else { if (pred == null) tab[i] = n; else pred.setLinkage(n); seg.decrementCount(); p = n; } } } } finally { seg.unlock(); } } } /** * Returns true if this map contains no key-value mappings. * * @return true if this map contains no key-value mappings */ public final boolean isEmpty() { final Segment[] segs = this.segments; for (int i = 0; i < segs.length; ++i) { Segment seg = segs[i]; if (seg != null && seg.getTableForTraversal() != null && seg.count != 0) return false; } return true; } /** * Returns the number of key-value mappings in this map. If the * map contains more than Integer.MAX_VALUE elements, returns * Integer.MAX_VALUE. * * @return the number of key-value mappings in this map */ public final int size() { long sum = 0; final Segment[] segs = this.segments; for (int i = 0; i < segs.length; ++i) { Segment seg = segs[i]; if (seg != null && seg.getTableForTraversal() != null) sum += seg.count; } return (sum >= Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) sum; } /** * Returns true if this map maps one or more keys to a * value equivalent to the given value with respect to this map's * value Equivalence. Note: This method requires a full internal * traversal of the hash table, and so is much slower than method * containsKey. * * @param value value whose presence in this map is to be tested * @return true if this map maps one or more keys to the * specified value * @throws NullPointerException if the specified value is null */ public final boolean containsValue(Object value) { if (value == null) throw new NullPointerException(); Segment[] segs = this.segments; for (int i = 0; i < segs.length; ++i) { Segment seg = segs[i]; Node[] tab; if (seg != null && (tab = seg.getTableForTraversal()) != null) { for (int j = 0; j < tab.length; ++j) { for (Node p = tab[j]; p != null; p = p.getLinkage()) { V v = (V)(p.getValue()); if (v == value || (v != null && valueEquivalence.equal(v, value))) return true; } } } } return false; } /** * Removes all of the mappings from this map. */ public final void clear() { Segment[] segs = this.segments; for (int i = 0; i < segs.length; ++i) { Segment seg = segs[i]; if (seg != null) { seg.lock(); try { seg.clearCount(); } finally { seg.unlock(); } } } } /** * If the specified key is not already associated with a value, * computes its value using the given mappingFunction, and if * non-null, enters it into the map. This is equivalent to * *
     *   if (map.containsKey(key))
     *       return map.get(key);
     *   value = mappingFunction.map(key);
     *   if (value != null)
     *      return map.put(key, value);
     *   else
     *      return null;
     * 
* * except that the action is performed atomically. Some * attempted operations on this map by other threads may be * blocked while computation is in progress. Because this function * is invoked within atomicity control, the computation should be * short and simple. The most common usage is to construct a new * object serving as an initial mapped value, or memoized result. * * @param key key with which the specified value is to be associated * @param mappingFunction the function to compute a value * @return the current (existing or computed) value associated with * the specified key, or null if the computation * returned null. * @throws NullPointerException if the specified key or mappingFunction * is null, * @throws RuntimeException or Error if the mappingFunction does so, * in which case the mapping is left unestablished. */ public V computeIfAbsent(K key, MappingFunction mappingFunction) { if (key == null || mappingFunction == null) throw new NullPointerException(); int hash = spreadHash(keyEquivalence.hash(key)); Segment seg = getSegmentForTraversal(hash); Node r = findNode(key, hash, seg); V v = null; if (r == null) { if (seg == null) seg = getSegmentForAdd(hash); seg.lock(); try { r = findNode(key, hash, seg); if (r == null || (v = (V)(r.getValue())) == null) { // Map is OK if function throws exception v = mappingFunction.map(key); if (v != null) { if (r != null) r.setValue(v); else { Node[] tab = seg.getTableForAdd(this); int i = hash & (tab.length - 1); r = factory.newNode(hash, key, v, this, tab[i]); // Fences.preStoreFence(r); // tab[i] = r; storeNode(tab, i, r); seg.incrementCount(); } } } } finally { seg.unlock(); } } if (r != null && v == null) removeIfReclaimed(r); return v; } /** * Updates the mapping for the given key with the result of the * given remappingFunction. This is equivalent to * *
     *   value = remappingFunction.remap(key, get(key));
     *   if (value != null)
     *     return put(key, value):
     *   else
     *     return remove(key);
     * 
* * except that the action is performed atomically. Some attempted * operations on this map by other threads may be blocked while * computation is in progress. * *

Sample Usage. A remapping function can be used to * perform frequency counting of words using code such as: *

     * map.compute(word, new RemappingFunction<String,Integer>() {
     *   public Integer remap(String k, Integer v) {
     *     return (v == null) ? 1 : v + 1;
     *   }});
     * 
* * @param key key with which the specified value is to be associated * @param remappingFunction the function to compute a value * @return the updated value or * null if the computation returned null * @throws NullPointerException if the specified key or remappingFunction * is null, * @throws RuntimeException or Error if the remappingFunction does so, * in which case the mapping is left in its previous state */ public V compute(K key, RemappingFunction remappingFunction) { if (key == null || remappingFunction == null) throw new NullPointerException(); int hash = spreadHash(keyEquivalence.hash(key)); V value = null; Segment seg = getSegmentForAdd(hash); seg.lock(); try { Node[] tab = seg.getTableForAdd(this); int i = hash & (tab.length - 1); Node pred = null; Node p = tab[i]; while (p != null) { K k = (K)(p.get()); if (k == key || (k != null && p.getLocator() == hash && keyEquivalence.equal(k, key))) { value = (V)(p.getValue()); break; } pred = p; p = p.getLinkage(); } value = remappingFunction.remap(key, value); if (p != null) { if (value != null) p.setValue(value); else { Node n = p.getLinkage(); if (pred == null) tab[i] = n; else pred.setLinkage(n); seg.decrementCount(); } } else if (value != null) { Node r = factory.newNode(hash, key, value, this, tab[i]); // Fences.preStoreFence(r); // tab[i] = r; storeNode(tab, i, r); seg.incrementCount(); } } finally { seg.unlock(); } return value; } abstract class HashIterator { int nextSegmentIndex; int nextTableIndex; Node[] currentTable; Node nextNode; Object nextKey; // key of nextNode Object nextValue; // value of nextNode Object lastKey; // for remove() HashIterator() { nextSegmentIndex = segments.length - 1; nextTableIndex = -1; advance(); } public final boolean hasNext() { return nextNode != null; } final void advance() { lastKey = nextKey; if (nextNode != null) nextNode = nextNode.getLinkage(); for (;;) { if (nextNode != null) { if ((nextKey = nextNode.get()) != null && (nextValue = nextNode.getValue()) != null) return; Node n = nextNode.getLinkage(); removeIfReclaimed(nextNode); nextNode = n; } else if (nextTableIndex >= 0) { nextNode = currentTable[nextTableIndex--]; } else if (nextSegmentIndex >= 0) { Segment seg = segments[nextSegmentIndex--]; Node[] t; if (seg != null && (t = seg.getTableForTraversal()) != null) { currentTable = t; nextTableIndex = t.length - 1; } } else { nextKey = null; nextValue = null; return; } } } final K nextKey() { if (nextNode == null) throw new NoSuchElementException(); Object k = nextKey; advance(); return (K)k; } final V nextValue() { if (nextNode == null) throw new NoSuchElementException(); Object v = nextValue; advance(); return (V)v; } final Map.Entry nextEntry() { if (nextNode == null) throw new NoSuchElementException(); WriteThroughEntry e = new WriteThroughEntry((K)nextKey, (V)nextValue); advance(); return e; } public void remove() { if (lastKey == null) throw new IllegalStateException(); CustomConcurrentHashMap.this.remove(lastKey); lastKey = null; } } final class WriteThroughEntry implements Map.Entry, Serializable { private static final long serialVersionUID = 7249069346764182397L; final K key; V value; WriteThroughEntry(K key, V value) { this.key = key; this.value = value; } public K getKey() { return key; } public V getValue() { return value; } public V setValue(V value) { if (value == null) throw new NullPointerException(); V v = this.value; this.value = value; CustomConcurrentHashMap.this.doPut(key, value, false); return v; } public int hashCode() { return keyEquivalence.hash(key) ^ valueEquivalence.hash(value); } public boolean equals(Object o) { if (!(o instanceof Map.Entry)) return false; Map.Entry e = (Map.Entry)o; return (keyEquivalence.equal(key, e.getKey()) && valueEquivalence.equal(value, e.getValue())); } } final class KeyIterator extends HashIterator implements Iterator { public K next() { return super.nextKey(); } } final KeyIterator keyIterator() { // needed by Set return new KeyIterator(); } final class ValueIterator extends HashIterator implements Iterator { public V next() { return super.nextValue(); } } final class EntryIterator extends HashIterator implements Iterator> { public Map.Entry next() { return super.nextEntry(); } } final class KeySetView extends AbstractSet { public Iterator iterator() { return new KeyIterator(); } public int size() { return CustomConcurrentHashMap.this.size(); } public boolean isEmpty() { return CustomConcurrentHashMap.this.isEmpty(); } public boolean contains(Object o) { return CustomConcurrentHashMap.this.containsKey(o); } public boolean remove(Object o) { return CustomConcurrentHashMap.this.remove(o) != null; } public void clear() { CustomConcurrentHashMap.this.clear(); } } final class Values extends AbstractCollection { public Iterator iterator() { return new ValueIterator(); } public int size() { return CustomConcurrentHashMap.this.size(); } public boolean isEmpty() { return CustomConcurrentHashMap.this.isEmpty(); } public boolean contains(Object o) { return CustomConcurrentHashMap.this.containsValue(o); } public void clear() { CustomConcurrentHashMap.this.clear(); } } final class EntrySet extends AbstractSet> { public Iterator> iterator() { return new EntryIterator(); } public boolean contains(Object o) { if (!(o instanceof Map.Entry)) return false; Map.Entry e = (Map.Entry)o; V v = CustomConcurrentHashMap.this.get(e.getKey()); return v != null && valueEquivalence.equal(v, e.getValue()); } public boolean remove(Object o) { if (!(o instanceof Map.Entry)) return false; Map.Entry e = (Map.Entry)o; return CustomConcurrentHashMap.this.remove(e.getKey(), e.getValue()); } public int size() { return CustomConcurrentHashMap.this.size(); } public boolean isEmpty() { return CustomConcurrentHashMap.this.isEmpty(); } public void clear() { CustomConcurrentHashMap.this.clear(); } } /** * Returns a {@link Set} view of the keys contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. The set supports element * removal, which removes the corresponding mapping from this map, * via the Iterator.remove, Set.remove, * removeAll, retainAll, and clear * operations. It does not support the add or * addAll operations. * *

The view's iterator is a "weakly consistent" iterator * that will never throw {@link ConcurrentModificationException}, * and guarantees to traverse elements as they existed upon * construction of the iterator, and may (but is not guaranteed to) * reflect any modifications subsequent to construction. */ public Set keySet() { Set ks = keySet; return (ks != null) ? ks : (keySet = new KeySetView()); } /** * Returns a {@link Collection} view of the values contained in this map. * The collection is backed by the map, so changes to the map are * reflected in the collection, and vice-versa. The collection * supports element removal, which removes the corresponding * mapping from this map, via the Iterator.remove, * Collection.remove, removeAll, * retainAll, and clear operations. It does not * support the add or addAll operations. * *

The view's iterator is a "weakly consistent" iterator * that will never throw {@link ConcurrentModificationException}, * and guarantees to traverse elements as they existed upon * construction of the iterator, and may (but is not guaranteed to) * reflect any modifications subsequent to construction. */ public Collection values() { Collection vs = values; return (vs != null) ? vs : (values = new Values()); } /** * Returns a {@link Set} view of the mappings contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. The set supports element * removal, which removes the corresponding mapping from the map, * via the Iterator.remove, Set.remove, * removeAll, retainAll, and clear * operations. It does not support the add or * addAll operations. * *

The view's iterator is a "weakly consistent" iterator * that will never throw {@link ConcurrentModificationException}, * and guarantees to traverse elements as they existed upon * construction of the iterator, and may (but is not guaranteed to) * reflect any modifications subsequent to construction. */ public Set> entrySet() { Set> es = entrySet; return (es != null) ? es : (entrySet = new EntrySet()); } // overridden AbstractMap methods /** * Compares the specified object with this map for equality. * Returns true if the given object is also a map of the * same size, holding keys that are equal using this Map's key * Equivalence, and which map to values that are equal according * to this Map's value equivalence. * * @param o object to be compared for equality with this map * @return true if the specified object is equal to this map */ public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof Map)) return false; Map m = (Map) o; if (m.size() != size()) return false; try { Iterator> i = entrySet().iterator(); while (i.hasNext()) { Entry e = i.next(); K key = e.getKey(); V value = e.getValue(); if (value != null) { V mv = m.get(key); if (mv == null) return false; if (!valueEquivalence.equal(mv, value)) return false; } } } catch (ClassCastException unused) { return false; } catch (NullPointerException unused) { return false; } return true; } /** * Returns the sum of the hash codes of each entry in this map's * entrySet() view, which in turn are the hash codes * computed using key and value Equivalences for this Map. * @return the hash code */ public int hashCode() { int h = 0; Iterator> i = entrySet().iterator(); while (i.hasNext()) h += i.next().hashCode(); return h; } /** * Save the state of the instance to a stream (i.e., serialize * it). * @param s the stream * @serialData * the key (Object) and value (Object) * for each key-value mapping, followed by a null pair. * The key-value mappings are emitted in no particular order. */ private void writeObject(java.io.ObjectOutputStream s) throws IOException { s.defaultWriteObject(); for (Map.Entry e : entrySet()) { s.writeObject(e.getKey()); s.writeObject(e.getValue()); } s.writeObject(null); s.writeObject(null); } /** * Reconstitute the instance from a stream (i.e., deserialize it). * @param s the stream */ private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); this.segments = (Segment[])(new Segment[NSEGMENTS]); for (;;) { K key = (K) s.readObject(); V value = (V) s.readObject(); if (key == null) break; put(key, value); } } /** * A hash-based set with properties identical to those of * Collections.newSetFromMap applied to a * CustomConcurrentHashMap, but possibly more * space-efficient. The set does not permit null elements. The * set is serializable; however, serializing a set that uses soft * or weak references can give unpredictable results. */ public static class KeySet extends AbstractSet implements Set, Serializable { final CustomConcurrentHashMap cchm; /** * Creates a set with the given parameters * @param strength the strength of elements * @param equivalence the Equivalence to use * @param expectedSize an estimate of the number of elements * that will be held in the set. If no estimate is known, zero * is an acceptable value. */ public KeySet(Strength strength, Equivalence equivalence, int expectedSize) { this.cchm = new CustomConcurrentHashMap (strength.getName(), equivalence, SELF_STRING, equivalence, expectedSize); } /** * Returns an element equivalent to the given element with * respect to this set's Equivalence, if such an element * exists, else adds and returns the given element. * * @param e the element * @return e, or an element equivalent to e. */ public K intern(K e) { K oldElement = cchm.doPut(e, e, true); return (oldElement != null) ? oldElement : e; } /** * Returns true if this set contains an * element equivalent to the given element with respect * to this set's Equivalence. * @param o element whose presence in this set is to be tested * @return true if this set contains the specified element */ public boolean contains(Object o) { return cchm.containsKey(o); } /** * Returns a weakly consistent iterator over the * elements in this set, that may reflect some, all or none of * the changes made to the set after the iterator was created. * * @return an Iterator over the elements in this set */ public Iterator iterator() { return cchm.keyIterator(); } /** * Adds the specified element to this set if there is not * already an element equivalent to the given element with * respect to this set's Equivalence. * * @param e element to be added to this set * @return true if this set did not already contain * the specified element */ public boolean add(K e) { return cchm.doPut(e, e, true) != null; } /** * Removes an element equivalent to the given element with * respect to this set's Equivalence, if one is present. * * @param o object to be removed from this set, if present * @return true if the set contained the specified element */ public boolean remove(Object o) { return cchm.remove(o) != null; } /** * Returns true if this set contains no elements. * * @return true if this set contains no elements */ public boolean isEmpty() { return cchm.isEmpty(); } /** * Returns the number of elements in this set (its cardinality). * * @return the number of elements in this set (its cardinality) */ public int size() { return cchm.size(); } /** * Removes all of the elements from this set. */ public void clear() { cchm.clear(); } /** * Returns the sum of the hash codes of each element, as * computed by this set's Equivalence. * @return the hash code */ public int hashCode() { int h = 0; Iterator i = iterator(); while (i.hasNext()) h += cchm.keyEquivalence.hash(i.next()); return h; } } // Reference queue mechanics for reclaimable nodes static volatile ReferenceQueue refQueue; /** * Returns a queue that may be used as the ReferenceQueue argument * to {@link java.lang.ref.Reference} constructors to arrange * removal of reclaimed nodes from maps via a background thread. * @return the reference queue associated with the background * cleanup thread. */ static ReferenceQueue getReclamationQueue() { ReferenceQueue q = refQueue; if (q != null) return q; else return startReclamation(); } static synchronized ReferenceQueue startReclamation() { ReferenceQueue q = refQueue; if (q == null) { refQueue = q = new ReferenceQueue(); new ReclamationThread(q).start(); } return q; } static final class ReclamationThread extends Thread { final ReferenceQueue queue; ReclamationThread(ReferenceQueue q) { this.queue = q; setDaemon(true); } public void run() { ReferenceQueue q = queue; for (;;) { try { Reference r = q.remove(); if (r instanceof Reclaimable) ((Reclaimable)r).onReclamation(); } catch (InterruptedException e) { /* ignore */ } } } } // classes extending Weak/soft refs embedded in reclaimable nodes static class EmbeddedWeakReference extends WeakReference implements Reclaimable { final Reclaimable outer; EmbeddedWeakReference(Object x, Reclaimable outer) { super(x, getReclamationQueue()); this.outer = outer; } public final void onReclamation() { clear(); outer.onReclamation(); } } static class EmbeddedSoftReference extends SoftReference implements Reclaimable { final Reclaimable outer; EmbeddedSoftReference(Object x, Reclaimable outer) { super(x, getReclamationQueue()); this.outer = outer; } public final void onReclamation() { clear(); outer.onReclamation(); } } // builtin mapping node classes // Strong Keys static abstract class StrongKeyNode implements Node { final Object key; final int locator; StrongKeyNode(int locator, Object key) { this.locator = locator; this.key = key; } public final Object get() { return key; } public final int getLocator() { return locator; } } static abstract class StrongKeySelfValueNode extends StrongKeyNode { StrongKeySelfValueNode(int locator, Object key) { super(locator, key); } public final Object getValue() { return key; } public final void setValue(Object value) { } public final void onReclamation() { } } static final class TerminalStrongKeySelfValueNode extends StrongKeySelfValueNode { TerminalStrongKeySelfValueNode(int locator, Object key) { super(locator, key); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedStrongKeySelfValueNode extends StrongKeySelfValueNode { volatile Node linkage; LinkedStrongKeySelfValueNode(int locator, Object key, Node linkage) { super(locator, key); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class StrongKeySelfValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalStrongKeySelfValueNode (locator, key); else return new LinkedStrongKeySelfValueNode (locator, key, linkage); } } static abstract class StrongKeyStrongValueNode extends StrongKeyNode { volatile Object value; StrongKeyStrongValueNode(int locator, Object key, Object value) { super(locator, key); this.value = value; } public final Object getValue() { return value; } public final void setValue(Object value) { this.value = value; } public final void onReclamation() { } } static final class TerminalStrongKeyStrongValueNode extends StrongKeyStrongValueNode { TerminalStrongKeyStrongValueNode(int locator, Object key, Object value) { super(locator, key, value); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedStrongKeyStrongValueNode extends StrongKeyStrongValueNode { volatile Node linkage; LinkedStrongKeyStrongValueNode(int locator, Object key, Object value, Node linkage) { super(locator, key, value); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class StrongKeyStrongValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalStrongKeyStrongValueNode (locator, key, value); else return new LinkedStrongKeyStrongValueNode (locator, key, value, linkage); } } // ... static abstract class StrongKeyIntValueNode extends StrongKeyNode { volatile int value; StrongKeyIntValueNode(int locator, Object key, Object value) { super(locator, key); this.value = ((Integer)value).intValue(); } public final Object getValue() { return Integer.valueOf(value); } public final void setValue(Object value) { this.value = ((Integer)value).intValue(); } public final void onReclamation() { } } static final class TerminalStrongKeyIntValueNode extends StrongKeyIntValueNode { TerminalStrongKeyIntValueNode(int locator, Object key, Object value) { super(locator, key, value); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedStrongKeyIntValueNode extends StrongKeyIntValueNode { volatile Node linkage; LinkedStrongKeyIntValueNode(int locator, Object key, Object value, Node linkage) { super(locator, key, value); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class StrongKeyIntValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalStrongKeyIntValueNode (locator, key, value); else return new LinkedStrongKeyIntValueNode (locator, key, value, linkage); } } // ... static abstract class StrongKeyWeakValueNode extends StrongKeyNode { volatile EmbeddedWeakReference valueRef; final CustomConcurrentHashMap cchm; StrongKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key); this.cchm = cchm; if (value != null) this.valueRef = new EmbeddedWeakReference(value, this); } public final void onReclamation() { cchm.removeIfReclaimed(this); } public final Object getValue() { EmbeddedWeakReference vr = valueRef; return (vr == null) ? null : vr.get(); } public final void setValue(Object value) { if (value == null) valueRef = null; else valueRef = new EmbeddedWeakReference(value, this); } } static final class TerminalStrongKeyWeakValueNode extends StrongKeyWeakValueNode { TerminalStrongKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedStrongKeyWeakValueNode extends StrongKeyWeakValueNode { volatile Node linkage; LinkedStrongKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class StrongKeyWeakValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalStrongKeyWeakValueNode (locator, key, value, cchm); else return new LinkedStrongKeyWeakValueNode (locator, key, value, cchm, linkage); } } static abstract class StrongKeySoftValueNode extends StrongKeyNode { volatile EmbeddedSoftReference valueRef; final CustomConcurrentHashMap cchm; StrongKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key); this.cchm = cchm; if (value != null) this.valueRef = new EmbeddedSoftReference(value, this); } public final void onReclamation() { cchm.removeIfReclaimed(this); } public final Object getValue() { EmbeddedSoftReference vr = valueRef; return (vr == null) ? null : vr.get(); } public final void setValue(Object value) { if (value == null) valueRef = null; else valueRef = new EmbeddedSoftReference(value, this); } } static final class TerminalStrongKeySoftValueNode extends StrongKeySoftValueNode { TerminalStrongKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedStrongKeySoftValueNode extends StrongKeySoftValueNode { volatile Node linkage; LinkedStrongKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class StrongKeySoftValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalStrongKeySoftValueNode (locator, key, value, cchm); else return new LinkedStrongKeySoftValueNode (locator, key, value, cchm, linkage); } } // Weak keys static abstract class WeakKeyNode extends WeakReference implements Node { final int locator; final CustomConcurrentHashMap cchm; WeakKeyNode(int locator, Object key, CustomConcurrentHashMap cchm) { super(key, getReclamationQueue()); this.locator = locator; this.cchm = cchm; } public final int getLocator() { return locator; } public final void onReclamation() { clear(); cchm.removeIfReclaimed(this); } } static abstract class WeakKeySelfValueNode extends WeakKeyNode { WeakKeySelfValueNode(int locator, Object key, CustomConcurrentHashMap cchm) { super(locator, key, cchm); } public final Object getValue() { return get(); } public final void setValue(Object value) { } } static final class TerminalWeakKeySelfValueNode extends WeakKeySelfValueNode { TerminalWeakKeySelfValueNode(int locator, Object key, CustomConcurrentHashMap cchm) { super(locator, key, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedWeakKeySelfValueNode extends WeakKeySelfValueNode { volatile Node linkage; LinkedWeakKeySelfValueNode(int locator, Object key, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class WeakKeySelfValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalWeakKeySelfValueNode (locator, key, cchm); else return new LinkedWeakKeySelfValueNode (locator, key, cchm, linkage); } } static abstract class WeakKeyStrongValueNode extends WeakKeyNode { volatile Object value; WeakKeyStrongValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, cchm); this.value = value; } public final Object getValue() { return value; } public final void setValue(Object value) { this.value = value; } } static final class TerminalWeakKeyStrongValueNode extends WeakKeyStrongValueNode { TerminalWeakKeyStrongValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedWeakKeyStrongValueNode extends WeakKeyStrongValueNode { volatile Node linkage; LinkedWeakKeyStrongValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class WeakKeyStrongValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalWeakKeyStrongValueNode (locator, key, value, cchm); else return new LinkedWeakKeyStrongValueNode (locator, key, value, cchm, linkage); } } static abstract class WeakKeyIntValueNode extends WeakKeyNode { volatile int value; WeakKeyIntValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, cchm); this.value = ((Integer)value).intValue(); } public final Object getValue() { return Integer.valueOf(value); } public final void setValue(Object value) { this.value = ((Integer)value).intValue(); } } static final class TerminalWeakKeyIntValueNode extends WeakKeyIntValueNode { TerminalWeakKeyIntValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedWeakKeyIntValueNode extends WeakKeyIntValueNode { volatile Node linkage; LinkedWeakKeyIntValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class WeakKeyIntValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalWeakKeyIntValueNode (locator, key, value, cchm); else return new LinkedWeakKeyIntValueNode (locator, key, value, cchm, linkage); } } static abstract class WeakKeyWeakValueNode extends WeakKeyNode { volatile EmbeddedWeakReference valueRef; WeakKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, cchm); if (value != null) this.valueRef = new EmbeddedWeakReference(value, this); } public final Object getValue() { EmbeddedWeakReference vr = valueRef; return (vr == null) ? null : vr.get(); } public final void setValue(Object value) { if (value == null) valueRef = null; else valueRef = new EmbeddedWeakReference(value, this); } } static final class TerminalWeakKeyWeakValueNode extends WeakKeyWeakValueNode { TerminalWeakKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedWeakKeyWeakValueNode extends WeakKeyWeakValueNode { volatile Node linkage; LinkedWeakKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class WeakKeyWeakValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalWeakKeyWeakValueNode (locator, key, value, cchm); else return new LinkedWeakKeyWeakValueNode (locator, key, value, cchm, linkage); } } static abstract class WeakKeySoftValueNode extends WeakKeyNode { volatile EmbeddedSoftReference valueRef; WeakKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, cchm); if (value != null) this.valueRef = new EmbeddedSoftReference(value, this); } public final Object getValue() { EmbeddedSoftReference vr = valueRef; return (vr == null) ? null : vr.get(); } public final void setValue(Object value) { if (value == null) valueRef = null; else valueRef = new EmbeddedSoftReference(value, this); } } static final class TerminalWeakKeySoftValueNode extends WeakKeySoftValueNode { TerminalWeakKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedWeakKeySoftValueNode extends WeakKeySoftValueNode { volatile Node linkage; LinkedWeakKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class WeakKeySoftValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalWeakKeySoftValueNode (locator, key, value, cchm); else return new LinkedWeakKeySoftValueNode (locator, key, value, cchm, linkage); } } // Soft keys static abstract class SoftKeyNode extends SoftReference implements Node { final int locator; final CustomConcurrentHashMap cchm; SoftKeyNode(int locator, Object key, CustomConcurrentHashMap cchm) { super(key, getReclamationQueue()); this.locator = locator; this.cchm = cchm; } public final int getLocator() { return locator; } public final void onReclamation() { clear(); cchm.removeIfReclaimed(this); } } static abstract class SoftKeySelfValueNode extends SoftKeyNode { SoftKeySelfValueNode(int locator, Object key, CustomConcurrentHashMap cchm) { super(locator, key, cchm); } public final Object getValue() { return get(); } public final void setValue(Object value) { } } static final class TerminalSoftKeySelfValueNode extends SoftKeySelfValueNode { TerminalSoftKeySelfValueNode(int locator, Object key, CustomConcurrentHashMap cchm) { super(locator, key, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedSoftKeySelfValueNode extends SoftKeySelfValueNode { volatile Node linkage; LinkedSoftKeySelfValueNode(int locator, Object key, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class SoftKeySelfValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalSoftKeySelfValueNode (locator, key, cchm); else return new LinkedSoftKeySelfValueNode (locator, key, cchm, linkage); } } static abstract class SoftKeyStrongValueNode extends SoftKeyNode { volatile Object value; SoftKeyStrongValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, cchm); this.value = value; } public final Object getValue() { return value; } public final void setValue(Object value) { this.value = value; } } static final class TerminalSoftKeyStrongValueNode extends SoftKeyStrongValueNode { TerminalSoftKeyStrongValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedSoftKeyStrongValueNode extends SoftKeyStrongValueNode { volatile Node linkage; LinkedSoftKeyStrongValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class SoftKeyStrongValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalSoftKeyStrongValueNode (locator, key, value, cchm); else return new LinkedSoftKeyStrongValueNode (locator, key, value, cchm, linkage); } } static abstract class SoftKeyIntValueNode extends SoftKeyNode { volatile int value; SoftKeyIntValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, cchm); this.value = ((Integer)value).intValue(); } public final Object getValue() { return Integer.valueOf(value); } public final void setValue(Object value) { this.value = ((Integer)value).intValue(); } } static final class TerminalSoftKeyIntValueNode extends SoftKeyIntValueNode { TerminalSoftKeyIntValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedSoftKeyIntValueNode extends SoftKeyIntValueNode { volatile Node linkage; LinkedSoftKeyIntValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class SoftKeyIntValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalSoftKeyIntValueNode (locator, key, value, cchm); else return new LinkedSoftKeyIntValueNode (locator, key, value, cchm, linkage); } } static abstract class SoftKeyWeakValueNode extends SoftKeyNode { volatile EmbeddedWeakReference valueRef; SoftKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, cchm); if (value != null) this.valueRef = new EmbeddedWeakReference(value, this); } public final Object getValue() { EmbeddedWeakReference vr = valueRef; return (vr == null) ? null : vr.get(); } public final void setValue(Object value) { if (value == null) valueRef = null; else valueRef = new EmbeddedWeakReference(value, this); } } static final class TerminalSoftKeyWeakValueNode extends SoftKeyWeakValueNode { TerminalSoftKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedSoftKeyWeakValueNode extends SoftKeyWeakValueNode { volatile Node linkage; LinkedSoftKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class SoftKeyWeakValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalSoftKeyWeakValueNode (locator, key, value, cchm); else return new LinkedSoftKeyWeakValueNode (locator, key, value, cchm, linkage); } } static abstract class SoftKeySoftValueNode extends SoftKeyNode { volatile EmbeddedSoftReference valueRef; SoftKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, cchm); if (value != null) this.valueRef = new EmbeddedSoftReference(value, this); } public final Object getValue() { EmbeddedSoftReference vr = valueRef; return (vr == null) ? null : vr.get(); } public final void setValue(Object value) { if (value == null) valueRef = null; else valueRef = new EmbeddedSoftReference(value, this); } } static final class TerminalSoftKeySoftValueNode extends SoftKeySoftValueNode { TerminalSoftKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedSoftKeySoftValueNode extends SoftKeySoftValueNode { volatile Node linkage; LinkedSoftKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class SoftKeySoftValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalSoftKeySoftValueNode (locator, key, value, cchm); else return new LinkedSoftKeySoftValueNode (locator, key, value, cchm, linkage); } } static abstract class IntKeyNode implements Node { final int key; IntKeyNode(int locator, Object key) { this.key = ((Integer)key).intValue(); } public final Object get() { return Integer.valueOf(key); } public final int getLocator() { return spreadHash(key); } } static abstract class IntKeySelfValueNode extends IntKeyNode { IntKeySelfValueNode(int locator, Object key) { super(locator, key); } public final Object getValue() { return Integer.valueOf(key); } public final void setValue(Object value) { } public final void onReclamation() { } } static final class TerminalIntKeySelfValueNode extends IntKeySelfValueNode { TerminalIntKeySelfValueNode(int locator, Object key) { super(locator, key); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedIntKeySelfValueNode extends IntKeySelfValueNode { volatile Node linkage; LinkedIntKeySelfValueNode(int locator, Object key, Node linkage) { super(locator, key); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class IntKeySelfValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalIntKeySelfValueNode (locator, key); else return new LinkedIntKeySelfValueNode (locator, key, linkage); } } static abstract class IntKeyStrongValueNode extends IntKeyNode { volatile Object value; IntKeyStrongValueNode(int locator, Object key, Object value) { super(locator, key); this.value = value; } public final Object getValue() { return value; } public final void setValue(Object value) { this.value = value; } public final void onReclamation() { } } static final class TerminalIntKeyStrongValueNode extends IntKeyStrongValueNode { TerminalIntKeyStrongValueNode(int locator, Object key, Object value) { super(locator, key, value); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedIntKeyStrongValueNode extends IntKeyStrongValueNode { volatile Node linkage; LinkedIntKeyStrongValueNode(int locator, Object key, Object value, Node linkage) { super(locator, key, value); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class IntKeyStrongValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalIntKeyStrongValueNode (locator, key, value); else return new LinkedIntKeyStrongValueNode (locator, key, value, linkage); } } static abstract class IntKeyIntValueNode extends IntKeyNode { volatile int value; IntKeyIntValueNode(int locator, Object key, Object value) { super(locator, key); this.value = ((Integer)value).intValue(); } public final Object getValue() { return Integer.valueOf(value); } public final void setValue(Object value) { this.value = ((Integer)value).intValue(); } public final void onReclamation() { } } static final class TerminalIntKeyIntValueNode extends IntKeyIntValueNode { TerminalIntKeyIntValueNode(int locator, Object key, Object value) { super(locator, key, value); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedIntKeyIntValueNode extends IntKeyIntValueNode { volatile Node linkage; LinkedIntKeyIntValueNode(int locator, Object key, Object value, Node linkage) { super(locator, key, value); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class IntKeyIntValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalIntKeyIntValueNode (locator, key, value); else return new LinkedIntKeyIntValueNode (locator, key, value, linkage); } } static abstract class IntKeyWeakValueNode extends IntKeyNode { volatile EmbeddedWeakReference valueRef; final CustomConcurrentHashMap cchm; IntKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key); this.cchm = cchm; if (value != null) this.valueRef = new EmbeddedWeakReference(value, this); } public final void onReclamation() { cchm.removeIfReclaimed(this); } public final Object getValue() { EmbeddedWeakReference vr = valueRef; return (vr == null) ? null : vr.get(); } public final void setValue(Object value) { if (value == null) valueRef = null; else valueRef = new EmbeddedWeakReference(value, this); } } static final class TerminalIntKeyWeakValueNode extends IntKeyWeakValueNode { TerminalIntKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedIntKeyWeakValueNode extends IntKeyWeakValueNode { volatile Node linkage; LinkedIntKeyWeakValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class IntKeyWeakValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalIntKeyWeakValueNode (locator, key, value, cchm); else return new LinkedIntKeyWeakValueNode (locator, key, value, cchm, linkage); } } static abstract class IntKeySoftValueNode extends IntKeyNode { volatile EmbeddedSoftReference valueRef; final CustomConcurrentHashMap cchm; IntKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key); this.cchm = cchm; if (value != null) this.valueRef = new EmbeddedSoftReference(value, this); } public final void onReclamation() { cchm.removeIfReclaimed(this); } public final Object getValue() { EmbeddedSoftReference vr = valueRef; return (vr == null) ? null : vr.get(); } public final void setValue(Object value) { if (value == null) valueRef = null; else valueRef = new EmbeddedSoftReference(value, this); } } static final class TerminalIntKeySoftValueNode extends IntKeySoftValueNode { TerminalIntKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm) { super(locator, key, value, cchm); } public final Node getLinkage() { return null; } public final void setLinkage(Node r) { } } static final class LinkedIntKeySoftValueNode extends IntKeySoftValueNode { volatile Node linkage; LinkedIntKeySoftValueNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { super(locator, key, value, cchm); this.linkage = linkage; } public final Node getLinkage() { return linkage; } public final void setLinkage(Node r) { linkage = r; } } static final class IntKeySoftValueNodeFactory implements NodeFactory, Serializable { private static final long serialVersionUID = 7249069346764182397L; public final Node newNode(int locator, Object key, Object value, CustomConcurrentHashMap cchm, Node linkage) { if (linkage == null) return new TerminalIntKeySoftValueNode (locator, key, value, cchm); else return new LinkedIntKeySoftValueNode (locator, key, value, cchm, linkage); } } // Temporary Unsafe mechanics for preliminary release static final Unsafe UNSAFE; static final long tableBase; static final int tableShift; static final long segmentsBase; static final int segmentsShift; private static Unsafe getUnsafe() throws Throwable { try { return Unsafe.getUnsafe(); } catch (SecurityException se) { try { return java.security.AccessController.doPrivileged (new java.security.PrivilegedExceptionAction() { public Unsafe run() throws Exception { return getUnsafePrivileged(); }}); } catch (java.security.PrivilegedActionException e) { throw e.getCause(); } } } private static Unsafe getUnsafePrivileged() throws NoSuchFieldException, IllegalAccessException { Field f = Unsafe.class.getDeclaredField("theUnsafe"); f.setAccessible(true); return (Unsafe) f.get(null); } static { try { UNSAFE = getUnsafe(); tableBase = UNSAFE.arrayBaseOffset(Node[].class); int s = UNSAFE.arrayIndexScale(Node[].class); if ((s & (s-1)) != 0) throw new Error("data type scale not a power of two"); tableShift = 31 - Integer.numberOfLeadingZeros(s); segmentsBase = UNSAFE.arrayBaseOffset(Segment[].class); s = UNSAFE.arrayIndexScale(Segment[].class); if ((s & (s-1)) != 0) throw new Error("data type scale not a power of two"); segmentsShift = 31 - Integer.numberOfLeadingZeros(s); } catch (Throwable e) { throw new RuntimeException("Could not initialize intrinsics", e); } } // Fenced store into segment table array. Unneeded when we have Fences static final void storeNode(Node[] table, int i, Node r) { long nodeOffset = ((long) i << tableShift) + tableBase; UNSAFE.putOrderedObject(table, nodeOffset, r); } static final void storeSegment(Segment[] segs, int i, Segment s) { long segmentOffset = ((long) i << segmentsShift) + segmentsBase; UNSAFE.putOrderedObject(segs, segmentOffset, s); } } jsr166/src/extra166y/package-info.java0000644000000000000000000000041611537741066014541 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Collections supporting parallel operations. */ package extra166y; jsr166/src/extra166y/ParallelArrayWithFilter.java0000644000000000000000000001741611537741066016762 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelArray that causes operations to apply * only to elements for which a selector returns true. * Instances of this class may be constructed only via prefix * methods of ParallelArray or its other prefix classes. */ public abstract class ParallelArrayWithFilter extends ParallelArrayWithMapping{ ParallelArrayWithFilter(ForkJoinPool ex, int origin, int fence, T[] array) { super(ex, origin, fence, array); } /** * Replaces elements with the results of applying the given * op to their current values. * @param op the op * @return this (to simplify use in expressions) */ public ParallelArrayWithFilter replaceWithMapping (Op op) { ex.invoke(new PAS.FJOTransform(this, origin, fence, null, op)); return this; } /** * Replaces elements with the results of applying the given * op to their indices * @param op the op * @return this (to simplify use in expressions) */ public ParallelArrayWithFilter replaceWithMappedIndex (IntToObject op) { ex.invoke(new PAS.FJOIndexMap(this, origin, fence, null, op)); return this; } /** * Replaces elements with the results of applying the given * mapping to each index and current element value * @param op the op * @return this (to simplify use in expressions) */ public ParallelArrayWithFilter replaceWithMappedIndex (IntAndObjectToObject op) { ex.invoke(new PAS.FJOBinaryIndexMap (this, origin, fence, null, op)); return this; } /** * Replaces elements with results of applying the given * generator. * @param generator the generator * @return this (to simplify use in expressions) */ public ParallelArrayWithFilter replaceWithGeneratedValue (Generator generator) { ex.invoke(new PAS.FJOGenerate (this, origin, fence, null, generator)); return this; } /** * Replaces elements with the given value. * @param value the value * @return this (to simplify use in expressions) */ public ParallelArrayWithFilter replaceWithValue(T value) { ex.invoke(new PAS.FJOFill(this, origin, fence, null, value)); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement) * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) */ public ParallelArrayWithFilter replaceWithMapping (BinaryOp combiner, ParallelArrayWithMapping other) { ex.invoke(new PAS.FJOPACombineInPlace (this, origin, fence, null, other, other.origin - origin, combiner)); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement) * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) */ public ParallelArrayWithFilter replaceWithMapping (BinaryOp combiner, T[] other) { ex.invoke(new PAS.FJOCombineInPlace (this, origin, fence, null, other, -origin, combiner)); return this; } /** * Returns a new ParallelArray containing only non-null unique * elements (that is, without any duplicates). This method * uses each element's equals method to test for * duplication. * @return the new ParallelArray */ public ParallelArray allUniqueElements() { PAS.UniquifierTable tab = new PAS.UniquifierTable (fence - origin, this, false); PAS.FJOUniquifier f = new PAS.FJOUniquifier (this, origin, fence, null, tab); ex.invoke(f); T[] res = (T[])(tab.uniqueObjects(f.count)); return new ParallelArray(ex, res); } /** * Returns a new ParallelArray containing only non-null unique * elements (that is, without any duplicates). This method * uses reference identity to test for duplication. * @return the new ParallelArray */ public ParallelArray allNonidenticalElements() { PAS.UniquifierTable tab = new PAS.UniquifierTable (fence - origin, this, true); PAS.FJOUniquifier f = new PAS.FJOUniquifier (this, origin, fence, null, tab); ex.invoke(f); T[] res = (T[])(tab.uniqueObjects(f.count)); return new ParallelArray(ex, res); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the current selector (if * present) and the given selector returns true * @param selector the selector * @return operation prefix */ public abstract ParallelArrayWithFilter withFilter (Predicate selector); /** * Returns an operation prefix that causes a method to operate * only on elements for which the current selector (if * present) and the given binary selector returns true * @param selector the selector * @return operation prefix */ public ParallelArrayWithFilter withFilter (BinaryPredicate selector, ParallelArrayWithMapping other) { return withIndexedFilter(AbstractParallelAnyArray.indexedSelector(selector, other, origin)); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the current selector (if * present) and the given indexed selector returns true * @param selector the selector * @return operation prefix */ public abstract ParallelArrayWithFilter withIndexedFilter (IntAndObjectPredicate selector); /** * Returns true if all elements at the same relative positions * of this and other array are equal. * @param other the other array * @return true if equal */ public boolean hasAllEqualElements (ParallelArrayWithMapping other) { return withFilter(CommonOps.inequalityPredicate(), other).anyIndex() < 0; } /** * Returns true if all elements at the same relative positions * of this and other array are identical. * @param other the other array * @return true if equal */ public boolean hasAllIdenticalElements (ParallelArrayWithMapping other) { return withFilter(CommonOps.nonidentityPredicate(), other).anyIndex() < 0; } final void leafTransfer(int lo, int hi, Object[] dest, int offset) { final Object[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = (a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, Object[] dest, int offset) { final Object[] a = this.array; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = (a[indices[i]]); } final Object oget(int i) { return this.array[i]; } } jsr166/src/extra166y/ParallelArrayWithMapping.java0000644000000000000000000003256011537741066017125 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelArray that causes operations to apply * to mappings of elements, not to the elements themselves. * Instances of this class may be constructed only via prefix * methods of ParallelArray or its other prefix classes. */ public abstract class ParallelArrayWithMapping extends AbstractParallelAnyArray.OPap { ParallelArrayWithMapping(ForkJoinPool ex, int origin, int fence, T[] array) { super(ex, origin, fence, array); } /** * Applies the given procedure to elements * @param procedure the procedure */ public void apply(Procedure procedure) { ex.invoke(new PAS.FJOApply(this, origin, fence, null, procedure)); } /** * Returns reduction of elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public U reduce(Reducer reducer, U base) { PAS.FJOReduce f = new PAS.FJOReduce (this, origin, fence, null, reducer, base); ex.invoke(f); return (U)(f.result); } /** * Returns some element matching bound and filter * constraints, or null if none. * @return an element, or null if none. */ public U any() { int i = anyIndex(); return (i < 0) ? null : (U)oget(i); } /** * Returns the minimum element, or null if empty * @param comparator the comparator * @return minimum element, or null if empty */ public U min(Comparator comparator) { return reduce(CommonOps.minReducer(comparator), null); } /** * Returns the minimum element, or null if empty, * assuming that all elements are Comparables * @return minimum element, or null if empty * @throws ClassCastException if any element is not Comparable. */ public U min() { return reduce((Reducer)(CommonOps.castedMinReducer()), null); } /** * Returns the maximum element, or null if empty * @param comparator the comparator * @return maximum element, or null if empty */ public U max(Comparator comparator) { return reduce(CommonOps.maxReducer(comparator), null); } /** * Returns the maximum element, or null if empty * assuming that all elements are Comparables * @return maximum element, or null if empty * @throws ClassCastException if any element is not Comparable. */ public U max() { return reduce((Reducer)(CommonOps.castedMaxReducer()), null); } /** * Returns summary statistics, using the given comparator * to locate minimum and maximum elements. * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelArray.SummaryStatistics summary (Comparator comparator) { PAS.FJOStats f = new PAS.FJOStats (this, origin, fence, null, comparator); ex.invoke(f); return (ParallelArray.SummaryStatistics)f; } /** * Returns summary statistics, assuming that all elements are * Comparables * @return the summary. */ public ParallelArray.SummaryStatistics summary() { return summary((Comparator)(CommonOps.castedComparator())); } /** * Returns a new ParallelArray holding elements * @return a new ParallelArray holding elements */ public ParallelArray all() { return new ParallelArray(ex, (U[])allObjects(null)); } /** * Returns a new ParallelArray with the given element type * holding elements * @param elementType the type of the elements * @return a new ParallelArray holding elements */ public ParallelArray all(Class elementType) { return new ParallelArray(ex, (U[])allObjects(elementType)); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op * applied to current op's results * @param op the op * @return operation prefix */ public abstract ParallelArrayWithMapping withMapping (Op op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op * applied to current op's results * @param op the op * @return operation prefix */ public abstract ParallelArrayWithDoubleMapping withMapping (ObjectToDouble op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op * applied to current op's results * @param op the op * @return operation prefix */ public abstract ParallelArrayWithLongMapping withMapping (ObjectToLong op); /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithMapping withMapping (BinaryOp combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithMapping withMapping (ObjectAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithMapping withMapping (ObjectAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithDoubleMapping withMapping (ObjectAndObjectToDouble combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithDoubleMapping withMapping (ObjectAndDoubleToDouble combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithDoubleMapping withMapping (ObjectAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithLongMapping withMapping (ObjectAndObjectToLong combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithLongMapping withMapping (ObjectAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithLongMapping withMapping (ObjectAndLongToLong combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper); /** * Returns an Iterable view to sequentially step through mapped * elements also obeying bound and filter constraints, without * performing computations to evaluate them in parallel * @return the Iterable view */ public Iterable sequentially() { return new Sequentially(); } } jsr166/src/extra166y/ParallelDoubleArrayWithDoubleMapping.java0000644000000000000000000003104411537741066021407 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelArray that causes operations to apply * to mappings of elements, not to the elements themselves. * Instances of this class may be constructed only via prefix * methods of ParallelDoubleArray or its other prefix classes. */ public abstract class ParallelDoubleArrayWithDoubleMapping extends AbstractParallelAnyArray.DPap { ParallelDoubleArrayWithDoubleMapping (ForkJoinPool ex, int origin, int fence, double[] array) { super(ex, origin, fence, array); } /** * Applies the given procedure to elements * @param procedure the procedure */ public void apply(DoubleProcedure procedure) { ex.invoke(new PAS.FJDApply(this, origin, fence, null, procedure)); } /** * Returns reduction of elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public double reduce(DoubleReducer reducer, double base) { PAS.FJDReduce f = new PAS.FJDReduce (this, origin, fence, null, reducer, base); ex.invoke(f); return f.result; } /** * Returns the minimum element, or Double.MAX_VALUE if empty * @return minimum element, or Double.MAX_VALUE if empty */ public double min() { return reduce(CommonOps.naturalDoubleMinReducer(), Double.MAX_VALUE); } /** * Returns the minimum element, or Double.MAX_VALUE if empty * @param comparator the comparator * @return minimum element, or Double.MAX_VALUE if empty */ public double min(DoubleComparator comparator) { return reduce(CommonOps.doubleMinReducer(comparator), Double.MAX_VALUE); } /** * Returns the maximum element, or -Double.MAX_VALUE if empty * @return maximum element, or -Double.MAX_VALUE if empty */ public double max() { return reduce(CommonOps.naturalDoubleMaxReducer(), -Double.MAX_VALUE); } /** * Returns the maximum element, or -Double.MAX_VALUE if empty * @param comparator the comparator * @return maximum element, or -Double.MAX_VALUE if empty */ public double max(DoubleComparator comparator) { return reduce(CommonOps.doubleMaxReducer(comparator), -Double.MAX_VALUE); } /** * Returns the sum of elements * @return the sum of elements */ public double sum() { return reduce(CommonOps.doubleAdder(), 0); } /** * Returns summary statistics * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelDoubleArray.SummaryStatistics summary (DoubleComparator comparator) { PAS.FJDStats f = new PAS.FJDStats (this, origin, fence, null, comparator); ex.invoke(f); return f; } /** * Returns summary statistics, using natural comparator * @return the summary. */ public ParallelDoubleArray.SummaryStatistics summary() { return summary(CommonOps.naturalDoubleComparator()); } /** * Returns a new ParallelDoubleArray holding elements * @return a new ParallelDoubleArray holding elements */ public ParallelDoubleArray all() { return new ParallelDoubleArray(ex, allDoubles()); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelDoubleArrayWithDoubleMapping withMapping (DoubleOp op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelDoubleArrayWithLongMapping withMapping (DoubleToLong op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelDoubleArrayWithMapping withMapping (DoubleToObject op); /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (DoubleAndObjectToObject combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (DoubleAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (DoubleAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithDoubleMapping withMapping (DoubleAndObjectToDouble combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithDoubleMapping withMapping (BinaryDoubleOp combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithDoubleMapping withMapping (DoubleAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (DoubleAndObjectToLong combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (DoubleAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (DoubleAndLongToLong combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelDoubleArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper); /** * Returns an Iterable view to sequentially step through mapped * elements also obeying bound and filter constraints, without * performing computations to evaluate them in parallel * @return the Iterable view */ public Iterable sequentially() { return new SequentiallyAsDouble(); } } jsr166/src/extra166y/ParallelLongArray.java0000644000000000000000000011616311537741066015577 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * An array of longs supporting parallel operations. This class * provides methods supporting the same operations as {@link * ParallelArray}, but specialized for scalar longs. It additionally * provides a few methods specific to numerical values. * *

Sample usages. * Here is a complete (although naive) prime filter program: *

 * import java.math.BigInteger;
 * import jsr166y.*;
 * import static extra166y.Ops.*;
 * import static extra166y.ParallelLongArray.*;
 *
 * public class Sieve {
 *   public static void main(String[] args) {
 *     int n = Integer.parseInt(args[0]);
 *     // create array of divisors
 *     ParallelLongArray a = create(n-1, defaultExecutor());
 *     a.replaceWithMappedIndex(add2);
 *     int i = 0;
 *     long p = 2;
 *     while (p * p < n) { // repeatedly filter
 *         a = a.withFilter(notDivisibleBy(p)).all();
 *         p = a.get(++i);
 *     }
 *     System.out.printf("sieve(%d) = %s%n", n, a);
 *     // check result
 *     if (!a.withFilter(notProbablePrime).isEmpty())
 *         throw new Error();
 *   }
 *   static IntToLong add2 = new IntToLong() {
 *     public long op(int i) { return i + 2; } };
 *   static LongPredicate notDivisibleBy(final long p) {
 *     return new LongPredicate() {
 *        public boolean op(long n) { return n <= p || (n % p) != 0; }
 *     }; }
 *   static LongPredicate notProbablePrime = new LongPredicate() {
 *     private static final int CERTAINTY = 8;
 *     public boolean op(long n) {
 *       return !BigInteger.valueOf(n).isProbablePrime(CERTAINTY);
 *     }
 *   };
 * }
 * 
*/ public class ParallelLongArray extends AbstractParallelAnyArray.LUPap { // Same internals as ParallelArray, but specialized for longs AsList listView; /** * Returns a common default executor for use in ParallelArrays. * This executor arranges enough parallelism to use most, but not * necessarily all, of the available processors on this system. * @return the executor */ public static ForkJoinPool defaultExecutor() { return PAS.defaultExecutor(); } /** * Constructor for use by subclasses to create a new ParallelLongArray * using the given executor, and initially using the supplied * array, with effective size bound by the given limit. This * constructor is designed to enable extensions via * subclassing. To create a ParallelLongArray, use {@link #create}, * {@link #createEmpty}, {@link #createUsingHandoff} or {@link * #createFromCopy}. * @param executor the executor * @param array the array * @param limit the upper bound limit */ protected ParallelLongArray(ForkJoinPool executor, long[] array, int limit) { super(executor, 0, limit, array); if (executor == null || array == null) throw new NullPointerException(); if (limit < 0 || limit > array.length) throw new IllegalArgumentException(); } /** * Trusted internal version of protected constructor. */ ParallelLongArray(ForkJoinPool executor, long[] array) { super(executor, 0, array.length, array); } /** * Creates a new ParallelLongArray using the given executor and * an array of the given size * @param size the array size * @param executor the executor */ public static ParallelLongArray create (int size, ForkJoinPool executor) { long[] array = new long[size]; return new ParallelLongArray(executor, array, size); } /** * Creates a new ParallelLongArray initially using the given array and * executor. In general, the handed off array should not be used * for other purposes once constructing this ParallelLongArray. The * given array may be internally replaced by another array in the * course of methods that add or remove elements. * @param handoff the array * @param executor the executor */ public static ParallelLongArray createUsingHandoff (long[] handoff, ForkJoinPool executor) { return new ParallelLongArray(executor, handoff, handoff.length); } /** * Creates a new ParallelLongArray using the given executor and * initially holding copies of the given * source elements. * @param source the source of initial elements * @param executor the executor */ public static ParallelLongArray createFromCopy (long[] source, ForkJoinPool executor) { // For now, avoid copyOf so people can compile with Java5 int size = source.length; long[] array = new long[size]; System.arraycopy(source, 0, array, 0, size); return new ParallelLongArray(executor, array, size); } /** * Creates a new ParallelLongArray using an array of the given size, * initially holding copies of the given source truncated or * padded with zeros to obtain the specified length. * @param source the source of initial elements * @param size the array size * @param executor the executor */ public static ParallelLongArray createFromCopy (int size, long[] source, ForkJoinPool executor) { // For now, avoid copyOf so people can compile with Java5 long[] array = new long[size]; System.arraycopy(source, 0, array, 0, Math.min(source.length, size)); return new ParallelLongArray(executor, array, size); } /** * Creates a new ParallelLongArray using the given executor and * an array of the given size, but with an initial effective size * of zero, enabling incremental insertion via {@link * ParallelLongArray#asList} operations. * @param size the array size * @param executor the executor */ public static ParallelLongArray createEmpty (int size, ForkJoinPool executor) { long[] array = new long[size]; return new ParallelLongArray(executor, array, 0); } /** * Summary statistics for a possibly bounded, filtered, and/or * mapped ParallelLongArray. */ public static interface SummaryStatistics { /** Return the number of elements */ public int size(); /** Return the minimum element, or Long.MAX_VALUE if empty */ public long min(); /** Return the maximum element, or Long.MIN_VALUE if empty */ public long max(); /** Return the index of the minimum element, or -1 if empty */ public int indexOfMin(); /** Return the index of the maximum element, or -1 if empty */ public int indexOfMax(); /** Return the sum of all elements */ public long sum(); /** Return the arithmetic average of all elements */ public double average(); } /** * Returns the executor used for computations * @return the executor */ public ForkJoinPool getExecutor() { return ex; } /** * Applies the given procedure to elements * @param procedure the procedure */ public void apply(LongProcedure procedure) { super.apply(procedure); } /** * Returns reduction of elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public long reduce(LongReducer reducer, long base) { return super.reduce(reducer, base); } /** * Returns a new ParallelLongArray holding all elements * @return a new ParallelLongArray holding all elements */ public ParallelLongArray all() { return super.all(); } /** * Replaces elements with the results of applying the given op * to their current values. * @param op the op * @return this (to simplify use in expressions) */ public ParallelLongArray replaceWithMapping(LongOp op) { super.replaceWithMapping(op); return this; } /** * Replaces elements with the results of applying the given * op to their indices. * @param op the op * @return this (to simplify use in expressions) */ public ParallelLongArray replaceWithMappedIndex(IntToLong op) { super.replaceWithMappedIndex(op); return this; } /** * Replaces elements with the results of applying the given * mapping to each index and current element value * @param op the op * @return this (to simplify use in expressions) */ public ParallelLongArray replaceWithMappedIndex(IntAndLongToLong op) { super.replaceWithMappedIndex(op); return this; } /** * Replaces elements with the results of applying the given * generator. For example, to fill the array with uniform random * values, use * replaceWithGeneratedValue(Ops.longRandom()) * @param generator the generator * @return this (to simplify use in expressions) */ public ParallelLongArray replaceWithGeneratedValue(LongGenerator generator){ super.replaceWithGeneratedValue(generator); return this; } /** * Replaces elements with the given value. * @param value the value * @return this (to simplify use in expressions) */ public ParallelLongArray replaceWithValue(long value) { super.replaceWithValue(value); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement) * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) */ public ParallelLongArray replaceWithMapping (BinaryLongOp combiner, ParallelLongArrayWithLongMapping other) { super.replaceWithMapping(combiner, other); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement) * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) * @throws ArrayIndexOutOfBoundsException if other array has * fewer elements than this array. */ public ParallelLongArray replaceWithMapping(BinaryLongOp combiner, long[] other) { super.replaceWithMapping(combiner, other); return this; } /** * Returns the index of some element equal to given target, or -1 * if not present * @param target the element to search for * @return the index or -1 if not present */ public int indexOf(long target) { return super.indexOf(target); } /** * Assuming this array is sorted, returns the index of an element * equal to given target, or -1 if not present. If the array * is not sorted, the results are undefined. * @param target the element to search for * @return the index or -1 if not present */ public int binarySearch(long target) { return super.binarySearch(target); } /** * Assuming this array is sorted with respect to the given * comparator, returns the index of an element equal to given * target, or -1 if not present. If the array is not sorted, the * results are undefined. * @param target the element to search for * @param comparator the comparator * @return the index or -1 if not present */ public int binarySearch(long target, LongComparator comparator) { return super.binarySearch(target, comparator); } /** * Returns summary statistics, using the given comparator * to locate minimum and maximum elements. * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelLongArray.SummaryStatistics summary (LongComparator comparator) { return super.summary(comparator); } /** * Returns summary statistics, using natural comparator * @return the summary. */ public ParallelLongArray.SummaryStatistics summary() { return super.summary(); } /** * Returns the minimum element, or Long.MAX_VALUE if empty * @param comparator the comparator * @return minimum element, or Long.MAX_VALUE if empty */ public long min(LongComparator comparator) { return super.min(comparator); } /** * Returns the minimum element, or Long.MAX_VALUE if empty, * @return minimum element, or Long.MAX_VALUE if empty */ public long min() { return super.min(); } /** * Returns the maximum element, or Long.MIN_VALUE if empty * @param comparator the comparator * @return maximum element, or Long.MIN_VALUE if empty */ public long max(LongComparator comparator) { return super.max(comparator); } /** * Returns the maximum element, or Long.MIN_VALUE if empty * @return maximum element, or Long.MIN_VALUE if empty */ public long max() { return super.max(); } /** * Replaces each element with the running cumulation of applying * the given reducer. For example, if the contents are the numbers * 1, 2, 3, and the reducer operation adds numbers, then * after invocation of this method, the contents would be 1, * 3, 6 (that is, 1, 1+2, 1+2+3); * @param reducer the reducer * @param base the result for an empty array * @return this (to simplify use in expressions) */ public ParallelLongArray cumulate(LongReducer reducer, long base) { super.cumulate(reducer, base); return this; } /** * Replaces each element with the cumulation of applying the given * reducer to all previous values, and returns the total * reduction. For example, if the contents are the numbers 1, * 2, 3, and the reducer operation adds numbers, then after * invocation of this method, the contents would be 0, 1, * 3 (that is, 0, 0+1, 0+1+2, and the return value * would be 6 (that is, 1+2+3); * @param reducer the reducer * @param base the result for an empty array * @return the total reduction */ public long precumulate(LongReducer reducer, long base) { return super.precumulate(reducer, base); } /** * Sorts the array. Unlike Arrays.sort, this sort does * not guarantee that elements with equal keys maintain their * relative position in the array. * @param comparator the comparator to use * @return this (to simplify use in expressions) */ public ParallelLongArray sort(LongComparator comparator) { super.sort(comparator); return this; } /** * Sorts the array, assuming all elements are Comparable. Unlike * Arrays.sort, this sort does not guarantee that elements * with equal keys maintain their relative position in the array. * @throws ClassCastException if any element is not Comparable. * @return this (to simplify use in expressions) */ public ParallelLongArray sort() { super.sort(); return this; } /** * Removes consecutive elements that are equal, * shifting others leftward, and possibly decreasing size. This * method may be used after sorting to ensure that this * ParallelLongArray contains a set of unique elements. * @return this (to simplify use in expressions) */ public ParallelLongArray removeConsecutiveDuplicates() { // Sequential implementation for now int k = 0; int n = fence; if (k < n) { long[] arr = this.array; long last = arr[k++]; for (int i = k; i < n; ++i) { long x = arr[i]; if (last != x) arr[k++] = last = x; } removeSlotsAt(k, n); } return this; } /** * Equivalent to asList().addAll but specialized for array * arguments and likely to be more efficient. * @param other the elements to add * @return this (to simplify use in expressions) */ public ParallelLongArray addAll(long[] other) { int csize = other.length; int end = fence; insertSlotsAt(end, csize); System.arraycopy(other, 0, array, end, csize); return this; } /** * Appends all (possibly bounded, filtered, or mapped) elements of * the given ParallelDoubleArray, resizing and/or reallocating this * array if necessary. * @param other the elements to add * @return this (to simplify use in expressions) */ public ParallelLongArray addAll(ParallelLongArrayWithLongMapping other) { int end = fence; if (other.hasFilter()) { PAS.FJLAppendAllDriver r = new PAS.FJLAppendAllDriver (other, end, array); ex.invoke(r); array = r.results; fence = end + r.resultSize; } else { int csize = other.size(); insertSlotsAt(end, csize); if (other.hasMap()) ex.invoke(new PAS.FJLMap(other, other.origin, other.fence, null, array, end - other.origin)); else System.arraycopy(other.array, 0, array, end, csize); } return this; } /** * Returns a new ParallelLongArray containing only the unique * elements of this array (that is, without any duplicates). * @return the new ParallelLongArray */ public ParallelLongArray allUniqueElements() { return super.allUniqueElements(); } /** * Removes from the array all elements for which the given * selector holds. * @param selector the selector * @return this (to simplify use in expressions) */ public ParallelLongArray removeAll(LongPredicate selector) { LFPap v = new LFPap(ex, 0, fence, array, selector); PAS.FJRemoveAllDriver f = new PAS.FJRemoveAllDriver(v, 0, fence); ex.invoke(f); removeSlotsAt(f.offset, fence); return this; } /** * Returns true if all elements at the same relative positions * of this and other array are equal. * @param other the other array */ public boolean hasAllEqualElements(ParallelLongArrayWithLongMapping other) { return super.hasAllEqualElements(other); } /** * Returns the sum of elements * @return the sum of elements */ public long sum() { return super.sum(); } /** * Replaces each element with the running sum * @return this (to simplify use in expressions) */ public ParallelLongArray cumulateSum() { super.cumulateSum(); return this; } /** * Replaces each element with its prefix sum * @return the total sum */ public long precumulateSum() { return super.precumulateSum(); } /** * Returns an operation prefix that causes a method to * operate only on the elements of the array between * firstIndex (inclusive) and upperBound (exclusive). * @param firstIndex the lower bound (inclusive) * @param upperBound the upper bound (exclusive) * @return operation prefix */ public ParallelLongArrayWithBounds withBounds(int firstIndex, int upperBound) { return super.withBounds(firstIndex, upperBound); } /** * Returns an operation prefix that causes a method to operate * only on the elements of the array for which the given selector * returns true * @param selector the selector * @return operation prefix */ public ParallelLongArrayWithFilter withFilter(LongPredicate selector) { return super.withFilter(selector); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the given binary selector returns * true * @param selector the selector * @return operation prefix */ public ParallelLongArrayWithFilter withFilter (BinaryLongPredicate selector, ParallelLongArrayWithLongMapping other) { return super.withFilter(selector, other); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the given indexed selector returns * true * @param selector the selector * @return operation prefix */ public ParallelLongArrayWithFilter withIndexedFilter (IntAndLongPredicate selector) { return super.withIndexedFilter(selector); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public ParallelLongArrayWithMapping withMapping (LongToObject op) { return super.withMapping(op); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public ParallelLongArrayWithLongMapping withMapping(LongOp op) { return super.withMapping(op); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public ParallelLongArrayWithDoubleMapping withMapping(LongToDouble op) { return super.withMapping(op); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (LongAndObjectToObject combiner, ParallelArrayWithMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (LongAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (LongAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (LongAndObjectToDouble combiner, ParallelArrayWithMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (LongAndDoubleToDouble combiner, ParallelDoubleArrayWithDoubleMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (LongAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (LongAndObjectToLong combiner, ParallelArrayWithMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (LongAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (BinaryLongOp combiner, ParallelLongArrayWithLongMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate on * mappings of this array using the given mapper that accepts as * arguments an element's current index and value, and produces a * new value. * @param mapper the mapper * @return operation prefix */ public ParallelLongArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return super.withIndexedMapping(mapper); } /** * Returns an operation prefix that causes a method to operate on * mappings of this array using the given mapper that accepts as * arguments an element's current index and value, and produces a * new value. * @param mapper the mapper * @return operation prefix */ public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return super.withIndexedMapping(mapper); } /** * Returns an operation prefix that causes a method to operate on * mappings of this array using the given mapper that accepts as * arguments an element's current index and value, and produces a * new value. * @param mapper the mapper * @return operation prefix */ public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return super.withIndexedMapping(mapper); } /** * Returns an iterator stepping through each element of the array * up to the current limit. This iterator does not * support the remove operation. However, a full * ListIterator supporting add, remove, and set * operations is available via {@link #asList}. * @return an iterator stepping through each element. */ public Iterator iterator() { return new ParallelLongArrayIterator(array, fence); } static final class ParallelLongArrayIterator implements Iterator { int cursor; final long[] arr; final int hi; ParallelLongArrayIterator(long[] a, int limit) { arr = a; hi = limit; } public boolean hasNext() { return cursor < hi; } public Long next() { if (cursor >= hi) throw new NoSuchElementException(); return Long.valueOf(arr[cursor++]); } public void remove() { throw new UnsupportedOperationException(); } } // List support /** * Returns a view of this ParallelLongArray as a List. This List has * the same structural and performance characteristics as {@link * ArrayList}, and may be used to modify, replace or extend the * bounds of the array underlying this ParallelLongArray. The methods * supported by this list view are not in general * implemented as parallel operations. This list is also not * itself thread-safe. In particular, performing list updates * while other parallel operations are in progress has undefined * (and surely undesired) effects. * @return a list view */ public List asList() { AsList lv = listView; if (lv == null) listView = lv = new AsList(); return lv; } /** * Returns the effective size of the underlying array. The * effective size is the current limit, if used (see {@link * #setLimit}), or the length of the array otherwise. * @return the effective size of array */ public int size() { return fence; } /** * Returns the underlying array used for computations * @return the array */ public long[] getArray() { return array; } /** * Returns the element of the array at the given index * @param i the index * @return the element of the array at the given index */ public long get(int i) { return array[i]; } /** * Sets the element of the array at the given index to the given value * @param i the index * @param x the value */ public void set(int i, long x) { array[i] = x; } /** * Equivalent to asList().toString() * @return a string representation */ public String toString() { return asList().toString(); } /** * Ensures that the underlying array can be accessed up to the * given upper bound, reallocating and copying the underlying * array to expand if necessary. Or, if the given limit is less * than the length of the underlying array, causes computations to * ignore elements past the given limit. * @param newLimit the new upper bound * @throws IllegalArgumentException if newLimit less than zero. */ public final void setLimit(int newLimit) { if (newLimit < 0) throw new IllegalArgumentException(); int cap = array.length; if (newLimit > cap) resizeArray(newLimit); fence = newLimit; } final void replaceElementsParallelLongArrayWith(long[] a) { System.arraycopy(a, 0, array, 0, a.length); fence = a.length; } final void resizeArray(int newCap) { int cap = array.length; if (newCap > cap) { long[] a = new long[newCap]; System.arraycopy(array, 0, a, 0, cap); array = a; } } final void insertElementAt(int index, long e) { int hi = fence++; if (hi >= array.length) resizeArray((hi * 3)/2 + 1); if (hi > index) System.arraycopy(array, index, array, index+1, hi - index); array[index] = e; } final void appendElement(long e) { int hi = fence++; if (hi >= array.length) resizeArray((hi * 3)/2 + 1); array[hi] = e; } /** * Make len slots available at index */ final void insertSlotsAt(int index, int len) { if (len <= 0) return; int cap = array.length; int newSize = fence + len; if (cap < newSize) { cap = (cap * 3)/2 + 1; if (cap < newSize) cap = newSize; resizeArray(cap); } if (index < fence) System.arraycopy(array, index, array, index + len, fence - index); fence = newSize; } final void removeSlotAt(int index) { System.arraycopy(array, index + 1, array, index, fence - index - 1); --fence; } final void removeSlotsAt(int fromIndex, int toIndex) { if (fromIndex < toIndex) { int size = fence; System.arraycopy(array, toIndex, array, fromIndex, size - toIndex); int newSize = size - (toIndex - fromIndex); fence = newSize; } } final int seqIndexOf(long target) { long[] arr = array; int end = fence; for (int i = 0; i < end; i++) if (target == arr[i]) return i; return -1; } final int seqLastIndexOf(long target) { long[] arr = array; for (int i = fence - 1; i >= 0; i--) if (target == arr[i]) return i; return -1; } final class ListIter implements ListIterator { int cursor; int lastRet; long[] arr; // cache array and bound int hi; ListIter(int lo) { this.cursor = lo; this.lastRet = -1; this.arr = ParallelLongArray.this.array; this.hi = ParallelLongArray.this.fence; } public boolean hasNext() { return cursor < hi; } public Long next() { int i = cursor; if (i < 0 || i >= hi) throw new NoSuchElementException(); long next = arr[i]; lastRet = i; cursor = i + 1; return Long.valueOf(next); } public void remove() { int k = lastRet; if (k < 0) throw new IllegalStateException(); ParallelLongArray.this.removeSlotAt(k); hi = ParallelLongArray.this.fence; if (lastRet < cursor) cursor--; lastRet = -1; } public boolean hasPrevious() { return cursor > 0; } public Long previous() { int i = cursor - 1; if (i < 0 || i >= hi) throw new NoSuchElementException(); long previous = arr[i]; lastRet = cursor = i; return Long.valueOf(previous); } public int nextIndex() { return cursor; } public int previousIndex() { return cursor - 1; } public void set(Long e) { int i = lastRet; if (i < 0 || i >= hi) throw new NoSuchElementException(); arr[i] = e.longValue(); } public void add(Long e) { int i = cursor; ParallelLongArray.this.insertElementAt(i, e.longValue()); arr = ParallelLongArray.this.array; hi = ParallelLongArray.this.fence; lastRet = -1; cursor = i + 1; } } final class AsList extends AbstractList implements RandomAccess { public Long get(int i) { if (i >= fence) throw new IndexOutOfBoundsException(); return Long.valueOf(array[i]); } public Long set(int i, Long x) { if (i >= fence) throw new IndexOutOfBoundsException(); long[] arr = array; Long t = Long.valueOf(arr[i]); arr[i] = x.longValue(); return t; } public boolean isEmpty() { return fence == 0; } public int size() { return fence; } public Iterator iterator() { return new ListIter(0); } public ListIterator listIterator() { return new ListIter(0); } public ListIterator listIterator(int index) { if (index < 0 || index > fence) throw new IndexOutOfBoundsException(); return new ListIter(index); } public boolean add(Long e) { appendElement(e.longValue()); return true; } public void add(int index, Long e) { if (index < 0 || index > fence) throw new IndexOutOfBoundsException(); insertElementAt(index, e.longValue()); } public boolean addAll(Collection c) { int csize = c.size(); if (csize == 0) return false; int hi = fence; setLimit(hi + csize); long[] arr = array; for (Long e : c) arr[hi++] = e.longValue(); return true; } public boolean addAll(int index, Collection c) { if (index < 0 || index > fence) throw new IndexOutOfBoundsException(); int csize = c.size(); if (csize == 0) return false; insertSlotsAt(index, csize); long[] arr = array; for (Long e : c) arr[index++] = e.longValue(); return true; } public void clear() { fence = 0; } public boolean remove(Object o) { if (!(o instanceof Long)) return false; int idx = seqIndexOf(((Long)o).longValue()); if (idx < 0) return false; removeSlotAt(idx); return true; } public Long remove(int index) { Long oldValue = get(index); removeSlotAt(index); return oldValue; } public void removeRange(int fromIndex, int toIndex) { removeSlotsAt(fromIndex, toIndex); } public boolean contains(Object o) { if (!(o instanceof Long)) return false; return seqIndexOf(((Long)o).longValue()) >= 0; } public int indexOf(Object o) { if (!(o instanceof Long)) return -1; return seqIndexOf(((Long)o).longValue()); } public int lastIndexOf(Object o) { if (!(o instanceof Long)) return -1; return seqLastIndexOf(((Long)o).longValue()); } } } jsr166/src/extra166y/ParallelArrayWithLongMapping.java0000644000000000000000000003053711537741066017747 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelArray that causes operations to apply * to mappings of elements, not to the elements themselves. * Instances of this class may be constructed only via prefix * methods of ParallelArray or its other prefix classes. */ public abstract class ParallelArrayWithLongMapping extends AbstractParallelAnyArray.OPap { ParallelArrayWithLongMapping (ForkJoinPool ex, int origin, int fence, T[] array) { super(ex, origin, fence, array); } /** * Applies the given procedure * @param procedure the procedure */ public void apply(LongProcedure procedure) { ex.invoke(new PAS.FJLApply(this, origin, fence, null, procedure)); } /** * Returns reduction of mapped elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public long reduce(LongReducer reducer, long base) { PAS.FJLReduce f = new PAS.FJLReduce (this, origin, fence, null, reducer, base); ex.invoke(f); return f.result; } /** * Returns the minimum element, or Long.MAX_VALUE if empty * @return minimum element, or Long.MAX_VALUE if empty */ public long min() { return reduce(CommonOps.naturalLongMinReducer(), Long.MAX_VALUE); } /** * Returns the minimum element, or Long.MAX_VALUE if empty * @param comparator the comparator * @return minimum element, or Long.MAX_VALUE if empty */ public long min(LongComparator comparator) { return reduce(CommonOps.longMinReducer(comparator), Long.MAX_VALUE); } /** * Returns the maximum element, or Long.MIN_VALUE if empty * @return maximum element, or Long.MIN_VALUE if empty */ public long max() { return reduce(CommonOps.naturalLongMaxReducer(), Long.MIN_VALUE); } /** * Returns the maximum element, or Long.MIN_VALUE if empty * @param comparator the comparator * @return maximum element, or Long.MIN_VALUE if empty */ public long max(LongComparator comparator) { return reduce(CommonOps.longMaxReducer(comparator), Long.MIN_VALUE); } /** * Returns the sum of elements * @return the sum of elements */ public long sum() { return reduce(CommonOps.longAdder(), 0L); } /** * Returns summary statistics * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelLongArray.SummaryStatistics summary (LongComparator comparator) { PAS.FJLStats f = new PAS.FJLStats (this, origin, fence, null, comparator); ex.invoke(f); return f; } /** * Returns summary statistics, using natural comparator * @return the summary. */ public ParallelLongArray.SummaryStatistics summary() { return summary(CommonOps.naturalLongComparator()); } /** * Returns a new ParallelLongArray holding mappings * @return a new ParallelLongArray holding mappings */ public ParallelLongArray all() { return new ParallelLongArray(ex, allLongs()); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelArrayWithDoubleMapping withMapping(LongToDouble op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelArrayWithLongMapping withMapping(LongOp op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelArrayWithMapping withMapping (LongToObject op); /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithMapping withMapping (LongAndObjectToObject combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithMapping withMapping (LongAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithMapping withMapping (LongAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithDoubleMapping withMapping (LongAndObjectToDouble combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithDoubleMapping withMapping (LongAndDoubleToDouble combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithDoubleMapping withMapping (LongAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithLongMapping withMapping (LongAndObjectToLong combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithLongMapping withMapping (LongAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelArrayWithLongMapping withMapping (BinaryLongOp combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelArrayWithMapping withIndexedMapping (IntAndLongToObject mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper); /** * Returns an Iterable view to sequentially step through mapped * elements also obeying bound and filter constraints, without * performing computations to evaluate them in parallel * @return the Iterable view */ public Iterable sequentially() { return new SequentiallyAsLong(); } } jsr166/src/extra166y/ParallelLongArrayWithMapping.java0000644000000000000000000003267511537741066017754 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelLongArray that causes operations to apply * to mappings of elements, not to the elements themselves. * Instances of this class may be constructed only via prefix * methods of ParallelLongArray or its other prefix classes. */ public abstract class ParallelLongArrayWithMapping extends AbstractParallelAnyArray.LPap { ParallelLongArrayWithMapping (ForkJoinPool ex, int origin, int fence, long[] array) { super(ex, origin, fence, array); } /** * Applies the given procedure to mapped elements * @param procedure the procedure */ public void apply(Procedure procedure) { ex.invoke(new PAS.FJOApply(this, origin, fence, null, procedure)); } /** * Returns reduction of mapped elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public U reduce(Reducer reducer, U base) { PAS.FJOReduce f = new PAS.FJOReduce (this, origin, fence, null, reducer, base); ex.invoke(f); return (U)(f.result); } /** * Returns mapping of some element matching bound and filter * constraints, or null if none. * @return mapping of matching element, or null if none. */ public U any() { int i = anyIndex(); return (i < 0) ? null : (U)oget(i); } /** * Returns the minimum mapped element, or null if empty * @param comparator the comparator * @return minimum mapped element, or null if empty */ public U min(Comparator comparator) { return reduce(CommonOps.minReducer(comparator), null); } /** * Returns the minimum mapped element, or null if empty, * assuming that all elements are Comparables * @return minimum mapped element, or null if empty * @throws ClassCastException if any element is not Comparable. */ public U min() { return reduce((Reducer)(CommonOps.castedMinReducer()), null); } /** * Returns the maximum mapped element, or null if empty * @param comparator the comparator * @return maximum mapped element, or null if empty */ public U max(Comparator comparator) { return reduce(CommonOps.maxReducer(comparator), null); } /** * Returns the maximum mapped element, or null if empty * assuming that all elements are Comparables * @return maximum mapped element, or null if empty * @throws ClassCastException if any element is not Comparable. */ public U max() { return reduce((Reducer)(CommonOps.castedMaxReducer()), null); } /** * Returns summary statistics, using the given comparator * to locate minimum and maximum elements. * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelArray.SummaryStatistics summary (Comparator comparator) { PAS.FJOStats f = new PAS.FJOStats (this, origin, fence, null, comparator); ex.invoke(f); return (ParallelArray.SummaryStatistics)f; } /** * Returns summary statistics, assuming that all elements are * Comparables * @return the summary. */ public ParallelArray.SummaryStatistics summary() { return summary((Comparator)(CommonOps.castedComparator())); } /** * Returns a new ParallelArray holding mapped elements * @return a new ParallelArray holding mapped elements */ public ParallelArray all() { return new ParallelArray(ex, (U[])allObjects(null)); } /** * Returns a new ParallelArray with the given element type holding * all elements * @param elementType the type of the elements * @return a new ParallelArray holding all elements */ public ParallelArray all(Class elementType) { return new ParallelArray(ex, (U[])allObjects(elementType)); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op * applied to current op's results * @param op the op * @return operation prefix */ public abstract ParallelLongArrayWithMapping withMapping (Op op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op * applied to current op's results * @param op the op * @return operation prefix */ public abstract ParallelLongArrayWithLongMapping withMapping (ObjectToLong op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op * applied to current op's results * @param op the op * @return operation prefix */ public abstract ParallelLongArrayWithDoubleMapping withMapping (ObjectToDouble op); /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (BinaryOp combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (ObjectAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (ObjectAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (ObjectAndObjectToDouble combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (ObjectAndDoubleToDouble combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (ObjectAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (ObjectAndObjectToLong combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (ObjectAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (ObjectAndLongToLong combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelLongArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelLongArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper); /** * Returns an Iterable view to sequentially step through mapped * elements also obeying bound and filter constraints, without * performing computations to evaluate them in parallel * @return the Iterable view */ public Iterable sequentially() { return new Sequentially(); } } jsr166/src/extra166y/CommonOps.java0000644000000000000000000011030611537741066014127 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; /** * A collection of static factory methods providing commonly useful * implementations of operations. */ public class CommonOps { private CommonOps() {} // disable construction /** * Returns a Comparator for Comparable objects */ public static > Comparator naturalComparator(Class type) { return new Comparator() { public int compare(T a, T b) { return a.compareTo(b); } }; } /** * Returns a reducer returning the maximum of two Comparable * elements, treating null as less than any non-null element. */ public static > Reducer naturalMaxReducer(Class type) { return new Reducer() { public T op(T a, T b) { return (a != null && (b == null || a.compareTo(b) >= 0)) ? a : b; } }; } /** * Returns a reducer returning the minimum of two Comparable * elements, treating null as greater than any non-null element. */ public static > Reducer naturalMinReducer(Class type) { return new Reducer() { public T op(T a, T b) { return (a != null && (b == null || a.compareTo(b) <= 0)) ? a : b; } }; } /** * Returns a reducer returning the maximum of two elements, using * the given comparator, and treating null as less than any * non-null element. */ public static Reducer maxReducer (final Comparator comparator) { return new Reducer() { public T op(T a, T b) { return (a != null && (b == null || comparator.compare(a, b) >= 0)) ? a : b; } }; } /** * Returns a reducer returning the minimum of two elements, using * the given comparator, and treating null as greater than any * non-null element. */ public static Reducer minReducer (final Comparator comparator) { return new Reducer() { public T op(T a, T b) { return (a != null && (b == null || comparator.compare(a, b) <= 0)) ? a : b; } }; } /** * Returns a Comparator that casts its arguments as Comparable on * each comparison, throwing ClassCastException on failure. */ public static Comparator castedComparator() { return (Comparator)(RawComparator.cmp); } static final class RawComparator implements Comparator { static final RawComparator cmp = new RawComparator(); public int compare(Object a, Object b) { return ((Comparable)a).compareTo((Comparable)b); } } /** * Returns a reducer returning maximum of two values, or * null if both arguments are null, and that casts * its arguments as Comparable on each comparison, throwing * ClassCastException on failure. */ public static Reducer castedMaxReducer() { return (Reducer)RawMaxReducer.max; } static final class RawMaxReducer implements Reducer { static final RawMaxReducer max = new RawMaxReducer(); public Object op(Object a, Object b) { return (a != null && (b == null || ((Comparable)a).compareTo((Comparable)b) >= 0)) ? a : b; } } /** * Returns a reducer returning minimum of two values, or * null if both arguments are null, and that casts * its arguments as Comparable on each comparison, throwing * ClassCastException on failure. */ public static Reducer castedMinReducer() { return (Reducer)RawMinReducer.min; } static final class RawMinReducer implements Reducer { static final RawMinReducer min = new RawMinReducer(); public Object op(Object a, Object b) { return (a != null && (b == null || ((Comparable)a).compareTo((Comparable)b) <= 0)) ? a : b; } } /** * Returns a comparator for doubles relying on natural ordering */ public static DoubleComparator naturalDoubleComparator() { return NaturalDoubleComparator.comparator; } static final class NaturalDoubleComparator implements DoubleComparator { static final NaturalDoubleComparator comparator = new NaturalDoubleComparator(); public int compare(double a, double b) { return Double.compare(a, b); } } /** * Returns a reducer returning the maximum of two double elements, * using natural comparator */ public static DoubleReducer naturalDoubleMaxReducer() { return NaturalDoubleMaxReducer.max; } static final class NaturalDoubleMaxReducer implements DoubleReducer { public static final NaturalDoubleMaxReducer max = new NaturalDoubleMaxReducer(); public double op(double a, double b) { return Math.max(a, b); } } /** * Returns a reducer returning the minimum of two double elements, * using natural comparator */ public static DoubleReducer naturalDoubleMinReducer() { return NaturalDoubleMinReducer.min; } static final class NaturalDoubleMinReducer implements DoubleReducer { public static final NaturalDoubleMinReducer min = new NaturalDoubleMinReducer(); public double op(double a, double b) { return Math.min(a, b); } } /** * Returns a reducer returning the maximum of two double elements, * using the given comparator */ public static DoubleReducer doubleMaxReducer (final DoubleComparator comparator) { return new DoubleReducer() { public double op(double a, double b) { return (comparator.compare(a, b) >= 0) ? a : b; } }; } /** * Returns a reducer returning the minimum of two double elements, * using the given comparator */ public static DoubleReducer doubleMinReducer (final DoubleComparator comparator) { return new DoubleReducer() { public double op(double a, double b) { return (comparator.compare(a, b) <= 0) ? a : b; } }; } /** * Returns a comparator for longs relying on natural ordering */ public static LongComparator naturalLongComparator() { return NaturalLongComparator.comparator; } static final class NaturalLongComparator implements LongComparator { static final NaturalLongComparator comparator = new NaturalLongComparator(); public int compare(long a, long b) { return (a < b) ? -1 : ((a > b) ? 1 : 0); } } /** * Returns a reducer returning the maximum of two long elements, * using natural comparator */ public static LongReducer naturalLongMaxReducer() { return NaturalLongMaxReducer.max; } static final class NaturalLongMaxReducer implements LongReducer { public static final NaturalLongMaxReducer max = new NaturalLongMaxReducer(); public long op(long a, long b) { return (a >= b) ? a : b; } } /** * A reducer returning the minimum of two long elements, * using natural comparator */ public static LongReducer naturalLongMinReducer() { return NaturalLongMinReducer.min; } static final class NaturalLongMinReducer implements LongReducer { public static final NaturalLongMinReducer min = new NaturalLongMinReducer(); public long op(long a, long b) { return (a <= b) ? a : b; } } /** * Returns a reducer returning the maximum of two long elements, * using the given comparator */ public static LongReducer longMaxReducer (final LongComparator comparator) { return new LongReducer() { public long op(long a, long b) { return (comparator.compare(a, b) >= 0) ? a : b; } }; } /** * Returns a reducer returning the minimum of two long elements, * using the given comparator */ public static LongReducer longMinReducer (final LongComparator comparator) { return new LongReducer() { public long op(long a, long b) { return (comparator.compare(a, b) <= 0) ? a : b; } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static Op compoundOp (final Op first, final Op second) { return new Op() { public final V op(T t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static Op compoundOp (final ObjectToDouble first, final DoubleToObject second) { return new Op() { public final V op(T t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static Op compoundOp (final ObjectToLong first, final LongToObject second) { return new Op() { public final V op(T t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static DoubleToObject compoundOp (final DoubleToObject first, final Op second) { return new DoubleToObject() { public final V op(double t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static LongToObject compoundOp (final LongToObject first, final Op second) { return new LongToObject() { public final V op(long t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static ObjectToDouble compoundOp (final Op first, final ObjectToDouble second) { return new ObjectToDouble() { public final double op(T t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static ObjectToLong compoundOp (final Op first, final ObjectToLong second) { return new ObjectToLong() { public final long op(T t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static ObjectToDouble compoundOp (final ObjectToDouble first, final DoubleOp second) { return new ObjectToDouble() { public final double op(T t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static ObjectToLong compoundOp (final ObjectToDouble first, final DoubleToLong second) { return new ObjectToLong() { public final long op(T t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static ObjectToLong compoundOp (final ObjectToLong first, final LongOp second) { return new ObjectToLong() { public final long op(T t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static ObjectToDouble compoundOp (final ObjectToLong first, final LongToDouble second) { return new ObjectToDouble() { public final double op(T t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static DoubleOp compoundOp (final DoubleOp first, final DoubleOp second) { return new DoubleOp() { public final double op(double t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static DoubleToLong compoundOp (final DoubleOp first, final DoubleToLong second) { return new DoubleToLong() { public final long op(double t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static DoubleToLong compoundOp (final DoubleToLong first, final LongOp second) { return new DoubleToLong() { public final long op(double t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static DoubleToObject compoundOp (final DoubleToLong first, final LongToObject second) { return new DoubleToObject() { public final T op(double t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static LongToObject compoundOp (final LongToDouble first, final DoubleToObject second) { return new LongToObject() { public final T op(long t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static LongToDouble compoundOp (final LongOp first, final LongToDouble second) { return new LongToDouble() { public final double op(long t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static LongToDouble compoundOp (final LongToDouble first, final DoubleOp second) { return new LongToDouble() { public final double op(long t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static DoubleToObject compoundOp (final DoubleOp first, final DoubleToObject second) { return new DoubleToObject() { public final T op(double t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static LongToObject compoundOp (final LongOp first, final LongToObject second) { return new LongToObject() { public final T op(long t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static DoubleOp compoundOp (final DoubleToObject first, final ObjectToDouble second) { return new DoubleOp() { public final double op(double t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static LongToDouble compoundOp (final LongToObject first, final ObjectToDouble second) { return new LongToDouble() { public final double op(long t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static DoubleToLong compoundOp (final DoubleToObject first, final ObjectToLong second) { return new DoubleToLong() { public final long op(double t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static LongOp compoundOp (final LongToObject first, final ObjectToLong second) { return new LongOp() { public final long op(long t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static LongOp compoundOp (final LongOp first, final LongOp second) { return new LongOp() { public final long op(long t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static DoubleOp compoundOp (final DoubleToLong first, final LongToDouble second) { return new DoubleOp() { public final double op(double t) { return second.op(first.op(t)); } }; } /** * Returns a composite mapper that applies a second mapper to the results * of applying the first one */ public static LongOp compoundOp (final LongToDouble first, final DoubleToLong second) { return new LongOp() { public final long op(long t) { return second.op(first.op(t)); } }; } /** * Returns a predicate evaluating to the negation of its contained predicate */ public static Predicate notPredicate (final Predicate pred) { return new Predicate() { public final boolean op(T x) { return !pred.op(x); } }; } /** * Returns a predicate evaluating to the negation of its contained predicate */ public static DoublePredicate notPredicate (final DoublePredicate pred) { return new DoublePredicate() { public final boolean op(double x) { return !pred.op(x); } }; } /** * Returns a predicate evaluating to the negation of its contained predicate */ public static LongPredicate notPredicate (final LongPredicate pred) { return new LongPredicate() { public final boolean op(long x) { return !pred.op(x); } }; } /** * Returns a predicate evaluating to the conjunction of its contained predicates */ public static Predicate andPredicate (final Predicate first, final Predicate second) { return new Predicate() { public final boolean op(T x) { return first.op(x) && second.op(x); } }; } /** * Returns a predicate evaluating to the disjunction of its contained predicates */ public static Predicate orPredicate (final Predicate first, final Predicate second) { return new Predicate() { public final boolean op(T x) { return first.op(x) || second.op(x); } }; } /** * Returns a predicate evaluating to the conjunction of its contained predicates */ public static DoublePredicate andPredicate (final DoublePredicate first, final DoublePredicate second) { return new DoublePredicate() { public final boolean op(double x) { return first.op(x) && second.op(x); } }; } /** * Returns a predicate evaluating to the disjunction of its contained predicates */ public static DoublePredicate orPredicate (final DoublePredicate first, final DoublePredicate second) { return new DoublePredicate() { public final boolean op(double x) { return first.op(x) || second.op(x); } }; } /** * Returns a predicate evaluating to the conjunction of its contained predicates */ public static LongPredicate andPredicate (final LongPredicate first, final LongPredicate second) { return new LongPredicate() { public final boolean op(long x) { return first.op(x) && second.op(x); } }; } /** * Returns a predicate evaluating to the disjunction of its contained predicates */ public static LongPredicate orPredicate (final LongPredicate first, final LongPredicate second) { return new LongPredicate() { public final boolean op(long x) { return first.op(x) || second.op(x); } }; } /** * Returns a predicate evaluating to true if its argument is non-null */ public static Predicate isNonNullPredicate() { return IsNonNullPredicate.predicate; } static final class IsNonNullPredicate implements Predicate { static final IsNonNullPredicate predicate = new IsNonNullPredicate(); public final boolean op(Object x) { return x != null; } } /** * Returns a predicate evaluating to true if its argument is null */ public static Predicate isNullPredicate() { return IsNullPredicate.predicate; } static final class IsNullPredicate implements Predicate { static final IsNullPredicate predicate = new IsNullPredicate(); public final boolean op(Object x) { return x != null; } } /** * Returns a predicate evaluating to true if its argument is an instance * of (see {@link Class#isInstance} the given type (class). */ public static Predicate instanceofPredicate(final Class type) { return new Predicate() { public final boolean op(Object x) { return type.isInstance(x); } }; } /** * Returns a predicate evaluating to true if its argument is assignable * from (see {@link Class#isAssignableFrom} the given type (class). */ public static Predicate isAssignablePredicate(final Class type) { return new Predicate() { public final boolean op(Object x) { return type.isAssignableFrom(x.getClass()); } }; } /** * Returns a reducer that adds two double elements */ public static DoubleReducer doubleAdder() { return DoubleAdder.adder; } static final class DoubleAdder implements DoubleReducer { static final DoubleAdder adder = new DoubleAdder(); public double op(double a, double b) { return a + b; } } /** * Returns a reducer that adds two long elements */ public static LongReducer longAdder() { return LongAdder.adder; } static final class LongAdder implements LongReducer { static final LongAdder adder = new LongAdder(); public long op(long a, long b) { return a + b; } } /** * Returns a reducer that adds two int elements */ public static IntReducer intAdder() { return IntAdder.adder; } static final class IntAdder implements IntReducer { static final IntAdder adder = new IntAdder(); public int op(int a, int b) { return a + b; } } /** * Returns a generator producing uniform random values between * zero and one, with the same properties as {@link * java.util.Random#nextDouble} */ public static DoubleGenerator doubleRandom() { return DoubleRandomGenerator.generator; } static final class DoubleRandomGenerator implements DoubleGenerator { static final DoubleRandomGenerator generator = new DoubleRandomGenerator(); public double op() { return ThreadLocalRandom.current().nextDouble(); } } /** * Returns a generator producing uniform random values between * zero and the given bound, with the same properties as {@link * java.util.Random#nextDouble}. * @param bound the upper bound (exclusive) of opd values */ public static DoubleGenerator doubleRandom(double bound) { return new DoubleBoundedRandomGenerator(bound); } static final class DoubleBoundedRandomGenerator implements DoubleGenerator { final double bound; DoubleBoundedRandomGenerator(double bound) { this.bound = bound; } public double op() { return ThreadLocalRandom.current().nextDouble() * bound; } } /** * Returns a generator producing uniform random values between the * given least value (inclusive) and bound (exclusive) * @param least the least value returned * @param bound the upper bound (exclusive) of opd values */ public static DoubleGenerator doubleRandom(double least, double bound) { return new DoubleIntervalRandomGenerator(least, bound); } static final class DoubleIntervalRandomGenerator implements DoubleGenerator { final double least; final double range; DoubleIntervalRandomGenerator(double least, double bound) { this.least = least; this.range = bound - least; } public double op() { return ThreadLocalRandom.current().nextDouble() * range + least; } } /** * Returns a generator producing uniform random values with the * same properties as {@link java.util.Random#nextLong} */ public static LongGenerator longRandom() { return LongRandomGenerator.generator; } static final class LongRandomGenerator implements LongGenerator { static final LongRandomGenerator generator = new LongRandomGenerator(); public long op() { return ThreadLocalRandom.current().nextLong(); } } /** * Returns a generator producing uniform random values with the * same properties as {@link java.util.Random#nextInt(int)} * @param bound the upper bound (exclusive) of opd values */ public static LongGenerator longRandom(long bound) { if (bound <= 0) throw new IllegalArgumentException(); return new LongBoundedRandomGenerator(bound); } static final class LongBoundedRandomGenerator implements LongGenerator { final long bound; LongBoundedRandomGenerator(long bound) { this.bound = bound; } public long op() { return ThreadLocalRandom.current().nextLong(bound); } } /** * Returns a generator producing uniform random values between the * given least value (inclusive) and bound (exclusive). * @param least the least value returned * @param bound the upper bound (exclusive) of opd values */ public static LongGenerator longRandom(long least, long bound) { if (least >= bound) throw new IllegalArgumentException(); return new LongIntervalRandomGenerator(least, bound); } static final class LongIntervalRandomGenerator implements LongGenerator { final long least; final long range; LongIntervalRandomGenerator(long least, long bound) { this.least = least; this.range = bound - least; } public long op() { return ThreadLocalRandom.current().nextLong(range) + least; } } /** * Returns a generator producing uniform random values with the * same properties as {@link java.util.Random#nextInt} */ public static IntGenerator intRandom() { return IntRandomGenerator.generator; } static final class IntRandomGenerator implements IntGenerator { static final IntRandomGenerator generator = new IntRandomGenerator(); public int op() { return ThreadLocalRandom.current().nextInt(); } } /** * Returns a generator producing uniform random values with the * same properties as {@link java.util.Random#nextInt(int)} * @param bound the upper bound (exclusive) of opd values */ public static IntGenerator intRandom(int bound) { if (bound <= 0) throw new IllegalArgumentException(); return new IntBoundedRandomGenerator(bound); } static final class IntBoundedRandomGenerator implements IntGenerator { final int bound; IntBoundedRandomGenerator(int bound) { this.bound = bound; } public int op() { return ThreadLocalRandom.current().nextInt(bound); } } /** * Returns a generator producing uniform random values between the * given least value (inclusive) and bound (exclusive) * @param least the least value returned * @param bound the upper bound (exclusive) of opd values */ public static IntGenerator intRandom(int least, int bound) { if (least >= bound) throw new IllegalArgumentException(); return new IntIntervalRandomGenerator(least, bound); } static final class IntIntervalRandomGenerator implements IntGenerator { final int least; final int range; IntIntervalRandomGenerator(int least, int bound) { this.least = least; this.range = bound - least; } public int op() { return ThreadLocalRandom.current().nextInt(range) + least; } } /** * Returns a predicate evaluating to true if the * first argument equals the second */ public static BinaryPredicate equalityPredicate() { return EqualityPredicate.predicate; } static final class EqualityPredicate implements BinaryPredicate { static final EqualityPredicate predicate = new EqualityPredicate(); public final boolean op(Object x, Object y) { return x.equals(y); } } /** * Returns a predicate evaluating to true if the * first argument == the second */ public static BinaryPredicate identityPredicate() { return IdentityPredicate.predicate; } static final class IdentityPredicate implements BinaryPredicate { static final IdentityPredicate predicate = new IdentityPredicate(); public final boolean op(Object x, Object y) { return x == y; } } /** * Returns a predicate evaluating to true if the * first argument == the second */ public static BinaryIntPredicate intEqualityPredicate() { return IntEqualityPredicate.predicate; } static final class IntEqualityPredicate implements BinaryIntPredicate { static final IntEqualityPredicate predicate = new IntEqualityPredicate(); public final boolean op(int x, int y) { return x == y; } } /** * Returns a predicate evaluating to true if the * first argument == the second */ public static BinaryLongPredicate longEqualityPredicate() { return LongEqualityPredicate.predicate; } static final class LongEqualityPredicate implements BinaryLongPredicate { static final LongEqualityPredicate predicate = new LongEqualityPredicate(); public final boolean op(long x, long y) { return x == y; } } /** * Returns a predicate evaluating to true if the * first argument == the second */ public static BinaryDoublePredicate doubleEqualityPredicate() { return DoubleEqualityPredicate.predicate; } static final class DoubleEqualityPredicate implements BinaryDoublePredicate { static final DoubleEqualityPredicate predicate = new DoubleEqualityPredicate(); public final boolean op(double x, double y) { return x == y; } } /** * Returns a predicate evaluating to true if the * first argument !equals the second */ public static BinaryPredicate inequalityPredicate() { return InequalityPredicate.predicate; } static final class InequalityPredicate implements BinaryPredicate { static final InequalityPredicate predicate = new InequalityPredicate(); public final boolean op(Object x, Object y) { return !x.equals(y); } } /** * Returns a predicate evaluating to true if the * first argument != the second */ public static BinaryPredicate nonidentityPredicate() { return NonidentityPredicate.predicate; } static final class NonidentityPredicate implements BinaryPredicate { static final NonidentityPredicate predicate = new NonidentityPredicate(); public final boolean op(Object x, Object y) { return x != y; } } /** * Returns a predicate evaluating to true if the * first argument != the second */ public static BinaryIntPredicate intInequalityPredicate() { return IntInequalityPredicate.predicate; } static final class IntInequalityPredicate implements BinaryIntPredicate { static final IntInequalityPredicate predicate = new IntInequalityPredicate(); public final boolean op(int x, int y) { return x != y; } } /** * Returns a predicate evaluating to true if the * first argument == the second */ public static BinaryLongPredicate longInequalityPredicate() { return LongInequalityPredicate.predicate; } static final class LongInequalityPredicate implements BinaryLongPredicate { static final LongInequalityPredicate predicate = new LongInequalityPredicate(); public final boolean op(long x, long y) { return x != y; } } /** * Returns a predicate evaluating to true if the * first argument != the second */ public static BinaryDoublePredicate doubleInequalityPredicate() { return DoubleInequalityPredicate.predicate; } static final class DoubleInequalityPredicate implements BinaryDoublePredicate { static final DoubleInequalityPredicate predicate = new DoubleInequalityPredicate(); public final boolean op(double x, double y) { return x != y; } } } jsr166/src/extra166y/AbstractParallelAnyArray.java0000644000000000000000000110324311561242416017077 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * Abstract class serving as the basis of parallel * array classes across types. */ public abstract class AbstractParallelAnyArray { /* * This class and its subclasses (most of which are defined here * as nested static classes) maintain the execution parameters for * ParallelArray, ParallelDoubleArray, and ParallelLongArray * tasks. Pap instances hold the non-operation-specific control * and data accessors needed for a task as a whole (as opposed to * subtasks), and also house some of the leaf methods that perform * the actual array processing. The leaf methods are for the most * part just plain array operations. They are boringly repetitive * in order to flatten out and minimize inner-loop overhead, as * well as to minimize call-chain depth. This makes it more likely * that dynamic compilers can go the rest of the way, and hoist * per-element method call dispatch, so we have a good chance to * speed up processing via parallelism rather than lose due to * dispatch and indirection overhead. The dispatching from Pap to * FJ and back is otherwise Visitor-pattern-like, allowing the * basic parallelism control for most FJ tasks to be centralized. * * Note the extensive use of raw types. Arrays and generics do not * work together very well. It is more manageable to avoid them here, * and let the public classes perform casts in and out to the * processing here. Also note that the majority of code in concrete * classes is just for managing the various flavors created using * with* methods. * * Internal concrete classes are named using an * abbreviation scheme to avoid mile-long class names: * O, D, L for Object, Double, Long, for underlying Parallel array * U - unfiltered * F - filtered * R - relation-filtered (aka index-filtered) * OM, DM, LM - Mapped * OC, DC, LC - combiner-mapped (aka index-mapped) */ final ForkJoinPool ex; final int origin; int fence; int threshold; AbstractParallelAnyArray(ForkJoinPool ex, int origin, int fence) { this.ex = ex; this.origin = origin; this.fence = fence; } // A few public methods exported across all subclasses /** * Return the number of elements selected using bound or * filter restrictions. Note that this method must evaluate * all selectors to return its result. * @return the number of elements */ public int size() { if (!hasFilter()) return fence - origin; PAS.FJCountSelected f = new PAS.FJCountSelected (this, origin, fence, null); ex.invoke(f); return f.count; } /** * Returns the index of some element matching bound and filter * constraints, or -1 if none. * @return index of matching element, or -1 if none. */ public int anyIndex() { if (!hasFilter()) return (origin < fence) ? origin : -1; AtomicInteger result = new AtomicInteger(-1); PAS.FJSelectAny f = new PAS.FJSelectAny (this, origin, fence, null, result); ex.invoke(f); return result.get(); } /** * Returns true if there are no elements * @return true if there are no elements */ public boolean isEmpty() { return anyIndex() < 0; } /** * Returns size threshold for splitting into subtask. By * default, uses about 8 times as many tasks as threads */ final int computeThreshold() { int n = fence - origin; int p = ex.getParallelism(); return threshold = (p > 1) ? (1 + n / (p << 3)) : n; } /** * Returns lazily computed threshold. */ final int getThreshold() { int t = threshold; if (t == 0) t = computeThreshold(); return t; } /** * Access methods for ref, double, long. Checking for * null/false return is used as a sort of type test. These * are used to avoid duplication in non-performance-critical * aspects of control, as well as to provide a simple default * mechanism for extensions. */ Object[] ogetArray() { return null; } double[] dgetArray() { return null; } long[] lgetArray() { return null; } abstract Object oget(int index); abstract double dget(int index); abstract long lget(int index); boolean hasMap() { return false; } boolean hasFilter() { return false; } boolean isSelected(int index) { return true; } /* * Leaf methods for FJ tasks. Default versions use isSelected, * oget, dget, etc. But most are overridden in most concrete * classes to avoid per-element dispatching. */ void leafApply(int lo, int hi, Procedure procedure) { for (int i = lo; i < hi; ++i) if (isSelected(i)) procedure.op(oget(i)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { for (int i = lo; i < hi; ++i) if (isSelected(i)) procedure.op(dget(i)); } void leafApply(int lo, int hi, LongProcedure procedure) { for (int i = lo; i < hi; ++i) if (isSelected(i)) procedure.op(lget(i)); } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { boolean gotFirst = false; Object r = base; for (int i = lo; i < hi; ++i) { if (isSelected(i)) { Object x = oget(i); if (!gotFirst) { gotFirst = true; r = x; } else r = reducer.op(r, x); } } return r; } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { boolean gotFirst = false; double r = base; for (int i = lo; i < hi; ++i) { if (isSelected(i)) { double x = dget(i); if (!gotFirst) { gotFirst = true; r = x; } else r = reducer.op(r, x); } } return r; } long leafReduce(int lo, int hi, LongReducer reducer, long base) { boolean gotFirst = false; long r = base; for (int i = lo; i < hi; ++i) { if (isSelected(i)) { long x = lget(i); if (!gotFirst) { gotFirst = true; r = x; } else r = reducer.op(r, x); } } return r; } // copy elements, ignoring selector, but applying mapping void leafTransfer(int lo, int hi, Object[] dest, int offset) { for (int i = lo; i < hi; ++i) dest[offset++] = oget(i); } void leafTransfer(int lo, int hi, double[] dest, int offset) { for (int i = lo; i < hi; ++i) dest[offset++] = dget(i); } void leafTransfer(int lo, int hi, long[] dest, int offset) { for (int i = lo; i < hi; ++i) dest[offset++] = lget(i); } // copy elements indexed in indices[loIdx..hiIdx], ignoring // selector, but applying mapping void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, Object[] dest, int offset) { for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = oget(indices[i]); } void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, double[] dest, int offset) { for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = dget(indices[i]); } void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, long[] dest, int offset) { for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = lget(indices[i]); } // add indices of selected elements to index array; return #added final int leafIndexSelected(int lo, int hi, boolean positive, int[] indices) { int k = 0; for (int i = lo; i < hi; ++i) { if (isSelected(i) == positive) indices[lo + k++] = i; } return k; } // move selected elements to indices starting at offset, // return final offset abstract int leafMoveSelected(int lo, int hi, int offset, boolean positive); // move elements indexed by indices[loIdx...hiIdx] starting // at given offset abstract void leafMoveByIndex(int[] indices, int loIdx, int hiIdx, int offset); /** * Shared support for select/map all -- probe filter, map, and * type to start selection driver, or do parallel mapping, or * just copy, */ final Object[] allObjects(Class elementType) { if (hasFilter()) { if (elementType == null) { if (!hasMap()) elementType = ogetArray().getClass().getComponentType(); else elementType = Object.class; } PAS.FJOSelectAllDriver r = new PAS.FJOSelectAllDriver (this, elementType); ex.invoke(r); return r.results; } else { int n = fence - origin; Object[] dest; if (hasMap()) { if (elementType == null) dest = new Object[n]; else dest = (Object[])Array.newInstance(elementType, n); ex.invoke(new PAS.FJOMap(this, origin, fence, null, dest, -origin)); } else { Object[] array = ogetArray(); if (elementType == null) elementType = array.getClass().getComponentType(); dest = (Object[])Array.newInstance(elementType, n); System.arraycopy(array, origin, dest, 0, n); } return dest; } } final double[] allDoubles() { if (hasFilter()) { PAS.FJDSelectAllDriver r = new PAS.FJDSelectAllDriver(this); ex.invoke(r); return r.results; } else { int n = fence - origin; double[] dest = new double[n]; if (hasMap()) { ex.invoke(new PAS.FJDMap(this, origin, fence, null, dest, -origin)); } else { double[] array = dgetArray(); System.arraycopy(array, origin, dest, 0, n); } return dest; } } final long[] allLongs() { if (hasFilter()) { PAS.FJLSelectAllDriver r = new PAS.FJLSelectAllDriver(this); ex.invoke(r); return r.results; } else { int n = fence - origin; long[] dest = new long[n]; if (hasMap()) { ex.invoke(new PAS.FJLMap(this, origin, fence, null, dest, -origin)); } else { long[] array = lgetArray(); System.arraycopy(array, origin, dest, 0, n); } return dest; } } // Bounds check a range void boundsCheck(int lo, int hi) { if (lo > hi) throw new IllegalArgumentException(origin + " > " + fence); if (lo < 0) throw new ArrayIndexOutOfBoundsException(origin); if (hi - lo > this.fence - this.origin) throw new ArrayIndexOutOfBoundsException(fence); } /* * The following methods can be called only for classes * supporting in-place replacements (currently, those classes * without mappings). They are declared as no-ops here, and * overridden only where applicable. */ void leafTransform(int l, int h, Op op) {} void leafIndexMap(int l, int h, IntToObject op) {} void leafBinaryIndexMap(int l, int h, IntAndObjectToObject op) {} void leafGenerate(int l, int h, Generator generator) {} void leafFill(int l, int h, Object value) {} void leafCombineInPlace(int lo, int hi, Object[] other, int otherOffset, BinaryOp combiner) {} void leafCombineInPlace(int lo, int hi, ParallelArrayWithMapping other, int otherOffset, BinaryOp combiner) {} void leafTransform(int l, int h, DoubleOp op) {} void leafIndexMap(int l, int h, IntToDouble array) {} void leafBinaryIndexMap(int l, int h, IntAndDoubleToDouble op) {} void leafGenerate(int l, int h, DoubleGenerator generator) {} void leafFill(int l, int h, double value) {} void leafCombineInPlace(int lo, int hi, double[] other, int otherOffset, BinaryDoubleOp combiner) {} void leafCombineInPlace(int lo, int hi, ParallelDoubleArrayWithDoubleMapping other, int otherOffset, BinaryDoubleOp combiner) {} void leafTransform(int l, int h, LongOp op) {} void leafIndexMap(int l, int h, IntToLong array) {} void leafBinaryIndexMap(int l, int h, IntAndLongToLong op) {} void leafGenerate(int l, int h, LongGenerator generator) {} void leafFill(int l, int h, long value) {} void leafCombineInPlace(int lo, int hi, long[] other, int otherOffset, BinaryLongOp combiner) {} void leafCombineInPlace(int lo, int hi, ParallelLongArrayWithLongMapping other, int otherOffset, BinaryLongOp combiner) {} // Base of object ref array classes static abstract class OPap extends AbstractParallelAnyArray { T[] array; OPap(ForkJoinPool ex, int origin, int fence, T[] array) { super(ex, origin, fence); this.array = array; } final Object[] ogetArray() { return this.array; } double dget(int i) { return ((Number)oget(i)).doubleValue(); } long lget(int i) { return ((Number)oget(i)).longValue(); } final void leafMoveByIndex(int[] indices, int loIdx, int hiIdx, int offset) { final Object[] array = this.array; for (int i = loIdx; i < hiIdx; ++i) array[offset++] = array[indices[i]]; } final int leafMoveSelected(int lo, int hi, int offset, boolean positive) { final Object[] array = this.array; for (int i = lo; i < hi; ++i) { if (isSelected(i) == positive) array[offset++] = array[i]; } return offset; } } // Base of double array classes static abstract class DPap extends AbstractParallelAnyArray { double[] array; DPap(ForkJoinPool ex, int origin, int fence, double[] array) { super(ex, origin, fence); this.array = array; } final double[] dgetArray() { return this.array; } Object oget(int i) { return Double.valueOf(dget(i)); } long lget(int i) { return (long)(dget(i)); } final void leafMoveByIndex(int[] indices, int loIdx, int hiIdx, int offset) { final double[] array = this.array; for (int i = loIdx; i < hiIdx; ++i) array[offset++] = array[indices[i]]; } final int leafMoveSelected(int lo, int hi, int offset, boolean positive) { final double[] array = this.array; for (int i = lo; i < hi; ++i) { if (isSelected(i) == positive) array[offset++] = array[i]; } return offset; } } // Base of long array classes static abstract class LPap extends AbstractParallelAnyArray { long[] array; LPap(ForkJoinPool ex, int origin, int fence, long[] array) { super(ex, origin, fence); this.array = array; } final long[] lgetArray() { return this.array; } Object oget(int i) { return Long.valueOf(lget(i)); } double dget(int i) { return (double)(lget(i)); } final void leafMoveByIndex(int[] indices, int loIdx, int hiIdx, int offset) { final long[] array = this.array; for (int i = loIdx; i < hiIdx; ++i) array[offset++] = array[indices[i]]; } final int leafMoveSelected(int lo, int hi, int offset, boolean positive) { final long[] array = this.array; for (int i = lo; i < hi; ++i) { if (isSelected(i) == positive) array[offset++] = array[i]; } return offset; } } // Plain (unfiltered, unmapped) classes static class OUPap extends ParallelArrayWithBounds { OUPap(ForkJoinPool ex, int origin, int fence, T[] array) { super(ex, origin, fence, array); } public ParallelArrayWithBounds withBounds(int lo, int hi) { boundsCheck(lo, hi); return new OUPap(ex, origin + lo, origin + hi, array); } public ParallelArrayWithFilter withFilter (Predicate selector) { return new OFPap(ex, origin, fence, array, selector); } public ParallelArrayWithFilter withIndexedFilter (IntAndObjectPredicate selector) { return new ORPap(ex, origin, fence, array, selector); } public ParallelArrayWithMapping withMapping (Op op) { return new OUOMPap(ex, origin, fence, array, op); } public ParallelArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new OUDMPap(ex, origin, fence, array, op); } public ParallelArrayWithLongMapping withMapping (ObjectToLong op) { return new OULMPap(ex, origin, fence, array, op); } public ParallelArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new OUOCPap(ex, origin, fence, array, mapper); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new OUDCPap(ex, origin, fence, array, mapper); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new OULCPap(ex, origin, fence, array, mapper); } public int indexOf(T target) { AtomicInteger result = new AtomicInteger(-1); PAS.FJOIndexOf f = new PAS.FJOIndexOf (this, origin, fence, null, result, target); ex.invoke(f); return result.get(); } public int binarySearch(T target) { final Object[] a = this.array; int lo = origin; int hi = fence - 1; while (lo <= hi) { int mid = (lo + hi) >>> 1; int c = ((Comparable)target).compareTo((Comparable)a[mid]); if (c == 0) return mid; else if (c < 0) hi = mid - 1; else lo = mid + 1; } return -1; } public int binarySearch(T target, Comparator comparator) { Comparator cmp = comparator; final Object[] a = this.array; int lo = origin; int hi = fence - 1; while (lo <= hi) { int mid = (lo + hi) >>> 1; int c = cmp.compare(target, a[mid]); if (c == 0) return mid; else if (c < 0) hi = mid - 1; else lo = mid + 1; } return -1; } public ParallelArrayWithBounds cumulate(Reducer reducer, T base) { PAS.FJOCumulateOp op = new PAS.FJOCumulateOp(this, reducer, base); PAS.FJOScan r = new PAS.FJOScan(null, op, origin, fence); ex.invoke(r); return this; } public T precumulate(Reducer reducer, T base) { PAS.FJOPrecumulateOp op = new PAS.FJOPrecumulateOp (this, reducer, base); PAS.FJOScan r = new PAS.FJOScan(null, op, origin, fence); ex.invoke(r); return (T)(r.out); } public ParallelArrayWithBounds sort (Comparator cmp) { final Object[] a = this.array; Class tc = array.getClass().getComponentType(); T[] ws = (T[])Array.newInstance(tc, fence); ex.invoke(new PAS.FJOSorter (cmp, array, ws, origin, fence - origin, getThreshold())); return this; } public ParallelArrayWithBounds sort() { final Object[] a = this.array; Class tc = array.getClass().getComponentType(); if (!Comparable.class.isAssignableFrom(tc)) { sort(CommonOps.castedComparator()); } else { Comparable[] ca = (Comparable[])array; Comparable[] ws = (Comparable[])Array.newInstance(tc, fence); ex.invoke(new PAS.FJOCSorter (ca, ws, origin, fence - origin, getThreshold())); } return this; } final void leafApply(int lo, int hi, Procedure procedure) { final Object[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(a[i]); } final Object leafReduce(int lo, int hi, Reducer reducer, Object base) { if (lo >= hi) return base; final Object[] a = this.array; Object r = a[lo]; for (int i = lo+1; i < hi; ++i) r = reducer.op(r, a[i]); return r; } final void leafTransform(int l, int h, Op op) { final Object[] a = this.array; for (int i = l; i < h; ++i) a[i] = op.op(a[i]); } final void leafIndexMap(int l, int h, IntToObject op) { final Object[] a = this.array; for (int i = l; i < h; ++i) a[i] = op.op(i); } final void leafBinaryIndexMap(int l, int h, IntAndObjectToObject op) { final Object[] a = this.array; for (int i = l; i < h; ++i) a[i] = op.op(i, a[i]); } final void leafGenerate(int l, int h, Generator generator) { final Object[] a = this.array; for (int i = l; i < h; ++i) a[i] = generator.op(); } final void leafFill(int l, int h, Object value) { final Object[] a = this.array; for (int i = l; i < h; ++i) a[i] = value; } final void leafCombineInPlace(int l, int h, Object[] other, int otherOffset, BinaryOp combiner) { final Object[] a = this.array; int k = l + otherOffset; for (int i = l; i < h; ++i) a[i] = combiner.op(a[i], other[k++]); } final void leafCombineInPlace(int l, int h, ParallelArrayWithMapping other, int otherOffset, BinaryOp combiner) { final Object[] a = this.array; int k = l + otherOffset; if (other.hasFilter()) { for (int i = l; i < h; ++i) { if (other.isSelected(k)) a[i] = combiner.op(a[i], other.oget(k)); k++; } } else if (other.hasMap()) { for (int i = l; i < h; ++i) a[i] = combiner.op(a[i], other.oget(k++)); } else { Object[] b = other.array; for (int i = l; i < h; ++i) a[i] = combiner.op(a[i], b[k++]); } } } static class DUPap extends ParallelDoubleArrayWithBounds { DUPap(ForkJoinPool ex, int origin, int fence, double[] array) { super(ex, origin, fence, array); } public ParallelDoubleArrayWithBounds withBounds(int lo, int hi) { boundsCheck(lo, hi); return new DUPap(ex, origin + lo, origin + hi, array); } public ParallelDoubleArrayWithFilter withFilter(DoublePredicate selector) { return new DFPap(ex, origin, fence, array, selector); } public ParallelDoubleArrayWithFilter withIndexedFilter (IntAndDoublePredicate selector) { return new DRPap(ex, origin, fence, array, selector); } public ParallelDoubleArrayWithMapping withMapping (DoubleToObject op) { return new DUOMPap(ex, origin, fence, array, op); } public ParallelDoubleArrayWithDoubleMapping withMapping(DoubleOp op) { return new DUDMPap(ex, origin, fence, array, op); } public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) { return new DULMPap(ex, origin, fence, array, op); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new DUOCPap(ex, origin, fence, array, mapper); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new DUDCPap(ex, origin, fence, array, mapper); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new DULCPap(ex, origin, fence, array, mapper); } public int indexOf(double target) { AtomicInteger result = new AtomicInteger(-1); PAS.FJDIndexOf f = new PAS.FJDIndexOf (this, origin, fence, null, result, target); ex.invoke(f); return result.get(); } public int binarySearch(double target) { final double[] a = this.array; int lo = origin; int hi = fence - 1; while (lo <= hi) { int mid = (lo + hi) >>> 1; double m = a[mid]; if (target == m) return mid; else if (target < m) hi = mid - 1; else lo = mid + 1; } return -1; } public int binarySearch(double target, DoubleComparator comparator) { final double[] a = this.array; int lo = origin; int hi = fence - 1; while (lo <= hi) { int mid = (lo + hi) >>> 1; int c = comparator.compare(target, a[mid]); if (c == 0) return mid; else if (c < 0) hi = mid - 1; else lo = mid + 1; } return -1; } public ParallelDoubleArrayWithBounds cumulate(DoubleReducer reducer, double base) { PAS.FJDCumulateOp op = new PAS.FJDCumulateOp(this, reducer, base); PAS.FJDScan r = new PAS.FJDScan(null, op, origin, fence); ex.invoke(r); return this; } public ParallelDoubleArrayWithBounds cumulateSum() { PAS.FJDCumulatePlusOp op = new PAS.FJDCumulatePlusOp(this); PAS.FJDScan r = new PAS.FJDScan(null, op, origin, fence); ex.invoke(r); return this; } public double precumulate(DoubleReducer reducer, double base) { PAS.FJDPrecumulateOp op = new PAS.FJDPrecumulateOp(this, reducer, base); PAS.FJDScan r = new PAS.FJDScan(null, op, origin, fence); ex.invoke(r); return r.out; } public double precumulateSum() { PAS.FJDPrecumulatePlusOp op = new PAS.FJDPrecumulatePlusOp(this); PAS.FJDScan r = new PAS.FJDScan(null, op, origin, fence); ex.invoke(r); return r.out; } public ParallelDoubleArrayWithBounds sort(DoubleComparator cmp) { ex.invoke(new PAS.FJDSorter (cmp, this.array, new double[fence], origin, fence - origin, getThreshold())); return this; } public ParallelDoubleArrayWithBounds sort() { ex.invoke(new PAS.FJDCSorter (this.array, new double[fence], origin, fence - origin, getThreshold())); return this; } final void leafApply(int lo, int hi, DoubleProcedure procedure) { final double[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(a[i]); } final double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { if (lo >= hi) return base; final double[] a = this.array; double r = a[lo]; for (int i = lo+1; i < hi; ++i) r = reducer.op(r, a[i]); return r; } final void leafTransform(int l, int h, DoubleOp op) { final double[] a = this.array; for (int i = l; i < h; ++i) a[i] = op.op(a[i]); } final void leafIndexMap(int l, int h, IntToDouble op) { final double[] a = this.array; for (int i = l; i < h; ++i) a[i] = op.op(i); } final void leafBinaryIndexMap(int l, int h, IntAndDoubleToDouble op) { final double[] a = this.array; for (int i = l; i < h; ++i) a[i] = op.op(i, a[i]); } final void leafGenerate(int l, int h, DoubleGenerator generator) { final double[] a = this.array; for (int i = l; i < h; ++i) a[i] = generator.op(); } final void leafFill(int l, int h, double value) { final double[] a = this.array; for (int i = l; i < h; ++i) a[i] = value; } final void leafCombineInPlace (int l, int h, double[] other, int otherOffset, BinaryDoubleOp combiner) { final double[] a = this.array; int k = l + otherOffset; for (int i = l; i < h; ++i) a[i] = combiner.op(a[i], other[k++]); } final void leafCombineInPlace (int l, int h, ParallelDoubleArrayWithDoubleMapping other, int otherOffset, BinaryDoubleOp combiner) { final double[] a = this.array; int k = l + otherOffset; if (other.hasFilter()) { for (int i = l; i < h; ++i) { if (other.isSelected(k)) a[i] = combiner.op(a[i], other.dget(k)); k++; } } else if (other.hasMap()) { for (int i = l; i < h; ++i) a[i] = combiner.op(a[i], other.dget(k++)); } else { double[] b = other.array; for (int i = l; i < h; ++i) a[i] = combiner.op(a[i], b[k++]); } } } static class LUPap extends ParallelLongArrayWithBounds { LUPap(ForkJoinPool ex, int origin, int fence, long[] array) { super(ex, origin, fence, array); } public ParallelLongArrayWithBounds withBounds(int lo, int hi) { boundsCheck(lo, hi); return new LUPap(ex, origin + lo, origin + hi, array); } public ParallelLongArrayWithFilter withFilter(LongPredicate selector) { return new LFPap(ex, origin, fence, array, selector); } public ParallelLongArrayWithFilter withIndexedFilter (IntAndLongPredicate selector) { return new LRPap(ex, origin, fence, array, selector); } public ParallelLongArrayWithMapping withMapping (LongToObject op) { return new LUOMPap(ex, origin, fence, array, op); } public ParallelLongArrayWithLongMapping withMapping(LongOp op) { return new LULMPap(ex, origin, fence, array, op); } public ParallelLongArrayWithDoubleMapping withMapping(LongToDouble op) { return new LUDMPap(ex, origin, fence, array, op); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new LUOCPap(ex, origin, fence, array, mapper); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new LUDCPap(ex, origin, fence, array, mapper); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new LULCPap(ex, origin, fence, array, mapper); } public int indexOf(long target) { AtomicInteger result = new AtomicInteger(-1); PAS.FJLIndexOf f = new PAS.FJLIndexOf (this, origin, fence, null, result, target); ex.invoke(f); return result.get(); } public int binarySearch(long target) { final long[] a = this.array; int lo = origin; int hi = fence - 1; while (lo <= hi) { int mid = (lo + hi) >>> 1; long m = a[mid]; if (target == m) return mid; else if (target < m) hi = mid - 1; else lo = mid + 1; } return -1; } public int binarySearch(long target, LongComparator comparator) { final long[] a = this.array; int lo = origin; int hi = fence - 1; while (lo <= hi) { int mid = (lo + hi) >>> 1; int c = comparator.compare(target, a[mid]); if (c == 0) return mid; else if (c < 0) hi = mid - 1; else lo = mid + 1; } return -1; } public ParallelLongArrayWithBounds cumulate(LongReducer reducer, long base) { PAS.FJLCumulateOp op = new PAS.FJLCumulateOp(this, reducer, base); PAS.FJLScan r = new PAS.FJLScan(null, op, origin, fence); ex.invoke(r); return this; } public ParallelLongArrayWithBounds cumulateSum() { PAS.FJLCumulatePlusOp op = new PAS.FJLCumulatePlusOp(this); PAS.FJLScan r = new PAS.FJLScan(null, op, origin, fence); ex.invoke(r); return this; } public long precumulate(LongReducer reducer, long base) { PAS.FJLPrecumulateOp op = new PAS.FJLPrecumulateOp (this, reducer, base); PAS.FJLScan r = new PAS.FJLScan(null, op, origin, fence); ex.invoke(r); return r.out; } public long precumulateSum() { PAS.FJLPrecumulatePlusOp op = new PAS.FJLPrecumulatePlusOp(this); PAS.FJLScan r = new PAS.FJLScan(null, op, origin, fence); ex.invoke(r); return r.out; } public ParallelLongArrayWithBounds sort(LongComparator cmp) { ex.invoke(new PAS.FJLSorter (cmp, this.array, new long[fence], origin, fence - origin, getThreshold())); return this; } public ParallelLongArrayWithBounds sort() { ex.invoke(new PAS.FJLCSorter (this.array, new long[fence], origin, fence - origin, getThreshold())); return this; } final void leafApply(int lo, int hi, LongProcedure procedure) { final long[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(a[i]); } final long leafReduce(int lo, int hi, LongReducer reducer, long base) { if (lo >= hi) return base; final long[] a = this.array; long r = a[lo]; for (int i = lo+1; i < hi; ++i) r = reducer.op(r, a[i]); return r; } final void leafTransform(int l, int h, LongOp op) { final long[] a = this.array; for (int i = l; i < h; ++i) a[i] = op.op(a[i]); } final void leafIndexMap(int l, int h, IntToLong op) { final long[] a = this.array; for (int i = l; i < h; ++i) a[i] = op.op(i); } final void leafBinaryIndexMap(int l, int h, IntAndLongToLong op) { final long[] a = this.array; for (int i = l; i < h; ++i) a[i] = op.op(i, a[i]); } final void leafGenerate(int l, int h, LongGenerator generator) { final long[] a = this.array; for (int i = l; i < h; ++i) a[i] = generator.op(); } final void leafFill(int l, int h, long value) { final long[] a = this.array; for (int i = l; i < h; ++i) a[i] = value; } final void leafCombineInPlace (int l, int h, long[] other, int otherOffset, BinaryLongOp combiner) { final long[] a = this.array; int k = l + otherOffset; for (int i = l; i < h; ++i) a[i] = combiner.op(a[i], other[k++]); } final void leafCombineInPlace (int l, int h, ParallelLongArrayWithLongMapping other, int otherOffset, BinaryLongOp combiner) { final long[] a = this.array; int k = l + otherOffset; if (other.hasFilter()) { for (int i = l; i < h; ++i) { if (other.isSelected(k)) a[i] = combiner.op(a[i], other.lget(k)); k++; } } else if (other.hasMap()) { for (int i = l; i < h; ++i) a[i] = combiner.op(a[i], other.lget(k++)); } else { long[] b = other.array; for (int i = l; i < h; ++i) a[i] = combiner.op(a[i], b[k++]); } } } static final class AndPredicate implements Predicate { final Predicate first; final Predicate second; AndPredicate(Predicate first, Predicate second) { this.first = first; this.second = second; } public final boolean op(T x) { return first.op(x) && second.op(x); } } // Filtered (but unmapped) classes static final class OFPap extends ParallelArrayWithFilter { final Predicate selector; OFPap(ForkJoinPool ex, int origin, int fence, T[] array, Predicate selector) { super(ex, origin, fence, array); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelArrayWithFilter withFilter (Predicate selector) { return new OFPap(ex, origin, fence, array, new AndPredicate(this.selector, selector)); } public ParallelArrayWithFilter withIndexedFilter (IntAndObjectPredicate selector) { return new ORPap (ex, origin, fence, array, compoundIndexedSelector(this.selector, selector)); } public ParallelArrayWithMapping withMapping (Op op) { return new OFOMPap(ex, origin, fence, array, selector, op); } public ParallelArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new OFDMPap(ex, origin, fence, array, selector, op); } public ParallelArrayWithLongMapping withMapping (ObjectToLong op) { return new OFLMPap(ex, origin, fence, array, selector, op); } public ParallelArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new OFOCPap(ex, origin, fence, array, selector, mapper); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new OFDCPap(ex, origin, fence, array, selector, mapper); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new OFLCPap(ex, origin, fence, array, selector, mapper); } void leafApply(int lo, int hi, Procedure procedure) { final Predicate s = selector; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(x)) procedure.op(x); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final Predicate s = selector; boolean gotFirst = false; Object r = base; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(x)) { if (!gotFirst) { gotFirst = true; r = x; } else r = reducer.op(r, x); } } return r; } final void leafTransform(int l, int h, Op op) { final Object[] a = this.array; final Predicate s = selector; for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(x)) a[i] = op.op(x); } } final void leafIndexMap(int l, int h, IntToObject op) { final Object[] a = this.array; final Predicate s = selector; for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(x)) a[i] = op.op(i); } } final void leafBinaryIndexMap(int l, int h, IntAndObjectToObject op) { final Object[] a = this.array; final Predicate s = selector; for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(x)) a[i] = op.op(i, x); } } final void leafGenerate(int l, int h, Generator generator) { final Object[] a = this.array; final Predicate s = selector; for (int i = l; i < h; ++i) { if (s.op(a[i])) a[i] = generator.op(); } } final void leafFill(int l, int h, Object value) { final Object[] a = this.array; final Predicate s = selector; for (int i = l; i < h; ++i) { if (s.op(a[i])) a[i] = value; } } final void leafCombineInPlace (int l, int h, Object[] other, int otherOffset, BinaryOp combiner) { final Object[] a = this.array; final Predicate s = selector; int k = l + otherOffset; for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(x)) a[i] = combiner.op(x, other[k]); k++; } } final void leafCombineInPlace (int l, int h, ParallelArrayWithMapping other, int otherOffset, BinaryOp combiner) { final Object[] a = this.array; final Predicate s = selector; int k = l + otherOffset; if (other.hasFilter()) { for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(x) && other.isSelected(k)) a[i] = combiner.op(x, other.oget(k)); k++; } } else if (other.hasMap()) { for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(x)) a[i] = combiner.op(x, other.oget(k)); k++; } } else { Object[] b = other.array; for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(x)) a[i] = combiner.op(x, b[k]); k++; } } } } static final class DFPap extends ParallelDoubleArrayWithFilter { final DoublePredicate selector; DFPap(ForkJoinPool ex, int origin, int fence, double[] array, DoublePredicate selector) { super(ex, origin, fence, array); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelDoubleArrayWithFilter withFilter(DoublePredicate selector) { return new DFPap(ex, origin, fence, array, CommonOps.andPredicate(this.selector, selector)); } public ParallelDoubleArrayWithFilter withIndexedFilter (IntAndDoublePredicate selector) { return new DRPap (ex, origin, fence, array, compoundIndexedSelector(this.selector, selector)); } public ParallelDoubleArrayWithMapping withMapping (DoubleToObject op) { return new DFOMPap(ex, origin, fence, array, selector, op); } public ParallelDoubleArrayWithDoubleMapping withMapping(DoubleOp op) { return new DFDMPap(ex, origin, fence, array, selector, op); } public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) { return new DFLMPap(ex, origin, fence, array, selector, op); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new DFOCPap(ex, origin, fence, array, selector, mapper); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new DFDCPap(ex, origin, fence, array, selector, mapper); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new DFLCPap(ex, origin, fence, array, selector, mapper); } final void leafApply(int lo, int hi, DoubleProcedure procedure) { final DoublePredicate s = selector; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(x)) procedure.op(x); } } final double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final DoublePredicate s = selector; boolean gotFirst = false; double r = base; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(x)) { if (!gotFirst) { gotFirst = true; r = x; } else r = reducer.op(r, x); } } return r; } final void leafTransform(int l, int h, DoubleOp op) { final double[] a = this.array; final DoublePredicate s = selector; for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(x)) a[i] = op.op(x); } } final void leafIndexMap(int l, int h, IntToDouble op) { final double[] a = this.array; final DoublePredicate s = selector; for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(x)) a[i] = op.op(i); } } final void leafBinaryIndexMap(int l, int h, IntAndDoubleToDouble op) { final double[] a = this.array; final DoublePredicate s = selector; for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(x)) a[i] = op.op(i, x); } } final void leafGenerate(int l, int h, DoubleGenerator generator) { final double[] a = this.array; final DoublePredicate s = selector; for (int i = l; i < h; ++i) { if (s.op(a[i])) a[i] = generator.op(); } } final void leafFill(int l, int h, double value) { final double[] a = this.array; final DoublePredicate s = selector; for (int i = l; i < h; ++i) { if (s.op(a[i])) a[i] = value; } } final void leafCombineInPlace (int l, int h, double[] other, int otherOffset, BinaryDoubleOp combiner) { final double[] a = this.array; final DoublePredicate s = selector; int k = l + otherOffset; for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(x)) a[i] = combiner.op(x, other[k]); k++; } } final void leafCombineInPlace (int l, int h, ParallelDoubleArrayWithDoubleMapping other, int otherOffset, BinaryDoubleOp combiner) { final double[] a = this.array; final DoublePredicate s = selector; int k = l + otherOffset; if (other.hasFilter()) { for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(x) && other.isSelected(k)) a[i] = combiner.op(x, other.dget(k)); k++; } } else if (other.hasMap()) { for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(x)) a[i] = combiner.op(x, other.dget(k)); k++; } } else { double[] b = other.array; for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(x)) a[i] = combiner.op(x, b[k]); k++; } } } } static final class LFPap extends ParallelLongArrayWithFilter { final LongPredicate selector; LFPap(ForkJoinPool ex, int origin, int fence, long[] array, LongPredicate selector) { super(ex, origin, fence, array); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelLongArrayWithFilter withFilter(LongPredicate selector) { return new LFPap(ex, origin, fence, array, CommonOps.andPredicate(this.selector, selector)); } public ParallelLongArrayWithFilter withIndexedFilter (IntAndLongPredicate selector) { return new LRPap (ex, origin, fence, array, compoundIndexedSelector(this.selector, selector)); } public ParallelLongArrayWithMapping withMapping (LongToObject op) { return new LFOMPap(ex, origin, fence, array, selector, op); } public ParallelLongArrayWithLongMapping withMapping (LongOp op) { return new LFLMPap(ex, origin, fence, array, selector, op); } public ParallelLongArrayWithDoubleMapping withMapping (LongToDouble op) { return new LFDMPap(ex, origin, fence, array, selector, op); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new LFOCPap(ex, origin, fence, array, selector, mapper); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new LFDCPap(ex, origin, fence, array, selector, mapper); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new LFLCPap(ex, origin, fence, array, selector, mapper); } final void leafApply(int lo, int hi, LongProcedure procedure) { final LongPredicate s = selector; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(x)) procedure.op(x); } } final long leafReduce(int lo, int hi, LongReducer reducer, long base) { final LongPredicate s = selector; boolean gotFirst = false; long r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(x)) { if (!gotFirst) { gotFirst = true; r = x; } else r = reducer.op(r, x); } } return r; } final void leafTransform(int l, int h, LongOp op) { final long[] a = this.array; final LongPredicate s = selector; for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(x)) a[i] = op.op(x); } } final void leafIndexMap(int l, int h, IntToLong op) { final long[] a = this.array; final LongPredicate s = selector; for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(x)) a[i] = op.op(i); } } final void leafBinaryIndexMap(int l, int h, IntAndLongToLong op) { final long[] a = this.array; final LongPredicate s = selector; for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(x)) a[i] = op.op(i, x); } } final void leafGenerate(int l, int h, LongGenerator generator) { final long[] a = this.array; final LongPredicate s = selector; for (int i = l; i < h; ++i) { if (s.op(a[i])) a[i] = generator.op(); } } final void leafFill(int l, int h, long value) { final long[] a = this.array; final LongPredicate s = selector; for (int i = l; i < h; ++i) { if (s.op(a[i])) a[i] = value; } } final void leafCombineInPlace (int l, int h, long[] other, int otherOffset, BinaryLongOp combiner) { final long[] a = this.array; final LongPredicate s = selector; int k = l + otherOffset; for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(x)) a[i] = combiner.op(x, other[k]); k++; } } final void leafCombineInPlace (int l, int h, ParallelLongArrayWithLongMapping other, int otherOffset, BinaryLongOp combiner) { final long[] a = this.array; final LongPredicate s = selector; int k = l + otherOffset; if (other.hasFilter()) { for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(x) && other.isSelected(k)) a[i] = combiner.op(x, other.lget(k)); k++; } } else if (other.hasMap()) { for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(x)) a[i] = combiner.op(x, other.lget(k)); k++; } } else { long[] b = other.array; for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(x)) a[i] = combiner.op(x, b[k]); k++; } } } } // Relationally Filtered (but unmapped) classes static final class ORPap extends ParallelArrayWithFilter { final IntAndObjectPredicate selector; ORPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectPredicate selector) { super(ex, origin, fence, array); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelArrayWithFilter withFilter (Predicate selector) { return new ORPap (ex, origin, fence, array, compoundIndexedSelector(this.selector, selector)); } public ParallelArrayWithFilter withIndexedFilter (IntAndObjectPredicate selector) { return new ORPap (ex, origin, fence, array, compoundIndexedSelector(this.selector, selector)); } public ParallelArrayWithMapping withMapping (Op op) { return new OROMPap(ex, origin, fence, array, selector, op); } public ParallelArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new ORDMPap(ex, origin, fence, array, selector, op); } public ParallelArrayWithLongMapping withMapping (ObjectToLong op) { return new ORLMPap(ex, origin, fence, array, selector, op); } public ParallelArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new OROCPap(ex, origin, fence, array, selector, mapper); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new ORDCPap(ex, origin, fence, array, selector, mapper); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new ORLCPap(ex, origin, fence, array, selector, mapper); } void leafApply(int lo, int hi, Procedure procedure) { final IntAndObjectPredicate s = selector; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(i, x)) procedure.op(x); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final IntAndObjectPredicate s = selector; boolean gotFirst = false; Object r = base; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(i, x)) { if (!gotFirst) { gotFirst = true; r = x; } else r = reducer.op(r, x); } } return r; } final void leafTransform(int l, int h, Op op) { final Object[] a = this.array; final IntAndObjectPredicate s = selector; for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(i, x)) a[i] = op.op(x); } } final void leafIndexMap(int l, int h, IntToObject op) { final Object[] a = this.array; final IntAndObjectPredicate s = selector; for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(i, x)) a[i] = op.op(i); } } final void leafBinaryIndexMap(int l, int h, IntAndObjectToObject op) { final Object[] a = this.array; final IntAndObjectPredicate s = selector; for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(i, x)) a[i] = op.op(i, x); } } final void leafGenerate(int l, int h, Generator generator) { final Object[] a = this.array; final IntAndObjectPredicate s = selector; for (int i = l; i < h; ++i) { if (s.op(i, a[i])) a[i] = generator.op(); } } final void leafFill(int l, int h, Object value) { final Object[] a = this.array; final IntAndObjectPredicate s = selector; for (int i = l; i < h; ++i) { if (s.op(i, a[i])) a[i] = value; } } final void leafCombineInPlace (int l, int h, Object[] other, int otherOffset, BinaryOp combiner) { final Object[] a = this.array; final IntAndObjectPredicate s = selector; int k = l + otherOffset; for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(i, x)) a[i] = combiner.op(x, other[k]); k++; } } final void leafCombineInPlace (int l, int h, ParallelArrayWithMapping other, int otherOffset, BinaryOp combiner) { final Object[] a = this.array; final IntAndObjectPredicate s = selector; int k = l + otherOffset; if (other.hasFilter()) { for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(i, x) && other.isSelected(k)) a[i] = combiner.op(x, other.oget(k)); k++; } } else if (other.hasMap()) { for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(i, x)) a[i] = combiner.op(x, other.oget(k)); k++; } } else { Object[] b = other.array; for (int i = l; i < h; ++i) { Object x = a[i]; if (s.op(i, x)) a[i] = combiner.op(x, b[k]); k++; } } } } static final class DRPap extends ParallelDoubleArrayWithFilter { final IntAndDoublePredicate selector; DRPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoublePredicate selector) { super(ex, origin, fence, array); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelDoubleArrayWithFilter withFilter (DoublePredicate selector) { return new DRPap (ex, origin, fence, array, compoundIndexedSelector(this.selector, selector)); } public ParallelDoubleArrayWithFilter withIndexedFilter (IntAndDoublePredicate selector) { return new DRPap (ex, origin, fence, array, compoundIndexedSelector(this.selector, selector)); } public ParallelDoubleArrayWithMapping withMapping (DoubleToObject op) { return new DROMPap(ex, origin, fence, array, selector, op); } public ParallelDoubleArrayWithDoubleMapping withMapping(DoubleOp op) { return new DRDMPap(ex, origin, fence, array, selector, op); } public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) { return new DRLMPap(ex, origin, fence, array, selector, op); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new DROCPap(ex, origin, fence, array, selector, mapper); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new DRDCPap(ex, origin, fence, array, selector, mapper); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new DRLCPap(ex, origin, fence, array, selector, mapper); } final void leafApply(int lo, int hi, DoubleProcedure procedure) { final IntAndDoublePredicate s = selector; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(i, x)) procedure.op(x); } } final double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final IntAndDoublePredicate s = selector; boolean gotFirst = false; double r = base; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(i, x)) { if (!gotFirst) { gotFirst = true; r = x; } else r = reducer.op(r, x); } } return r; } final void leafTransform(int l, int h, DoubleOp op) { final double[] a = this.array; final IntAndDoublePredicate s = selector; for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(i, x)) a[i] = op.op(x); } } final void leafIndexMap(int l, int h, IntToDouble op) { final double[] a = this.array; final IntAndDoublePredicate s = selector; for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(i, x)) a[i] = op.op(i); } } final void leafBinaryIndexMap(int l, int h, IntAndDoubleToDouble op) { final double[] a = this.array; final IntAndDoublePredicate s = selector; for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(i, x)) a[i] = op.op(i, x); } } final void leafGenerate(int l, int h, DoubleGenerator generator) { final double[] a = this.array; final IntAndDoublePredicate s = selector; for (int i = l; i < h; ++i) { if (s.op(i, a[i])) a[i] = generator.op(); } } final void leafFill(int l, int h, double value) { final double[] a = this.array; final IntAndDoublePredicate s = selector; for (int i = l; i < h; ++i) { if (s.op(i, a[i])) a[i] = value; } } final void leafCombineInPlace (int l, int h, double[] other, int otherOffset, BinaryDoubleOp combiner) { final double[] a = this.array; final IntAndDoublePredicate s = selector; int k = l + otherOffset; for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(i, x)) a[i] = combiner.op(x, other[k]); k++; } } final void leafCombineInPlace (int l, int h, ParallelDoubleArrayWithDoubleMapping other, int otherOffset, BinaryDoubleOp combiner) { final double[] a = this.array; final IntAndDoublePredicate s = selector; int k = l + otherOffset; if (other.hasFilter()) { for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(i, x) && other.isSelected(k)) a[i] = combiner.op(x, other.dget(k)); k++; } } else if (other.hasMap()) { for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(i, x)) a[i] = combiner.op(x, other.dget(k)); k++; } } else { double[] b = other.array; for (int i = l; i < h; ++i) { double x = a[i]; if (s.op(i, x)) a[i] = combiner.op(x, b[k]); k++; } } } } static final class LRPap extends ParallelLongArrayWithFilter { final IntAndLongPredicate selector; LRPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongPredicate selector) { super(ex, origin, fence, array); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelLongArrayWithFilter withFilter(LongPredicate selector) { return new LRPap(ex, origin, fence, array, compoundIndexedSelector(this.selector, selector)); } public ParallelLongArrayWithFilter withIndexedFilter (IntAndLongPredicate selector) { return new LRPap (ex, origin, fence, array, compoundIndexedSelector(this.selector, selector)); } public ParallelLongArrayWithMapping withMapping (LongToObject op) { return new LROMPap(ex, origin, fence, array, selector, op); } public ParallelLongArrayWithLongMapping withMapping (LongOp op) { return new LRLMPap(ex, origin, fence, array, selector, op); } public ParallelLongArrayWithDoubleMapping withMapping (LongToDouble op) { return new LRDMPap(ex, origin, fence, array, selector, op); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new LROCPap(ex, origin, fence, array, selector, mapper); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new LRDCPap(ex, origin, fence, array, selector, mapper); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new LRLCPap(ex, origin, fence, array, selector, mapper); } final void leafApply(int lo, int hi, LongProcedure procedure) { final IntAndLongPredicate s = selector; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(i, x)) procedure.op(x); } } final long leafReduce(int lo, int hi, LongReducer reducer, long base) { final IntAndLongPredicate s = selector; boolean gotFirst = false; long r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(i, x)) { if (!gotFirst) { gotFirst = true; r = x; } else r = reducer.op(r, x); } } return r; } final void leafTransform(int l, int h, LongOp op) { final long[] a = this.array; final IntAndLongPredicate s = selector; for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(i, x)) a[i] = op.op(x); } } final void leafIndexMap(int l, int h, IntToLong op) { final long[] a = this.array; final IntAndLongPredicate s = selector; for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(i, x)) a[i] = op.op(i); } } final void leafBinaryIndexMap(int l, int h, IntAndLongToLong op) { final long[] a = this.array; final IntAndLongPredicate s = selector; for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(i, x)) a[i] = op.op(i, x); } } final void leafGenerate(int l, int h, LongGenerator generator) { final long[] a = this.array; final IntAndLongPredicate s = selector; for (int i = l; i < h; ++i) { if (s.op(i, a[i])) a[i] = generator.op(); } } final void leafFill(int l, int h, long value) { final long[] a = this.array; final IntAndLongPredicate s = selector; for (int i = l; i < h; ++i) { if (s.op(i, a[i])) a[i] = value; } } final void leafCombineInPlace (int l, int h, long[] other, int otherOffset, BinaryLongOp combiner) { final long[] a = this.array; final IntAndLongPredicate s = selector; int k = l + otherOffset; for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(i, x)) a[i] = combiner.op(x, other[k]); k++; } } final void leafCombineInPlace (int l, int h, ParallelLongArrayWithLongMapping other, int otherOffset, BinaryLongOp combiner) { final long[] a = this.array; final IntAndLongPredicate s = selector; int k = l + otherOffset; if (other.hasFilter()) { for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(i, x) && other.isSelected(k)) a[i] = combiner.op(x, other.lget(k)); k++; } } else if (other.hasMap()) { for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(i, x)) a[i] = combiner.op(x, other.lget(k)); k++; } } else { long[] b = other.array; for (int i = l; i < h; ++i) { long x = a[i]; if (s.op(i, x)) a[i] = combiner.op(x, b[k]); k++; } } } } // Object-mapped static abstract class OOMPap extends ParallelArrayWithMapping { final Op op; OOMPap(ForkJoinPool ex, int origin, int fence, T[] array, Op op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final Object oget(int i) { return op.op(this.array[i]); } final double dget(int i) { return ((Number)oget(i)).doubleValue(); } final long lget(int i) { return ((Number)oget(i)).longValue(); } final void leafTransfer(int lo, int hi, Object[] dest, int offset) { final Op f = op; final Object[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, Object[] dest, int offset) { final Object[] a = this.array; final Op f = op; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = f.op(a[indices[i]]); } } static abstract class DOMPap extends ParallelDoubleArrayWithMapping { final DoubleToObject op; DOMPap(ForkJoinPool ex, int origin, int fence, double[] array, DoubleToObject op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final Object oget(int i) { return op.op(this.array[i]); } final double dget(int i) { return ((Number)oget(i)).doubleValue(); } final long lget(int i) { return ((Number)oget(i)).longValue(); } final void leafTransfer(int lo, int hi, Object[] dest, int offset) { final double[] a = this.array; final DoubleToObject f = op; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, Object[] dest, int offset) { final double[] a = this.array; final DoubleToObject f = op; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = f.op(a[indices[i]]); } } static abstract class LOMPap extends ParallelLongArrayWithMapping { final LongToObject op; LOMPap(ForkJoinPool ex, int origin, int fence, long[] array, LongToObject op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final Object oget(int i) { return op.op(this.array[i]); } final double dget(int i) { return ((Number)oget(i)).doubleValue(); } final long lget(int i) { return ((Number)oget(i)).longValue(); } final void leafTransfer(int lo, int hi, Object[] dest, int offset) { final long[] a = this.array; final LongToObject f = op; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, Object[] dest, int offset) { final long[] a = this.array; final LongToObject f = op; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = f.op(a[indices[i]]); } } // Object mapped, unfiltered static final class OUOMPap extends OOMPap { OUOMPap(ForkJoinPool ex, int origin, int fence, T[] array, Op op) { super(ex, origin, fence, array, op); } public ParallelArrayWithMapping withMapping (Op op) { return new OUOMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new OUDMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping (ObjectToLong op) { return new OULMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new OUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new OUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new OULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final Op f = op; final Object[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(a[i])); } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { if (lo >= hi) return base; final Object[] a = this.array; final Op f = op; Object r = f.op(a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(a[i])); return r; } } static final class DUOMPap extends DOMPap { DUOMPap(ForkJoinPool ex, int origin, int fence, double[] array, DoubleToObject op) { super(ex, origin, fence, array, op); } public ParallelDoubleArrayWithMapping withMapping (Op op) { return new DUOMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new DUDMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping (ObjectToLong op) { return new DULMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new DUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new DUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new DULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final double[] a = this.array; final DoubleToObject f = op; for (int i = lo; i < hi; ++i) procedure.op(f.op(a[i])); } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { if (lo >= hi) return base; final double[] a = this.array; final DoubleToObject f = op; Object r = f.op(a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(a[i])); return r; } } static final class LUOMPap extends LOMPap { LUOMPap(ForkJoinPool ex, int origin, int fence, long[] array, LongToObject op) { super(ex, origin, fence, array, op); } public ParallelLongArrayWithMapping withMapping (Op op) { return new LUOMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping (ObjectToLong op) { return new LULMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new LUDMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new LUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new LUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new LULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final long[] a = this.array; final LongToObject f = op; for (int i = lo; i < hi; ++i) procedure.op(f.op(a[i])); } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { if (lo >= hi) return base; final long[] a = this.array; final LongToObject f = op; Object r = f.op(a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(a[i])); return r; } } // Object-mapped, filtered static final class OFOMPap extends OOMPap { final Predicate selector; OFOMPap(ForkJoinPool ex, int origin, int fence, T[] array, Predicate selector, Op op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelArrayWithMapping withMapping (Op op) { return new OFOMPap (ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new OFDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping (ObjectToLong op) { return new OFLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new OFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new OFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new OFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final Predicate s = selector; final Object[] a = this.array; final Op f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(x)) procedure.op(f.op(x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final Predicate s = selector; final Object[] a = this.array; final Op f = op; boolean gotFirst = false; Object r = base; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(x)) { Object y = f.op(x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DFOMPap extends DOMPap { final DoublePredicate selector; DFOMPap(ForkJoinPool ex, int origin, int fence, double[] array, DoublePredicate selector, DoubleToObject op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelArray all(Class elementType) { PAS.FJOSelectAllDriver r = new PAS.FJOSelectAllDriver (this, elementType); ex.invoke(r); return new ParallelArray(ex, (U[])(r.results)); } public ParallelDoubleArrayWithMapping withMapping (Op op) { return new DFOMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new DFDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping (ObjectToLong op) { return new DFLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new DFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new DFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new DFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final DoublePredicate s = selector; final DoubleToObject f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(x)) procedure.op(f.op(x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { boolean gotFirst = false; Object r = base; final DoublePredicate s = selector; final DoubleToObject f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(x)) { Object y = f.op(x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LFOMPap extends LOMPap { final LongPredicate selector; LFOMPap(ForkJoinPool ex, int origin, int fence, long[] array, LongPredicate selector, LongToObject op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelLongArrayWithMapping withMapping (Op op) { return new LFOMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping (ObjectToLong op) { return new LFLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new LFDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new LFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new LFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new LFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final LongPredicate s = selector; final LongToObject f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(x)) procedure.op(f.op(x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final LongPredicate s = selector; final LongToObject f = op; boolean gotFirst = false; Object r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(x)) { Object y = f.op(x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } // Object-mapped, relational static final class OROMPap extends OOMPap { final IntAndObjectPredicate selector; OROMPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectPredicate selector, Op op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelArrayWithMapping withMapping (Op op) { return new OROMPap (ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithDoubleMapping withMapping(ObjectToDouble op) { return new ORDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping(ObjectToLong op) { return new ORLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new OROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new ORDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new ORLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final IntAndObjectPredicate s = selector; final Object[] a = this.array; final Op f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(i, x)) procedure.op(f.op(x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final IntAndObjectPredicate s = selector; final Object[] a = this.array; final Op f = op; boolean gotFirst = false; Object r = base; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(i, x)) { Object y = f.op(x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DROMPap extends DOMPap { final IntAndDoublePredicate selector; DROMPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoublePredicate selector, DoubleToObject op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelArray all(Class elementType) { PAS.FJOSelectAllDriver r = new PAS.FJOSelectAllDriver (this, elementType); ex.invoke(r); return new ParallelArray(ex, (U[])(r.results)); } public ParallelDoubleArrayWithMapping withMapping (Op op) { return new DROMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new DRDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping (ObjectToLong op) { return new DRLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new DROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new DRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new DRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final IntAndDoublePredicate s = selector; final DoubleToObject f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(i, x)) procedure.op(f.op(x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { boolean gotFirst = false; Object r = base; final IntAndDoublePredicate s = selector; final DoubleToObject f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(i, x)) { Object y = f.op(x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LROMPap extends LOMPap { final IntAndLongPredicate selector; LROMPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongPredicate selector, LongToObject op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelLongArrayWithMapping withMapping (Op op) { return new LROMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping (ObjectToLong op) { return new LRLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new LRDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new LROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new LRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new LRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final IntAndLongPredicate s = selector; final LongToObject f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(i, x)) procedure.op(f.op(x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final IntAndLongPredicate s = selector; final LongToObject f = op; boolean gotFirst = false; Object r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(i, x)) { Object y = f.op(x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } // Object-combined static abstract class OOCPap extends ParallelArrayWithMapping { final IntAndObjectToObject op; OOCPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectToObject op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final Object oget(int i) { return op.op(i, this.array[i]); } final double dget(int i) { return ((Number)oget(i)).doubleValue(); } final long lget(int i) { return ((Number)oget(i)).longValue(); } final void leafTransfer(int lo, int hi, Object[] dest, int offset) { final IntAndObjectToObject f = op; final Object[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(i, a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, Object[] dest, int offset) { final Object[] a = this.array; final IntAndObjectToObject f = op; for (int i = loIdx; i < hiIdx; ++i) { int idx = indices[i]; dest[offset++] = f.op(idx, a[idx]); } } } static abstract class DOCPap extends ParallelDoubleArrayWithMapping { final IntAndDoubleToObject op; DOCPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoubleToObject op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final Object oget(int i) { return op.op(i, this.array[i]); } final double dget(int i) { return ((Number)oget(i)).doubleValue(); } final long lget(int i) { return ((Number)oget(i)).longValue(); } final void leafTransfer(int lo, int hi, Object[] dest, int offset) { final IntAndDoubleToObject f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(i, a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, Object[] dest, int offset) { final double[] a = this.array; final IntAndDoubleToObject f = op; for (int i = loIdx; i < hiIdx; ++i) { int idx = indices[i]; dest[offset++] = f.op(idx, a[idx]); } } } static abstract class LOCPap extends ParallelLongArrayWithMapping { final IntAndLongToObject op; LOCPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongToObject op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final Object oget(int i) { return op.op(i, this.array[i]); } final double dget(int i) { return ((Number)oget(i)).doubleValue(); } final long lget(int i) { return ((Number)oget(i)).longValue(); } final void leafTransfer(int lo, int hi, Object[] dest, int offset) { final IntAndLongToObject f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(i, a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, Object[] dest, int offset) { final long[] a = this.array; final IntAndLongToObject f = op; for (int i = loIdx; i < hiIdx; ++i) { int idx = indices[i]; dest[offset++] = f.op(idx, a[idx]); } } } // Object-combined, unfiltered static final class OUOCPap extends OOCPap { OUOCPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectToObject op) { super(ex, origin, fence, array, op); } public ParallelArrayWithMapping withMapping (Op op) { return new OUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new OUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping (ObjectToLong op) { return new OULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new OUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new OUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new OULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final IntAndObjectToObject f = op; final Object[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(i, a[i])); } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { if (lo >= hi) return base; final Object[] a = this.array; final IntAndObjectToObject f = op; Object r = f.op(lo, a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(i, a[i])); return r; } } static final class DUOCPap extends DOCPap { DUOCPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoubleToObject op) { super(ex, origin, fence, array, op); } public ParallelDoubleArrayWithMapping< V> withMapping (Op op) { return new DUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new DUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping (ObjectToLong op) { return new DULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new DUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new DUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new DULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final IntAndDoubleToObject f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(i, a[i])); } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { if (lo >= hi) return base; final double[] a = this.array; final IntAndDoubleToObject f = op; Object r = f.op(lo, a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(i, a[i])); return r; } } static final class LUOCPap extends LOCPap { LUOCPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongToObject op) { super(ex, origin, fence, array, op); } public ParallelLongArrayWithMapping< V> withMapping (Op op) { return new LUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new LUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping (ObjectToLong op) { return new LULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new LUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new LUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new LULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final IntAndLongToObject f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(i, a[i])); } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { if (lo >= hi) return base; final long[] a = this.array; final IntAndLongToObject f = op; Object r = f.op(lo, a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(i, a[i])); return r; } } // object-combined filtered static final class OFOCPap extends OOCPap { final Predicate selector; OFOCPap(ForkJoinPool ex, int origin, int fence, T[] array, Predicate selector, IntAndObjectToObject op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelArrayWithMapping withMapping (Op op) { return new OFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new OFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping (ObjectToLong op) { return new OFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new OFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new OFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new OFLCPap (ex, origin, fence, array, selector, compoundIndexedOp (this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final Predicate s = selector; final Object[] a = this.array; final IntAndObjectToObject f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(x)) procedure.op(f.op(i, x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final Predicate s = selector; final Object[] a = this.array; final IntAndObjectToObject f = op; boolean gotFirst = false; Object r = base; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(x)) { Object y = f.op(i, x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DFOCPap extends DOCPap { final DoublePredicate selector; DFOCPap(ForkJoinPool ex, int origin, int fence, double[] array, DoublePredicate selector, IntAndDoubleToObject op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelDoubleArrayWithMapping< V> withMapping (Op op) { return new DFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new DFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping (ObjectToLong op) { return new DFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new DFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new DFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new DFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final DoublePredicate s = selector; final double[] a = this.array; final IntAndDoubleToObject f = op; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(x)) procedure.op(f.op(i, x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final DoublePredicate s = selector; final double[] a = this.array; final IntAndDoubleToObject f = op; boolean gotFirst = false; Object r = base; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(x)) { Object y = f.op(i, x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LFOCPap extends LOCPap { final LongPredicate selector; LFOCPap(ForkJoinPool ex, int origin, int fence, long[] array, LongPredicate selector, IntAndLongToObject op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelLongArrayWithMapping< V> withMapping (Op op) { return new LFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new LFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping (ObjectToLong op) { return new LFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new LFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new LFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new LFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final LongPredicate s = selector; final long[] a = this.array; final IntAndLongToObject f = op; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(x)) procedure.op(f.op(i, x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final LongPredicate s = selector; final long[] a = this.array; final IntAndLongToObject f = op; boolean gotFirst = false; Object r = base; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(x)) { Object y = f.op(i, x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } // Object-combined, relational static final class OROCPap extends OOCPap { final IntAndObjectPredicate selector; OROCPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectPredicate selector, IntAndObjectToObject op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelArrayWithMapping withMapping (Op op) { return new OROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new ORDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping (ObjectToLong op) { return new ORLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new OROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new ORDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new ORLCPap (ex, origin, fence, array, selector, compoundIndexedOp (this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final IntAndObjectPredicate s = selector; final Object[] a = this.array; final IntAndObjectToObject f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(i, x)) procedure.op(f.op(i, x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final IntAndObjectPredicate s = selector; final Object[] a = this.array; final IntAndObjectToObject f = op; boolean gotFirst = false; Object r = base; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(i, x)) { Object y = f.op(i, x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DROCPap extends DOCPap { final IntAndDoublePredicate selector; DROCPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoublePredicate selector, IntAndDoubleToObject op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelDoubleArrayWithMapping< V> withMapping (Op op) { return new DROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new DRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping (ObjectToLong op) { return new DRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new DROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new DRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new DRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final IntAndDoublePredicate s = selector; final double[] a = this.array; final IntAndDoubleToObject f = op; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(i, x)) procedure.op(f.op(i, x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final IntAndDoublePredicate s = selector; final double[] a = this.array; final IntAndDoubleToObject f = op; boolean gotFirst = false; Object r = base; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(i, x)) { Object y = f.op(i, x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LROCPap extends LOCPap { final IntAndLongPredicate selector; LROCPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongPredicate selector, IntAndLongToObject op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelLongArrayWithMapping< V> withMapping (Op op) { return new LROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping (ObjectToDouble op) { return new LRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping (ObjectToLong op) { return new LRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper) { return new LROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper) { return new LRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper) { return new LRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, Procedure procedure) { final IntAndLongPredicate s = selector; final long[] a = this.array; final IntAndLongToObject f = op; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(i, x)) procedure.op(f.op(i, x)); } } Object leafReduce(int lo, int hi, Reducer reducer, Object base) { final IntAndLongPredicate s = selector; final long[] a = this.array; final IntAndLongToObject f = op; boolean gotFirst = false; Object r = base; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(i, x)) { Object y = f.op(i, x); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } // Double-mapped static abstract class ODMPap extends ParallelArrayWithDoubleMapping { final ObjectToDouble op; ODMPap(ForkJoinPool ex, int origin, int fence, T[] array, ObjectToDouble op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final double dget(int i) { return op.op(this.array[i]); } final Object oget(int i) { return Double.valueOf(dget(i)); } final long lget(int i) { return (long)(dget(i)); } final void leafTransfer(int lo, int hi, double[] dest, int offset) { final ObjectToDouble f = op; final Object[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, double[] dest, int offset) { final Object[] a = this.array; final ObjectToDouble f = op; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = f.op(a[indices[i]]); } } static abstract class DDMPap extends ParallelDoubleArrayWithDoubleMapping { final DoubleOp op; DDMPap (ForkJoinPool ex, int origin, int fence, double[] array, DoubleOp op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final double dget(int i) { return op.op(this.array[i]); } final Object oget(int i) { return Double.valueOf(dget(i)); } final long lget(int i) { return (long)(dget(i)); } final void leafTransfer(int lo, int hi, double[] dest, int offset) { final double[] a = this.array; final DoubleOp f = op; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, double[] dest, int offset) { final double[] a = this.array; final DoubleOp f = op; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = f.op(a[indices[i]]); } } static abstract class LDMPap extends ParallelLongArrayWithDoubleMapping { final LongToDouble op; LDMPap(ForkJoinPool ex, int origin, int fence, long[] array, LongToDouble op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final double dget(int i) { return op.op(this.array[i]); } final Object oget(int i) { return Double.valueOf(dget(i)); } final long lget(int i) { return (long)(dget(i)); } final void leafTransfer(int lo, int hi, double[] dest, int offset) { final long[] a = this.array; final LongToDouble f = op; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, double[] dest, int offset) { final long[] a = this.array; final LongToDouble f = op; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = f.op(a[indices[i]]); } } // double-mapped, unfiltered static final class OUDMPap extends ODMPap { OUDMPap(ForkJoinPool ex, int origin, int fence, T[] array, ObjectToDouble op) { super(ex, origin, fence, array, op); } public ParallelArrayWithDoubleMapping withMapping(DoubleOp op) { return new OUDMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping(DoubleToLong op) { return new OULMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withMapping (DoubleToObject op) { return new OUOMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new OUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new OUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new OULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final ObjectToDouble f = op; final Object[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(a[i])); } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { if (lo >= hi) return base; final Object[] a = this.array; final ObjectToDouble f = op; double r = f.op(a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(a[i])); return r; } } static final class DUDMPap extends DDMPap { DUDMPap(ForkJoinPool ex, int origin, int fence, double[] array, DoubleOp op) { super(ex, origin, fence, array, op); } public ParallelDoubleArrayWithDoubleMapping withMapping(DoubleOp op) { return new DUDMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) { return new DULMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withMapping (DoubleToObject op) { return new DUOMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new DUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new DUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new DULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final double[] a = this.array; final DoubleOp f = op; for (int i = lo; i < hi; ++i) procedure.op(f.op(a[i])); } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { if (lo >= hi) return base; final double[] a = this.array; final DoubleOp f = op; double r = f.op(a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(a[i])); return r; } } static final class LUDMPap extends LDMPap { LUDMPap(ForkJoinPool ex, int origin, int fence, long[] array, LongToDouble op) { super(ex, origin, fence, array, op); } public ParallelLongArrayWithLongMapping withMapping(DoubleToLong op) { return new LULMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping(DoubleOp op) { return new LUDMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withMapping (DoubleToObject op) { return new LUOMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new LUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new LUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new LULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final LongToDouble f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(a[i])); } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { if (lo >= hi) return base; final long[] a = this.array; final LongToDouble f = op; double r = f.op(a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(a[i])); return r; } } // double-mapped, filtered static final class OFDMPap extends ODMPap { final Predicate selector; OFDMPap(ForkJoinPool ex, int origin, int fence, T[] array, Predicate selector, ObjectToDouble op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelArrayWithDoubleMapping withMapping(DoubleOp op) { return new OFDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping(DoubleToLong op) { return new OFLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withMapping (DoubleToObject op) { return new OFOMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new OFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new OFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new OFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final Predicate s = selector; final Object[] a = this.array; final ObjectToDouble f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(x)) procedure.op(f.op(x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final Predicate s = selector; final ObjectToDouble f = op; boolean gotFirst = false; double r = base; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object t = a[i]; if (s.op(t)) { double y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DFDMPap extends DDMPap { final DoublePredicate selector; DFDMPap(ForkJoinPool ex, int origin, int fence, double[] array, DoublePredicate selector, DoubleOp op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelDoubleArrayWithDoubleMapping withMapping(DoubleOp op) { return new DFDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) { return new DFLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withMapping (DoubleToObject op) { return new DFOMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new DFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new DFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new DFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final DoublePredicate s = selector; final DoubleOp f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(x)) procedure.op(f.op(x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final DoublePredicate s = selector; boolean gotFirst = false; double r = base; final double[] a = this.array; final DoubleOp f = op; for (int i = lo; i < hi; ++i) { double t = a[i]; if (s.op(t)) { double y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LFDMPap extends LDMPap { final LongPredicate selector; LFDMPap(ForkJoinPool ex, int origin, int fence, long[] array, LongPredicate selector, LongToDouble op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelLongArrayWithLongMapping withMapping(DoubleToLong op) { return new LFLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping(DoubleOp op) { return new LFDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withMapping (DoubleToObject op) { return new LFOMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new LFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new LFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new LFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final LongPredicate s = selector; final long[] a = this.array; final LongToDouble f = op; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(x)) procedure.op(f.op(x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final LongPredicate s = selector; final LongToDouble f = op; boolean gotFirst = false; double r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long t = a[i]; if (s.op(t)) { double y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } // double-mapped, relational static final class ORDMPap extends ODMPap { final IntAndObjectPredicate selector; ORDMPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectPredicate selector, ObjectToDouble op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelArrayWithDoubleMapping withMapping(DoubleOp op) { return new ORDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping(DoubleToLong op) { return new ORLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withMapping (DoubleToObject op) { return new OROMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new OROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new ORDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new ORLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final IntAndObjectPredicate s = selector; final Object[] a = this.array; final ObjectToDouble f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(i, x)) procedure.op(f.op(x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final IntAndObjectPredicate s = selector; final ObjectToDouble f = op; boolean gotFirst = false; double r = base; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object t = a[i]; if (s.op(i, t)) { double y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DRDMPap extends DDMPap { final IntAndDoublePredicate selector; DRDMPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoublePredicate selector, DoubleOp op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelDoubleArrayWithDoubleMapping withMapping(DoubleOp op) { return new DRDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) { return new DRLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withMapping (DoubleToObject op) { return new DROMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new DROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new DRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new DRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final IntAndDoublePredicate s = selector; final DoubleOp f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(i, x)) procedure.op(f.op(x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final IntAndDoublePredicate s = selector; boolean gotFirst = false; double r = base; final double[] a = this.array; final DoubleOp f = op; for (int i = lo; i < hi; ++i) { double t = a[i]; if (s.op(i, t)) { double y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LRDMPap extends LDMPap { final IntAndLongPredicate selector; LRDMPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongPredicate selector, LongToDouble op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelLongArrayWithLongMapping withMapping(DoubleToLong op) { return new LRLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping(DoubleOp op) { return new LRDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withMapping (DoubleToObject op) { return new LROMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new LROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new LRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new LRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final IntAndLongPredicate s = selector; final long[] a = this.array; final LongToDouble f = op; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(i, x)) procedure.op(f.op(x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final IntAndLongPredicate s = selector; final LongToDouble f = op; boolean gotFirst = false; double r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long t = a[i]; if (s.op(i, t)) { double y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } // double-combined static abstract class ODCPap extends ParallelArrayWithDoubleMapping { final IntAndObjectToDouble op; ODCPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectToDouble op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final double dget(int i) { return op.op(i, this.array[i]); } final Object oget(int i) { return Double.valueOf(dget(i)); } final long lget(int i) { return (long)(dget(i)); } final void leafTransfer(int lo, int hi, double[] dest, int offset) { final IntAndObjectToDouble f = op; final Object[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(i, a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, double[] dest, int offset) { final Object[] a = this.array; final IntAndObjectToDouble f = op; for (int i = loIdx; i < hiIdx; ++i) { int idx = indices[i]; dest[offset++] = f.op(idx, a[idx]); } } } static abstract class DDCPap extends ParallelDoubleArrayWithDoubleMapping { final IntAndDoubleToDouble op; DDCPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoubleToDouble op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final double dget(int i) { return op.op(i, this.array[i]); } final Object oget(int i) { return Double.valueOf(dget(i)); } final long lget(int i) { return (long)(dget(i)); } final void leafTransfer(int lo, int hi, double[] dest, int offset) { final IntAndDoubleToDouble f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(i, a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, double[] dest, int offset) { final double[] a = this.array; final IntAndDoubleToDouble f = op; for (int i = loIdx; i < hiIdx; ++i) { int idx = indices[i]; dest[offset++] = f.op(idx, a[idx]); } } } static abstract class LDCPap extends ParallelLongArrayWithDoubleMapping { final IntAndLongToDouble op; LDCPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongToDouble op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final double dget(int i) { return op.op(i, this.array[i]); } final Object oget(int i) { return Double.valueOf(dget(i)); } final long lget(int i) { return (long)(dget(i)); } final void leafTransfer(int lo, int hi, double[] dest, int offset) { final IntAndLongToDouble f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(i, a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, double[] dest, int offset) { final long[] a = this.array; final IntAndLongToDouble f = op; for (int i = loIdx; i < hiIdx; ++i) { int idx = indices[i]; dest[offset++] = f.op(idx, a[idx]); } } } // double-combined, unfiltered static final class OUDCPap extends ODCPap { OUDCPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectToDouble op) { super(ex, origin, fence, array, op); } public ParallelArrayWithDoubleMapping withMapping(DoubleOp op) { return new OUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping(DoubleToLong op) { return new OULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withMapping (DoubleToObject op) { return new OUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new OUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new OUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new OULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final IntAndObjectToDouble f = op; final Object[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(i, a[i])); } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { if (lo >= hi) return base; final Object[] a = this.array; final IntAndObjectToDouble f = op; double r = f.op(lo, a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(i, a[i])); return r; } } static final class DUDCPap extends DDCPap { DUDCPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoubleToDouble op) { super(ex, origin, fence, array, op); } public ParallelDoubleArrayWithDoubleMapping withMapping(DoubleOp op) { return new DUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) { return new DULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping< U> withMapping (DoubleToObject op) { return new DUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new DUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new DUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new DULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final IntAndDoubleToDouble f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(i, a[i])); } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { if (lo >= hi) return base; final double[] a = this.array; final IntAndDoubleToDouble f = op; double r = f.op(lo, a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(i, a[i])); return r; } } static final class LUDCPap extends LDCPap { LUDCPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongToDouble op) { super(ex, origin, fence, array, op); } public ParallelLongArrayWithDoubleMapping withMapping(DoubleOp op) { return new LUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping(DoubleToLong op) { return new LULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping< U> withMapping (DoubleToObject op) { return new LUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new LUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new LUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new LULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final IntAndLongToDouble f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(i, a[i])); } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { if (lo >= hi) return base; final long[] a = this.array; final IntAndLongToDouble f = op; double r = f.op(lo, a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(i, a[i])); return r; } } // double-combined, filtered static final class OFDCPap extends ODCPap { final Predicate selector; OFDCPap(ForkJoinPool ex, int origin, int fence, T[] array, Predicate selector, IntAndObjectToDouble op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelArrayWithDoubleMapping withMapping(DoubleOp op) { return new OFDCPap (ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping(DoubleToLong op) { return new OFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withMapping (DoubleToObject op) { return new OFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new OFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new OFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new OFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final Predicate s = selector; final Object[] a = this.array; final IntAndObjectToDouble f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(x)) procedure.op(f.op(i, x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final Predicate s = selector; final IntAndObjectToDouble f = op; boolean gotFirst = false; double r = base; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object t = a[i]; if (s.op(t)) { double y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DFDCPap extends DDCPap { final DoublePredicate selector; DFDCPap(ForkJoinPool ex, int origin, int fence, double[] array, DoublePredicate selector, IntAndDoubleToDouble op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelDoubleArrayWithDoubleMapping withMapping(DoubleOp op) { return new DFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) { return new DFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping< U> withMapping (DoubleToObject op) { return new DFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new DFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new DFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new DFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final DoublePredicate s = selector; final double[] a = this.array; final IntAndDoubleToDouble f = op; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(x)) procedure.op(f.op(i, x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final DoublePredicate s = selector; final IntAndDoubleToDouble f = op; boolean gotFirst = false; double r = base; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double t = a[i]; if (s.op(t)) { double y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LFDCPap extends LDCPap { final LongPredicate selector; LFDCPap(ForkJoinPool ex, int origin, int fence, long[] array, LongPredicate selector, IntAndLongToDouble op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelLongArrayWithDoubleMapping withMapping(DoubleOp op) { return new LFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping(DoubleToLong op) { return new LFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping< U> withMapping (DoubleToObject op) { return new LFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new LFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new LFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new LFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final LongPredicate s = selector; final long[] a = this.array; final IntAndLongToDouble f = op; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(x)) procedure.op(f.op(i, x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final LongPredicate s = selector; final IntAndLongToDouble f = op; boolean gotFirst = false; double r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long t = a[i]; if (s.op(t)) { double y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } // double-combined, relational static final class ORDCPap extends ODCPap { final IntAndObjectPredicate selector; ORDCPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectPredicate selector, IntAndObjectToDouble op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelArrayWithDoubleMapping withMapping(DoubleOp op) { return new ORDCPap (ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping(DoubleToLong op) { return new ORLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withMapping (DoubleToObject op) { return new OROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new OROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new ORDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new ORLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final IntAndObjectPredicate s = selector; final Object[] a = this.array; final IntAndObjectToDouble f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(i, x)) procedure.op(f.op(i, x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final IntAndObjectPredicate s = selector; final IntAndObjectToDouble f = op; boolean gotFirst = false; double r = base; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object t = a[i]; if (s.op(i, t)) { double y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DRDCPap extends DDCPap { final IntAndDoublePredicate selector; DRDCPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoublePredicate selector, IntAndDoubleToDouble op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelDoubleArrayWithDoubleMapping withMapping(DoubleOp op) { return new DRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) { return new DRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping< U> withMapping (DoubleToObject op) { return new DROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new DROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new DRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new DRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final IntAndDoublePredicate s = selector; final double[] a = this.array; final IntAndDoubleToDouble f = op; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(i, x)) procedure.op(f.op(i, x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final IntAndDoublePredicate s = selector; final IntAndDoubleToDouble f = op; boolean gotFirst = false; double r = base; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double t = a[i]; if (s.op(i, t)) { double y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LRDCPap extends LDCPap { final IntAndLongPredicate selector; LRDCPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongPredicate selector, IntAndLongToDouble op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelLongArrayWithDoubleMapping withMapping(DoubleOp op) { return new LRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping(DoubleToLong op) { return new LRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping< U> withMapping (DoubleToObject op) { return new LROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return new LROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return new LRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return new LRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, DoubleProcedure procedure) { final IntAndLongPredicate s = selector; final long[] a = this.array; final IntAndLongToDouble f = op; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(i, x)) procedure.op(f.op(i, x)); } } double leafReduce(int lo, int hi, DoubleReducer reducer, double base) { final IntAndLongPredicate s = selector; final IntAndLongToDouble f = op; boolean gotFirst = false; double r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long t = a[i]; if (s.op(i, t)) { double y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } // long-combined static abstract class OLMPap extends ParallelArrayWithLongMapping { final ObjectToLong op; OLMPap(ForkJoinPool ex, int origin, int fence, T[] array, final ObjectToLong op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final long lget(int i) { return op.op(this.array[i]); } final Object oget(int i) { return Long.valueOf(lget(i)); } final double dget(int i) { return (double)(lget(i)); } final void leafTransfer(int lo, int hi, long[] dest, int offset) { final ObjectToLong f = op; final Object[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, long[] dest, int offset) { final Object[] a = this.array; final ObjectToLong f = op; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = f.op(a[indices[i]]); } } static abstract class DLMPap extends ParallelDoubleArrayWithLongMapping { final DoubleToLong op; DLMPap(ForkJoinPool ex, int origin, int fence, double[] array, DoubleToLong op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final long lget(int i) { return op.op(this.array[i]); } final Object oget(int i) { return Long.valueOf(lget(i)); } final double dget(int i) { return (double)(lget(i)); } final void leafTransfer(int lo, int hi, long[] dest, int offset) { final double[] a = this.array; final DoubleToLong f = op; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, long[] dest, int offset) { final double[] a = this.array; final DoubleToLong f = op; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = f.op(a[indices[i]]); } } static abstract class LLMPap extends ParallelLongArrayWithLongMapping { final LongOp op; LLMPap(ForkJoinPool ex, int origin, int fence, long[] array, LongOp op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final long lget(int i) { return op.op(this.array[i]); } final Object oget(int i) { return Long.valueOf(lget(i)); } final double dget(int i) { return (double)(lget(i)); } final void leafTransfer(int lo, int hi, long[] dest, int offset) { final long[] a = this.array; final LongOp f = op; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, long[] dest, int offset) { final long[] a = this.array; final LongOp f = op; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = f.op(a[indices[i]]); } } // long-combined, unfiltered static final class OULMPap extends OLMPap { OULMPap(ForkJoinPool ex, int origin, int fence, T[] array, ObjectToLong op) { super(ex, origin, fence, array, op); } public ParallelArrayWithDoubleMapping withMapping(LongToDouble op) { return new OUDMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping(LongOp op) { return new OULMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withMapping (LongToObject op) { return new OUOMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new OUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new OUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new OULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final Object[] a = this.array; final ObjectToLong f = op; for (int i = lo; i < hi; ++i) procedure.op(f.op(a[i])); } long leafReduce(int lo, int hi, LongReducer reducer, long base) { if (lo >= hi) return base; final Object[] a = this.array; final ObjectToLong f = op; long r = f.op(a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(a[i])); return r; } } static final class DULMPap extends DLMPap { DULMPap(ForkJoinPool ex, int origin, int fence, double[] array, DoubleToLong op) { super(ex, origin, fence, array, op); } public ParallelDoubleArrayWithDoubleMapping withMapping (LongToDouble op) { return new DUDMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping (LongOp op) { return new DULMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withMapping (LongToObject op) { return new DUOMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new DUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new DUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new DULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final double[] a = this.array; final DoubleToLong f = op; for (int i = lo; i < hi; ++i) procedure.op(f.op(a[i])); } long leafReduce(int lo, int hi, LongReducer reducer, long base) { if (lo >= hi) return base; final double[] a = this.array; final DoubleToLong f = op; long r = f.op(a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(a[i])); return r; } } static final class LULMPap extends LLMPap { LULMPap(ForkJoinPool ex, int origin, int fence, long[] array, LongOp op) { super(ex, origin, fence, array, op); } public ParallelLongArrayWithLongMapping withMapping(LongOp op) { return new LULMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping(LongToDouble op) { return new LUDMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withMapping (LongToObject op) { return new LUOMPap(ex, origin, fence, array, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new LUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new LUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new LULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final LongOp f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(a[i])); } long leafReduce(int lo, int hi, LongReducer reducer, long base) { if (lo >= hi) return base; final long[] a = this.array; final LongOp f = op; long r = f.op(a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(a[i])); return r; } } // long-combined, filtered static final class OFLMPap extends OLMPap { final Predicate selector; OFLMPap(ForkJoinPool ex, int origin, int fence, T[] array, Predicate selector, ObjectToLong op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelArrayWithDoubleMapping withMapping (LongToDouble op) { return new OFDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping (LongOp op) { return new OFLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withMapping (LongToObject op) { return new OFOMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new OFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new OFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new OFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final Predicate s = selector; final Object[] a = this.array; final ObjectToLong f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(x)) procedure.op(f.op(x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { final Predicate s = selector; final ObjectToLong f = op; boolean gotFirst = false; long r = base; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object t = a[i]; if (s.op(t)) { long y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DFLMPap extends DLMPap { final DoublePredicate selector; DFLMPap(ForkJoinPool ex, int origin, int fence, double[] array, DoublePredicate selector, DoubleToLong op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelDoubleArrayWithDoubleMapping withMapping (LongToDouble op) { return new DFDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping (LongOp op) { return new DFLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withMapping (LongToObject op) { return new DFOMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new DFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new DFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new DFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final DoublePredicate s = selector; final DoubleToLong f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(x)) procedure.op(f.op(x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { boolean gotFirst = false; long r = base; final double[] a = this.array; final DoublePredicate s = selector; final DoubleToLong f = op; for (int i = lo; i < hi; ++i) { double t = a[i]; if (s.op(t)) { long y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LFLMPap extends LLMPap { final LongPredicate selector; LFLMPap(ForkJoinPool ex, int origin, int fence, long[] array, LongPredicate selector, LongOp op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelLongArrayWithLongMapping withMapping(LongOp op) { return new LFLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping(LongToDouble op) { return new LFDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withMapping (LongToObject op) { return new LFOMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new LFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new LFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new LFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final LongPredicate s = selector; final LongOp f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(x)) procedure.op(f.op(x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { final LongPredicate s = selector; final LongOp f = op; boolean gotFirst = false; long r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long t = a[i]; if (s.op(t)) { long y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } // Long-mapped, relational static final class ORLMPap extends OLMPap { final IntAndObjectPredicate selector; ORLMPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectPredicate selector, ObjectToLong op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelArrayWithDoubleMapping withMapping (LongToDouble op) { return new ORDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping (LongOp op) { return new ORLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withMapping (LongToObject op) { return new OROMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new OROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new ORDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new ORLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final IntAndObjectPredicate s = selector; final Object[] a = this.array; final ObjectToLong f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(i, x)) procedure.op(f.op(x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { final IntAndObjectPredicate s = selector; final ObjectToLong f = op; boolean gotFirst = false; long r = base; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object t = a[i]; if (s.op(i, t)) { long y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DRLMPap extends DLMPap { final IntAndDoublePredicate selector; DRLMPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoublePredicate selector, DoubleToLong op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelDoubleArrayWithDoubleMapping withMapping (LongToDouble op) { return new DRDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping (LongOp op) { return new DRLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withMapping (LongToObject op) { return new DROMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new DROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new DRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new DRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final IntAndDoublePredicate s = selector; final DoubleToLong f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(i, x)) procedure.op(f.op(x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { boolean gotFirst = false; long r = base; final double[] a = this.array; final IntAndDoublePredicate s = selector; final DoubleToLong f = op; for (int i = lo; i < hi; ++i) { double t = a[i]; if (s.op(i, t)) { long y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LRLMPap extends LLMPap { final IntAndLongPredicate selector; LRLMPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongPredicate selector, LongOp op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelLongArrayWithLongMapping withMapping(LongOp op) { return new LRLMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithDoubleMapping withMapping(LongToDouble op) { return new LRDMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withMapping (LongToObject op) { return new LROMPap(ex, origin, fence, array, selector, CommonOps.compoundOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new LROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new LRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new LRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final IntAndLongPredicate s = selector; final LongOp f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(i, x)) procedure.op(f.op(x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { final IntAndLongPredicate s = selector; final LongOp f = op; boolean gotFirst = false; long r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long t = a[i]; if (s.op(i, t)) { long y = f.op(t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } // long-combined static abstract class OLCPap extends ParallelArrayWithLongMapping { final IntAndObjectToLong op; OLCPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectToLong op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final long lget(int i) { return op.op(i, this.array[i]); } final Object oget(int i) { return Long.valueOf(lget(i)); } final double dget(int i) { return (double)(lget(i)); } final void leafTransfer(int lo, int hi, long[] dest, int offset) { final IntAndObjectToLong f = op; final Object[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(i, a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, long[] dest, int offset) { final Object[] a = this.array; final IntAndObjectToLong f = op; for (int i = loIdx; i < hiIdx; ++i) { int idx = indices[i]; dest[offset++] = f.op(idx, a[idx]); } } } static abstract class DLCPap extends ParallelDoubleArrayWithLongMapping { final IntAndDoubleToLong op; DLCPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoubleToLong op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final long lget(int i) { return op.op(i, this.array[i]); } final Object oget(int i) { return Long.valueOf(lget(i)); } final double dget(int i) { return (double)(lget(i)); } final void leafTransfer(int lo, int hi, long[] dest, int offset) { final IntAndDoubleToLong f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(i, a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, long[] dest, int offset) { final double[] a = this.array; final IntAndDoubleToLong f = op; for (int i = loIdx; i < hiIdx; ++i) { int idx = indices[i]; dest[offset++] = f.op(idx, a[idx]); } } } static abstract class LLCPap extends ParallelLongArrayWithLongMapping { final IntAndLongToLong op; LLCPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongToLong op) { super(ex, origin, fence, array); this.op = op; } final boolean hasMap() { return true; } final long lget(int i) { return op.op(i, this.array[i]); } final Object oget(int i) { return Long.valueOf(lget(i)); } final double dget(int i) { return (double)(lget(i)); } final void leafTransfer(int lo, int hi, long[] dest, int offset) { final IntAndLongToLong f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = f.op(i, a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, long[] dest, int offset) { final long[] a = this.array; final IntAndLongToLong f = op; for (int i = loIdx; i < hiIdx; ++i) { int idx = indices[i]; dest[offset++] = f.op(idx, a[idx]); } } } // long-combined, unfiltered static final class OULCPap extends OLCPap { OULCPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectToLong op) { super(ex, origin, fence, array, op); } public ParallelArrayWithDoubleMapping withMapping(LongToDouble op) { return new OUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping(LongOp op) { return new OULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withMapping (LongToObject op) { return new OUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new OUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new OUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new OULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final IntAndObjectToLong f = op; final Object[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(i, a[i])); } long leafReduce(int lo, int hi, LongReducer reducer, long base) { if (lo >= hi) return base; final Object[] a = this.array; final IntAndObjectToLong f = op; long r = f.op(lo, a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(i, a[i])); return r; } } static final class DULCPap extends DLCPap { DULCPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoubleToLong op) { super(ex, origin, fence, array, op); } public ParallelDoubleArrayWithDoubleMapping withMapping (LongToDouble op) { return new DUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping(LongOp op) { return new DULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping< U> withMapping (LongToObject op) { return new DUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new DUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new DUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new DULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final IntAndDoubleToLong f = op; final double[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(i, a[i])); } long leafReduce(int lo, int hi, LongReducer reducer, long base) { if (lo >= hi) return base; final double[] a = this.array; final IntAndDoubleToLong f = op; long r = f.op(lo, a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(i, a[i])); return r; } } static final class LULCPap extends LLCPap { LULCPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongToLong op) { super(ex, origin, fence, array, op); } public ParallelLongArrayWithDoubleMapping withMapping(LongToDouble op) { return new LUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping(LongOp op) { return new LULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping< U> withMapping (LongToObject op) { return new LUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new LUOCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new LUDCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new LULCPap(ex, origin, fence, array, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final IntAndLongToLong f = op; final long[] a = this.array; for (int i = lo; i < hi; ++i) procedure.op(f.op(i, a[i])); } long leafReduce(int lo, int hi, LongReducer reducer, long base) { if (lo >= hi) return base; final long[] a = this.array; final IntAndLongToLong f = op; long r = f.op(lo, a[lo]); for (int i = lo+1; i < hi; ++i) r = reducer.op(r, f.op(i, a[i])); return r; } } // long-combined, filtered static final class OFLCPap extends OLCPap { final Predicate selector; OFLCPap(ForkJoinPool ex, int origin, int fence, T[] array, Predicate selector, IntAndObjectToLong op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelArrayWithDoubleMapping withMapping(LongToDouble op) { return new OFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping(LongOp op) { return new OFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withMapping (LongToObject op) { return new OFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new OFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new OFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new OFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final Predicate s = selector; final Object[] a = this.array; final IntAndObjectToLong f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(x)) procedure.op(f.op(i, x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { final Predicate s = selector; final IntAndObjectToLong f = op; boolean gotFirst = false; long r = base; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object t = a[i]; if (s.op(t)) { long y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DFLCPap extends DLCPap { final DoublePredicate selector; DFLCPap(ForkJoinPool ex, int origin, int fence, double[] array, DoublePredicate selector, IntAndDoubleToLong op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelDoubleArrayWithDoubleMapping withMapping (LongToDouble op) { return new DFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping(LongOp op) { return new DFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping< U> withMapping (LongToObject op) { return new DFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new DFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new DFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new DFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final DoublePredicate s = selector; final double[] a = this.array; final IntAndDoubleToLong f = op; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(x)) procedure.op(f.op(i, x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { final DoublePredicate s = selector; final IntAndDoubleToLong f = op; boolean gotFirst = false; long r = base; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double t = a[i]; if (s.op(t)) { long y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LFLCPap extends LLCPap { final LongPredicate selector; LFLCPap(ForkJoinPool ex, int origin, int fence, long[] array, LongPredicate selector, IntAndLongToLong op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(this.array[i]); } public ParallelLongArrayWithDoubleMapping withMapping(LongToDouble op) { return new LFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping(LongOp op) { return new LFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping< U> withMapping (LongToObject op) { return new LFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new LFOCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new LFDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new LFLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final LongPredicate s = selector; final long[] a = this.array; final IntAndLongToLong f = op; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(x)) procedure.op(f.op(i, x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { final LongPredicate s = selector; final IntAndLongToLong f = op; boolean gotFirst = false; long r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long t = a[i]; if (s.op(t)) { long y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } // long-combined, relational static final class ORLCPap extends OLCPap { final IntAndObjectPredicate selector; ORLCPap(ForkJoinPool ex, int origin, int fence, T[] array, IntAndObjectPredicate selector, IntAndObjectToLong op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelArrayWithDoubleMapping withMapping(LongToDouble op) { return new ORDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithLongMapping withMapping(LongOp op) { return new ORLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withMapping (LongToObject op) { return new OROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new OROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new ORDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new ORLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final IntAndObjectPredicate s = selector; final Object[] a = this.array; final IntAndObjectToLong f = op; for (int i = lo; i < hi; ++i) { Object x = a[i]; if (s.op(i, x)) procedure.op(f.op(i, x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { final IntAndObjectPredicate s = selector; final IntAndObjectToLong f = op; boolean gotFirst = false; long r = base; final Object[] a = this.array; for (int i = lo; i < hi; ++i) { Object t = a[i]; if (s.op(i, t)) { long y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class DRLCPap extends DLCPap { final IntAndDoublePredicate selector; DRLCPap(ForkJoinPool ex, int origin, int fence, double[] array, IntAndDoublePredicate selector, IntAndDoubleToLong op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelDoubleArrayWithDoubleMapping withMapping (LongToDouble op) { return new DRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithLongMapping withMapping(LongOp op) { return new DRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping< U> withMapping (LongToObject op) { return new DROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new DROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new DRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new DRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final IntAndDoublePredicate s = selector; final double[] a = this.array; final IntAndDoubleToLong f = op; for (int i = lo; i < hi; ++i) { double x = a[i]; if (s.op(i, x)) procedure.op(f.op(i, x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { final IntAndDoublePredicate s = selector; final IntAndDoubleToLong f = op; boolean gotFirst = false; long r = base; final double[] a = this.array; for (int i = lo; i < hi; ++i) { double t = a[i]; if (s.op(i, t)) { long y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } static final class LRLCPap extends LLCPap { final IntAndLongPredicate selector; LRLCPap(ForkJoinPool ex, int origin, int fence, long[] array, IntAndLongPredicate selector, IntAndLongToLong op) { super(ex, origin, fence, array, op); this.selector = selector; } boolean hasFilter() { return true; } boolean isSelected(int i) { return selector.op(i, this.array[i]); } public ParallelLongArrayWithDoubleMapping withMapping(LongToDouble op) { return new LRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithLongMapping withMapping(LongOp op) { return new LRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping< U> withMapping (LongToObject op) { return new LROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, op)); } public ParallelLongArrayWithMapping withIndexedMapping (IntAndLongToObject mapper) { return new LROCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper) { return new LRDCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } public ParallelLongArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper) { return new LRLCPap(ex, origin, fence, array, selector, compoundIndexedOp(this.op, mapper)); } void leafApply(int lo, int hi, LongProcedure procedure) { final IntAndLongPredicate s = selector; final long[] a = this.array; final IntAndLongToLong f = op; for (int i = lo; i < hi; ++i) { long x = a[i]; if (s.op(i, x)) procedure.op(f.op(i, x)); } } long leafReduce(int lo, int hi, LongReducer reducer, long base) { final IntAndLongPredicate s = selector; final IntAndLongToLong f = op; boolean gotFirst = false; long r = base; final long[] a = this.array; for (int i = lo; i < hi; ++i) { long t = a[i]; if (s.op(i, t)) { long y = f.op(i, t); if (!gotFirst) { gotFirst = true; r = y; } else r = reducer.op(r, y); } } return r; } } /* * Iterator support */ class SequentiallyAsDouble implements Iterable { public Iterator iterator() { if (hasFilter()) return new FilteredAsDoubleIterator(); else return new UnfilteredAsDoubleIterator(); } } class UnfilteredAsDoubleIterator implements Iterator { int cursor = origin; public boolean hasNext() { return cursor < fence; } public Double next() { if (cursor >= fence) throw new NoSuchElementException(); return Double.valueOf(dget(cursor++)); } public void remove() { throw new UnsupportedOperationException(); } } class FilteredAsDoubleIterator implements Iterator { double next; int cursor; FilteredAsDoubleIterator() { cursor = origin; advance() ; } private void advance() { while (cursor < fence) { if (isSelected(cursor)) { next = dget(cursor); break; } cursor++; } } public boolean hasNext() { return cursor < fence; } public Double next() { if (cursor >= fence) throw new NoSuchElementException(); Double x = Double.valueOf(next); cursor++; advance(); return x; } public void remove() { throw new UnsupportedOperationException(); } } class SequentiallyAsLong implements Iterable { public Iterator iterator() { if (hasFilter()) return new FilteredAsLongIterator(); else return new UnfilteredAsLongIterator(); } } class UnfilteredAsLongIterator implements Iterator { int cursor = origin; public boolean hasNext() { return cursor < fence; } public Long next() { if (cursor >= fence) throw new NoSuchElementException(); return Long.valueOf(lget(cursor++)); } public void remove() { throw new UnsupportedOperationException(); } } class FilteredAsLongIterator implements Iterator { long next; int cursor; FilteredAsLongIterator() { cursor = origin; advance() ; } private void advance() { while (cursor < fence) { if (isSelected(cursor)) { next = lget(cursor); break; } cursor++; } } public boolean hasNext() { return cursor < fence; } public Long next() { if (cursor >= fence) throw new NoSuchElementException(); Long x = Long.valueOf(next); cursor++; advance(); return x; } public void remove() { throw new UnsupportedOperationException(); } } class Sequentially implements Iterable { public Iterator iterator() { if (hasFilter()) return new FilteredIterator(); else return new UnfilteredIterator(); } } class UnfilteredIterator implements Iterator { int cursor = origin; public boolean hasNext() { return cursor < fence; } public U next() { if (cursor >= fence) throw new NoSuchElementException(); return (U)oget(cursor++); } public void remove() { throw new UnsupportedOperationException(); } } class FilteredIterator implements Iterator { Object next; int cursor; FilteredIterator() { cursor = origin; advance() ; } private void advance() { while (cursor < fence) { if (isSelected(cursor)) { next = oget(cursor); break; } cursor++; } } public boolean hasNext() { return cursor < fence; } public U next() { if (cursor >= fence) throw new NoSuchElementException(); U x = (U)next; cursor++; advance(); return x; } public void remove() { throw new UnsupportedOperationException(); } } // Zillions of little classes to support binary ops // ToDo: specialize to flatten dispatch static IntAndObjectToObject indexedMapper (final BinaryOp combiner, final ParallelArrayWithMapping u, final int origin) { return new IntAndObjectToObject() { final int offset = u.origin - origin; public V op(int i, T a) { return combiner.op(a, (U)(u.oget(i+offset))); } }; } static IntAndObjectToDouble indexedMapper (final ObjectAndObjectToDouble combiner, final ParallelArrayWithMapping u, final int origin) { return new IntAndObjectToDouble() { final int offset = u.origin - origin; public double op(int i, T a) { return combiner.op(a, (U)(u.oget(i+offset))); } }; } static IntAndObjectToLong indexedMapper (final ObjectAndObjectToLong combiner, final ParallelArrayWithMapping u, final int origin) { return new IntAndObjectToLong() { final int offset = u.origin - origin; public long op(int i, T a) { return combiner.op(a, (U)(u.oget(i+offset))); } }; } static IntAndObjectToObject indexedMapper (final ObjectAndDoubleToObject combiner, final ParallelDoubleArrayWithDoubleMapping u, final int origin) { return new IntAndObjectToObject() { final int offset = u.origin - origin; public V op(int i, T a) { return combiner.op(a, u.dget(i+offset)); } }; } static IntAndObjectToDouble indexedMapper (final ObjectAndDoubleToDouble combiner, final ParallelDoubleArrayWithDoubleMapping u, final int origin) { return new IntAndObjectToDouble() { final int offset = u.origin - origin; public double op(int i, T a) { return combiner.op(a, u.dget(i+offset)); } }; } static IntAndObjectToLong indexedMapper (final ObjectAndDoubleToLong combiner, final ParallelDoubleArrayWithDoubleMapping u, final int origin) { return new IntAndObjectToLong() { final int offset = u.origin - origin; public long op(int i, T a) { return combiner.op(a, u.dget(i+offset)); } }; } static IntAndObjectToObject indexedMapper (final ObjectAndLongToObject combiner, final ParallelLongArrayWithLongMapping u, final int origin) { return new IntAndObjectToObject() { final int offset = u.origin - origin; public V op(int i, T a) { return combiner.op(a, u.lget(i+offset)); } }; } static IntAndObjectToDouble indexedMapper (final ObjectAndLongToDouble combiner, final ParallelLongArrayWithLongMapping u, final int origin) { return new IntAndObjectToDouble() { final int offset = u.origin - origin; public double op(int i, T a) { return combiner.op(a, u.lget(i+offset)); } }; } static IntAndObjectToLong indexedMapper (final ObjectAndLongToLong combiner, final ParallelLongArrayWithLongMapping u, final int origin) { return new IntAndObjectToLong() { final int offset = u.origin - origin; public long op(int i, T a) { return combiner.op(a, u.lget(i+offset)); } }; } static IntAndDoubleToObject indexedMapper (final DoubleAndObjectToObject combiner, final ParallelArrayWithMapping u, final int origin) { return new IntAndDoubleToObject() { final int offset = u.origin - origin; public V op(int i, double a) { return combiner.op(a, (U)(u.oget(i+offset))); } }; } static IntAndDoubleToDouble indexedMapper (final DoubleAndObjectToDouble combiner, final ParallelArrayWithMapping u, final int origin) { return new IntAndDoubleToDouble() { final int offset = u.origin - origin; public double op(int i, double a) { return combiner.op(a, (U)(u.oget(i+offset))); } }; } static IntAndDoubleToLong indexedMapper (final DoubleAndObjectToLong combiner, final ParallelArrayWithMapping u, final int origin) { return new IntAndDoubleToLong() { final int offset = u.origin - origin; public long op(int i, double a) { return combiner.op(a, (U)(u.oget(i+offset))); } }; } static IntAndDoubleToObject indexedMapper (final DoubleAndDoubleToObject combiner, final ParallelDoubleArrayWithDoubleMapping u, final int origin) { return new IntAndDoubleToObject() { final int offset = u.origin - origin; public V op(int i, double a) { return combiner.op(a, u.dget(i+offset)); } }; } static IntAndDoubleToDouble indexedMapper (final BinaryDoubleOp combiner, final ParallelDoubleArrayWithDoubleMapping u, final int origin) { return new IntAndDoubleToDouble() { final int offset = u.origin - origin; public double op(int i, double a) { return combiner.op(a, u.dget(i+offset)); } }; } static IntAndDoubleToLong indexedMapper (final DoubleAndDoubleToLong combiner, final ParallelDoubleArrayWithDoubleMapping u, final int origin) { return new IntAndDoubleToLong() { final int offset = u.origin - origin; public long op(int i, double a) { return combiner.op(a, u.dget(i+offset)); } }; } static IntAndDoubleToObject indexedMapper (final DoubleAndLongToObject combiner, final ParallelLongArrayWithLongMapping u, final int origin) { return new IntAndDoubleToObject() { final int offset = u.origin - origin; public V op(int i, double a) { return combiner.op(a, u.lget(i+offset)); } }; } static IntAndDoubleToDouble indexedMapper (final DoubleAndLongToDouble combiner, final ParallelLongArrayWithLongMapping u, final int origin) { return new IntAndDoubleToDouble() { final int offset = u.origin - origin; public double op(int i, double a) { return combiner.op(a, u.lget(i+offset)); } }; } static IntAndDoubleToLong indexedMapper (final DoubleAndLongToLong combiner, final ParallelLongArrayWithLongMapping u, final int origin) { return new IntAndDoubleToLong() { final int offset = u.origin - origin; public long op(int i, double a) { return combiner.op(a, u.lget(i+offset)); } }; } static IntAndLongToObject indexedMapper (final LongAndObjectToObject combiner, final ParallelArrayWithMapping u, final int origin) { return new IntAndLongToObject() { final int offset = u.origin - origin; public V op(int i, long a) { return combiner.op(a, (U)(u.oget(i+offset))); } }; } static IntAndLongToDouble indexedMapper (final LongAndObjectToDouble combiner, final ParallelArrayWithMapping u, final int origin) { return new IntAndLongToDouble() { final int offset = u.origin - origin; public double op(int i, long a) { return combiner.op(a, (U)(u.oget(i+offset))); } }; } static IntAndLongToLong indexedMapper (final LongAndObjectToLong combiner, final ParallelArrayWithMapping u, final int origin) { return new IntAndLongToLong() { final int offset = u.origin - origin; public long op(int i, long a) { return combiner.op(a, (U)(u.oget(i+offset))); } }; } static IntAndLongToObject indexedMapper (final LongAndDoubleToObject combiner, final ParallelDoubleArrayWithDoubleMapping u, final int origin) { return new IntAndLongToObject() { final int offset = u.origin - origin; public V op(int i, long a) { return combiner.op(a, u.dget(i+offset)); } }; } static IntAndLongToDouble indexedMapper (final LongAndDoubleToDouble combiner, final ParallelDoubleArrayWithDoubleMapping u, final int origin) { return new IntAndLongToDouble() { final int offset = u.origin - origin; public double op(int i, long a) { return combiner.op(a, u.dget(i+offset)); } }; } static IntAndLongToLong indexedMapper (final LongAndDoubleToLong combiner, final ParallelDoubleArrayWithDoubleMapping u, final int origin) { return new IntAndLongToLong() { final int offset = u.origin - origin; public long op(int i, long a) { return combiner.op(a, u.dget(i+offset)); } }; } static IntAndLongToObject indexedMapper (final LongAndLongToObject combiner, final ParallelLongArrayWithLongMapping u, final int origin) { return new IntAndLongToObject() { final int offset = u.origin - origin; public V op(int i, long a) { return combiner.op(a, u.lget(i+offset)); } }; } static IntAndLongToDouble indexedMapper (final LongAndLongToDouble combiner, final ParallelLongArrayWithLongMapping u, final int origin) { return new IntAndLongToDouble() { final int offset = u.origin - origin; public double op(int i, long a) { return combiner.op(a, u.lget(i+offset)); } }; } static IntAndLongToLong indexedMapper (final BinaryLongOp combiner, final ParallelLongArrayWithLongMapping u, final int origin) { return new IntAndLongToLong() { final int offset = u.origin - origin; public long op(int i, long a) { return combiner.op(a, u.lget(i+offset)); } }; } static IntAndObjectToObject compoundIndexedOp (final IntAndObjectToObject fst, final IntAndObjectToObject snd) { return new IntAndObjectToObject() { public V op(int i, T a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndObjectToDouble compoundIndexedOp (final IntAndObjectToObject fst, final IntAndObjectToDouble snd) { return new IntAndObjectToDouble() { public double op(int i, T a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndObjectToLong compoundIndexedOp (final IntAndObjectToObject fst, final IntAndObjectToLong snd) { return new IntAndObjectToLong() { public long op(int i, T a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndDoubleToObject compoundIndexedOp (final IntAndDoubleToObject fst, final IntAndObjectToObject snd) { return new IntAndDoubleToObject() { public V op(int i, double a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndDoubleToDouble compoundIndexedOp (final IntAndDoubleToObject fst, final IntAndObjectToDouble snd) { return new IntAndDoubleToDouble() { public double op(int i, double a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndDoubleToLong compoundIndexedOp (final IntAndDoubleToObject fst, final IntAndObjectToLong snd) { return new IntAndDoubleToLong() { public long op(int i, double a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndLongToObject compoundIndexedOp (final IntAndLongToObject fst, final IntAndObjectToObject snd) { return new IntAndLongToObject() { public V op(int i, long a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndLongToDouble compoundIndexedOp (final IntAndLongToObject fst, final IntAndObjectToDouble snd) { return new IntAndLongToDouble() { public double op(int i, long a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndLongToLong compoundIndexedOp (final IntAndLongToObject fst, final IntAndObjectToLong snd) { return new IntAndLongToLong() { public long op(int i, long a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndObjectToObject compoundIndexedOp (final IntAndObjectToDouble fst, final IntAndDoubleToObject snd) { return new IntAndObjectToObject() { public V op(int i, T a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndObjectToDouble compoundIndexedOp (final IntAndObjectToDouble fst, final IntAndDoubleToDouble snd) { return new IntAndObjectToDouble() { public double op(int i, T a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndObjectToLong compoundIndexedOp (final IntAndObjectToLong fst, final IntAndLongToLong snd) { return new IntAndObjectToLong() { public long op(int i, T a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndDoubleToObject compoundIndexedOp (final IntAndDoubleToLong fst, final IntAndLongToObject snd) { return new IntAndDoubleToObject() { public V op(int i, double a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndDoubleToDouble compoundIndexedOp (final IntAndDoubleToDouble fst, final IntAndDoubleToDouble snd) { return new IntAndDoubleToDouble() { public double op(int i, double a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndDoubleToLong compoundIndexedOp (final IntAndDoubleToDouble fst, final IntAndDoubleToLong snd) { return new IntAndDoubleToLong() { public long op(int i, double a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndLongToObject compoundIndexedOp (final IntAndLongToDouble fst, final IntAndDoubleToObject snd) { return new IntAndLongToObject() { public V op(int i, long a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndLongToDouble compoundIndexedOp (final IntAndLongToDouble fst, final IntAndDoubleToDouble snd) { return new IntAndLongToDouble() { public double op(int i, long a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndLongToLong compoundIndexedOp (final IntAndLongToDouble fst, final IntAndDoubleToLong snd) { return new IntAndLongToLong() { public long op(int i, long a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndObjectToObject compoundIndexedOp (final IntAndObjectToLong fst, final IntAndLongToObject snd) { return new IntAndObjectToObject() { public V op(int i, T a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndObjectToDouble compoundIndexedOp (final IntAndObjectToLong fst, final IntAndLongToDouble snd) { return new IntAndObjectToDouble() { public double op(int i, T a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndObjectToLong compoundIndexedOp (final IntAndObjectToDouble fst, final IntAndDoubleToLong snd) { return new IntAndObjectToLong() { public long op(int i, T a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndDoubleToObject compoundIndexedOp (final IntAndDoubleToDouble fst, final IntAndDoubleToObject snd) { return new IntAndDoubleToObject() { public V op(int i, double a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndDoubleToDouble compoundIndexedOp (final IntAndDoubleToLong fst, final IntAndLongToDouble snd) { return new IntAndDoubleToDouble() { public double op(int i, double a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndDoubleToLong compoundIndexedOp (final IntAndDoubleToLong fst, final IntAndLongToLong snd) { return new IntAndDoubleToLong() { public long op(int i, double a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndLongToObject compoundIndexedOp (final IntAndLongToLong fst, final IntAndLongToObject snd) { return new IntAndLongToObject() { public V op(int i, long a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndLongToDouble compoundIndexedOp (final IntAndLongToLong fst, final IntAndLongToDouble snd) { return new IntAndLongToDouble() { public double op(int i, long a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndLongToLong compoundIndexedOp (final IntAndLongToLong fst, final IntAndLongToLong snd) { return new IntAndLongToLong() { public long op(int i, long a) { return snd.op(i, fst.op(i, a)); } }; } static IntAndObjectToObject compoundIndexedOp (final IntAndObjectToObject fst, final Op snd) { return new IntAndObjectToObject() { public V op(int i, T a) { return snd.op(fst.op(i, a)); } }; } static IntAndObjectToDouble compoundIndexedOp (final IntAndObjectToObject fst, final ObjectToDouble snd) { return new IntAndObjectToDouble() { public double op(int i, T a) { return snd.op(fst.op(i, a)); } }; } static IntAndObjectToLong compoundIndexedOp (final IntAndObjectToObject fst, final ObjectToLong snd) { return new IntAndObjectToLong() { public long op(int i, T a) { return snd.op(fst.op(i, a)); } }; } static IntAndDoubleToObject compoundIndexedOp (final IntAndDoubleToObject fst, final Op snd) { return new IntAndDoubleToObject() { public V op(int i, double a) { return snd.op(fst.op(i, a)); } }; } static IntAndDoubleToDouble compoundIndexedOp (final IntAndDoubleToObject fst, final ObjectToDouble snd) { return new IntAndDoubleToDouble() { public double op(int i, double a) { return snd.op(fst.op(i, a)); } }; } static IntAndDoubleToLong compoundIndexedOp (final IntAndDoubleToObject fst, final ObjectToLong snd) { return new IntAndDoubleToLong() { public long op(int i, double a) { return snd.op(fst.op(i, a)); } }; } static IntAndLongToObject compoundIndexedOp (final IntAndLongToObject fst, final Op snd) { return new IntAndLongToObject() { public V op(int i, long a) { return snd.op(fst.op(i, a)); } }; } static IntAndLongToDouble compoundIndexedOp (final IntAndLongToObject fst, final ObjectToDouble snd) { return new IntAndLongToDouble() { public double op(int i, long a) { return snd.op(fst.op(i, a)); } }; } static IntAndLongToLong compoundIndexedOp (final IntAndLongToObject fst, final ObjectToLong snd) { return new IntAndLongToLong() { public long op(int i, long a) { return snd.op(fst.op(i, a)); } }; } static IntAndObjectToObject compoundIndexedOp (final IntAndObjectToDouble fst, final DoubleToObject snd) { return new IntAndObjectToObject() { public V op(int i, T a) { return snd.op(fst.op(i, a)); } }; } static IntAndObjectToDouble compoundIndexedOp (final IntAndObjectToDouble fst, final DoubleOp snd) { return new IntAndObjectToDouble() { public double op(int i, T a) { return snd.op(fst.op(i, a)); } }; } static IntAndObjectToLong compoundIndexedOp (final IntAndObjectToDouble fst, final DoubleToLong snd) { return new IntAndObjectToLong() { public long op(int i, T a) { return snd.op(fst.op(i, a)); } }; } static IntAndDoubleToObject compoundIndexedOp (final IntAndDoubleToDouble fst, final DoubleToObject snd) { return new IntAndDoubleToObject() { public V op(int i, double a) { return snd.op(fst.op(i, a)); } }; } static IntAndDoubleToDouble compoundIndexedOp (final IntAndDoubleToDouble fst, final DoubleOp snd) { return new IntAndDoubleToDouble() { public double op(int i, double a) { return snd.op(fst.op(i, a)); } }; } static IntAndDoubleToLong compoundIndexedOp (final IntAndDoubleToDouble fst, final DoubleToLong snd) { return new IntAndDoubleToLong() { public long op(int i, double a) { return snd.op(fst.op(i, a)); } }; } static IntAndLongToObject compoundIndexedOp (final IntAndLongToDouble fst, final DoubleToObject snd) { return new IntAndLongToObject() { public V op(int i, long a) { return snd.op(fst.op(i, a)); } }; } static IntAndLongToDouble compoundIndexedOp (final IntAndLongToDouble fst, final DoubleOp snd) { return new IntAndLongToDouble() { public double op(int i,long a) { return snd.op(fst.op(i, a)); } }; } static IntAndLongToLong compoundIndexedOp (final IntAndLongToDouble fst, final DoubleToLong snd) { return new IntAndLongToLong() { public long op(int i, long a) { return snd.op(fst.op(i, a)); } }; } static IntAndObjectToObject compoundIndexedOp (final IntAndObjectToLong fst, final LongToObject snd) { return new IntAndObjectToObject() { public V op(int i, T a) { return snd.op(fst.op(i, a)); } }; } static IntAndObjectToDouble compoundIndexedOp (final IntAndObjectToLong fst, final LongToDouble snd) { return new IntAndObjectToDouble() { public double op(int i, T a) { return snd.op(fst.op(i, a)); } }; } static IntAndObjectToLong compoundIndexedOp (final IntAndObjectToLong fst, final LongOp snd) { return new IntAndObjectToLong() { public long op(int i, T a) { return snd.op(fst.op(i, a)); } }; } static IntAndDoubleToObject compoundIndexedOp (final IntAndDoubleToLong fst, final LongToObject snd) { return new IntAndDoubleToObject() { public V op(int i, double a) { return snd.op(fst.op(i, a)); } }; } static IntAndDoubleToDouble compoundIndexedOp (final IntAndDoubleToLong fst, final LongToDouble snd) { return new IntAndDoubleToDouble() { public double op(int i, double a) { return snd.op(fst.op(i, a)); } }; } static IntAndDoubleToLong compoundIndexedOp (final IntAndDoubleToLong fst, final LongOp snd) { return new IntAndDoubleToLong() { public long op(int i, double a) { return snd.op(fst.op(i, a)); } }; } static IntAndLongToObject compoundIndexedOp (final IntAndLongToLong fst, final LongToObject snd) { return new IntAndLongToObject() { public V op(int i, long a) { return snd.op(fst.op(i, a)); } }; } static IntAndLongToDouble compoundIndexedOp (final IntAndLongToLong fst, final LongToDouble snd) { return new IntAndLongToDouble() { public double op(int i,long a) { return snd.op(fst.op(i, a)); } }; } static IntAndLongToLong compoundIndexedOp (final IntAndLongToLong fst, final LongOp snd) { return new IntAndLongToLong() { public long op(int i, long a) { return snd.op(fst.op(i, a)); } }; } static IntAndObjectToObject compoundIndexedOp (final Op fst, final IntAndObjectToObject snd) { return new IntAndObjectToObject() { public V op(int i, T a) { return snd.op(i, fst.op(a)); } }; } static IntAndObjectToDouble compoundIndexedOp (final Op fst, final IntAndObjectToDouble snd) { return new IntAndObjectToDouble() { public double op(int i, T a) { return snd.op(i, fst.op(a)); } }; } static IntAndObjectToLong compoundIndexedOp (final Op fst, final IntAndObjectToLong snd) { return new IntAndObjectToLong() { public long op(int i, T a) { return snd.op(i, fst.op(a)); } }; } static IntAndDoubleToObject compoundIndexedOp (final DoubleToObject fst, final IntAndObjectToObject snd) { return new IntAndDoubleToObject() { public V op(int i, double a) { return snd.op(i, fst.op(a)); } }; } static IntAndDoubleToDouble compoundIndexedOp (final DoubleToObject fst, final IntAndObjectToDouble snd) { return new IntAndDoubleToDouble() { public double op(int i, double a) { return snd.op(i, fst.op(a)); } }; } static IntAndDoubleToLong compoundIndexedOp (final DoubleToObject fst, final IntAndObjectToLong snd) { return new IntAndDoubleToLong() { public long op(int i, double a) { return snd.op(i, fst.op(a)); } }; } static IntAndLongToObject compoundIndexedOp (final LongToObject fst, final IntAndObjectToObject snd) { return new IntAndLongToObject() { public V op(int i, long a) { return snd.op(i, fst.op(a)); } }; } static IntAndLongToDouble compoundIndexedOp (final LongToObject fst, final IntAndObjectToDouble snd) { return new IntAndLongToDouble() { public double op(int i, long a) { return snd.op(i, fst.op(a)); } }; } static IntAndLongToLong compoundIndexedOp (final LongToObject fst, final IntAndObjectToLong snd) { return new IntAndLongToLong() { public long op(int i, long a) { return snd.op(i, fst.op(a)); } }; } static IntAndObjectToObject compoundIndexedOp (final ObjectToDouble fst, final IntAndDoubleToObject snd) { return new IntAndObjectToObject() { public V op(int i, T a) { return snd.op(i, fst.op(a)); } }; } static IntAndObjectToDouble compoundIndexedOp (final ObjectToDouble fst, final IntAndDoubleToDouble snd) { return new IntAndObjectToDouble() { public double op(int i, T a) { return snd.op(i, fst.op(a)); } }; } static IntAndObjectToLong compoundIndexedOp (final ObjectToDouble fst, final IntAndDoubleToLong snd) { return new IntAndObjectToLong() { public long op(int i, T a) { return snd.op(i, fst.op(a)); } }; } static IntAndDoubleToObject compoundIndexedOp (final DoubleOp fst, final IntAndDoubleToObject snd) { return new IntAndDoubleToObject() { public V op(int i, double a) { return snd.op(i, fst.op(a)); } }; } static IntAndDoubleToDouble compoundIndexedOp (final DoubleOp fst, final IntAndDoubleToDouble snd) { return new IntAndDoubleToDouble() { public double op(int i, double a) { return snd.op(i, fst.op(a)); } }; } static IntAndDoubleToLong compoundIndexedOp (final DoubleOp fst, final IntAndDoubleToLong snd) { return new IntAndDoubleToLong() { public long op(int i, double a) { return snd.op(i, fst.op(a)); } }; } static IntAndLongToObject compoundIndexedOp (final LongToDouble fst, final IntAndDoubleToObject snd) { return new IntAndLongToObject() { public V op(int i, long a) { return snd.op(i, fst.op(a)); } }; } static IntAndLongToDouble compoundIndexedOp (final LongToDouble fst, final IntAndDoubleToDouble snd) { return new IntAndLongToDouble() { public double op(int i, long a) { return snd.op(i, fst.op(a)); } }; } static IntAndLongToLong compoundIndexedOp (final LongToDouble fst, final IntAndDoubleToLong snd) { return new IntAndLongToLong() { public long op(int i, long a) { return snd.op(i, fst.op(a)); } }; } static IntAndObjectToObject compoundIndexedOp (final ObjectToLong fst, final IntAndLongToObject snd) { return new IntAndObjectToObject() { public V op(int i, T a) { return snd.op(i, fst.op(a)); } }; } static IntAndObjectToDouble compoundIndexedOp (final ObjectToLong fst, final IntAndLongToDouble snd) { return new IntAndObjectToDouble() { public double op(int i, T a) { return snd.op(i, fst.op(a)); } }; } static IntAndObjectToLong compoundIndexedOp (final ObjectToLong fst, final IntAndLongToLong snd) { return new IntAndObjectToLong() { public long op(int i, T a) { return snd.op(i, fst.op(a)); } }; } static IntAndDoubleToObject compoundIndexedOp (final DoubleToLong fst, final IntAndLongToObject snd) { return new IntAndDoubleToObject() { public V op(int i, double a) { return snd.op(i, fst.op(a)); } }; } static IntAndDoubleToDouble compoundIndexedOp (final DoubleToLong fst, final IntAndLongToDouble snd) { return new IntAndDoubleToDouble() { public double op(int i, double a) { return snd.op(i, fst.op(a)); } }; } static IntAndDoubleToLong compoundIndexedOp (final DoubleToLong fst, final IntAndLongToLong snd) { return new IntAndDoubleToLong() { public long op(int i, double a) { return snd.op(i, fst.op(a)); } }; } static IntAndLongToObject compoundIndexedOp (final LongOp fst, final IntAndLongToObject snd) { return new IntAndLongToObject() { public V op(int i, long a) { return snd.op(i, fst.op(a)); } }; } static IntAndLongToDouble compoundIndexedOp (final LongOp fst, final IntAndLongToDouble snd) { return new IntAndLongToDouble() { public double op(int i, long a) { return snd.op(i, fst.op(a)); } }; } static IntAndLongToLong compoundIndexedOp (final LongOp fst, final IntAndLongToLong snd) { return new IntAndLongToLong() { public long op(int i, long a) { return snd.op(i, fst.op(a)); } }; } // binary predicates static IntAndObjectPredicate indexedSelector (final BinaryPredicate bp, final ParallelArrayWithMapping u, final int origin) { return new IntAndObjectPredicate() { final int offset = u.origin - origin; public boolean op(int i, T a) { int k = i + offset; return u.isSelected(k) && bp.op(a, (U)(u.oget(k))); } }; } static IntAndDoublePredicate indexedSelector (final BinaryDoublePredicate bp, final ParallelDoubleArrayWithDoubleMapping u, final int origin) { return new IntAndDoublePredicate() { final int offset = u.origin - origin; public boolean op(int i, double a) { int k = i + offset; return u.isSelected(k) && bp.op(a, u.dget(k)); } }; } static IntAndLongPredicate indexedSelector (final BinaryLongPredicate bp, final ParallelLongArrayWithLongMapping u, final int origin) { return new IntAndLongPredicate() { final int offset = u.origin - origin; public boolean op(int i, long a) { int k = i + offset; return u.isSelected(k) && bp.op(a, u.lget(k)); } }; } static IntAndObjectPredicate compoundIndexedSelector (final Predicate fst, final IntAndObjectPredicate snd) { return new IntAndObjectPredicate() { public boolean op(int i, T a) { return fst.op(a) && snd.op(i, a); } }; } static IntAndObjectPredicate compoundIndexedSelector (final IntAndObjectPredicate fst, final IntAndObjectPredicate snd) { return new IntAndObjectPredicate() { public boolean op(int i, T a) { return fst.op(i, a) && snd.op(i, a); } }; } static IntAndObjectPredicate compoundIndexedSelector (final IntAndObjectPredicate fst, final Predicate snd) { return new IntAndObjectPredicate() { public boolean op(int i, T a) { return fst.op(i, a) && snd.op(a); } }; } static IntAndDoublePredicate compoundIndexedSelector (final DoublePredicate fst, final IntAndDoublePredicate snd) { return new IntAndDoublePredicate() { public boolean op(int i, double a) { return fst.op(a) && snd.op(i, a); } }; } static IntAndDoublePredicate compoundIndexedSelector (final IntAndDoublePredicate fst, final IntAndDoublePredicate snd) { return new IntAndDoublePredicate() { public boolean op(int i, double a) { return fst.op(i, a) && snd.op(i, a); } }; } static IntAndDoublePredicate compoundIndexedSelector (final IntAndDoublePredicate fst, final DoublePredicate snd) { return new IntAndDoublePredicate() { public boolean op(int i, double a) { return fst.op(i, a) && snd.op(a); } }; } static IntAndLongPredicate compoundIndexedSelector (final LongPredicate fst, final IntAndLongPredicate snd) { return new IntAndLongPredicate() { public boolean op(int i, long a) { return fst.op(a) && snd.op(i, a); } }; } static IntAndLongPredicate compoundIndexedSelector (final IntAndLongPredicate fst, final IntAndLongPredicate snd) { return new IntAndLongPredicate() { public boolean op(int i, long a) { return fst.op(i, a) && snd.op(i, a); } }; } static IntAndLongPredicate compoundIndexedSelector (final IntAndLongPredicate fst, final LongPredicate snd) { return new IntAndLongPredicate() { public boolean op(int i, long a) { return fst.op(i, a) && snd.op(a); } }; } } jsr166/src/extra166y/ParallelLongArrayWithBounds.java0000644000000000000000000001046511537741066017604 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelLongArray that causes operations to apply * only to elements within a given range. * Instances of this class may be constructed only via prefix * methods of ParallelLongArray or its other prefix classes. */ public abstract class ParallelLongArrayWithBounds extends ParallelLongArrayWithFilter { ParallelLongArrayWithBounds (ForkJoinPool ex, int origin, int fence, long[] array) { super(ex, origin, fence, array); } /** * Returns an operation prefix that causes a method to operate * only on the elements of the array between firstIndex * (inclusive) and upperBound (exclusive). The bound * arguments are relative to the current bounds. For example * pa.withBounds(2, 8).withBounds(3, 5) indexes the * 5th (= 2+3) and 6th elements of pa. However, indices * returned by methods such as indexOf are * with respect to the underlying ParallelLongArray. * @param firstIndex the lower bound (inclusive) * @param upperBound the upper bound (exclusive) * @return operation prefix */ public abstract ParallelLongArrayWithBounds withBounds (int firstIndex, int upperBound); /** * Returns the index of some element equal to given target, or * -1 if not present * @param target the element to search for * @return the index or -1 if not present */ public abstract int indexOf(long target); /** * Assuming this array is sorted, returns the index of an * element equal to given target, or -1 if not present. If the * array is not sorted, the results are undefined. * @param target the element to search for * @return the index or -1 if not present */ public abstract int binarySearch(long target); /** * Assuming this array is sorted with respect to the given * comparator, returns the index of an element equal to given * target, or -1 if not present. If the array is not sorted, * the results are undefined. * @param target the element to search for * @param comparator the comparator * @return the index or -1 if not present */ public abstract int binarySearch(long target, LongComparator comparator); /** * Replaces each element with the running cumulation of applying * the given reducer. * @param reducer the reducer * @param base the result for an empty array * @return this (to simplify use in expressions) */ public abstract ParallelLongArrayWithBounds cumulate(LongReducer reducer, long base); /** * Replaces each element with the running sum * @return this (to simplify use in expressions) */ public abstract ParallelLongArrayWithBounds cumulateSum(); /** * Replaces each element with the cumulation of applying the given * reducer to all previous values, and returns the total * reduction. * @param reducer the reducer * @param base the result for an empty array * @return the total reduction */ public abstract long precumulate(LongReducer reducer, long base); /** * Replaces each element with its prefix sum * @return the total sum */ public abstract long precumulateSum(); /** * Sorts the elements. * Unlike Arrays.sort, this sort does * not guarantee that elements with equal keys maintain their * relative position in the array. * @param cmp the comparator to use * @return this (to simplify use in expressions) */ public abstract ParallelLongArrayWithBounds sort(LongComparator cmp); /** * Sorts the elements, assuming all elements are * Comparable. Unlike Arrays.sort, this sort does not * guarantee that elements with equal keys maintain their relative * position in the array. * @throws ClassCastException if any element is not Comparable. * @return this (to simplify use in expressions) */ public abstract ParallelLongArrayWithBounds sort(); } jsr166/src/extra166y/ParallelDoubleArrayWithMapping.java0000644000000000000000000003263311537741066020261 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelDoubleArray that causes operations to apply * to mappings of elements, not to the elements themselves. * Instances of this class may be constructed only via prefix * methods of ParallelDoubleArray or its other prefix classes. */ public abstract class ParallelDoubleArrayWithMapping extends AbstractParallelAnyArray.DPap { ParallelDoubleArrayWithMapping (ForkJoinPool ex, int origin, int fence, double[] array) { super(ex, origin, fence, array); } /** * Applies the given procedure to mapped elements * @param procedure the procedure */ public void apply(Procedure procedure) { ex.invoke(new PAS.FJOApply(this, origin, fence, null, procedure)); } /** * Returns reduction of mapped elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public U reduce(Reducer reducer, U base) { PAS.FJOReduce f = new PAS.FJOReduce (this, origin, fence, null, reducer, base); ex.invoke(f); return (U)(f.result); } /** * Returns mapping of some element matching bound and filter * constraints, or null if none. * @return mapping of matching element, or null if none. */ public U any() { int i = anyIndex(); return (i < 0) ? null : (U)oget(i); } /** * Returns the minimum mapped element, or null if empty * @param comparator the comparator * @return minimum mapped element, or null if empty */ public U min(Comparator comparator) { return reduce(CommonOps.minReducer(comparator), null); } /** * Returns the minimum mapped element, or null if empty, * assuming that all elements are Comparables * @return minimum mapped element, or null if empty * @throws ClassCastException if any element is not Comparable. */ public U min() { return reduce((Reducer)(CommonOps.castedMinReducer()), null); } /** * Returns the maximum mapped element, or null if empty * @param comparator the comparator * @return maximum mapped element, or null if empty */ public U max(Comparator comparator) { return reduce(CommonOps.maxReducer(comparator), null); } /** * Returns the maximum mapped element, or null if empty * assuming that all elements are Comparables * @return maximum mapped element, or null if empty * @throws ClassCastException if any element is not Comparable. */ public U max() { return reduce((Reducer)(CommonOps.castedMaxReducer()), null); } /** * Returns summary statistics, using the given comparator * to locate minimum and maximum elements. * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelArray.SummaryStatistics summary (Comparator comparator) { PAS.FJOStats f = new PAS.FJOStats (this, origin, fence, null, comparator); ex.invoke(f); return (ParallelArray.SummaryStatistics)f; } /** * Returns summary statistics, assuming that all elements are * Comparables * @return the summary. */ public ParallelArray.SummaryStatistics summary() { return summary((Comparator)(CommonOps.castedComparator())); } /** * Returns a new ParallelArray holding elements * @return a new ParallelArray holding elements */ public ParallelArray all() { return new ParallelArray(ex, (U[])allObjects(null)); } /** * Returns a new ParallelArray with the given element type holding * elements * @param elementType the type of the elements * @return a new ParallelArray holding elements */ public ParallelArray all(Class elementType) { return new ParallelArray(ex, (U[])allObjects(elementType)); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op * applied to current op's results * @param op the op * @return operation prefix */ public abstract ParallelDoubleArrayWithMapping withMapping (Op op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op * applied to current op's results * @param op the op * @return operation prefix */ public abstract ParallelDoubleArrayWithDoubleMapping withMapping (ObjectToDouble op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op * applied to current op's results * @param op the op * @return operation prefix */ public abstract ParallelDoubleArrayWithLongMapping withMapping (ObjectToLong op); /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (BinaryOp combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (ObjectAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (ObjectAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithDoubleMapping withMapping (ObjectAndObjectToDouble combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithDoubleMapping withMapping (ObjectAndDoubleToDouble combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix */ public ParallelDoubleArrayWithDoubleMapping withMapping (ObjectAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (ObjectAndObjectToLong combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (ObjectAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (ObjectAndLongToLong combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelDoubleArrayWithMapping withIndexedMapping (IntAndObjectToObject mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndObjectToDouble mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndObjectToLong mapper); /** * Returns an Iterable view to sequentially step through mapped * elements also obeying bound and filter constraints, without * performing computations to evaluate them in parallel * @return the Iterable view */ public Iterable sequentially() { return new Sequentially(); } } jsr166/src/extra166y/ParallelLongArrayWithLongMapping.java0000644000000000000000000003061411537741066020563 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelLongArray that causes operations to apply * to mappings of elements, not to the elements themselves. * Instances of this class may be constructed only via prefix * methods of ParallelLongArray or its other prefix classes. */ public abstract class ParallelLongArrayWithLongMapping extends AbstractParallelAnyArray.LPap { ParallelLongArrayWithLongMapping (ForkJoinPool ex, int origin, int fence, long[] array) { super(ex, origin, fence, array); } /** * Applies the given procedure to elements * @param procedure the procedure */ public void apply(LongProcedure procedure) { ex.invoke(new PAS.FJLApply(this, origin, fence, null, procedure)); } /** * Returns reduction of elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public long reduce(LongReducer reducer, long base) { PAS.FJLReduce f = new PAS.FJLReduce (this, origin, fence, null, reducer, base); ex.invoke(f); return f.result; } /** * Returns the minimum element, or Long.MAX_VALUE if empty * @return minimum element, or Long.MAX_VALUE if empty */ public long min() { return reduce(CommonOps.naturalLongMinReducer(), Long.MAX_VALUE); } /** * Returns the minimum element, or Long.MAX_VALUE if empty * @param comparator the comparator * @return minimum element, or Long.MAX_VALUE if empty */ public long min(LongComparator comparator) { return reduce(CommonOps.longMinReducer(comparator), Long.MAX_VALUE); } /** * Returns the maximum element, or Long.MIN_VALUE if empty * @return maximum element, or Long.MIN_VALUE if empty */ public long max() { return reduce(CommonOps.naturalLongMaxReducer(), Long.MIN_VALUE); } /** * Returns the maximum element, or Long.MIN_VALUE if empty * @param comparator the comparator * @return maximum element, or Long.MIN_VALUE if empty */ public long max(LongComparator comparator) { return reduce(CommonOps.longMaxReducer(comparator), Long.MIN_VALUE); } /** * Returns the sum of elements * @return the sum of elements */ public long sum() { return reduce(CommonOps.longAdder(), 0L); } /** * Returns summary statistics * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelLongArray.SummaryStatistics summary (LongComparator comparator) { PAS.FJLStats f = new PAS.FJLStats (this, origin, fence, null, comparator); ex.invoke(f); return f; } /** * Returns summary statistics, using natural comparator * @return the summary. */ public ParallelLongArray.SummaryStatistics summary() { return summary(CommonOps.naturalLongComparator()); } /** * Returns a new ParallelLongArray holding elements * @return a new ParallelLongArray holding elements */ public ParallelLongArray all() { return new ParallelLongArray(ex, allLongs()); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelLongArrayWithLongMapping withMapping(LongOp op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelLongArrayWithDoubleMapping withMapping (LongToDouble op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelLongArrayWithMapping withMapping (LongToObject op); /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (LongAndObjectToObject combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (LongAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithMapping withMapping (LongAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (LongAndObjectToDouble combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (LongAndDoubleToDouble combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithDoubleMapping withMapping (LongAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (LongAndObjectToLong combiner, ParallelArrayWithMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (LongAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelLongArrayWithLongMapping withMapping (BinaryLongOp combiner, ParallelLongArrayWithLongMapping other) { if (other.hasFilter()) throw new IllegalArgumentException(); return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelLongArrayWithMapping withIndexedMapping (IntAndLongToObject mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelLongArrayWithDoubleMapping withIndexedMapping (IntAndLongToDouble mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelLongArrayWithLongMapping withIndexedMapping (IntAndLongToLong mapper); /** * Returns an Iterable view to sequentially step through mapped * elements also obeying bound and filter constraints, without * performing computations to evaluate them in parallel * @return the Iterable view */ public Iterable sequentially() { return new SequentiallyAsLong(); } } jsr166/src/extra166y/ParallelDoubleArrayWithBounds.java0000644000000000000000000001060711537741066020115 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelDoubleArray that causes operations to apply * only to elements within a given range. * Instances of this class may be constructed only via prefix * methods of ParallelDoubleArray or its other prefix classes. */ public abstract class ParallelDoubleArrayWithBounds extends ParallelDoubleArrayWithFilter { ParallelDoubleArrayWithBounds (ForkJoinPool ex, int origin, int fence, double[] array) { super(ex, origin, fence, array); } /** * Returns an operation prefix that causes a method to operate * only on the elements of the array between firstIndex * (inclusive) and upperBound (exclusive). The bound * arguments are relative to the current bounds. For example * pa.withBounds(2, 8).withBounds(3, 5) indexes the * 5th (= 2+3) and 6th elements of pa. However, indices * returned by methods such as indexOf are * with respect to the underlying ParallelDoubleArray. * @param firstIndex the lower bound (inclusive) * @param upperBound the upper bound (exclusive) * @return operation prefix */ public abstract ParallelDoubleArrayWithBounds withBounds (int firstIndex, int upperBound); /** * Returns the index of some element equal to given target, * or -1 if not present * @param target the element to search for * @return the index or -1 if not present */ public abstract int indexOf(double target); /** * Assuming this array is sorted, returns the index of an * element equal to given target, or -1 if not present. If the * array is not sorted, the results are undefined. * @param target the element to search for * @return the index or -1 if not present */ public abstract int binarySearch(double target); /** * Assuming this array is sorted with respect to the given * comparator, returns the index of an element equal to given * target, or -1 if not present. If the array is not sorted, * the results are undefined. * @param target the element to search for * @param comparator the comparator * @return the index or -1 if not present */ public abstract int binarySearch(double target, DoubleComparator comparator); /** * Replaces each element with the running cumulation of applying * the given reducer. * @param reducer the reducer * @param base the result for an empty array * @return this (to simplify use in expressions) */ public abstract ParallelDoubleArrayWithBounds cumulate(DoubleReducer reducer, double base); /** * Replaces each element with the running sum * @return this (to simplify use in expressions) */ public abstract ParallelDoubleArrayWithBounds cumulateSum(); /** * Replaces each element with the cumulation of applying the given * reducer to all previous values, and returns the total * reduction. * @param reducer the reducer * @param base the result for an empty array * @return the total reduction */ public abstract double precumulate(DoubleReducer reducer, double base); /** * Replaces each element with its prefix sum * @return the total sum */ public abstract double precumulateSum(); /** * Sorts the elements. * Unlike Arrays.sort, this sort does * not guarantee that elements with equal keys maintain their * relative position in the array. * @param cmp the comparator to use * @return this (to simplify use in expressions) */ public abstract ParallelDoubleArrayWithBounds sort(DoubleComparator cmp); /** * Sorts the elements, assuming all elements are * Comparable. Unlike Arrays.sort, this sort does not * guarantee that elements with equal keys maintain their relative * position in the array. * @throws ClassCastException if any element is not Comparable. * @return this (to simplify use in expressions) */ public abstract ParallelDoubleArrayWithBounds sort(); } jsr166/src/extra166y/ParallelDoubleArray.java0000644000000000000000000011443011537741066016105 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * An array of doubles supporting parallel operations. This class * provides methods supporting the same operations as {@link * ParallelArray}, but specialized for scalar doubles. It additionally * provides a few methods specific to numerical values. */ public class ParallelDoubleArray extends AbstractParallelAnyArray.DUPap { // Same internals as ParallelArray, but specialized for doubles AsList listView; // lazily constructed /** * Returns a common default executor for use in ParallelArrays. * This executor arranges enough parallelism to use most, but not * necessarily all, of the available processors on this system. * @return the executor */ public static ForkJoinPool defaultExecutor() { return PAS.defaultExecutor(); } /** * Constructor for use by subclasses to create a new ParallelDoubleArray * using the given executor, and initially using the supplied * array, with effective size bound by the given limit. This * constructor is designed to enable extensions via * subclassing. To create a ParallelDoubleArray, use {@link #create}, * {@link #createEmpty}, {@link #createUsingHandoff} or {@link * #createFromCopy}. * @param executor the executor * @param array the array * @param limit the upper bound limit */ protected ParallelDoubleArray(ForkJoinPool executor, double[] array, int limit) { super(executor, 0, limit, array); if (executor == null || array == null) throw new NullPointerException(); if (limit < 0 || limit > array.length) throw new IllegalArgumentException(); } /** * Trusted internal version of protected constructor. */ ParallelDoubleArray(ForkJoinPool executor, double[] array) { super(executor, 0, array.length, array); } /** * Creates a new ParallelDoubleArray using the given executor and * an array of the given size * @param size the array size * @param executor the executor */ public static ParallelDoubleArray create (int size, ForkJoinPool executor) { double[] array = new double[size]; return new ParallelDoubleArray(executor, array, size); } /** * Creates a new ParallelDoubleArray initially using the given array and * executor. In general, the handed off array should not be used * for other purposes once constructing this ParallelDoubleArray. The * given array may be internally replaced by another array in the * course of methods that add or remove elements. * @param handoff the array * @param executor the executor */ public static ParallelDoubleArray createUsingHandoff (double[] handoff, ForkJoinPool executor) { return new ParallelDoubleArray(executor, handoff, handoff.length); } /** * Creates a new ParallelDoubleArray using the given executor and * initially holding copies of the given * source elements. * @param source the source of initial elements * @param executor the executor */ public static ParallelDoubleArray createFromCopy (double[] source, ForkJoinPool executor) { // For now, avoid copyOf so people can compile with Java5 int size = source.length; double[] array = new double[size]; System.arraycopy(source, 0, array, 0, size); return new ParallelDoubleArray(executor, array, size); } /** * Creates a new ParallelDoubleArray using an array of the given size, * initially holding copies of the given source truncated or * padded with zeros to obtain the specified length. * @param source the source of initial elements * @param size the array size * @param executor the executor */ public static ParallelDoubleArray createFromCopy (int size, double[] source, ForkJoinPool executor) { // For now, avoid copyOf so people can compile with Java5 double[] array = new double[size]; System.arraycopy(source, 0, array, 0, Math.min(source.length, size)); return new ParallelDoubleArray(executor, array, size); } /** * Creates a new ParallelDoubleArray using the given executor and * an array of the given size, but with an initial effective size * of zero, enabling incremental insertion via {@link * ParallelDoubleArray#asList} operations. * @param size the array size * @param executor the executor */ public static ParallelDoubleArray createEmpty (int size, ForkJoinPool executor) { double[] array = new double[size]; return new ParallelDoubleArray(executor, array, 0); } /** * Summary statistics for a possibly bounded, filtered, and/or * mapped ParallelDoubleArray. */ public static interface SummaryStatistics { /** Return the number of elements */ public int size(); /** Return the minimum element, or Double.MAX_VALUE if empty */ public double min(); /** Return the maximum element, or -Double.MAX_VALUE if empty */ public double max(); /** Return the index of the minimum element, or -1 if empty */ public int indexOfMin(); /** Return the index of the maximum element, or -1 if empty */ public int indexOfMax(); /** Return the sum of all elements */ public double sum(); /** Return the arithmetic average of all elements */ public double average(); } /** * Returns the executor used for computations * @return the executor */ public ForkJoinPool getExecutor() { return ex; } /** * Applies the given procedure to elements * @param procedure the procedure */ public void apply(DoubleProcedure procedure) { super.apply(procedure); } /** * Returns reduction of elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public double reduce(DoubleReducer reducer, double base) { return super.reduce(reducer, base); } /** * Returns a new ParallelDoubleArray holding all elements * @return a new ParallelDoubleArray holding all elements */ public ParallelDoubleArray all() { return super.all(); } /** * Replaces elements with the results of applying the given op * to their current values. * @param op the op * @return this (to simplify use in expressions) */ public ParallelDoubleArray replaceWithMapping(DoubleOp op) { super.replaceWithMapping(op); return this; } /** * Replaces elements with the results of applying the given * op to their indices. * @param op the op * @return this (to simplify use in expressions) */ public ParallelDoubleArray replaceWithMappedIndex(IntToDouble op) { super.replaceWithMappedIndex(op); return this; } /** * Replaces elements with the results of applying the given * mapping to each index and current element value * @param op the op * @return this (to simplify use in expressions) */ public ParallelDoubleArray replaceWithMappedIndex(IntAndDoubleToDouble op) { super.replaceWithMappedIndex(op); return this; } /** * Replaces elements with the results of applying the given * generator. For example, to fill the array with uniform random * values, use * replaceWithGeneratedValue(Ops.doubleRandom()) * @param generator the generator * @return this (to simplify use in expressions) */ public ParallelDoubleArray replaceWithGeneratedValue(DoubleGenerator generator) { super.replaceWithGeneratedValue(generator); return this; } /** * Replaces elements with the given value. * @param value the value * @return this (to simplify use in expressions) */ public ParallelDoubleArray replaceWithValue(double value) { super.replaceWithValue(value); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement) * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) * @throws ArrayIndexOutOfBoundsException if other array has * fewer elements than this array. */ public ParallelDoubleArray replaceWithMapping (BinaryDoubleOp combiner, ParallelDoubleArrayWithDoubleMapping other) { super.replaceWithMapping(combiner, other); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement) * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) * @throws ArrayIndexOutOfBoundsException if other array has * fewer elements than this array. */ public ParallelDoubleArray replaceWithMapping(BinaryDoubleOp combiner, double[] other) { super.replaceWithMapping(combiner, other); return this; } /** * Returns the index of some element equal to given target, or -1 * if not present * @param target the element to search for * @return the index or -1 if not present */ public int indexOf(double target) { return super.indexOf(target); } /** * Assuming this array is sorted, returns the index of an element * equal to given target, or -1 if not present. If the array * is not sorted, the results are undefined. * @param target the element to search for * @return the index or -1 if not present */ public int binarySearch(double target) { return super.binarySearch(target); } /** * Assuming this array is sorted with respect to the given * comparator, returns the index of an element equal to given * target, or -1 if not present. If the array is not sorted, the * results are undefined. * @param target the element to search for * @param comparator the comparator * @return the index or -1 if not present */ public int binarySearch(double target, DoubleComparator comparator) { return super.binarySearch(target, comparator); } /** * Returns summary statistics, using the given comparator * to locate minimum and maximum elements. * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelDoubleArray.SummaryStatistics summary (DoubleComparator comparator) { return super.summary(comparator); } /** * Returns summary statistics, using natural comparator * @return the summary. */ public ParallelDoubleArray.SummaryStatistics summary() { return super.summary(); } /** * Returns the minimum element, or Double.MAX_VALUE if empty * @param comparator the comparator * @return minimum element, or Double.MAX_VALUE if empty */ public double min(DoubleComparator comparator) { return super.min(comparator); } /** * Returns the minimum element, or Double.MAX_VALUE if empty, * @return minimum element, or Double.MAX_VALUE if empty */ public double min() { return super.min(); } /** * Returns the maximum element, or -Double.MAX_VALUE if empty * @param comparator the comparator * @return maximum element, or -Double.MAX_VALUE if empty */ public double max(DoubleComparator comparator) { return super.max(comparator); } /** * Returns the maximum element, or -Double.MAX_VALUE if empty * @return maximum element, or -Double.MAX_VALUE if empty */ public double max() { return super.max(); } /** * Replaces each element with the running cumulation of applying * the given reducer. For example, if the contents are the numbers * 1, 2, 3, and the reducer operation adds numbers, then * after invocation of this method, the contents would be 1, * 3, 6 (that is, 1, 1+2, 1+2+3); * @param reducer the reducer * @param base the result for an empty array * @return this (to simplify use in expressions) */ public ParallelDoubleArray cumulate(DoubleReducer reducer, double base) { super.cumulate(reducer, base); return this; } /** * Replaces each element with the cumulation of applying the given * reducer to all previous values, and returns the total * reduction. For example, if the contents are the numbers 1, * 2, 3, and the reducer operation adds numbers, then after * invocation of this method, the contents would be 0, 1, * 3 (that is, 0, 0+1, 0+1+2, and the return value * would be 6 (that is, 1+2+3); * @param reducer the reducer * @param base the result for an empty array * @return the total reduction */ public double precumulate(DoubleReducer reducer, double base) { return super.precumulate(reducer, base); } /** * Sorts the array. Unlike Arrays.sort, this sort does * not guarantee that elements with equal keys maintain their * relative position in the array. * @param comparator the comparator to use * @return this (to simplify use in expressions) */ public ParallelDoubleArray sort(DoubleComparator comparator) { super.sort(comparator); return this; } /** * Sorts the array, assuming all elements are Comparable. Unlike * Arrays.sort, this sort does not guarantee that elements * with equal keys maintain their relative position in the array. * @throws ClassCastException if any element is not Comparable. * @return this (to simplify use in expressions) */ public ParallelDoubleArray sort() { super.sort(); return this; } /** * Removes consecutive elements that are equal, * shifting others leftward, and possibly decreasing size. This * method may be used after sorting to ensure that this * ParallelDoubleArray contains a set of unique elements. * @return this (to simplify use in expressions) */ public ParallelDoubleArray removeConsecutiveDuplicates() { // Sequential implementation for now int k = 0; int n = fence; if (k < n) { double[] arr = this.array; double last = arr[k++]; for (int i = k; i < n; ++i) { double x = arr[i]; if (last != x) arr[k++] = last = x; } removeSlotsAt(k, n); } return this; } /** * Equivalent to asList().addAll but specialized for * array arguments and likely to be more efficient. * @param other the elements to add * @return this (to simplify use in expressions) */ public ParallelDoubleArray addAll(double[] other) { int csize = other.length; int end = fence; insertSlotsAt(end, csize); System.arraycopy(other, 0, array, end, csize); return this; } /** * Appends all (possibly bounded, filtered, or mapped) elements of * the given ParallelDoubleArray, resizing and/or reallocating this * array if necessary. * @param other the elements to add * @return this (to simplify use in expressions) */ public ParallelDoubleArray addAll(ParallelDoubleArrayWithDoubleMapping other) { int end = fence; if (other.hasFilter()) { PAS.FJDAppendAllDriver r = new PAS.FJDAppendAllDriver (other, end, array); ex.invoke(r); array = r.results; fence = end + r.resultSize; } else { int csize = other.size(); insertSlotsAt(end, csize); if (other.hasMap()) ex.invoke(new PAS.FJDMap(other, other.origin, other.fence, null, array, end - other.origin)); else System.arraycopy(other.array, 0, array, end, csize); } return this; } /** * Returns a new ParallelDoubleArray containing only the unique * elements of this array (that is, without any duplicates). * @return the new ParallelDoubleArray */ public ParallelDoubleArray allUniqueElements() { return super.allUniqueElements(); } /** * Removes from the array all elements for which the given * selector holds. * @param selector the selector * @return this (to simplify use in expressions) */ public ParallelDoubleArray removeAll(DoublePredicate selector) { DFPap v = new DFPap(ex, 0, fence, array, selector); PAS.FJRemoveAllDriver f = new PAS.FJRemoveAllDriver(v, 0, fence); ex.invoke(f); removeSlotsAt(f.offset, fence); return this; } /** * Returns true if all elements at the same relative positions * of this and other array are equal. * @param other the other array * @return true if equal */ public boolean hasAllEqualElements (ParallelDoubleArrayWithDoubleMapping other) { return super.hasAllEqualElements(other); } /** * Returns the sum of elements * @return the sum of elements */ public double sum() { return super.sum(); } /** * Replaces each element with the running sum * @return this (to simplify use in expressions) */ public ParallelDoubleArray cumulateSum() { super.cumulateSum(); return this; } /** * Replaces each element with its prefix sum * @return the total sum */ public double precumulateSum() { return super.precumulateSum(); } /** * Returns an operation prefix that causes a method to * operate only on the elements of the array between * firstIndex (inclusive) and upperBound (exclusive). * @param firstIndex the lower bound (inclusive) * @param upperBound the upper bound (exclusive) * @return operation prefix */ public ParallelDoubleArrayWithBounds withBounds(int firstIndex, int upperBound) { return super.withBounds(firstIndex, upperBound); } /** * Returns an operation prefix that causes a method to operate * only on the elements of the array for which the given selector * returns true * @param selector the selector * @return operation prefix */ public ParallelDoubleArrayWithFilter withFilter(DoublePredicate selector) { return super.withFilter(selector); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the given binary selector returns * true * @param selector the selector * @return operation prefix */ public ParallelDoubleArrayWithFilter withFilter (BinaryDoublePredicate selector, ParallelDoubleArrayWithDoubleMapping other) { return super.withFilter(selector, other); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the given indexed selector returns * true * @param selector the selector * @return operation prefix */ public ParallelDoubleArrayWithFilter withIndexedFilter (IntAndDoublePredicate selector) { return super.withIndexedFilter(selector); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public ParallelDoubleArrayWithMapping withMapping (DoubleToObject op) { return super.withMapping(op); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public ParallelDoubleArrayWithDoubleMapping withMapping(DoubleOp op) { return super.withMapping(op); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) { return super.withMapping(op); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (DoubleAndObjectToObject combiner, ParallelArrayWithMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (DoubleAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithMapping withMapping (DoubleAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithDoubleMapping withMapping (DoubleAndObjectToDouble combiner, ParallelArrayWithMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithDoubleMapping withMapping (BinaryDoubleOp combiner, ParallelDoubleArrayWithDoubleMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithDoubleMapping withMapping (DoubleAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (DoubleAndObjectToLong combiner, ParallelArrayWithMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (DoubleAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a * filtered view (all filters must precede all mappings). */ public ParallelDoubleArrayWithLongMapping withMapping (DoubleAndLongToLong combiner, ParallelLongArrayWithLongMapping other) { return super.withMapping(combiner, other); } /** * Returns an operation prefix that causes a method to operate on * mappings of this array using the given mapper that accepts as * arguments an element's current index and value, and produces a * new value. * @param mapper the mapper * @return operation prefix */ public ParallelDoubleArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper) { return super.withIndexedMapping(mapper); } /** * Returns an operation prefix that causes a method to operate on * mappings of this array using the given mapper that accepts as * arguments an element's current index and value, and produces a * new value. * @param mapper the mapper * @return operation prefix */ public ParallelDoubleArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper) { return super.withIndexedMapping(mapper); } /** * Returns an operation prefix that causes a method to operate on * mappings of this array using the given mapper that accepts as * arguments an element's current index and value, and produces a * new value. * @param mapper the mapper * @return operation prefix */ public ParallelDoubleArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper) { return super.withIndexedMapping(mapper); } /** * Returns an iterator stepping through each element of the array * up to the current limit. This iterator does not * support the remove operation. However, a full * ListIterator supporting add, remove, and set * operations is available via {@link #asList}. * @return an iterator stepping through each element. */ public Iterator iterator() { return new ParallelDoubleArrayIterator(array, fence); } static final class ParallelDoubleArrayIterator implements Iterator { int cursor; final double[] arr; final int hi; ParallelDoubleArrayIterator(double[] a, int limit) { arr = a; hi = limit; } public boolean hasNext() { return cursor < hi; } public Double next() { if (cursor >= hi) throw new NoSuchElementException(); return Double.valueOf(arr[cursor++]); } public void remove() { throw new UnsupportedOperationException(); } } // List support /** * Returns a view of this ParallelDoubleArray as a List. This List * has the same structural and performance characteristics as * {@link ArrayList}, and may be used to modify, replace or extend * the bounds of the array underlying this ParallelDoubleArray. * The methods supported by this list view are not in * general implemented as parallel operations. This list is also * not itself thread-safe. In particular, performing list updates * while other parallel operations are in progress has undefined * (and surely undesired) effects. * @return a list view */ public List asList() { AsList lv = listView; if (lv == null) listView = lv = new AsList(); return lv; } /** * Returns the effective size of the underlying array. The * effective size is the current limit, if used (see {@link * #setLimit}), or the length of the array otherwise. * @return the effective size of array */ public int size() { return fence; } /** * Returns the underlying array used for computations * @return the array */ public double[] getArray() { return array; } /** * Returns the element of the array at the given index * @param i the index * @return the element of the array at the given index */ public double get(int i) { return array[i]; } /** * Sets the element of the array at the given index to the given value * @param i the index * @param x the value */ public void set(int i, double x) { array[i] = x; } /** * Equivalent to asList().toString() * @return a string representation */ public String toString() { return asList().toString(); } /** * Ensures that the underlying array can be accessed up to the * given upper bound, reallocating and copying the underlying * array to expand if necessary. Or, if the given limit is less * than the length of the underlying array, causes computations to * ignore elements past the given limit. * @param newLimit the new upper bound * @throws IllegalArgumentException if newLimit less than zero. */ public final void setLimit(int newLimit) { if (newLimit < 0) throw new IllegalArgumentException(); int cap = array.length; if (newLimit > cap) resizeArray(newLimit); fence = newLimit; } final void resizeArray(int newCap) { int cap = array.length; if (newCap > cap) { double[] a = new double[newCap]; System.arraycopy(array, 0, a, 0, cap); array = a; } } final void insertElementAt(int index, double e) { int hi = fence++; if (hi >= array.length) resizeArray((hi * 3)/2 + 1); if (hi > index) System.arraycopy(array, index, array, index+1, hi - index); array[index] = e; } final void appendElement(double e) { int hi = fence++; if (hi >= array.length) resizeArray((hi * 3)/2 + 1); array[hi] = e; } /** * Make len slots available at index */ final void insertSlotsAt(int index, int len) { if (len <= 0) return; int cap = array.length; int newSize = fence + len; if (cap < newSize) { cap = (cap * 3)/2 + 1; if (cap < newSize) cap = newSize; resizeArray(cap); } if (index < fence) System.arraycopy(array, index, array, index + len, fence - index); fence = newSize; } final void removeSlotAt(int index) { System.arraycopy(array, index + 1, array, index, fence - index - 1); --fence; } final void removeSlotsAt(int fromIndex, int toIndex) { if (fromIndex < toIndex) { int size = fence; System.arraycopy(array, toIndex, array, fromIndex, size - toIndex); int newSize = size - (toIndex - fromIndex); fence = newSize; } } final int seqIndexOf(double target) { double[] arr = array; int end = fence; for (int i = 0; i < end; i++) if (target == arr[i]) return i; return -1; } final int seqLastIndexOf(double target) { double[] arr = array; for (int i = fence - 1; i >= 0; i--) if (target == arr[i]) return i; return -1; } final class ListIter implements ListIterator { int cursor; int lastRet; double[] arr; // cache array and bound int hi; ListIter(int lo) { this.cursor = lo; this.lastRet = -1; this.arr = ParallelDoubleArray.this.array; this.hi = ParallelDoubleArray.this.fence; } public boolean hasNext() { return cursor < hi; } public Double next() { int i = cursor; if (i < 0 || i >= hi) throw new NoSuchElementException(); double next = arr[i]; lastRet = i; cursor = i + 1; return Double.valueOf(next); } public void remove() { int k = lastRet; if (k < 0) throw new IllegalStateException(); ParallelDoubleArray.this.removeSlotAt(k); hi = ParallelDoubleArray.this.fence; if (lastRet < cursor) cursor--; lastRet = -1; } public boolean hasPrevious() { return cursor > 0; } public Double previous() { int i = cursor - 1; if (i < 0 || i >= hi) throw new NoSuchElementException(); double previous = arr[i]; lastRet = cursor = i; return Double.valueOf(previous); } public int nextIndex() { return cursor; } public int previousIndex() { return cursor - 1; } public void set(Double e) { int i = lastRet; if (i < 0 || i >= hi) throw new NoSuchElementException(); arr[i] = e.doubleValue(); } public void add(Double e) { int i = cursor; ParallelDoubleArray.this.insertElementAt(i, e.doubleValue()); arr = ParallelDoubleArray.this.array; hi = ParallelDoubleArray.this.fence; lastRet = -1; cursor = i + 1; } } final class AsList extends AbstractList implements RandomAccess { public Double get(int i) { if (i >= fence) throw new IndexOutOfBoundsException(); return Double.valueOf(array[i]); } public Double set(int i, Double x) { if (i >= fence) throw new IndexOutOfBoundsException(); double[] arr = array; Double t = Double.valueOf(arr[i]); arr[i] = x.doubleValue(); return t; } public boolean isEmpty() { return fence == 0; } public int size() { return fence; } public Iterator iterator() { return new ListIter(0); } public ListIterator listIterator() { return new ListIter(0); } public ListIterator listIterator(int index) { if (index < 0 || index > fence) throw new IndexOutOfBoundsException(); return new ListIter(index); } public boolean add(Double e) { appendElement(e.doubleValue()); return true; } public void add(int index, Double e) { if (index < 0 || index > fence) throw new IndexOutOfBoundsException(); insertElementAt(index, e.doubleValue()); } public boolean addAll(Collection c) { int csize = c.size(); if (csize == 0) return false; int hi = fence; setLimit(hi + csize); double[] arr = array; for (Double e : c) arr[hi++] = e.doubleValue(); return true; } public boolean addAll(int index, Collection c) { if (index < 0 || index > fence) throw new IndexOutOfBoundsException(); int csize = c.size(); if (csize == 0) return false; insertSlotsAt(index, csize); double[] arr = array; for (Double e : c) arr[index++] = e.doubleValue(); return true; } public void clear() { fence = 0; } public boolean remove(Object o) { if (!(o instanceof Double)) return false; int idx = seqIndexOf(((Double)o).doubleValue()); if (idx < 0) return false; removeSlotAt(idx); return true; } public Double remove(int index) { Double oldValue = get(index); removeSlotAt(index); return oldValue; } public void removeRange(int fromIndex, int toIndex) { removeSlotsAt(fromIndex, toIndex); } public boolean contains(Object o) { if (!(o instanceof Double)) return false; return seqIndexOf(((Double)o).doubleValue()) >= 0; } public int indexOf(Object o) { if (!(o instanceof Double)) return -1; return seqIndexOf(((Double)o).doubleValue()); } public int lastIndexOf(Object o) { if (!(o instanceof Double)) return -1; return seqLastIndexOf(((Double)o).doubleValue()); } } } jsr166/src/extra166y/ParallelLongArrayWithFilter.java0000644000000000000000000001465611552064317017577 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelLongArray that causes operations to apply * only to elements for which a selector returns true. Instances of * this class may be constructed only via prefix methods of * ParallelLongArray or its other prefix classes. */ public abstract class ParallelLongArrayWithFilter extends ParallelLongArrayWithLongMapping { ParallelLongArrayWithFilter (ForkJoinPool ex, int origin, int fence, long[] array) { super(ex, origin, fence, array); } /** * Replaces elements with the results of applying the given * op to their current values. * @param op the op * @return this (to simplify use in expressions) */ public ParallelLongArrayWithFilter replaceWithMapping(LongOp op) { ex.invoke(new PAS.FJLTransform (this, origin, fence, null, op)); return this; } /** * Replaces elements with the results of applying the given * op to their indices. * @param op the op * @return this (to simplify use in expressions) */ public ParallelLongArrayWithFilter replaceWithMappedIndex(IntToLong op) { ex.invoke(new PAS.FJLIndexMap (this, origin, fence, null, op)); return this; } /** * Replaces elements with the results of applying the given * mapping to each index and current element value. * @param op the op * @return this (to simplify use in expressions) */ public ParallelLongArrayWithFilter replaceWithMappedIndex(IntAndLongToLong op) { ex.invoke(new PAS.FJLBinaryIndexMap (this, origin, fence, null, op)); return this; } /** * Replaces elements with results of applying the given * generator. * @param generator the generator * @return this (to simplify use in expressions) */ public ParallelLongArrayWithFilter replaceWithGeneratedValue(LongGenerator generator) { ex.invoke(new PAS.FJLGenerate (this, origin, fence, null, generator)); return this; } /** * Replaces elements with the given value. * @param value the value * @return this (to simplify use in expressions) */ public ParallelLongArrayWithFilter replaceWithValue(long value) { ex.invoke(new PAS.FJLFill (this, origin, fence, null, value)); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement). * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) */ public ParallelLongArrayWithFilter replaceWithMapping(BinaryLongOp combiner, ParallelLongArrayWithLongMapping other) { ex.invoke(new PAS.FJLPACombineInPlace (this, origin, fence, null, other, other.origin - origin, combiner)); return this; } /** * Replaces elements with results of applying * op(thisElement, otherElement). * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) */ public ParallelLongArrayWithFilter replaceWithMapping(BinaryLongOp combiner, long[] other) { ex.invoke(new PAS.FJLCombineInPlace (this, origin, fence, null, other, -origin, combiner)); return this; } /** * Returns a new ParallelLongArray containing only unique * elements (that is, without any duplicates). * @return the new ParallelLongArray */ public ParallelLongArray allUniqueElements() { PAS.UniquifierTable tab = new PAS.UniquifierTable (fence - origin, this, false); PAS.FJLUniquifier f = new PAS.FJLUniquifier (this, origin, fence, null, tab); ex.invoke(f); long[] res = tab.uniqueLongs(f.count); return new ParallelLongArray(ex, res); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the current selector (if * present) and the given selector returns true. * @param selector the selector * @return operation prefix */ public abstract ParallelLongArrayWithFilter withFilter(LongPredicate selector); /** * Returns an operation prefix that causes a method to operate * only on elements for which the current selector (if * present) and the given binary selector returns true. * @param selector the selector * @return operation prefix */ public ParallelLongArrayWithFilter withFilter (BinaryLongPredicate selector, ParallelLongArrayWithLongMapping other) { return withIndexedFilter(AbstractParallelAnyArray.indexedSelector(selector, other, origin)); } /** * Returns an operation prefix that causes a method to operate * only on elements for which the current selector (if * present) and the given indexed selector returns true. * @param selector the selector * @return operation prefix */ public abstract ParallelLongArrayWithFilter withIndexedFilter (IntAndLongPredicate selector); /** * Returns true if all elements at the same relative positions * of this and other array are equal. * @param other the other array * @return true if equal */ public boolean hasAllEqualElements(ParallelLongArrayWithLongMapping other) { return withFilter(CommonOps.longInequalityPredicate(), other).anyIndex() < 0; } final void leafTransfer(int lo, int hi, long[] dest, int offset) { final long[] a = this.array; for (int i = lo; i < hi; ++i) dest[offset++] = (a[i]); } final void leafTransferByIndex(int[] indices, int loIdx, int hiIdx, long[] dest, int offset) { final long[] a = this.array; for (int i = loIdx; i < hiIdx; ++i) dest[offset++] = (a[indices[i]]); } final long lget(int i) { return this.array[i]; } } jsr166/src/extra166y/ParallelArrayWithDoubleMapping.java0000644000000000000000000002542611537741066020263 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import jsr166y.*; import static extra166y.Ops.*; import java.util.*; import java.util.concurrent.atomic.*; import java.lang.reflect.Array; /** * A prefix view of ParallelArray that causes operations to apply * to mappings of elements, not to the elements themselves. * Instances of this class may be constructed only via prefix * methods of ParallelArray or its other prefix classes. */ public abstract class ParallelArrayWithDoubleMapping extends AbstractParallelAnyArray.OPap { ParallelArrayWithDoubleMapping (ForkJoinPool ex, int origin, int fence, T[] array) { super(ex, origin, fence, array); } /** * Applies the given procedure * @param procedure the procedure */ public void apply(DoubleProcedure procedure) { ex.invoke(new PAS.FJDApply(this, origin, fence, null, procedure)); } /** * Returns reduction of mapped elements * @param reducer the reducer * @param base the result for an empty array * @return reduction */ public double reduce(DoubleReducer reducer, double base) { PAS.FJDReduce f = new PAS.FJDReduce (this, origin, fence, null, reducer, base); ex.invoke(f); return f.result; } /** * Returns the minimum element, or Double.MAX_VALUE if empty * @return minimum element, or Double.MAX_VALUE if empty */ public double min() { return reduce(CommonOps.naturalDoubleMinReducer(), Double.MAX_VALUE); } /** * Returns the minimum element, or Double.MAX_VALUE if empty * @param comparator the comparator * @return minimum element, or Double.MAX_VALUE if empty */ public double min(DoubleComparator comparator) { return reduce(CommonOps.doubleMinReducer(comparator), Double.MAX_VALUE); } /** * Returns the maximum element, or -Double.MAX_VALUE if empty * @return maximum element, or -Double.MAX_VALUE if empty */ public double max() { return reduce(CommonOps.naturalDoubleMaxReducer(), -Double.MAX_VALUE); } /** * Returns the maximum element, or -Double.MAX_VALUE if empty * @param comparator the comparator * @return maximum element, or -Double.MAX_VALUE if empty */ public double max(DoubleComparator comparator) { return reduce(CommonOps.doubleMaxReducer(comparator), -Double.MAX_VALUE); } /** * Returns the sum of elements * @return the sum of elements */ public double sum() { return reduce(CommonOps.doubleAdder(), 0.0); } /** * Returns summary statistics * @param comparator the comparator to use for * locating minimum and maximum elements * @return the summary. */ public ParallelDoubleArray.SummaryStatistics summary (DoubleComparator comparator) { PAS.FJDStats f = new PAS.FJDStats (this, origin, fence, null, comparator); ex.invoke(f); return f; } /** * Returns summary statistics, using natural comparator * @return the summary. */ public ParallelDoubleArray.SummaryStatistics summary() { return summary(CommonOps.naturalDoubleComparator()); } /** * Returns a new ParallelDoubleArray holding mappings * @return a new ParallelDoubleArray holding mappings */ public ParallelDoubleArray all() { return new ParallelDoubleArray(ex, allDoubles()); } /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelArrayWithDoubleMapping withMapping(DoubleOp op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelArrayWithLongMapping withMapping(DoubleToLong op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op. * @param op the op * @return operation prefix */ public abstract ParallelArrayWithMapping withMapping (DoubleToObject op); /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix */ public ParallelArrayWithMapping withMapping (DoubleAndObjectToObject combiner, ParallelArrayWithMapping other) { return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix */ public ParallelArrayWithMapping withMapping (DoubleAndDoubleToObject combiner, ParallelDoubleArrayWithDoubleMapping other) { return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix */ public ParallelArrayWithMapping withMapping (DoubleAndLongToObject combiner, ParallelLongArrayWithLongMapping other) { return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix */ public ParallelArrayWithDoubleMapping withMapping (DoubleAndObjectToDouble combiner, ParallelArrayWithMapping other) { return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix */ public ParallelArrayWithDoubleMapping withMapping (BinaryDoubleOp combiner, ParallelDoubleArrayWithDoubleMapping other) { return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix */ public ParallelArrayWithDoubleMapping withMapping (DoubleAndLongToDouble combiner, ParallelLongArrayWithLongMapping other) { return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix */ public ParallelArrayWithLongMapping withMapping (DoubleAndObjectToLong combiner, ParallelArrayWithMapping other) { return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix */ public ParallelArrayWithLongMapping withMapping (DoubleAndDoubleToLong combiner, ParallelDoubleArrayWithDoubleMapping other) { return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on binary mappings of this array and the other array. * @param combiner the combiner * @param other the other array * @return operation prefix */ public ParallelArrayWithLongMapping withMapping (DoubleAndLongToLong combiner, ParallelLongArrayWithLongMapping other) { return withIndexedMapping (AbstractParallelAnyArray.indexedMapper(combiner, other, origin)); } /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelArrayWithMapping withIndexedMapping (IntAndDoubleToObject mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelArrayWithDoubleMapping withIndexedMapping (IntAndDoubleToDouble mapper); /** * Returns an operation prefix that causes a method to operate * on mappings of this array using the given mapper that * accepts as arguments an element's current index and value * (as mapped by preceding mappings, if any), and produces a * new value. * @param mapper the mapper * @return operation prefix */ public abstract ParallelArrayWithLongMapping withIndexedMapping (IntAndDoubleToLong mapper); /** * Returns an Iterable view to sequentially step through mapped * elements also obeying bound and filter constraints, without * performing computations to evaluate them in parallel * @return the Iterable view */ public Iterable sequentially() { return new SequentiallyAsDouble(); } } jsr166/src/jsr166x/0000755000000000000000000000000011652013242011005 5ustar jsr166/src/jsr166x/ConcurrentNavigableMap.java0000644000000000000000000000666311556021346016263 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166x; import java.util.*; import java.util.concurrent.*; /** * A {@link ConcurrentMap} supporting {@link NavigableMap} operations. * * @author Doug Lea * @param the type of keys maintained by this map * @param the type of mapped values */ public interface ConcurrentNavigableMap extends ConcurrentMap, NavigableMap { /** * Returns a view of the portion of this map whose keys range from * fromKey, inclusive, to toKey, exclusive. (If * fromKey and toKey are equal, the returned sorted map * is empty.) The returned sorted map is backed by this map, so changes * in the returned sorted map are reflected in this map, and vice-versa. * * @param fromKey low endpoint (inclusive) of the subMap. * @param toKey high endpoint (exclusive) of the subMap. * * @return a view of the portion of this map whose keys range from * fromKey, inclusive, to toKey, exclusive. * * @throws ClassCastException if fromKey and * toKey cannot be compared to one another using this * map's comparator (or, if the map has no comparator, using * natural ordering). * @throws IllegalArgumentException if fromKey is greater * than toKey. * @throws NullPointerException if fromKey or * toKey is null and this map does not support * null keys. */ public ConcurrentNavigableMap subMap(K fromKey, K toKey); /** * Returns a view of the portion of this map whose keys are strictly less * than toKey. The returned sorted map is backed by this map, so * changes in the returned sorted map are reflected in this map, and * vice-versa. * @param toKey high endpoint (exclusive) of the headMap. * @return a view of the portion of this map whose keys are strictly * less than toKey. * * @throws ClassCastException if toKey is not compatible * with this map's comparator (or, if the map has no comparator, * if toKey does not implement Comparable). * @throws NullPointerException if toKey is null * and this map does not support null keys. */ public ConcurrentNavigableMap headMap(K toKey); /** * Returns a view of the portion of this map whose keys are * greater than or equal to fromKey. The returned sorted * map is backed by this map, so changes in the returned sorted * map are reflected in this map, and vice-versa. * @param fromKey low endpoint (inclusive) of the tailMap. * @return a view of the portion of this map whose keys are greater * than or equal to fromKey. * @throws ClassCastException if fromKey is not compatible * with this map's comparator (or, if the map has no comparator, * if fromKey does not implement Comparable). * @throws NullPointerException if fromKey is null * and this map does not support null keys. */ public ConcurrentNavigableMap tailMap(K fromKey); } jsr166/src/jsr166x/package.html0000644000000000000000000000077411300151052013266 0ustar jsr166x overview

jsr166x overview

This package contains classes under development by JCP JSR166 that did not make it into release. Some of these may someday become part of package java.util.concurrent or its subpackages.
Doug Lea
Last modified: Fri Jul 30 08:06:46 EDT 2004 jsr166/src/jsr166x/NavigableMap.java0000644000000000000000000003053611556021346014214 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166x; import java.util.*; /** * A {@link SortedMap} extended with navigation methods returning the * closest matches for given search targets. Methods * lowerEntry, floorEntry, ceilingEntry, * and higherEntry return Map.Entry objects * associated with keys respectively less than, less than or equal, * greater than or equal, and greater than a given key, returning * null if there is no such key. Similarly, methods * lowerKey, floorKey, ceilingKey, and * higherKey return only the associated keys. All of these * methods are designed for locating, not traversing entries. * *

A NavigableMap may be viewed and traversed in either * ascending or descending key order. The Map methods * keySet and entrySet return ascending views, and * the additional methods descendingKeySet and * descendingEntrySet return descending views. The * performance of ascending traversals is likely to be faster than * descending traversals. Notice that it is possible to perform * subrannge traversals in either direction using SubMap. * *

This interface additionally defines methods firstEntry, * pollFirstEntry, lastEntry, and * pollLastEntry that return and/or remove the least and * greatest mappings, if any exist, else returning null. * *

Implementations of entry-returning methods are expected to * return Map.Entry pairs representing snapshots of mappings * at the time they were produced, and thus generally do not * support the optional Entry.setValue method. Note however * that it is possible to change mappings in the associated map using * method put. * * @author Doug Lea * @param the type of keys maintained by this map * @param the type of mapped values */ public interface NavigableMap extends SortedMap { /** * Returns a key-value mapping associated with the least key * greater than or equal to the given key, or null if there is * no such entry. * * @param key the key. * @return an Entry associated with ceiling of given key, or null * if there is no such Entry. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null and this map * does not support null keys. */ public Map.Entry ceilingEntry(K key); /** * Returns least key greater than or equal to the given key, or * null if there is no such key. * * @param key the key. * @return the ceiling key, or null * if there is no such key. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null and this map * does not support null keys. */ public K ceilingKey(K key); /** * Returns a key-value mapping associated with the greatest * key strictly less than the given key, or null if there is no * such entry. * * @param key the key. * @return an Entry with greatest key less than the given * key, or null if there is no such Entry. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null and this map * does not support null keys. */ public Map.Entry lowerEntry(K key); /** * Returns the greatest key strictly less than the given key, or * null if there is no such key. * * @param key the key. * @return the greatest key less than the given * key, or null if there is no such key. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null and this map * does not support null keys. */ public K lowerKey(K key); /** * Returns a key-value mapping associated with the greatest key * less than or equal to the given key, or null if there * is no such entry. * * @param key the key. * @return an Entry associated with floor of given key, or null * if there is no such Entry. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null and this map * does not support null keys. */ public Map.Entry floorEntry(K key); /** * Returns the greatest key * less than or equal to the given key, or null if there * is no such key. * * @param key the key. * @return the floor of given key, or null if there is no * such key. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null and this map * does not support null keys. */ public K floorKey(K key); /** * Returns a key-value mapping associated with the least key * strictly greater than the given key, or null if there * is no such entry. * * @param key the key. * @return an Entry with least key greater than the given key, or * null if there is no such Entry. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null and this map * does not support null keys. */ public Map.Entry higherEntry(K key); /** * Returns the least key strictly greater than the given key, or * null if there is no such key. * * @param key the key. * @return the least key greater than the given key, or * null if there is no such key. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null and this map * does not support null keys. */ public K higherKey(K key); /** * Returns a key-value mapping associated with the least * key in this map, or null if the map is empty. * * @return an Entry with least key, or null * if the map is empty. */ public Map.Entry firstEntry(); /** * Returns a key-value mapping associated with the greatest * key in this map, or null if the map is empty. * * @return an Entry with greatest key, or null * if the map is empty. */ public Map.Entry lastEntry(); /** * Removes and returns a key-value mapping associated with * the least key in this map, or null if the map is empty. * * @return the removed first entry of this map, or null * if the map is empty. */ public Map.Entry pollFirstEntry(); /** * Removes and returns a key-value mapping associated with * the greatest key in this map, or null if the map is empty. * * @return the removed last entry of this map, or null * if the map is empty. */ public Map.Entry pollLastEntry(); /** * Returns a set view of the keys contained in this map, in * descending key order. The set is backed by the map, so changes * to the map are reflected in the set, and vice-versa. If the * map is modified while an iteration over the set is in progress * (except through the iterator's own remove operation), * the results of the iteration are undefined. The set supports * element removal, which removes the corresponding mapping from * the map, via the Iterator.remove, Set.remove, * removeAll retainAll, and clear * operations. It does not support the add or addAll * operations. * * @return a set view of the keys contained in this map. */ Set descendingKeySet(); /** * Returns a set view of the mappings contained in this map, in * descending key order. Each element in the returned set is a * Map.Entry. The set is backed by the map, so changes to * the map are reflected in the set, and vice-versa. If the map * is modified while an iteration over the set is in progress * (except through the iterator's own remove operation, * or through the setValue operation on a map entry * returned by the iterator) the results of the iteration are * undefined. The set supports element removal, which removes the * corresponding mapping from the map, via the * Iterator.remove, Set.remove, * removeAll, retainAll and clear * operations. It does not support the add or * addAll operations. * * @return a set view of the mappings contained in this map. */ Set> descendingEntrySet(); /** * Returns a view of the portion of this map whose keys range from * fromKey, inclusive, to toKey, exclusive. (If * fromKey and toKey are equal, the returned sorted map * is empty.) The returned sorted map is backed by this map, so changes * in the returned sorted map are reflected in this map, and vice-versa. * * @param fromKey low endpoint (inclusive) of the subMap. * @param toKey high endpoint (exclusive) of the subMap. * * @return a view of the portion of this map whose keys range from * fromKey, inclusive, to toKey, exclusive. * * @throws ClassCastException if fromKey and * toKey cannot be compared to one another using this * map's comparator (or, if the map has no comparator, using * natural ordering). * @throws IllegalArgumentException if fromKey is greater * than toKey. * @throws NullPointerException if fromKey or * toKey is null and this map does not support * null keys. */ public NavigableMap subMap(K fromKey, K toKey); /** * Returns a view of the portion of this map whose keys are strictly less * than toKey. The returned sorted map is backed by this map, so * changes in the returned sorted map are reflected in this map, and * vice-versa. * @param toKey high endpoint (exclusive) of the headMap. * @return a view of the portion of this map whose keys are strictly * less than toKey. * * @throws ClassCastException if toKey is not compatible * with this map's comparator (or, if the map has no comparator, * if toKey does not implement Comparable). * @throws NullPointerException if toKey is null * and this map does not support null keys. */ public NavigableMap headMap(K toKey); /** * Returns a view of the portion of this map whose keys are * greater than or equal to fromKey. The returned sorted * map is backed by this map, so changes in the returned sorted * map are reflected in this map, and vice-versa. * @param fromKey low endpoint (inclusive) of the tailMap. * @return a view of the portion of this map whose keys are greater * than or equal to fromKey. * @throws ClassCastException if fromKey is not compatible * with this map's comparator (or, if the map has no comparator, * if fromKey does not implement Comparable). * @throws NullPointerException if fromKey is null * and this map does not support null keys. */ public NavigableMap tailMap(K fromKey); } jsr166/src/jsr166x/ConcurrentSkipListSet.java0000644000000000000000000005153011537741066016153 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166x; import java.util.*; import java.util.concurrent.*; /** * A scalable concurrent {@link NavigableSet} implementation based on * a {@link ConcurrentSkipListMap}. This class maintains a set in * ascending order, sorted according to the natural order for * the element's class (see {@link Comparable}), or by the comparator * provided at creation time, depending on which constructor is * used.

* * This implementation provides expected average log(n) time * cost for the contains, add, and remove * operations and their variants. Insertion, removal, and access * operations safely execute concurrently by multiple * threads. Iterators are weakly consistent, returning elements * reflecting the state of the set at some point at or since the * creation of the iterator. They do not throw {@link * ConcurrentModificationException}, and may proceed concurrently with * other operations. * *

Beware that, unlike in most collections, the size * method is not a constant-time operation. Because of the * asynchronous nature of these sets, determining the current number * of elements requires a traversal of the elements. Additionally, the * bulk operations addAll, removeAll, * <retainAll, and tt>containsAll are not * guaranteed to be performed atomically. For example, an iterator * operating concurrently with an addAll operation might view * only some of the added elements. * *

This class and its iterators implement all of the * optional methods of the {@link Set} and {@link Iterator} * interfaces. Like most other concurrent collection implementations, * this class does not permit the use of null elements. * because null arguments and return values cannot be reliably * distinguished from the absence of elements. * * @author Doug Lea * @param the type of elements maintained by this set */ public class ConcurrentSkipListSet extends AbstractSet implements NavigableSet, Cloneable, java.io.Serializable { private static final long serialVersionUID = -2479143111061671589L; /** * The underlying map. Uses Boolean.TRUE as value for each * element. Note that this class relies on default serialization, * which is a little wasteful in saving all of the useless value * fields of underlying map, but enables this field to be declared * final, which is necessary for thread safety. */ private final ConcurrentSkipListMap m; /** * Constructs a new, empty set, sorted according to the elements' natural * order. */ public ConcurrentSkipListSet() { m = new ConcurrentSkipListMap(); } /** * Constructs a new, empty set, sorted according to the specified * comparator. * * @param c the comparator that will be used to sort this set. A * null value indicates that the elements' natural * ordering should be used. */ public ConcurrentSkipListSet(Comparator c) { m = new ConcurrentSkipListMap(c); } /** * Constructs a new set containing the elements in the specified * collection, sorted according to the elements' natural order. * * @param c The elements that will comprise the new set. * * @throws ClassCastException if the elements in the specified * collection are not comparable, or are not mutually comparable. * @throws NullPointerException if the specified collection is * null. */ public ConcurrentSkipListSet(Collection c) { m = new ConcurrentSkipListMap(); addAll(c); } /** * Constructs a new set containing the same elements as the specified * sorted set, sorted according to the same ordering. * * @param s sorted set whose elements will comprise the new set. * @throws NullPointerException if the specified sorted set is * null. */ public ConcurrentSkipListSet(SortedSet s) { m = new ConcurrentSkipListMap(s.comparator()); addAll(s); } /** * Returns a shallow copy of this set. (The elements themselves * are not cloned.) * * @return a shallow copy of this set. */ public Object clone() { ConcurrentSkipListSet clone = null; try { clone = (ConcurrentSkipListSet) super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(); } clone.m.initialize(); clone.addAll(this); return clone; } /* ---------------- Set operations -------------- */ /** * Returns the number of elements in this set. If this set * contains more than Integer.MAX_VALUE elements, it * returns Integer.MAX_VALUE. * *

Beware that, unlike in most collections, this method is * NOT a constant-time operation. Because of the * asynchronous nature of these sets, determining the current * number of elements requires traversing them all to count them. * Additionally, it is possible for the size to change during * execution of this method, in which case the returned result * will be inaccurate. Thus, this method is typically not very * useful in concurrent applications. * * @return the number of elements in this set. */ public int size() { return m.size(); } /** * Returns true if this set contains no elements. * @return true if this set contains no elements. */ public boolean isEmpty() { return m.isEmpty(); } /** * Returns true if this set contains the specified element. * * @param o the object to be checked for containment in this set. * @return true if this set contains the specified element. * * @throws ClassCastException if the specified object cannot be compared * with the elements currently in the set. * @throws NullPointerException if o is null. */ public boolean contains(Object o) { return m.containsKey(o); } /** * Adds the specified element to this set if it is not already present. * * @param o element to be added to this set. * @return true if the set did not already contain the specified * element. * * @throws ClassCastException if the specified object cannot be compared * with the elements currently in the set. * @throws NullPointerException if o is null. */ public boolean add(E o) { return m.putIfAbsent(o, Boolean.TRUE) == null; } /** * Removes the specified element from this set if it is present. * * @param o object to be removed from this set, if present. * @return true if the set contained the specified element. * * @throws ClassCastException if the specified object cannot be compared * with the elements currently in the set. * @throws NullPointerException if o is null. */ public boolean remove(Object o) { return m.removep(o); } /** * Removes all of the elements from this set. */ public void clear() { m.clear(); } /** * Returns an iterator over the elements in this set. The elements * are returned in ascending order. * * @return an iterator over the elements in this set. */ public Iterator iterator() { return m.keyIterator(); } /** * Returns an iterator over the elements in this set. The elements * are returned in descending order. * * @return an iterator over the elements in this set. */ public Iterator descendingIterator() { return m.descendingKeyIterator(); } /* ---------------- AbstractSet Overrides -------------- */ /** * Compares the specified object with this set for equality. Returns * true if the specified object is also a set, the two sets * have the same size, and every member of the specified set is * contained in this set (or equivalently, every member of this set is * contained in the specified set). This definition ensures that the * equals method works properly across different implementations of the * set interface. * * @param o Object to be compared for equality with this set. * @return true if the specified Object is equal to this set. */ public boolean equals(Object o) { // Override AbstractSet version to avoid calling size() if (o == this) return true; if (!(o instanceof Set)) return false; Collection c = (Collection) o; try { return containsAll(c) && c.containsAll(this); } catch (ClassCastException unused) { return false; } catch (NullPointerException unused) { return false; } } /** * Removes from this set all of its elements that are contained in * the specified collection. If the specified collection is also * a set, this operation effectively modifies this set so that its * value is the asymmetric set difference of the two sets. * * @param c collection that defines which elements will be removed from * this set. * @return true if this set changed as a result of the call. * * @throws ClassCastException if the types of one or more elements in this * set are incompatible with the specified collection * @throws NullPointerException if the specified collection, or any * of its elements are null. */ public boolean removeAll(Collection c) { // Override AbstractSet version to avoid unnecessary call to size() boolean modified = false; for (Iterator i = c.iterator(); i.hasNext(); ) if (remove(i.next())) modified = true; return modified; } /* ---------------- Relational operations -------------- */ /** * Returns an element greater than or equal to the given element, or * null if there is no such element. * * @param o the value to match * @return an element greater than or equal to given element, or * null if there is no such element. * @throws ClassCastException if o cannot be compared with the elements * currently in the set. * @throws NullPointerException if o is null */ public E ceiling(E o) { return m.ceilingKey(o); } /** * Returns an element strictly less than the given element, or * null if there is no such element. * * @param o the value to match * @return the greatest element less than the given element, or * null if there is no such element. * @throws ClassCastException if o cannot be compared with the elements * currently in the set. * @throws NullPointerException if o is null. */ public E lower(E o) { return m.lowerKey(o); } /** * Returns an element less than or equal to the given element, or * null if there is no such element. * * @param o the value to match * @return the greatest element less than or equal to given * element, or null if there is no such element. * @throws ClassCastException if o cannot be compared with the elements * currently in the set. * @throws NullPointerException if o is null. */ public E floor(E o) { return m.floorKey(o); } /** * Returns an element strictly greater than the given element, or * null if there is no such element. * * @param o the value to match * @return the least element greater than the given element, or * null if there is no such element. * @throws ClassCastException if o cannot be compared with the elements * currently in the set. * @throws NullPointerException if o is null. */ public E higher(E o) { return m.higherKey(o); } /** * Retrieves and removes the first (lowest) element. * * @return the least element, or null if empty. */ public E pollFirst() { return m.pollFirstKey(); } /** * Retrieves and removes the last (highest) element. * * @return the last element, or null if empty. */ public E pollLast() { return m.pollLastKey(); } /* ---------------- SortedSet operations -------------- */ /** * Returns the comparator used to order this set, or null * if this set uses its elements natural ordering. * * @return the comparator used to order this set, or null * if this set uses its elements natural ordering. */ public Comparator comparator() { return m.comparator(); } /** * Returns the first (lowest) element currently in this set. * * @return the first (lowest) element currently in this set. * @throws NoSuchElementException sorted set is empty. */ public E first() { return m.firstKey(); } /** * Returns the last (highest) element currently in this set. * * @return the last (highest) element currently in this set. * @throws NoSuchElementException sorted set is empty. */ public E last() { return m.lastKey(); } /** * Returns a view of the portion of this set whose elements range from * fromElement, inclusive, to toElement, exclusive. (If * fromElement and toElement are equal, the returned * sorted set is empty.) The returned sorted set is backed by this set, * so changes in the returned sorted set are reflected in this set, and * vice-versa. * @param fromElement low endpoint (inclusive) of the subSet. * @param toElement high endpoint (exclusive) of the subSet. * @return a view of the portion of this set whose elements range from * fromElement, inclusive, to toElement, * exclusive. * @throws ClassCastException if fromElement and * toElement cannot be compared to one another using * this set's comparator (or, if the set has no comparator, * using natural ordering). * @throws IllegalArgumentException if fromElement is * greater than toElement. * @throws NullPointerException if fromElement or * toElement is null. */ public NavigableSet subSet(E fromElement, E toElement) { return new ConcurrentSkipListSubSet(m, fromElement, toElement); } /** * Returns a view of the portion of this set whose elements are strictly * less than toElement. The returned sorted set is backed by * this set, so changes in the returned sorted set are reflected in this * set, and vice-versa. * @param toElement high endpoint (exclusive) of the headSet. * @return a view of the portion of this set whose elements are strictly * less than toElement. * @throws ClassCastException if toElement is not compatible * with this set's comparator (or, if the set has no comparator, * if toElement does not implement Comparable). * @throws NullPointerException if toElement is null. */ public NavigableSet headSet(E toElement) { return new ConcurrentSkipListSubSet(m, null, toElement); } /** * Returns a view of the portion of this set whose elements are * greater than or equal to fromElement. The returned * sorted set is backed by this set, so changes in the returned * sorted set are reflected in this set, and vice-versa. * @param fromElement low endpoint (inclusive) of the tailSet. * @return a view of the portion of this set whose elements are * greater than or equal to fromElement. * @throws ClassCastException if fromElement is not * compatible with this set's comparator (or, if the set has no * comparator, if fromElement does not implement * Comparable). * @throws NullPointerException if fromElement is null. */ public NavigableSet tailSet(E fromElement) { return new ConcurrentSkipListSubSet(m, fromElement, null); } /** * Subsets returned by {@link ConcurrentSkipListSet} subset operations * represent a subrange of elements of their underlying * sets. Instances of this class support all methods of their * underlying sets, differing in that elements outside their range are * ignored, and attempts to add elements outside their ranges result * in {@link IllegalArgumentException}. Instances of this class are * constructed only using the subSet, headSet, and * tailSet methods of their underlying sets. * */ static class ConcurrentSkipListSubSet extends AbstractSet implements NavigableSet, java.io.Serializable { private static final long serialVersionUID = -7647078645896651609L; /** The underlying submap */ private final ConcurrentSkipListMap.ConcurrentSkipListSubMap s; /** * Creates a new submap. * @param fromElement inclusive least value, or null if from start * @param toElement exclusive upper bound or null if to end * @throws IllegalArgumentException if fromElement and toElement * non-null and fromElement greater than toElement */ ConcurrentSkipListSubSet(ConcurrentSkipListMap map, E fromElement, E toElement) { s = new ConcurrentSkipListMap.ConcurrentSkipListSubMap (map, fromElement, toElement); } // subsubset construction public NavigableSet subSet(E fromElement, E toElement) { if (!s.inOpenRange(fromElement) || !s.inOpenRange(toElement)) throw new IllegalArgumentException("element out of range"); return new ConcurrentSkipListSubSet(s.getMap(), fromElement, toElement); } public NavigableSet headSet(E toElement) { E least = s.getLeast(); if (!s.inOpenRange(toElement)) throw new IllegalArgumentException("element out of range"); return new ConcurrentSkipListSubSet(s.getMap(), least, toElement); } public NavigableSet tailSet(E fromElement) { E fence = s.getFence(); if (!s.inOpenRange(fromElement)) throw new IllegalArgumentException("element out of range"); return new ConcurrentSkipListSubSet(s.getMap(), fromElement, fence); } // relays to submap methods public int size() { return s.size(); } public boolean isEmpty() { return s.isEmpty(); } public boolean contains(Object o) { return s.containsKey(o); } public void clear() { s.clear(); } public E first() { return s.firstKey(); } public E last() { return s.lastKey(); } public E ceiling(E o) { return s.ceilingKey(o); } public E lower(E o) { return s.lowerKey(o); } public E floor(E o) { return s.floorKey(o); } public E higher(E o) { return s.higherKey(o); } public boolean remove(Object o) { return s.remove(o)==Boolean.TRUE; } public boolean add(E o) { return s.put(o, Boolean.TRUE)==null; } public Comparator comparator() { return s.comparator(); } public Iterator iterator() { return s.keySet().iterator(); } public Iterator descendingIterator() { return s.descendingKeySet().iterator(); } public E pollFirst() { Map.Entry e = s.pollFirstEntry(); return (e == null) ? null : e.getKey(); } public E pollLast() { Map.Entry e = s.pollLastEntry(); return (e == null) ? null : e.getKey(); } } } jsr166/src/jsr166x/ArrayDeque.java0000644000000000000000000006305311537741066013737 0ustar /* * Written by Josh Bloch of Google Inc. and released to the public domain, * as explained at http://creativecommons.org/publicdomain/zero/1.0/. */ package jsr166x; // XXX This belongs in java.util!!! XXX import java.util.*; // XXX This import goes away XXX import java.io.*; /** * Resizable-array implementation of the {@link Deque} interface. Array * deques have no capacity restrictions; they grow as necessary to support * usage. They are not thread-safe; in the absence of external * synchronization, they do not support concurrent access by multiple threads. * Null elements are prohibited. This class is likely to be faster than * {@link Stack} when used as a stack, and faster than {@link LinkedList} * when used as a queue. * *

Most ArrayDeque operations run in amortized constant time. * Exceptions include {@link #remove(Object) remove}, {@link * #removeFirstOccurrence removeFirstOccurrence}, {@link #removeLastOccurrence * removeLastOccurrence}, {@link #contains contains }, {@link #iterator * iterator.remove()}, and the bulk operations, all of which run in linear * time. * *

The iterators returned by this class's iterator method are * fail-fast: If the deque is modified at any time after the iterator * is created, in any way except through the iterator's own remove method, the * iterator will generally throw a {@link ConcurrentModificationException}. * Thus, in the face of concurrent modification, the iterator fails quickly * and cleanly, rather than risking arbitrary, non-deterministic behavior at * an undetermined time in the future. * *

Note that the fail-fast behavior of an iterator cannot be guaranteed * as it is, generally speaking, impossible to make any hard guarantees in the * presence of unsynchronized concurrent modification. Fail-fast iterators * throw ConcurrentModificationException on a best-effort basis. * Therefore, it would be wrong to write a program that depended on this * exception for its correctness: the fail-fast behavior of iterators * should be used only to detect bugs. * *

This class and its iterator implement all of the * optional methods of the {@link Collection} and {@link * Iterator} interfaces. This class is a member of the Java Collections * Framework. * * @author Josh Bloch and Doug Lea * @since 1.6 * @param the type of elements held in this collection */ public class ArrayDeque extends AbstractCollection implements Deque, Cloneable, Serializable { /** * The array in which the elements of in the deque are stored. * The capacity of the deque is the length of this array, which is * always a power of two. The array is never allowed to become * full, except transiently within an addX method where it is * resized (see doubleCapacity) immediately upon becoming full, * thus avoiding head and tail wrapping around to equal each * other. We also guarantee that all array cells not holding * deque elements are always null. */ private transient E[] elements; /** * The index of the element at the head of the deque (which is the * element that would be removed by remove() or pop()); or an * arbitrary number equal to tail if the deque is empty. */ private transient int head; /** * The index at which the next element would be added to the tail * of the deque (via addLast(E), add(E), or push(E)). */ private transient int tail; /** * The minimum capacity that we'll use for a newly created deque. * Must be a power of 2. */ private static final int MIN_INITIAL_CAPACITY = 8; // ****** Array allocation and resizing utilities ****** /** * Allocate empty array to hold the given number of elements. * * @param numElements the number of elements to hold. */ private void allocateElements(int numElements) { int initialCapacity = MIN_INITIAL_CAPACITY; // Find the best power of two to hold elements. // Tests "<=" because arrays aren't kept full. if (numElements >= initialCapacity) { initialCapacity = numElements; initialCapacity |= (initialCapacity >>> 1); initialCapacity |= (initialCapacity >>> 2); initialCapacity |= (initialCapacity >>> 4); initialCapacity |= (initialCapacity >>> 8); initialCapacity |= (initialCapacity >>> 16); initialCapacity++; if (initialCapacity < 0) // Too many elements, must back off initialCapacity >>>= 1;// Good luck allocating 2 ^ 30 elements } elements = (E[]) new Object[initialCapacity]; } /** * Double the capacity of this deque. Call only when full, i.e., * when head and tail have wrapped around to become equal. */ private void doubleCapacity() { assert head == tail; int p = head; int n = elements.length; int r = n - p; // number of elements to the right of p int newCapacity = n << 1; if (newCapacity < 0) throw new IllegalStateException("Sorry, deque too big"); Object[] a = new Object[newCapacity]; System.arraycopy(elements, p, a, 0, r); System.arraycopy(elements, 0, a, r, p); elements = (E[])a; head = 0; tail = n; } /** * Copy the elements from our element array into the specified array, * in order (from first to last element in the deque). It is assumed * that the array is large enough to hold all elements in the deque. * * @return its argument */ private T[] copyElements(T[] a) { if (head < tail) { System.arraycopy(elements, head, a, 0, size()); } else if (head > tail) { int headPortionLen = elements.length - head; System.arraycopy(elements, head, a, 0, headPortionLen); System.arraycopy(elements, 0, a, headPortionLen, tail); } return a; } /** * Constructs an empty array deque with the an initial capacity * sufficient to hold 16 elements. */ public ArrayDeque() { elements = (E[]) new Object[16]; } /** * Constructs an empty array deque with an initial capacity * sufficient to hold the specified number of elements. * * @param numElements lower bound on initial capacity of the deque */ public ArrayDeque(int numElements) { allocateElements(numElements); } /** * Constructs a deque containing the elements of the specified * collection, in the order they are returned by the collection's * iterator. (The first element returned by the collection's * iterator becomes the first element, or front of the * deque.) * * @param c the collection whose elements are to be placed into the deque * @throws NullPointerException if the specified collection is null */ public ArrayDeque(Collection c) { allocateElements(c.size()); addAll(c); } // The main insertion and extraction methods are addFirst, // addLast, pollFirst, pollLast. The other methods are defined in // terms of these. /** * Inserts the specified element to the front this deque. * * @param e the element to insert * @throws NullPointerException if e is null */ public void addFirst(E e) { if (e == null) throw new NullPointerException(); elements[head = (head - 1) & (elements.length - 1)] = e; if (head == tail) doubleCapacity(); } /** * Inserts the specified element to the end this deque. * This method is equivalent to {@link Collection#add} and * {@link #push}. * * @param e the element to insert * @throws NullPointerException if e is null */ public void addLast(E e) { if (e == null) throw new NullPointerException(); elements[tail] = e; if ( (tail = (tail + 1) & (elements.length - 1)) == head) doubleCapacity(); } /** * Retrieves and removes the first element of this deque, or * null if this deque is empty. * * @return the first element of this deque, or null if * this deque is empty */ public E pollFirst() { int h = head; E result = elements[h]; // Element is null if deque empty if (result == null) return null; elements[h] = null; // Must null out slot head = (h + 1) & (elements.length - 1); return result; } /** * Retrieves and removes the last element of this deque, or * null if this deque is empty. * * @return the last element of this deque, or null if * this deque is empty */ public E pollLast() { int t = (tail - 1) & (elements.length - 1); E result = elements[t]; if (result == null) return null; elements[t] = null; tail = t; return result; } /** * Inserts the specified element to the front this deque. * * @param e the element to insert * @return true (as per the spec for {@link Deque#offerFirst}) * @throws NullPointerException if e is null */ public boolean offerFirst(E e) { addFirst(e); return true; } /** * Inserts the specified element to the end this deque. * * @param e the element to insert * @return true (as per the spec for {@link Deque#offerLast}) * @throws NullPointerException if e is null */ public boolean offerLast(E e) { addLast(e); return true; } /** * Retrieves and removes the first element of this deque. This method * differs from the pollFirst method in that it throws an * exception if this deque is empty. * * @return the first element of this deque * @throws NoSuchElementException if this deque is empty */ public E removeFirst() { E x = pollFirst(); if (x == null) throw new NoSuchElementException(); return x; } /** * Retrieves and removes the last element of this deque. This method * differs from the pollLast method in that it throws an * exception if this deque is empty. * * @return the last element of this deque * @throws NoSuchElementException if this deque is empty */ public E removeLast() { E x = pollLast(); if (x == null) throw new NoSuchElementException(); return x; } /** * Retrieves, but does not remove, the first element of this deque, * returning null if this deque is empty. * * @return the first element of this deque, or null if * this deque is empty */ public E peekFirst() { return elements[head]; // elements[head] is null if deque empty } /** * Retrieves, but does not remove, the last element of this deque, * returning null if this deque is empty. * * @return the last element of this deque, or null if this deque * is empty */ public E peekLast() { return elements[(tail - 1) & (elements.length - 1)]; } /** * Retrieves, but does not remove, the first element of this * deque. This method differs from the peek method only * in that it throws an exception if this deque is empty. * * @return the first element of this deque * @throws NoSuchElementException if this deque is empty */ public E getFirst() { E x = elements[head]; if (x == null) throw new NoSuchElementException(); return x; } /** * Retrieves, but does not remove, the last element of this * deque. This method differs from the peek method only * in that it throws an exception if this deque is empty. * * @return the last element of this deque * @throws NoSuchElementException if this deque is empty */ public E getLast() { E x = elements[(tail - 1) & (elements.length - 1)]; if (x == null) throw new NoSuchElementException(); return x; } /** * Removes the first occurrence of the specified element in this * deque (when traversing the deque from head to tail). If the deque * does not contain the element, it is unchanged. * * @param e element to be removed from this deque, if present * @return true if the deque contained the specified element */ public boolean removeFirstOccurrence(Object e) { if (e == null) return false; int mask = elements.length - 1; int i = head; E x; while ( (x = elements[i]) != null) { if (e.equals(x)) { delete(i); return true; } i = (i + 1) & mask; } return false; } /** * Removes the last occurrence of the specified element in this * deque (when traversing the deque from head to tail). If the deque * does not contain the element, it is unchanged. * * @param e element to be removed from this deque, if present * @return true if the deque contained the specified element */ public boolean removeLastOccurrence(Object e) { if (e == null) return false; int mask = elements.length - 1; int i = (tail - 1) & mask; E x; while ( (x = elements[i]) != null) { if (e.equals(x)) { delete(i); return true; } i = (i - 1) & mask; } return false; } // *** Queue methods *** /** * Inserts the specified element to the end of this deque. * *

This method is equivalent to {@link #offerLast}. * * @param e the element to insert * @return true (as per the spec for {@link Queue#offer}) * @throws NullPointerException if e is null */ public boolean offer(E e) { return offerLast(e); } /** * Inserts the specified element to the end of this deque. * *

This method is equivalent to {@link #addLast}. * * @param e the element to insert * @return true (as per the spec for {@link Collection#add}) * @throws NullPointerException if e is null */ public boolean add(E e) { addLast(e); return true; } /** * Retrieves and removes the head of the queue represented by * this deque, or null if this deque is empty. In other words, * retrieves and removes the first element of this deque, or null * if this deque is empty. * *

This method is equivalent to {@link #pollFirst}. * * @return the first element of this deque, or null if * this deque is empty */ public E poll() { return pollFirst(); } /** * Retrieves and removes the head of the queue represented by this deque. * This method differs from the poll method in that it throws an * exception if this deque is empty. * *

This method is equivalent to {@link #removeFirst}. * * @return the head of the queue represented by this deque * @throws NoSuchElementException if this deque is empty */ public E remove() { return removeFirst(); } /** * Retrieves, but does not remove, the head of the queue represented by * this deque, returning null if this deque is empty. * *

This method is equivalent to {@link #peekFirst} * * @return the head of the queue represented by this deque, or * null if this deque is empty */ public E peek() { return peekFirst(); } /** * Retrieves, but does not remove, the head of the queue represented by * this deque. This method differs from the peek method only in * that it throws an exception if this deque is empty. * *

This method is equivalent to {@link #getFirst} * * @return the head of the queue represented by this deque * @throws NoSuchElementException if this deque is empty */ public E element() { return getFirst(); } // *** Stack methods *** /** * Pushes an element onto the stack represented by this deque. In other * words, inserts the element to the front this deque. * *

This method is equivalent to {@link #addFirst}. * * @param e the element to push * @throws NullPointerException if e is null */ public void push(E e) { addFirst(e); } /** * Pops an element from the stack represented by this deque. In other * words, removes and returns the first element of this deque. * *

This method is equivalent to {@link #removeFirst()}. * * @return the element at the front of this deque (which is the top * of the stack represented by this deque) * @throws NoSuchElementException if this deque is empty */ public E pop() { return removeFirst(); } /** * Remove the element at the specified position in the elements array, * adjusting head, tail, and size as necessary. This can result in * motion of elements backwards or forwards in the array. * *

This method is called delete rather than remove to emphasize the * that that its semantics differ from those of List.remove(int). * * @return true if elements moved backwards */ private boolean delete(int i) { // Case 1: Deque doesn't wrap // Case 2: Deque does wrap and removed element is in the head portion if ((head < tail || tail == 0) || i >= head) { System.arraycopy(elements, head, elements, head + 1, i - head); elements[head] = null; head = (head + 1) & (elements.length - 1); return false; } // Case 3: Deque wraps and removed element is in the tail portion tail--; System.arraycopy(elements, i + 1, elements, i, tail - i); elements[tail] = null; return true; } // *** Collection Methods *** /** * Returns the number of elements in this deque. * * @return the number of elements in this deque */ public int size() { return (tail - head) & (elements.length - 1); } /** * Returns true if this collection contains no elements.

* * @return true if this collection contains no elements. */ public boolean isEmpty() { return head == tail; } /** * Returns an iterator over the elements in this deque. The elements * will be ordered from first (head) to last (tail). This is the same * order that elements would be dequeued (via successive calls to * {@link #remove} or popped (via successive calls to {@link #pop}). * * @return an Iterator over the elements in this deque */ public Iterator iterator() { return new DeqIterator(); } private class DeqIterator implements Iterator { /** * Index of element to be returned by subsequent call to next. */ private int cursor = head; /** * Tail recorded at construction (also in remove), to stop * iterator and also to check for comodification. */ private int fence = tail; /** * Index of element returned by most recent call to next. * Reset to -1 if element is deleted by a call to remove. */ private int lastRet = -1; public boolean hasNext() { return cursor != fence; } public E next() { E result; if (cursor == fence) throw new NoSuchElementException(); // This check doesn't catch all possible comodifications, // but does catch the ones that corrupt traversal if (tail != fence || (result = elements[cursor]) == null) throw new ConcurrentModificationException(); lastRet = cursor; cursor = (cursor + 1) & (elements.length - 1); return result; } public void remove() { if (lastRet < 0) throw new IllegalStateException(); if (delete(lastRet)) cursor--; lastRet = -1; fence = tail; } } /** * Returns true if this deque contains the specified * element. More formally, returns true if and only if this * deque contains at least one element e such that * e.equals(o). * * @param o object to be checked for containment in this deque * @return true if this deque contains the specified element */ public boolean contains(Object o) { if (o == null) return false; int mask = elements.length - 1; int i = head; E x; while ( (x = elements[i]) != null) { if (o.equals(x)) return true; i = (i + 1) & mask; } return false; } /** * Removes a single instance of the specified element from this deque. * This method is equivalent to {@link #removeFirstOccurrence}. * * @param e element to be removed from this deque, if present * @return true if this deque contained the specified element */ public boolean remove(Object e) { return removeFirstOccurrence(e); } /** * Removes all of the elements from this deque. */ public void clear() { int h = head; int t = tail; if (h != t) { // clear all cells head = tail = 0; int i = h; int mask = elements.length - 1; do { elements[i] = null; i = (i + 1) & mask; } while (i != t); } } /** * Returns an array containing all of the elements in this list * in the correct order. * * @return an array containing all of the elements in this list * in the correct order */ public Object[] toArray() { return copyElements(new Object[size()]); } /** * Returns an array containing all of the elements in this deque in the * correct order; the runtime type of the returned array is that of the * specified array. If the deque fits in the specified array, it is * returned therein. Otherwise, a new array is allocated with the runtime * type of the specified array and the size of this deque. * *

If the deque fits in the specified array with room to spare (i.e., * the array has more elements than the deque), the element in the array * immediately following the end of the collection is set to null. * * @param a the array into which the elements of the deque are to * be stored, if it is big enough; otherwise, a new array of the * same runtime type is allocated for this purpose * @return an array containing the elements of the deque * @throws ArrayStoreException if the runtime type of a is not a supertype * of the runtime type of every element in this deque */ public T[] toArray(T[] a) { int size = size(); if (a.length < size) a = (T[])java.lang.reflect.Array.newInstance( a.getClass().getComponentType(), size); copyElements(a); if (a.length > size) a[size] = null; return a; } // *** Object methods *** /** * Returns a copy of this deque. * * @return a copy of this deque */ public ArrayDeque clone() { try { ArrayDeque result = (ArrayDeque) super.clone(); // These two lines are currently faster than cloning the array: result.elements = (E[]) new Object[elements.length]; System.arraycopy(elements, 0, result.elements, 0, elements.length); return result; } catch (CloneNotSupportedException e) { throw new AssertionError(); } } /** * Appease the serialization gods. */ private static final long serialVersionUID = 2340985798034038923L; /** * Serialize this deque. * * @serialData The current size (int) of the deque, * followed by all of its elements (each an object reference) in * first-to-last order. */ private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); // Write out size int size = size(); s.writeInt(size); // Write out elements in order. int i = head; int mask = elements.length - 1; for (int j = 0; j < size; j++) { s.writeObject(elements[i]); i = (i + 1) & mask; } } /** * Deserialize this deque. */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); // Read in size and allocate array int size = s.readInt(); allocateElements(size); head = 0; tail = size; // Read in all elements in the proper order. for (int i = 0; i < size; i++) elements[i] = (E)s.readObject(); } } jsr166/src/jsr166x/Deque.java0000644000000000000000000003775611537741066012753 0ustar /* * Written by Doug Lea and Josh Bloch with assistance from members of * JCP JSR-166 Expert Group and released to the public domain, as explained * at http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166x; // XXX This belongs in java.util!!! XXX import java.util.*; // XXX This import goes away XXX /** * A linear collection that supports element insertion and removal at * both ends. The name deque is short for "double ended queue" * and is usually pronounced "deck". Most Deque * implementations place no fixed limits on the number of elements * they may contain, but this interface supports capacity-restricted * deques as well as those with no fixed size limit. * *

This interface defines methods to access the elements at both * ends of the deque. Methods are provided to insert, remove, and * examine the element. Each of these methods exists in two forms: * one throws an exception if the operation fails, the other returns a * special value (either null or false, depending on * the operation). The latter form of the insert operation is * designed specifically for use with capacity-restricted * Deque implementations; in most implementations, insert * operations cannot fail. * *

The twelve methods described above are summarized in the * following table:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
First Element (Head) Last Element (Tail)
Throws exceptionReturns special valueThrows exceptionReturns special value
Insert{@link #addFirst addFirst(e)}{@link #offerFirst offerFirst(e)}{@link #addLast addLast(e)}{@link #offerLast offerLast(e)}
Remove{@link #removeFirst removeFirst()}{@link #pollFirst pollFirst()}{@link #removeLast removeLast()}{@link #pollLast pollLast()}
Examine{@link #getFirst getFirst()}{@link #peekFirst peekFirst()}{@link #getLast getLast()}{@link #peekLast peekLast()}
* *

This interface extends the {@link Queue} interface. When a deque is * used as a queue, FIFO (First-In-First-Out) behavior results. Elements are * added to the end of the deque and removed from the beginning. The methods * inherited from the Queue interface are precisely equivalent to * Deque methods as indicated in the following table:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Queue Method Equivalent Deque Method
{@link java.util.Queue#offer offer(e)}{@link #offerLast offerLast(e)}
{@link java.util.Queue#add add(e)}{@link #addLast addLast(e)}
{@link java.util.Queue#poll poll()}{@link #pollFirst pollFirst()}
{@link java.util.Queue#remove remove()}{@link #removeFirst removeFirst()}
{@link java.util.Queue#peek peek()}{@link #peek peekFirst()}
{@link java.util.Queue#element element()}{@link #getFirst getFirst()}
* *

Deques can also be used as LIFO (Last-In-First-Out) stacks. This * interface should be used in preference to the legacy {@link Stack} class. * When a dequeue is used as a stack, elements are pushed and popped from the * beginning of the deque. Stack methods are precisely equivalent to * Deque methods as indicated in the table below:

* * * * * * * * * * * * * * * * * * * *
Stack Method Equivalent Deque Method
{@link #push push(e)}{@link #addFirst addFirst(e)}
{@link #pop pop()}{@link #removeFirst removeFirst()}
{@link #peek peek()}{@link #peekFirst peekFirst()}
* *

Note that the {@link #peek peek} method works equally well when * a deque is used as a queue or a stack; in either case, elements are * drawn from the beginning of the deque. * *

This interface provides two methods to remove interior * elements, {@link #removeFirstOccurrence removeFirstOccurrence} and * {@link #removeLastOccurrence removeLastOccurrence}. Unlike the * {@link List} interface, this interface does not provide support for * indexed access to elements. * *

While Deque implementations are not strictly required * to prohibit the insertion of null elements, they are strongly * encouraged to do so. Users of any Deque implementations * that do allow null elements are strongly encouraged not to * take advantage of the ability to insert nulls. This is so because * null is used as a special return value by various methods * to indicated that the deque is empty. * *

Deque implementations generally do not define * element-based versions of the equals and hashCode * methods, but instead inherit the identity-based versions from class * Object. * *

This interface is a member of the Java Collections * Framework. * * @author Doug Lea * @author Josh Bloch * @since 1.6 * @param the type of elements held in this collection */ public interface Deque extends Queue { /** * Inserts the specified element to the front this deque unless it would * violate capacity restrictions. When using a capacity-restricted deque, * this method is generally preferable to method addFirst, which * can fail to insert an element only by throwing an exception. * * @param e the element to insert * @return true if it was possible to insert the element, * else false * @throws NullPointerException if e is null and this * deque does not permit null elements */ boolean offerFirst(E e); /** * Inserts the specified element to the end of this deque unless it would * violate capacity restrictions. When using a capacity-restricted deque, * this method is generally preferable to method addLast which * can fail to insert an element only by throwing an exception. * * @param e the element to insert * @return true if it was possible to insert the element, * else false * @throws NullPointerException if e is null and this * deque does not permit null elements */ boolean offerLast(E e); /** * Inserts the specified element to the front of this deque unless it * would violate capacity restrictions. * * @param e the element to insert * @throws IllegalStateException if it was not possible to insert * the element due to capacity restrictions * @throws NullPointerException if e is null and this * deque does not permit null elements */ void addFirst(E e); /** * Inserts the specified element to the end of this deque unless it would * violate capacity restrictions. * * @param e the element to insert * @throws IllegalStateException if it was not possible to insert * the element due to capacity restrictions * @throws NullPointerException if e is null and this * deque does not permit null elements */ void addLast(E e); /** * Retrieves and removes the first element of this deque, or * null if this deque is empty. * * @return the first element of this deque, or null if * this deque is empty */ E pollFirst(); /** * Retrieves and removes the last element of this deque, or * null if this deque is empty. * * @return the last element of this deque, or null if * this deque is empty */ E pollLast(); /** * Removes and returns the first element of this deque. This method * differs from the pollFirst method only in that it throws an * exception if this deque is empty. * * @return the first element of this deque * @throws NoSuchElementException if this deque is empty */ E removeFirst(); /** * Retrieves and removes the last element of this deque. This method * differs from the pollLast method only in that it throws an * exception if this deque is empty. * * @return the last element of this deque * @throws NoSuchElementException if this deque is empty */ E removeLast(); /** * Retrieves, but does not remove, the first element of this deque, * returning null if this deque is empty. * * @return the first element of this deque, or null if * this deque is empty */ E peekFirst(); /** * Retrieves, but does not remove, the last element of this deque, * returning null if this deque is empty. * * @return the last element of this deque, or null if this deque * is empty */ E peekLast(); /** * Retrieves, but does not remove, the first element of this * deque. This method differs from the peek method only * in that it throws an exception if this deque is empty. * * @return the first element of this deque * @throws NoSuchElementException if this deque is empty */ E getFirst(); /** * Retrieves, but does not remove, the last element of this * deque. This method differs from the peek method only * in that it throws an exception if this deque is empty. * * @return the last element of this deque * @throws NoSuchElementException if this deque is empty */ E getLast(); /** * Removes the first occurrence of the specified element in this * deque. If the deque does not contain the element, it is * unchanged. More formally, removes the first element e * such that (o==null ? e==null : o.equals(e)) (if * such an element exists). * * @param e element to be removed from this deque, if present * @return true if the deque contained the specified element * @throws NullPointerException if the specified element is null */ boolean removeFirstOccurrence(Object e); /** * Removes the last occurrence of the specified element in this * deque. If the deque does not contain the element, it is * unchanged. More formally, removes the last element e * such that (o==null ? e==null : o.equals(e)) (if * such an element exists). * * @param e element to be removed from this deque, if present * @return true if the deque contained the specified element * @throws NullPointerException if the specified element is null */ boolean removeLastOccurrence(Object e); // *** Queue methods *** /** * Inserts the specified element into the queue represented by this deque * unless it would violate capacity restrictions. In other words, inserts * the specified element to the end of this deque. When using a * capacity-restricted deque, this method is generally preferable to the * {@link #add} method, which can fail to insert an element only by * throwing an exception. * *

This method is equivalent to {@link #offerLast}. * * @param e the element to insert * @return true if it was possible to insert the element, * else false * @throws NullPointerException if e is null and this * deque does not permit null elements */ boolean offer(E e); /** * Inserts the specified element into the queue represented by this * deque unless it would violate capacity restrictions. In other words, * inserts the specified element as the last element of this deque. * *

This method is equivalent to {@link #addLast}. * * @param e the element to insert * @return true (as per the spec for {@link Collection#add}) * @throws IllegalStateException if it was not possible to insert * the element due to capacity restrictions * @throws NullPointerException if e is null and this * deque does not permit null elements */ boolean add(E e); /** * Retrieves and removes the head of the queue represented by * this deque, or null if this deque is empty. In other words, * retrieves and removes the first element of this deque, or null * if this deque is empty. * *

This method is equivalent to {@link #pollFirst()}. * * @return the first element of this deque, or null if * this deque is empty */ E poll(); /** * Retrieves and removes the head of the queue represented by this deque. * This method differs from the poll method only in that it * throws an exception if this deque is empty. * *

This method is equivalent to {@link #removeFirst()}. * * @return the head of the queue represented by this deque * @throws NoSuchElementException if this deque is empty */ E remove(); /** * Retrieves, but does not remove, the head of the queue represented by * this deque, returning null if this deque is empty. * *

This method is equivalent to {@link #peekFirst()} * * @return the head of the queue represented by this deque, or * null if this deque is empty */ E peek(); /** * Retrieves, but does not remove, the head of the queue represented by * this deque. This method differs from the peek method only in * that it throws an exception if this deque is empty. * *

This method is equivalent to {@link #getFirst()} * * @return the head of the queue represented by this deque * @throws NoSuchElementException if this deque is empty */ E element(); // *** Stack methods *** /** * Pushes an element onto the stack represented by this deque. In other * words, inserts the element to the front this deque unless it would * violate capacity restrictions. * *

This method is equivalent to {@link #addFirst}. * * @throws IllegalStateException if it was not possible to insert * the element due to capacity restrictions * @throws NullPointerException if e is null and this * deque does not permit null elements */ void push(E e); /** * Pops an element from the stack represented by this deque. In other * words, removes and returns the first element of this deque. * *

This method is equivalent to {@link #removeFirst()}. * * @return the element at the front of this deque (which is the top * of the stack represented by this deque) * @throws NoSuchElementException if this deque is empty */ E pop(); // *** Collection Method *** /** * Returns an iterator over the elements in this deque. The elements * will be ordered from first (head) to last (tail). * * @return an Iterator over the elements in this deque */ Iterator iterator(); } jsr166/src/jsr166x/ConcurrentLinkedDeque.java0000644000000000000000000007216611551700072016123 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166x; import java.util.AbstractCollection; import java.util.ArrayList; import java.util.Collection; import jsr166x.Deque; //import java.util.Deque; import java.util.Iterator; import java.util.ConcurrentModificationException; import java.util.NoSuchElementException; import java.util.concurrent.atomic.AtomicReference; /** * A concurrent linked-list implementation of a {@link Deque} * (double-ended queue). Concurrent insertion, removal, and access * operations execute safely across multiple threads. Iterators are * weakly consistent, returning elements reflecting the state * of the deque at some point at or since the creation of the * iterator. They do not throw {@link * ConcurrentModificationException}, and may proceed concurrently with * other operations. * *

This class and its iterators implement all of the * optional methods of the {@link Collection} and {@link * Iterator} interfaces. Like most other concurrent collection * implementations, this class does not permit the use of * {@code null} elements. because some null arguments and return * values cannot be reliably distinguished from the absence of * elements. Arbitrarily, the {@link Collection#remove} method is * mapped to {@code removeFirstOccurrence}, and {@link * Collection#add} is mapped to {@code addLast}. * *

Beware that, unlike in most collections, the {@code size} * method is NOT a constant-time operation. Because of the * asynchronous nature of these deques, determining the current number * of elements requires a traversal of the elements. * *

This class is {@code Serializable}, but relies on default * serialization mechanisms. Usually, it is a better idea for any * serializable class using a {@code ConcurrentLinkedDeque} to instead * serialize a snapshot of the elements obtained by method * {@code toArray}. * * @author Doug Lea * @param the type of elements held in this collection */ public class ConcurrentLinkedDeque extends AbstractCollection implements Deque, java.io.Serializable { /* * This is an adaptation of an algorithm described in Paul * Martin's "A Practical Lock-Free Doubly-Linked List". Sun Labs * Tech report. The basic idea is to primarily rely on * next-pointers to ensure consistency. Prev-pointers are in part * optimistic, reconstructed using forward pointers as needed. * The main forward list uses a variant of HM-list algorithm * similar to the one used in ConcurrentSkipListMap class, but a * little simpler. It is also basically similar to the approach * in Edya Ladan-Mozes and Nir Shavit "An Optimistic Approach to * Lock-Free FIFO Queues" in DISC04. * * Quoting a summary in Paul Martin's tech report: * * All cleanups work to maintain these invariants: * (1) forward pointers are the ground truth. * (2) forward pointers to dead nodes can be improved by swinging them * further forward around the dead node. * (2.1) forward pointers are still correct when pointing to dead * nodes, and forward pointers from dead nodes are left * as they were when the node was deleted. * (2.2) multiple dead nodes may point forward to the same node. * (3) backward pointers were correct when they were installed * (3.1) backward pointers are correct when pointing to any * node which points forward to them, but since more than * one forward pointer may point to them, the live one is best. * (4) backward pointers that are out of date due to deletion * point to a deleted node, and need to point further back until * they point to the live node that points to their source. * (5) backward pointers that are out of date due to insertion * point too far backwards, so shortening their scope (by searching * forward) fixes them. * (6) backward pointers from a dead node cannot be "improved" since * there may be no live node pointing forward to their origin. * (However, it does no harm to try to improve them while * racing with a deletion.) * * * Notation guide for local variables * n, b, f : a node, its predecessor, and successor * s : some other successor */ /** * Linked Nodes. As a minor efficiency hack, this class * opportunistically inherits from AtomicReference, with the * atomic ref used as the "next" link. * * Nodes are in doubly-linked lists. There are three * kinds of special nodes, distinguished by: * * The list header has a null prev link. * * The list trailer has a null next link. * * A deletion marker has a prev link pointing to itself. * All three kinds of special nodes have null element fields. * * Regular nodes have non-null element, next, and prev fields. To * avoid visible inconsistencies when deletions overlap element * replacement, replacements are done by replacing the node, not * just setting the element. * * Nodes can be traversed by read-only ConcurrentLinkedDeque class * operations just by following raw next pointers, so long as they * ignore any special nodes seen along the way. (This is automated * in method forward.) However, traversal using prev pointers is * not guaranteed to see all live nodes since a prev pointer of a * deleted node can become unrecoverably stale. */ static final class Node extends AtomicReference> { private volatile Node prev; final E element; private static final long serialVersionUID = 876323262645176354L; /** Creates a node with given contents. */ Node(E element, Node next, Node prev) { super(next); this.prev = prev; this.element = element; } /** Creates a marker node with given successor. */ Node(Node next) { super(next); this.prev = this; this.element = null; } /** * Gets next link (which is actually the value held * as atomic reference). */ private Node getNext() { return get(); } /** * Sets next link. * @param n the next node */ void setNext(Node n) { set(n); } /** * compareAndSet next link */ private boolean casNext(Node cmp, Node val) { return compareAndSet(cmp, val); } /** * Gets prev link. */ private Node getPrev() { return prev; } /** * Sets prev link. * @param b the previous node */ void setPrev(Node b) { prev = b; } /** * Returns true if this is a header, trailer, or marker node. */ boolean isSpecial() { return element == null; } /** * Returns true if this is a trailer node. */ boolean isTrailer() { return getNext() == null; } /** * Returns true if this is a header node. */ boolean isHeader() { return getPrev() == null; } /** * Returns true if this is a marker node. */ boolean isMarker() { return getPrev() == this; } /** * Returns true if this node is followed by a marker node, * meaning that this node is deleted. * * @return true if this node is deleted */ boolean isDeleted() { Node f = getNext(); return f != null && f.isMarker(); } /** * Returns next node, ignoring deletion marker. */ private Node nextNonmarker() { Node f = getNext(); return (f == null || !f.isMarker()) ? f : f.getNext(); } /** * Returns the next non-deleted node, swinging next pointer * around any encountered deleted nodes, and also patching up * successor's prev link to point back to this. Returns * null if this node is trailer so has no successor. * * @return successor, or null if no such */ Node successor() { Node f = nextNonmarker(); for (;;) { if (f == null) return null; if (!f.isDeleted()) { if (f.getPrev() != this && !isDeleted()) f.setPrev(this); // relink f's prev return f; } Node s = f.nextNonmarker(); if (f == getNext()) casNext(f, s); // unlink f f = s; } } /** * Returns the apparent predecessor of target by searching * forward for it, starting at this node, patching up pointers * while traversing. Used by predecessor(). * * @return target's predecessor, or null if not found */ private Node findPredecessorOf(Node target) { Node n = this; for (;;) { Node f = n.successor(); if (f == target) return n; if (f == null) return null; n = f; } } /** * Returns the previous non-deleted node, patching up pointers * as needed. Returns null if this node is header so has no * successor. May also return null if this node is deleted, * so doesn't have a distinct predecessor. * * @return predecessor or null if not found */ Node predecessor() { Node n = this; for (;;) { Node b = n.getPrev(); if (b == null) return n.findPredecessorOf(this); Node s = b.getNext(); if (s == this) return b; if (s == null || !s.isMarker()) { Node p = b.findPredecessorOf(this); if (p != null) return p; } n = b; } } /** * Returns the next node containing a nondeleted user element. * Use for forward list traversal. * * @return successor, or null if no such */ Node forward() { Node f = successor(); return (f == null || f.isSpecial()) ? null : f; } /** * Returns previous node containing a nondeleted user element, if * possible. Use for backward list traversal, but beware that * if this method is called from a deleted node, it might not * be able to determine a usable predecessor. * * @return predecessor, or null if no such could be found */ Node back() { Node f = predecessor(); return (f == null || f.isSpecial()) ? null : f; } /** * Tries to insert a node holding element as successor, failing * if this node is deleted. * * @param element the element * @return the new node, or null on failure */ Node append(E element) { for (;;) { Node f = getNext(); if (f == null || f.isMarker()) return null; Node x = new Node(element, f, this); if (casNext(f, x)) { f.setPrev(x); // optimistically link return x; } } } /** * Tries to insert a node holding element as predecessor, failing * if no live predecessor can be found to link to. * * @param element the element * @return the new node, or null on failure */ Node prepend(E element) { for (;;) { Node b = predecessor(); if (b == null) return null; Node x = new Node(element, this, b); if (b.casNext(this, x)) { setPrev(x); // optimistically link return x; } } } /** * Tries to mark this node as deleted, failing if already * deleted or if this node is header or trailer. * * @return true if successful */ boolean delete() { Node b = getPrev(); Node f = getNext(); if (b != null && f != null && !f.isMarker() && casNext(f, new Node(f))) { if (b.casNext(this, f)) f.setPrev(b); return true; } return false; } /** * Tries to insert a node holding element to replace this node. * failing if already deleted. A currently unused proof of * concept that demonstrates atomic node content replacement. * * Although this implementation ensures that exactly one * version of this Node is alive at a given time, it fails to * maintain atomicity in the sense that iterators may * encounter both the old and new versions of the element. * * @param newElement the new element * @return the new node, or null on failure */ Node replace(E newElement) { for (;;) { Node b = getPrev(); Node f = getNext(); if (b == null || f == null || f.isMarker()) return null; Node x = new Node(newElement, f, b); if (casNext(f, new Node(x))) { b.successor(); // to relink b x.successor(); // to relink f return x; } } } } // Minor convenience utilities /** * Returns true if given reference is non-null and isn't a header, * trailer, or marker. * * @param n (possibly null) node * @return true if n exists as a user node */ private static boolean usable(Node n) { return n != null && !n.isSpecial(); } /** * Throws NullPointerException if argument is null. * * @param v the element */ private static void checkNotNull(Object v) { if (v == null) throw new NullPointerException(); } /** * Returns element unless it is null, in which case throws * NoSuchElementException. * * @param v the element * @return the element */ private E screenNullResult(E v) { if (v == null) throw new NoSuchElementException(); return v; } /** * Creates an array list and fills it with elements of this list. * Used by toArray. * * @return the arrayList */ private ArrayList toArrayList() { ArrayList c = new ArrayList(); for (Node n = header.forward(); n != null; n = n.forward()) c.add(n.element); return c; } // Fields and constructors private static final long serialVersionUID = 876323262645176354L; /** * List header. First usable node is at header.forward(). */ private final Node header; /** * List trailer. Last usable node is at trailer.back(). */ private final Node trailer; /** * Constructs an empty deque. */ public ConcurrentLinkedDeque() { Node h = new Node(null, null, null); Node t = new Node(null, null, h); h.setNext(t); header = h; trailer = t; } /** * Constructs a deque initially containing the elements of * the given collection, added in traversal order of the * collection's iterator. * * @param c the collection of elements to initially contain * @throws NullPointerException if the specified collection or any * of its elements are null */ public ConcurrentLinkedDeque(Collection c) { this(); addAll(c); } /** * Inserts the specified element at the front of this deque. * * @throws NullPointerException {@inheritDoc} */ public void addFirst(E e) { checkNotNull(e); while (header.append(e) == null) ; } /** * Inserts the specified element at the end of this deque. * This is identical in function to the {@code add} method. * * @throws NullPointerException {@inheritDoc} */ public void addLast(E e) { checkNotNull(e); while (trailer.prepend(e) == null) ; } /** * Inserts the specified element at the front of this deque. * * @return {@code true} always * @throws NullPointerException {@inheritDoc} */ public boolean offerFirst(E e) { addFirst(e); return true; } /** * Inserts the specified element at the end of this deque. * *

This method is equivalent to {@link #add}. * * @return {@code true} always * @throws NullPointerException {@inheritDoc} */ public boolean offerLast(E e) { addLast(e); return true; } public E peekFirst() { Node n = header.successor(); return (n == null) ? null : n.element; } public E peekLast() { Node n = trailer.predecessor(); return (n == null) ? null : n.element; } /** * @throws NoSuchElementException {@inheritDoc} */ public E getFirst() { return screenNullResult(peekFirst()); } /** * @throws NoSuchElementException {@inheritDoc} */ public E getLast() { return screenNullResult(peekLast()); } public E pollFirst() { for (;;) { Node n = header.successor(); if (!usable(n)) return null; if (n.delete()) return n.element; } } public E pollLast() { for (;;) { Node n = trailer.predecessor(); if (!usable(n)) return null; if (n.delete()) return n.element; } } /** * @throws NoSuchElementException {@inheritDoc} */ public E removeFirst() { return screenNullResult(pollFirst()); } /** * @throws NoSuchElementException {@inheritDoc} */ public E removeLast() { return screenNullResult(pollLast()); } // *** Queue and stack methods *** /** * Inserts the specified element at the tail of this queue. * * @return {@code true} (as specified by {@link Queue#offer}) * @throws NullPointerException if the specified element is null */ public boolean offer(E e) { return offerLast(e); } /** * Inserts the specified element at the tail of this deque. * * @return {@code true} (as specified by {@link Collection#add}) * @throws NullPointerException if the specified element is null */ public boolean add(E e) { return offerLast(e); } public E poll() { return pollFirst(); } public E remove() { return removeFirst(); } public E peek() { return peekFirst(); } public E element() { return getFirst(); } public void push(E e) { addFirst(e); } public E pop() { return removeFirst(); } /** * Removes the first element {@code e} such that * {@code o.equals(e)}, if such an element exists in this deque. * If the deque does not contain the element, it is unchanged. * * @param o element to be removed from this deque, if present * @return {@code true} if the deque contained the specified element * @throws NullPointerException if the specified element is {@code null} */ public boolean removeFirstOccurrence(Object o) { checkNotNull(o); for (;;) { Node n = header.forward(); for (;;) { if (n == null) return false; if (o.equals(n.element)) { if (n.delete()) return true; else break; // restart if interference } n = n.forward(); } } } /** * Removes the last element {@code e} such that * {@code o.equals(e)}, if such an element exists in this deque. * If the deque does not contain the element, it is unchanged. * * @param o element to be removed from this deque, if present * @return {@code true} if the deque contained the specified element * @throws NullPointerException if the specified element is {@code null} */ public boolean removeLastOccurrence(Object o) { checkNotNull(o); for (;;) { Node s = trailer; for (;;) { Node n = s.back(); if (s.isDeleted() || (n != null && n.successor() != s)) break; // restart if pred link is suspect. if (n == null) return false; if (o.equals(n.element)) { if (n.delete()) return true; else break; // restart if interference } s = n; } } } /** * Returns {@code true} if this deque contains at least one * element {@code e} such that {@code o.equals(e)}. * * @param o element whose presence in this deque is to be tested * @return {@code true} if this deque contains the specified element */ public boolean contains(Object o) { if (o == null) return false; for (Node n = header.forward(); n != null; n = n.forward()) if (o.equals(n.element)) return true; return false; } /** * Returns {@code true} if this collection contains no elements. * * @return {@code true} if this collection contains no elements */ public boolean isEmpty() { return !usable(header.successor()); } /** * Returns the number of elements in this deque. If this deque * contains more than {@code Integer.MAX_VALUE} elements, it * returns {@code Integer.MAX_VALUE}. * *

Beware that, unlike in most collections, this method is * NOT a constant-time operation. Because of the * asynchronous nature of these deques, determining the current * number of elements requires traversing them all to count them. * Additionally, it is possible for the size to change during * execution of this method, in which case the returned result * will be inaccurate. Thus, this method is typically not very * useful in concurrent applications. * * @return the number of elements in this deque */ public int size() { long count = 0; for (Node n = header.forward(); n != null; n = n.forward()) ++count; return (count >= Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) count; } /** * Removes the first element {@code e} such that * {@code o.equals(e)}, if such an element exists in this deque. * If the deque does not contain the element, it is unchanged. * * @param o element to be removed from this deque, if present * @return {@code true} if the deque contained the specified element * @throws NullPointerException if the specified element is {@code null} */ public boolean remove(Object o) { return removeFirstOccurrence(o); } /** * Appends all of the elements in the specified collection to the end of * this deque, in the order that they are returned by the specified * collection's iterator. The behavior of this operation is undefined if * the specified collection is modified while the operation is in * progress. (This implies that the behavior of this call is undefined if * the specified Collection is this deque, and this deque is nonempty.) * * @param c the elements to be inserted into this deque * @return {@code true} if this deque changed as a result of the call * @throws NullPointerException if {@code c} or any element within it * is {@code null} */ public boolean addAll(Collection c) { Iterator it = c.iterator(); if (!it.hasNext()) return false; do { addLast(it.next()); } while (it.hasNext()); return true; } /** * Removes all of the elements from this deque. */ public void clear() { while (pollFirst() != null) ; } /** * Returns an array containing all of the elements in this deque, in * proper sequence (from first to last element). * *

The returned array will be "safe" in that no references to it are * maintained by this deque. (In other words, this method must allocate * a new array). The caller is thus free to modify the returned array. * *

This method acts as bridge between array-based and collection-based * APIs. * * @return an array containing all of the elements in this deque */ public Object[] toArray() { return toArrayList().toArray(); } /** * Returns an array containing all of the elements in this deque, * in proper sequence (from first to last element); the runtime * type of the returned array is that of the specified array. If * the deque fits in the specified array, it is returned therein. * Otherwise, a new array is allocated with the runtime type of * the specified array and the size of this deque. * *

If this deque fits in the specified array with room to spare * (i.e., the array has more elements than this deque), the element in * the array immediately following the end of the deque is set to * {@code null}. * *

Like the {@link #toArray()} method, this method acts as bridge between * array-based and collection-based APIs. Further, this method allows * precise control over the runtime type of the output array, and may, * under certain circumstances, be used to save allocation costs. * *

Suppose {@code x} is a deque known to contain only strings. * The following code can be used to dump the deque into a newly * allocated array of {@code String}: * *

     *     String[] y = x.toArray(new String[0]);
* * Note that {@code toArray(new Object[0])} is identical in function to * {@code toArray()}. * * @param a the array into which the elements of the deque are to * be stored, if it is big enough; otherwise, a new array of the * same runtime type is allocated for this purpose * @return an array containing all of the elements in this deque * @throws ArrayStoreException if the runtime type of the specified array * is not a supertype of the runtime type of every element in * this deque * @throws NullPointerException if the specified array is null */ public T[] toArray(T[] a) { return toArrayList().toArray(a); } /** * Returns an iterator over the elements in this deque in proper sequence. * The elements will be returned in order from first (head) to last (tail). * The returned {@code Iterator} is a "weakly consistent" iterator that * will never throw {@link java.util.ConcurrentModificationException * ConcurrentModificationException}, * and guarantees to traverse elements as they existed upon * construction of the iterator, and may (but is not guaranteed to) * reflect any modifications subsequent to construction. * * @return an iterator over the elements in this deque in proper sequence */ public Iterator iterator() { return new CLDIterator(); } final class CLDIterator implements Iterator { Node last; Node next = header.forward(); public boolean hasNext() { return next != null; } public E next() { Node l = last = next; if (l == null) throw new NoSuchElementException(); next = next.forward(); return l.element; } public void remove() { Node l = last; if (l == null) throw new IllegalStateException(); while (!l.delete() && !l.isDeleted()) ; } } /** * Not yet implemented. */ public Iterator descendingIterator() { throw new UnsupportedOperationException(); } } jsr166/src/jsr166x/ConcurrentSkipListMap.java0000644000000000000000000037140411556021346016133 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166x; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; /** * A scalable {@link ConcurrentNavigableMap} implementation. This * class maintains a map in ascending key order, sorted according to * the natural order for the key's class (see {@link * Comparable}), or by the {@link Comparator} provided at creation * time, depending on which constructor is used. * *

This class implements a concurrent variant of SkipLists providing * expected average log(n) time cost for the * containsKey, get, put and * remove operations and their variants. Insertion, removal, * update, and access operations safely execute concurrently by * multiple threads. Iterators are weakly consistent, returning * elements reflecting the state of the map at some point at or since * the creation of the iterator. They do not throw {@link * ConcurrentModificationException}, and may proceed concurrently with * other operations. Ascending key ordered views and their iterators * are faster than descending ones. * *

All Map.Entry pairs returned by methods in this class * and its views represent snapshots of mappings at the time they were * produced. They do not support the Entry.setValue * method. (Note however that it is possible to change mappings in the * associated map using put, putIfAbsent, or * replace, depending on exactly which effect you need.) * *

Beware that, unlike in most collections, the size * method is not a constant-time operation. Because of the * asynchronous nature of these maps, determining the current number * of elements requires a traversal of the elements. Additionally, * the bulk operations putAll, equals, and * clear are not guaranteed to be performed * atomically. For example, an iterator operating concurrently with a * putAll operation might view only some of the added * elements. * *

This class and its views and iterators implement all of the * optional methods of the {@link Map} and {@link Iterator} * interfaces. Like most other concurrent collections, this class does * not permit the use of null keys or values because some * null return values cannot be reliably distinguished from the * absence of elements. * * @author Doug Lea * @param the type of keys maintained by this map * @param the type of mapped values */ public class ConcurrentSkipListMap extends AbstractMap implements ConcurrentNavigableMap, Cloneable, java.io.Serializable { /* * This class implements a tree-like two-dimensionally linked skip * list in which the index levels are represented in separate * nodes from the base nodes holding data. There are two reasons * for taking this approach instead of the usual array-based * structure: 1) Array based implementations seem to encounter * more complexity and overhead 2) We can use cheaper algorithms * for the heavily-traversed index lists than can be used for the * base lists. Here's a picture of some of the basics for a * possible list with 2 levels of index: * * Head nodes Index nodes * +-+ right +-+ +-+ * |2|---------------->| |--------------------->| |->null * +-+ +-+ +-+ * | down | | * v v v * +-+ +-+ +-+ +-+ +-+ +-+ * |1|----------->| |->| |------>| |----------->| |------>| |->null * +-+ +-+ +-+ +-+ +-+ +-+ * v | | | | | * Nodes next v v v v v * +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ * | |->|A|->|B|->|C|->|D|->|E|->|F|->|G|->|H|->|I|->|J|->|K|->null * +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ * * The base lists use a variant of the HM linked ordered set * algorithm. See Tim Harris, "A pragmatic implementation of * non-blocking linked lists" * http://www.cl.cam.ac.uk/~tlh20/publications.html and Maged * Michael "High Performance Dynamic Lock-Free Hash Tables and * List-Based Sets" * http://www.research.ibm.com/people/m/michael/pubs.htm. The * basic idea in these lists is to mark the "next" pointers of * deleted nodes when deleting to avoid conflicts with concurrent * insertions, and when traversing to keep track of triples * (predecessor, node, successor) in order to detect when and how * to unlink these deleted nodes. * * Rather than using mark-bits to mark list deletions (which can * be slow and space-intensive using AtomicMarkedReference), nodes * use direct CAS'able next pointers. On deletion, instead of * marking a pointer, they splice in another node that can be * thought of as standing for a marked pointer (indicating this by * using otherwise impossible field values). Using plain nodes * acts roughly like "boxed" implementations of marked pointers, * but uses new nodes only when nodes are deleted, not for every * link. This requires less space and supports faster * traversal. Even if marked references were better supported by * JVMs, traversal using this technique might still be faster * because any search need only read ahead one more node than * otherwise required (to check for trailing marker) rather than * unmasking mark bits or whatever on each read. * * This approach maintains the essential property needed in the HM * algorithm of changing the next-pointer of a deleted node so * that any other CAS of it will fail, but implements the idea by * changing the pointer to point to a different node, not by * marking it. While it would be possible to further squeeze * space by defining marker nodes not to have key/value fields, it * isn't worth the extra type-testing overhead. The deletion * markers are rarely encountered during traversal and are * normally quickly garbage collected. (Note that this technique * would not work well in systems without garbage collection.) * * In addition to using deletion markers, the lists also use * nullness of value fields to indicate deletion, in a style * similar to typical lazy-deletion schemes. If a node's value is * null, then it is considered logically deleted and ignored even * though it is still reachable. This maintains proper control of * concurrent replace vs delete operations -- an attempted replace * must fail if a delete beat it by nulling field, and a delete * must return the last non-null value held in the field. (Note: * Null, rather than some special marker, is used for value fields * here because it just so happens to mesh with the Map API * requirement that method get returns null if there is no * mapping, which allows nodes to remain concurrently readable * even when deleted. Using any other marker value here would be * messy at best.) * * Here's the sequence of events for a deletion of node n with * predecessor b and successor f, initially: * * +------+ +------+ +------+ * ... | b |------>| n |----->| f | ... * +------+ +------+ +------+ * * 1. CAS n's value field from non-null to null. * From this point on, no public operations encountering * the node consider this mapping to exist. However, other * ongoing insertions and deletions might still modify * n's next pointer. * * 2. CAS n's next pointer to point to a new marker node. * From this point on, no other nodes can be appended to n. * which avoids deletion errors in CAS-based linked lists. * * +------+ +------+ +------+ +------+ * ... | b |------>| n |----->|marker|------>| f | ... * +------+ +------+ +------+ +------+ * * 3. CAS b's next pointer over both n and its marker. * From this point on, no new traversals will encounter n, * and it can eventually be GCed. * +------+ +------+ * ... | b |----------------------------------->| f | ... * +------+ +------+ * * A failure at step 1 leads to simple retry due to a lost race * with another operation. Steps 2-3 can fail because some other * thread noticed during a traversal a node with null value and * helped out by marking and/or unlinking. This helping-out * ensures that no thread can become stuck waiting for progress of * the deleting thread. The use of marker nodes slightly * complicates helping-out code because traversals must track * consistent reads of up to four nodes (b, n, marker, f), not * just (b, n, f), although the next field of a marker is * immutable, and once a next field is CAS'ed to point to a * marker, it never again changes, so this requires less care. * * Skip lists add indexing to this scheme, so that the base-level * traversals start close to the locations being found, inserted * or deleted -- usually base level traversals only traverse a few * nodes. This doesn't change the basic algorithm except for the * need to make sure base traversals start at predecessors (here, * b) that are not (structurally) deleted, otherwise retrying * after processing the deletion. * * Index levels are maintained as lists with volatile next fields, * using CAS to link and unlink. Races are allowed in index-list * operations that can (rarely) fail to link in a new index node * or delete one. (We can't do this of course for data nodes.) * However, even when this happens, the index lists remain sorted, * so correctly serve as indices. This can impact performance, * but since skip lists are probabilistic anyway, the net result * is that under contention, the effective "p" value may be lower * than its nominal value. And race windows are kept small enough * that in practice these failures are rare, even under a lot of * contention. * * The fact that retries (for both base and index lists) are * relatively cheap due to indexing allows some minor * simplifications of retry logic. Traversal restarts are * performed after most "helping-out" CASes. This isn't always * strictly necessary, but the implicit backoffs tend to help * reduce other downstream failed CAS's enough to outweigh restart * cost. This worsens the worst case, but seems to improve even * highly contended cases. * * Unlike most skip-list implementations, index insertion and * deletion here require a separate traversal pass occuring after * the base-level action, to add or remove index nodes. This adds * to single-threaded overhead, but improves contended * multithreaded performance by narrowing interference windows, * and allows deletion to ensure that all index nodes will be made * unreachable upon return from a public remove operation, thus * avoiding unwanted garbage retention. This is more important * here than in some other data structures because we cannot null * out node fields referencing user keys since they might still be * read by other ongoing traversals. * * Indexing uses skip list parameters that maintain good search * performance while using sparser-than-usual indices: The * hardwired parameters k=1, p=0.5 (see method randomLevel) mean * that about one-quarter of the nodes have indices. Of those that * do, half have one level, a quarter have two, and so on (see * Pugh's Skip List Cookbook, sec 3.4). The expected total space * requirement for a map is slightly less than for the current * implementation of java.util.TreeMap. * * Changing the level of the index (i.e, the height of the * tree-like structure) also uses CAS. The head index has initial * level/height of one. Creation of an index with height greater * than the current level adds a level to the head index by * CAS'ing on a new top-most head. To maintain good performance * after a lot of removals, deletion methods heuristically try to * reduce the height if the topmost levels appear to be empty. * This may encounter races in which it possible (but rare) to * reduce and "lose" a level just as it is about to contain an * index (that will then never be encountered). This does no * structural harm, and in practice appears to be a better option * than allowing unrestrained growth of levels. * * The code for all this is more verbose than you'd like. Most * operations entail locating an element (or position to insert an * element). The code to do this can't be nicely factored out * because subsequent uses require a snapshot of predecessor * and/or successor and/or value fields which can't be returned * all at once, at least not without creating yet another object * to hold them -- creating such little objects is an especially * bad idea for basic internal search operations because it adds * to GC overhead. (This is one of the few times I've wished Java * had macros.) Instead, some traversal code is interleaved within * insertion and removal operations. The control logic to handle * all the retry conditions is sometimes twisty. Most search is * broken into 2 parts. findPredecessor() searches index nodes * only, returning a base-level predecessor of the key. findNode() * finishes out the base-level search. Even with this factoring, * there is a fair amount of near-duplication of code to handle * variants. * * For explanation of algorithms sharing at least a couple of * features with this one, see Mikhail Fomitchev's thesis * (http://www.cs.yorku.ca/~mikhail/), Keir Fraser's thesis * (http://www.cl.cam.ac.uk/users/kaf24/), and Hakan Sundell's * thesis (http://www.cs.chalmers.se/~phs/). * * Given the use of tree-like index nodes, you might wonder why * this doesn't use some kind of search tree instead, which would * support somewhat faster search operations. The reason is that * there are no known efficient lock-free insertion and deletion * algorithms for search trees. The immutability of the "down" * links of index nodes (as opposed to mutable "left" fields in * true trees) makes this tractable using only CAS operations. * * Notation guide for local variables * Node: b, n, f for predecessor, node, successor * Index: q, r, d for index node, right, down. * t for another index node * Head: h * Levels: j * Keys: k, key * Values: v, value * Comparisons: c */ private static final long serialVersionUID = -8627078645895051609L; /** * Special value used to identify base-level header */ private static final Object BASE_HEADER = new Object(); /** * The topmost head index of the skiplist. */ private transient volatile HeadIndex head; /** * The Comparator used to maintain order in this Map, or null * if using natural order. * @serial */ private final Comparator comparator; /** * Seed for simple random number generator. Not volatile since it * doesn't matter too much if different threads don't see updates. */ private transient int randomSeed; /** Lazily initialized key set */ private transient KeySet keySet; /** Lazily initialized entry set */ private transient EntrySet entrySet; /** Lazily initialized values collection */ private transient Values values; /** Lazily initialized descending key set */ private transient DescendingKeySet descendingKeySet; /** Lazily initialized descending entry set */ private transient DescendingEntrySet descendingEntrySet; /** * Initialize or reset state. Needed by constructors, clone, * clear, readObject. and ConcurrentSkipListSet.clone. * (Note that comparator must be separately initialized.) */ final void initialize() { keySet = null; entrySet = null; values = null; descendingEntrySet = null; descendingKeySet = null; randomSeed = (int) System.nanoTime(); head = new HeadIndex(new Node(null, BASE_HEADER, null), null, null, 1); } /** Updater for casHead */ private static final AtomicReferenceFieldUpdater headUpdater = AtomicReferenceFieldUpdater.newUpdater (ConcurrentSkipListMap.class, HeadIndex.class, "head"); /** * compareAndSet head node */ private boolean casHead(HeadIndex cmp, HeadIndex val) { return headUpdater.compareAndSet(this, cmp, val); } /* ---------------- Nodes -------------- */ /** * Nodes hold keys and values, and are singly linked in sorted * order, possibly with some intervening marker nodes. The list is * headed by a dummy node accessible as head.node. The value field * is declared only as Object because it takes special non-V * values for marker and header nodes. */ static final class Node { final K key; volatile Object value; volatile Node next; /** * Creates a new regular node. */ Node(K key, Object value, Node next) { this.key = key; this.value = value; this.next = next; } /** * Creates a new marker node. A marker is distinguished by * having its value field point to itself. Marker nodes also * have null keys, a fact that is exploited in a few places, * but this doesn't distinguish markers from the base-level * header node (head.node), which also has a null key. */ Node(Node next) { this.key = null; this.value = this; this.next = next; } /** Updater for casNext */ static final AtomicReferenceFieldUpdater nextUpdater = AtomicReferenceFieldUpdater.newUpdater (Node.class, Node.class, "next"); /** Updater for casValue */ static final AtomicReferenceFieldUpdater valueUpdater = AtomicReferenceFieldUpdater.newUpdater (Node.class, Object.class, "value"); /** * compareAndSet value field */ boolean casValue(Object cmp, Object val) { return valueUpdater.compareAndSet(this, cmp, val); } /** * compareAndSet next field */ boolean casNext(Node cmp, Node val) { return nextUpdater.compareAndSet(this, cmp, val); } /** * Return true if this node is a marker. This method isn't * actually called in an any current code checking for markers * because callers will have already read value field and need * to use that read (not another done here) and so directly * test if value points to node. * @param n a possibly null reference to a node * @return true if this node is a marker node */ boolean isMarker() { return value == this; } /** * Return true if this node is the header of base-level list. * @return true if this node is header node */ boolean isBaseHeader() { return value == BASE_HEADER; } /** * Tries to append a deletion marker to this node. * @param f the assumed current successor of this node * @return true if successful */ boolean appendMarker(Node f) { return casNext(f, new Node(f)); } /** * Helps out a deletion by appending marker or unlinking from * predecessor. This is called during traversals when value * field seen to be null. * @param b predecessor * @param f successor */ void helpDelete(Node b, Node f) { /* * Rechecking links and then doing only one of the * help-out stages per call tends to minimize CAS * interference among helping threads. */ if (f == next && this == b.next) { if (f == null || f.value != f) // not already marked appendMarker(f); else b.casNext(this, f.next); } } /** * Return value if this node contains a valid key-value pair, * else null. * @return this node's value if it isn't a marker or header or * is deleted, else null. */ V getValidValue() { Object v = value; if (v == this || v == BASE_HEADER) return null; return (V)v; } /** * Create and return a new SnapshotEntry holding current * mapping if this node holds a valid value, else null * @return new entry or null */ SnapshotEntry createSnapshot() { V v = getValidValue(); if (v == null) return null; return new SnapshotEntry(key, v); } } /* ---------------- Indexing -------------- */ /** * Index nodes represent the levels of the skip list. To improve * search performance, keys of the underlying nodes are cached. * Note that even though both Nodes and Indexes have * forward-pointing fields, they have different types and are * handled in different ways, that can't nicely be captured by * placing field in a shared abstract class. */ static class Index { final K key; final Node node; final Index down; volatile Index right; /** * Creates index node with given values */ Index(Node node, Index down, Index right) { this.node = node; this.key = node.key; this.down = down; this.right = right; } /** Updater for casRight */ static final AtomicReferenceFieldUpdater rightUpdater = AtomicReferenceFieldUpdater.newUpdater (Index.class, Index.class, "right"); /** * compareAndSet right field */ final boolean casRight(Index cmp, Index val) { return rightUpdater.compareAndSet(this, cmp, val); } /** * Returns true if the node this indexes has been deleted. * @return true if indexed node is known to be deleted */ final boolean indexesDeletedNode() { return node.value == null; } /** * Tries to CAS newSucc as successor. To minimize races with * unlink that may lose this index node, if the node being * indexed is known to be deleted, it doesn't try to link in. * @param succ the expected current successor * @param newSucc the new successor * @return true if successful */ final boolean link(Index succ, Index newSucc) { Node n = node; newSucc.right = succ; return n.value != null && casRight(succ, newSucc); } /** * Tries to CAS right field to skip over apparent successor * succ. Fails (forcing a retraversal by caller) if this node * is known to be deleted. * @param succ the expected current successor * @return true if successful */ final boolean unlink(Index succ) { return !indexesDeletedNode() && casRight(succ, succ.right); } } /* ---------------- Head nodes -------------- */ /** * Nodes heading each level keep track of their level. */ static final class HeadIndex extends Index { final int level; HeadIndex(Node node, Index down, Index right, int level) { super(node, down, right); this.level = level; } } /* ---------------- Map.Entry support -------------- */ /** * An immutable representation of a key-value mapping as it * existed at some point in time. This class does not * support the Map.Entry.setValue method. */ static class SnapshotEntry implements Map.Entry { private final K key; private final V value; /** * Creates a new entry representing the given key and value. * @param key the key * @param value the value */ SnapshotEntry(K key, V value) { this.key = key; this.value = value; } /** * Returns the key corresponding to this entry. * * @return the key corresponding to this entry. */ public K getKey() { return key; } /** * Returns the value corresponding to this entry. * * @return the value corresponding to this entry. */ public V getValue() { return value; } /** * Always fails, throwing UnsupportedOperationException. * @throws UnsupportedOperationException always. */ public V setValue(V value) { throw new UnsupportedOperationException(); } // inherit javadoc public boolean equals(Object o) { if (!(o instanceof Map.Entry)) return false; Map.Entry e = (Map.Entry)o; // As mandated by Map.Entry spec: return ((key==null ? e.getKey()==null : key.equals(e.getKey())) && (value==null ? e.getValue()==null : value.equals(e.getValue()))); } // inherit javadoc public int hashCode() { // As mandated by Map.Entry spec: return ((key==null ? 0 : key.hashCode()) ^ (value==null ? 0 : value.hashCode())); } /** * Returns a String consisting of the key followed by an * equals sign ("=") followed by the associated * value. * @return a String representation of this entry. */ public String toString() { return getKey() + "=" + getValue(); } } /* ---------------- Comparison utilities -------------- */ /** * Represents a key with a comparator as a Comparable. * * Because most sorted collections seem to use natural order on * Comparables (Strings, Integers, etc), most internal methods are * geared to use them. This is generally faster than checking * per-comparison whether to use comparator or comparable because * it doesn't require a (Comparable) cast for each comparison. * (Optimizers can only sometimes remove such redundant checks * themselves.) When Comparators are used, * ComparableUsingComparators are created so that they act in the * same way as natural orderings. This penalizes use of * Comparators vs Comparables, which seems like the right * tradeoff. */ static final class ComparableUsingComparator implements Comparable { final K actualKey; final Comparator cmp; ComparableUsingComparator(K key, Comparator cmp) { this.actualKey = key; this.cmp = cmp; } public int compareTo(K k2) { return cmp.compare(actualKey, k2); } } /** * If using comparator, return a ComparableUsingComparator, else * cast key as Comparator, which may cause ClassCastException, * which is propagated back to caller. */ private Comparable comparable(Object key) throws ClassCastException { if (key == null) throw new NullPointerException(); return (comparator != null) ? new ComparableUsingComparator(key, comparator) : (Comparable)key; } /** * Compare using comparator or natural ordering. Used when the * ComparableUsingComparator approach doesn't apply. */ int compare(K k1, K k2) throws ClassCastException { Comparator cmp = comparator; if (cmp != null) return cmp.compare(k1, k2); else return ((Comparable)k1).compareTo(k2); } /** * Return true if given key greater than or equal to least and * strictly less than fence, bypassing either test if least or * fence oare null. Needed mainly in submap operations. */ boolean inHalfOpenRange(K key, K least, K fence) { if (key == null) throw new NullPointerException(); return ((least == null || compare(key, least) >= 0) && (fence == null || compare(key, fence) < 0)); } /** * Return true if given key greater than or equal to least and less * or equal to fence. Needed mainly in submap operations. */ boolean inOpenRange(K key, K least, K fence) { if (key == null) throw new NullPointerException(); return ((least == null || compare(key, least) >= 0) && (fence == null || compare(key, fence) <= 0)); } /* ---------------- Traversal -------------- */ /** * Return a base-level node with key strictly less than given key, * or the base-level header if there is no such node. Also * unlinks indexes to deleted nodes found along the way. Callers * rely on this side-effect of clearing indices to deleted nodes. * @param key the key * @return a predecessor of key */ private Node findPredecessor(Comparable key) { for (;;) { Index q = head; for (;;) { Index d, r; if ((r = q.right) != null) { if (r.indexesDeletedNode()) { if (q.unlink(r)) continue; // reread r else break; // restart } if (key.compareTo(r.key) > 0) { q = r; continue; } } if ((d = q.down) != null) q = d; else return q.node; } } } /** * Return node holding key or null if no such, clearing out any * deleted nodes seen along the way. Repeatedly traverses at * base-level looking for key starting at predecessor returned * from findPredecessor, processing base-level deletions as * encountered. Some callers rely on this side-effect of clearing * deleted nodes. * * Restarts occur, at traversal step centered on node n, if: * * (1) After reading n's next field, n is no longer assumed * predecessor b's current successor, which means that * we don't have a consistent 3-node snapshot and so cannot * unlink any subsequent deleted nodes encountered. * * (2) n's value field is null, indicating n is deleted, in * which case we help out an ongoing structural deletion * before retrying. Even though there are cases where such * unlinking doesn't require restart, they aren't sorted out * here because doing so would not usually outweigh cost of * restarting. * * (3) n is a marker or n's predecessor's value field is null, * indicating (among other possibilities) that * findPredecessor returned a deleted node. We can't unlink * the node because we don't know its predecessor, so rely * on another call to findPredecessor to notice and return * some earlier predecessor, which it will do. This check is * only strictly needed at beginning of loop, (and the * b.value check isn't strictly needed at all) but is done * each iteration to help avoid contention with other * threads by callers that will fail to be able to change * links, and so will retry anyway. * * The traversal loops in doPut, doRemove, and findNear all * include the same three kinds of checks. And specialized * versions appear in doRemoveFirst, doRemoveLast, findFirst, and * findLast. They can't easily share code because each uses the * reads of fields held in locals occurring in the orders they * were performed. * * @param key the key * @return node holding key, or null if no such. */ private Node findNode(Comparable key) { for (;;) { Node b = findPredecessor(key); Node n = b.next; for (;;) { if (n == null) return null; Node f = n.next; if (n != b.next) // inconsistent read break; Object v = n.value; if (v == null) { // n is deleted n.helpDelete(b, f); break; } if (v == n || b.value == null) // b is deleted break; int c = key.compareTo(n.key); if (c < 0) return null; if (c == 0) return n; b = n; n = f; } } } /** * Specialized variant of findNode to perform Map.get. Does a weak * traversal, not bothering to fix any deleted index nodes, * returning early if it happens to see key in index, and passing * over any deleted base nodes, falling back to getUsingFindNode * only if it would otherwise return value from an ongoing * deletion. Also uses "bound" to eliminate need for some * comparisons (see Pugh Cookbook). Also folds uses of null checks * and node-skipping because markers have null keys. * @param okey the key * @return the value, or null if absent */ private V doGet(Object okey) { Comparable key = comparable(okey); K bound = null; Index q = head; for (;;) { K rk; Index d, r; if ((r = q.right) != null && (rk = r.key) != null && rk != bound) { int c = key.compareTo(rk); if (c > 0) { q = r; continue; } if (c == 0) { Object v = r.node.value; return (v != null) ? (V)v : getUsingFindNode(key); } bound = rk; } if ((d = q.down) != null) q = d; else { for (Node n = q.node.next; n != null; n = n.next) { K nk = n.key; if (nk != null) { int c = key.compareTo(nk); if (c == 0) { Object v = n.value; return (v != null) ? (V)v : getUsingFindNode(key); } if (c < 0) return null; } } return null; } } } /** * Perform map.get via findNode. Used as a backup if doGet * encounters an in-progress deletion. * @param key the key * @return the value, or null if absent */ private V getUsingFindNode(Comparable key) { /* * Loop needed here and elsewhere in case value field goes * null just as it is about to be returned, in which case we * lost a race with a deletion, so must retry. */ for (;;) { Node n = findNode(key); if (n == null) return null; Object v = n.value; if (v != null) return (V)v; } } /* ---------------- Insertion -------------- */ /** * Main insertion method. Adds element if not present, or * replaces value if present and onlyIfAbsent is false. * @param kkey the key * @param value the value that must be associated with key * @param onlyIfAbsent if should not insert if already present * @return the old value, or null if newly inserted */ private V doPut(K kkey, V value, boolean onlyIfAbsent) { Comparable key = comparable(kkey); for (;;) { Node b = findPredecessor(key); Node n = b.next; for (;;) { if (n != null) { Node f = n.next; if (n != b.next) // inconsistent read break; Object v = n.value; if (v == null) { // n is deleted n.helpDelete(b, f); break; } if (v == n || b.value == null) // b is deleted break; int c = key.compareTo(n.key); if (c > 0) { b = n; n = f; continue; } if (c == 0) { if (onlyIfAbsent || n.casValue(v, value)) return (V)v; else break; // restart if lost race to replace value } // else c < 0; fall through } Node z = new Node(kkey, value, n); if (!b.casNext(n, z)) break; // restart if lost race to append to b int level = randomLevel(); if (level > 0) insertIndex(z, level); return null; } } } /** * Return a random level for inserting a new node. * Hardwired to k=1, p=0.5, max 31. * * This uses a cheap pseudo-random function that according to * http://home1.gte.net/deleyd/random/random4.html was used in * Turbo Pascal. It seems the fastest usable one here. The low * bits are apparently not very random (the original used only * upper 16 bits) so we traverse from highest bit down (i.e., test * sign), thus hardly ever use lower bits. */ private int randomLevel() { int level = 0; int r = randomSeed; randomSeed = r * 134775813 + 1; if (r < 0) { while ((r <<= 1) > 0) ++level; } return level; } /** * Create and add index nodes for given node. * @param z the node * @param level the level of the index */ private void insertIndex(Node z, int level) { HeadIndex h = head; int max = h.level; if (level <= max) { Index idx = null; for (int i = 1; i <= level; ++i) idx = new Index(z, idx, null); addIndex(idx, h, level); } else { // Add a new level /* * To reduce interference by other threads checking for * empty levels in tryReduceLevel, new levels are added * with initialized right pointers. Which in turn requires * keeping levels in an array to access them while * creating new head index nodes from the opposite * direction. */ level = max + 1; Index[] idxs = (Index[])new Index[level+1]; Index idx = null; for (int i = 1; i <= level; ++i) idxs[i] = idx = new Index(z, idx, null); HeadIndex oldh; int k; for (;;) { oldh = head; int oldLevel = oldh.level; if (level <= oldLevel) { // lost race to add level k = level; break; } HeadIndex newh = oldh; Node oldbase = oldh.node; for (int j = oldLevel+1; j <= level; ++j) newh = new HeadIndex(oldbase, newh, idxs[j], j); if (casHead(oldh, newh)) { k = oldLevel; break; } } addIndex(idxs[k], oldh, k); } } /** * Add given index nodes from given level down to 1. * @param idx the topmost index node being inserted * @param h the value of head to use to insert. This must be * snapshotted by callers to provide correct insertion level * @param indexLevel the level of the index */ private void addIndex(Index idx, HeadIndex h, int indexLevel) { // Track next level to insert in case of retries int insertionLevel = indexLevel; Comparable key = comparable(idx.key); // Similar to findPredecessor, but adding index nodes along // path to key. for (;;) { Index q = h; Index t = idx; int j = h.level; for (;;) { Index r = q.right; if (r != null) { // compare before deletion check avoids needing recheck int c = key.compareTo(r.key); if (r.indexesDeletedNode()) { if (q.unlink(r)) continue; else break; } if (c > 0) { q = r; continue; } } if (j == insertionLevel) { // Don't insert index if node already deleted if (t.indexesDeletedNode()) { findNode(key); // cleans up return; } if (!q.link(r, t)) break; // restart if (--insertionLevel == 0) { // need final deletion check before return if (t.indexesDeletedNode()) findNode(key); return; } } if (j > insertionLevel && j <= indexLevel) t = t.down; q = q.down; --j; } } } /* ---------------- Deletion -------------- */ /** * Main deletion method. Locates node, nulls value, appends a * deletion marker, unlinks predecessor, removes associated index * nodes, and possibly reduces head index level. * * Index nodes are cleared out simply by calling findPredecessor. * which unlinks indexes to deleted nodes found along path to key, * which will include the indexes to this node. This is done * unconditionally. We can't check beforehand whether there are * index nodes because it might be the case that some or all * indexes hadn't been inserted yet for this node during initial * search for it, and we'd like to ensure lack of garbage * retention, so must call to be sure. * * @param okey the key * @param value if non-null, the value that must be * associated with key * @return the node, or null if not found */ private V doRemove(Object okey, Object value) { Comparable key = comparable(okey); for (;;) { Node b = findPredecessor(key); Node n = b.next; for (;;) { if (n == null) return null; Node f = n.next; if (n != b.next) // inconsistent read break; Object v = n.value; if (v == null) { // n is deleted n.helpDelete(b, f); break; } if (v == n || b.value == null) // b is deleted break; int c = key.compareTo(n.key); if (c < 0) return null; if (c > 0) { b = n; n = f; continue; } if (value != null && !value.equals(v)) return null; if (!n.casValue(v, null)) break; if (!n.appendMarker(f) || !b.casNext(n, f)) findNode(key); // Retry via findNode else { findPredecessor(key); // Clean index if (head.right == null) tryReduceLevel(); } return (V)v; } } } /** * Possibly reduce head level if it has no nodes. This method can * (rarely) make mistakes, in which case levels can disappear even * though they are about to contain index nodes. This impacts * performance, not correctness. To minimize mistakes as well as * to reduce hysteresis, the level is reduced by one only if the * topmost three levels look empty. Also, if the removed level * looks non-empty after CAS, we try to change it back quick * before anyone notices our mistake! (This trick works pretty * well because this method will practically never make mistakes * unless current thread stalls immediately before first CAS, in * which case it is very unlikely to stall again immediately * afterwards, so will recover.) * * We put up with all this rather than just let levels grow * because otherwise, even a small map that has undergone a large * number of insertions and removals will have a lot of levels, * slowing down access more than would an occasional unwanted * reduction. */ private void tryReduceLevel() { HeadIndex h = head; HeadIndex d; HeadIndex e; if (h.level > 3 && (d = (HeadIndex)h.down) != null && (e = (HeadIndex)d.down) != null && e.right == null && d.right == null && h.right == null && casHead(h, d) && // try to set h.right != null) // recheck casHead(d, h); // try to backout } /** * Version of remove with boolean return. Needed by view classes */ boolean removep(Object key) { return doRemove(key, null) != null; } /* ---------------- Finding and removing first element -------------- */ /** * Specialized variant of findNode to get first valid node * @return first node or null if empty */ Node findFirst() { for (;;) { Node b = head.node; Node n = b.next; if (n == null) return null; if (n.value != null) return n; n.helpDelete(b, n.next); } } /** * Remove first entry; return either its key or a snapshot. * @param keyOnly if true return key, else return SnapshotEntry * (This is a little ugly, but avoids code duplication.) * @return null if empty, first key if keyOnly true, else key,value entry */ Object doRemoveFirst(boolean keyOnly) { for (;;) { Node b = head.node; Node n = b.next; if (n == null) return null; Node f = n.next; if (n != b.next) continue; Object v = n.value; if (v == null) { n.helpDelete(b, f); continue; } if (!n.casValue(v, null)) continue; if (!n.appendMarker(f) || !b.casNext(n, f)) findFirst(); // retry clearIndexToFirst(); K key = n.key; return keyOnly ? key : new SnapshotEntry(key, (V)v); } } /** * Clear out index nodes associated with deleted first entry. * Needed by doRemoveFirst */ private void clearIndexToFirst() { for (;;) { Index q = head; for (;;) { Index r = q.right; if (r != null && r.indexesDeletedNode() && !q.unlink(r)) break; if ((q = q.down) == null) { if (head.right == null) tryReduceLevel(); return; } } } } /** * Remove first entry; return key or null if empty. */ K pollFirstKey() { return (K)doRemoveFirst(true); } /* ---------------- Finding and removing last element -------------- */ /** * Specialized version of find to get last valid node * @return last node or null if empty */ Node findLast() { /* * findPredecessor can't be used to traverse index level * because this doesn't use comparisons. So traversals of * both levels are folded together. */ Index q = head; for (;;) { Index d, r; if ((r = q.right) != null) { if (r.indexesDeletedNode()) { q.unlink(r); q = head; // restart } else q = r; } else if ((d = q.down) != null) { q = d; } else { Node b = q.node; Node n = b.next; for (;;) { if (n == null) return b.isBaseHeader() ? null : b; Node f = n.next; // inconsistent read if (n != b.next) break; Object v = n.value; if (v == null) { // n is deleted n.helpDelete(b, f); break; } if (v == n || b.value == null) // b is deleted break; b = n; n = f; } q = head; // restart } } } /** * Specialized version of doRemove for last entry. * @param keyOnly if true return key, else return SnapshotEntry * @return null if empty, last key if keyOnly true, else key,value entry */ Object doRemoveLast(boolean keyOnly) { for (;;) { Node b = findPredecessorOfLast(); Node n = b.next; if (n == null) { if (b.isBaseHeader()) // empty return null; else continue; // all b's successors are deleted; retry } for (;;) { Node f = n.next; if (n != b.next) // inconsistent read break; Object v = n.value; if (v == null) { // n is deleted n.helpDelete(b, f); break; } if (v == n || b.value == null) // b is deleted break; if (f != null) { b = n; n = f; continue; } if (!n.casValue(v, null)) break; K key = n.key; Comparable ck = comparable(key); if (!n.appendMarker(f) || !b.casNext(n, f)) findNode(ck); // Retry via findNode else { findPredecessor(ck); // Clean index if (head.right == null) tryReduceLevel(); } return keyOnly ? key : new SnapshotEntry(key, (V)v); } } } /** * Specialized variant of findPredecessor to get predecessor of * last valid node. Needed by doRemoveLast. It is possible that * all successors of returned node will have been deleted upon * return, in which case this method can be retried. * @return likely predecessor of last node. */ private Node findPredecessorOfLast() { for (;;) { Index q = head; for (;;) { Index d, r; if ((r = q.right) != null) { if (r.indexesDeletedNode()) { q.unlink(r); break; // must restart } // proceed as far across as possible without overshooting if (r.node.next != null) { q = r; continue; } } if ((d = q.down) != null) q = d; else return q.node; } } } /** * Remove last entry; return key or null if empty. */ K pollLastKey() { return (K)doRemoveLast(true); } /* ---------------- Relational operations -------------- */ // Control values OR'ed as arguments to findNear private static final int EQ = 1; private static final int LT = 2; private static final int GT = 0; // Actually checked as !LT /** * Utility for ceiling, floor, lower, higher methods. * @param kkey the key * @param rel the relation -- OR'ed combination of EQ, LT, GT * @return nearest node fitting relation, or null if no such */ Node findNear(K kkey, int rel) { Comparable key = comparable(kkey); for (;;) { Node b = findPredecessor(key); Node n = b.next; for (;;) { if (n == null) return ((rel & LT) == 0 || b.isBaseHeader()) ? null : b; Node f = n.next; if (n != b.next) // inconsistent read break; Object v = n.value; if (v == null) { // n is deleted n.helpDelete(b, f); break; } if (v == n || b.value == null) // b is deleted break; int c = key.compareTo(n.key); if ((c == 0 && (rel & EQ) != 0) || (c < 0 && (rel & LT) == 0)) return n; if ( c <= 0 && (rel & LT) != 0) return b.isBaseHeader() ? null : b; b = n; n = f; } } } /** * Return SnapshotEntry for results of findNear. * @param kkey the key * @param rel the relation -- OR'ed combination of EQ, LT, GT * @return Entry fitting relation, or null if no such */ SnapshotEntry getNear(K kkey, int rel) { for (;;) { Node n = findNear(kkey, rel); if (n == null) return null; SnapshotEntry e = n.createSnapshot(); if (e != null) return e; } } /** * Return ceiling, or first node if key is null */ Node findCeiling(K key) { return (key == null) ? findFirst() : findNear(key, GT|EQ); } /** * Return lower node, or last node if key is null */ Node findLower(K key) { return (key == null) ? findLast() : findNear(key, LT); } /** * Return SnapshotEntry or key for results of findNear ofter screening * to ensure result is in given range. Needed by submaps. * @param kkey the key * @param rel the relation -- OR'ed combination of EQ, LT, GT * @param least minimum allowed key value * @param fence key greater than maximum allowed key value * @param keyOnly if true return key, else return SnapshotEntry * @return Key or Entry fitting relation, or null if no such */ Object getNear(K kkey, int rel, K least, K fence, boolean keyOnly) { K key = kkey; // Don't return keys less than least if ((rel & LT) == 0) { if (compare(key, least) < 0) { key = least; rel = rel | EQ; } } for (;;) { Node n = findNear(key, rel); if (n == null || !inHalfOpenRange(n.key, least, fence)) return null; K k = n.key; V v = n.getValidValue(); if (v != null) return keyOnly ? k : new SnapshotEntry(k, v); } } /** * Find and remove least element of subrange. * @param least minimum allowed key value * @param fence key greater than maximum allowed key value * @param keyOnly if true return key, else return SnapshotEntry * @return least Key or Entry, or null if no such */ Object removeFirstEntryOfSubrange(K least, K fence, boolean keyOnly) { for (;;) { Node n = findCeiling(least); if (n == null) return null; K k = n.key; if (fence != null && compare(k, fence) >= 0) return null; V v = doRemove(k, null); if (v != null) return keyOnly ? k : new SnapshotEntry(k, v); } } /** * Find and remove greatest element of subrange. * @param least minimum allowed key value * @param fence key greater than maximum allowed key value * @param keyOnly if true return key, else return SnapshotEntry * @return least Key or Entry, or null if no such */ Object removeLastEntryOfSubrange(K least, K fence, boolean keyOnly) { for (;;) { Node n = findLower(fence); if (n == null) return null; K k = n.key; if (least != null && compare(k, least) < 0) return null; V v = doRemove(k, null); if (v != null) return keyOnly ? k : new SnapshotEntry(k, v); } } /* ---------------- Constructors -------------- */ /** * Constructs a new empty map, sorted according to the keys' natural * order. */ public ConcurrentSkipListMap() { this.comparator = null; initialize(); } /** * Constructs a new empty map, sorted according to the given comparator. * * @param c the comparator that will be used to sort this map. A * null value indicates that the keys' natural * ordering should be used. */ public ConcurrentSkipListMap(Comparator c) { this.comparator = c; initialize(); } /** * Constructs a new map containing the same mappings as the given map, * sorted according to the keys' natural order. * * @param m the map whose mappings are to be placed in this map. * @throws ClassCastException if the keys in m are not Comparable, or * are not mutually comparable. * @throws NullPointerException if the specified map is null. */ public ConcurrentSkipListMap(Map m) { this.comparator = null; initialize(); putAll(m); } /** * Constructs a new map containing the same mappings as the given * SortedMap, sorted according to the same ordering. * @param m the sorted map whose mappings are to be placed in this * map, and whose comparator is to be used to sort this map. * @throws NullPointerException if the specified sorted map is * null. */ public ConcurrentSkipListMap(SortedMap m) { this.comparator = m.comparator(); initialize(); buildFromSorted(m); } /** * Returns a shallow copy of this Map instance. (The keys and * values themselves are not cloned.) * * @return a shallow copy of this Map. */ public Object clone() { ConcurrentSkipListMap clone = null; try { clone = (ConcurrentSkipListMap) super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(); } clone.initialize(); clone.buildFromSorted(this); return clone; } /** * Streamlined bulk insertion to initialize from elements of * given sorted map. Call only from constructor or clone * method. */ private void buildFromSorted(SortedMap map) { if (map == null) throw new NullPointerException(); HeadIndex h = head; Node basepred = h.node; // Track the current rightmost node at each level. Uses an // ArrayList to avoid committing to initial or maximum level. ArrayList> preds = new ArrayList>(); // initialize for (int i = 0; i <= h.level; ++i) preds.add(null); Index q = h; for (int i = h.level; i > 0; --i) { preds.set(i, q); q = q.down; } Iterator> it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry e = it.next(); int j = randomLevel(); if (j > h.level) j = h.level + 1; K k = e.getKey(); V v = e.getValue(); if (k == null || v == null) throw new NullPointerException(); Node z = new Node(k, v, null); basepred.next = z; basepred = z; if (j > 0) { Index idx = null; for (int i = 1; i <= j; ++i) { idx = new Index(z, idx, null); if (i > h.level) h = new HeadIndex(h.node, h, idx, i); if (i < preds.size()) { preds.get(i).right = idx; preds.set(i, idx); } else preds.add(idx); } } } head = h; } /* ---------------- Serialization -------------- */ /** * Save the state of the Map instance to a stream. * * @serialData The key (Object) and value (Object) for each * key-value mapping represented by the Map, followed by * null. The key-value mappings are emitted in key-order * (as determined by the Comparator, or by the keys' natural * ordering if no Comparator). */ private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { // Write out the Comparator and any hidden stuff s.defaultWriteObject(); // Write out keys and values (alternating) for (Node n = findFirst(); n != null; n = n.next) { V v = n.getValidValue(); if (v != null) { s.writeObject(n.key); s.writeObject(v); } } s.writeObject(null); } /** * Reconstitute the Map instance from a stream. */ private void readObject(final java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { // Read in the Comparator and any hidden stuff s.defaultReadObject(); // Reset transients initialize(); /* * This is nearly identical to buildFromSorted, but is * distinct because readObject calls can't be nicely adapted * as the kind of iterator needed by buildFromSorted. (They * can be, but doing so requires type cheats and/or creation * of adaptor classes.) It is simpler to just adapt the code. */ HeadIndex h = head; Node basepred = h.node; ArrayList> preds = new ArrayList>(); for (int i = 0; i <= h.level; ++i) preds.add(null); Index q = h; for (int i = h.level; i > 0; --i) { preds.set(i, q); q = q.down; } for (;;) { Object k = s.readObject(); if (k == null) break; Object v = s.readObject(); if (v == null) throw new NullPointerException(); K key = (K) k; V val = (V) v; int j = randomLevel(); if (j > h.level) j = h.level + 1; Node z = new Node(key, val, null); basepred.next = z; basepred = z; if (j > 0) { Index idx = null; for (int i = 1; i <= j; ++i) { idx = new Index(z, idx, null); if (i > h.level) h = new HeadIndex(h.node, h, idx, i); if (i < preds.size()) { preds.get(i).right = idx; preds.set(i, idx); } else preds.add(idx); } } } head = h; } /* ------ Map API methods ------ */ /** * Returns true if this map contains a mapping for the specified * key. * @param key key whose presence in this map is to be tested. * @return true if this map contains a mapping for the * specified key. * @throws ClassCastException if the key cannot be compared with the keys * currently in the map. * @throws NullPointerException if the key is null. */ public boolean containsKey(Object key) { return doGet(key) != null; } /** * Returns the value to which this map maps the specified key. Returns * null if the map contains no mapping for this key. * * @param key key whose associated value is to be returned. * @return the value to which this map maps the specified key, or * null if the map contains no mapping for the key. * @throws ClassCastException if the key cannot be compared with the keys * currently in the map. * @throws NullPointerException if the key is null. */ public V get(Object key) { return doGet(key); } /** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * * @return previous value associated with specified key, or null * if there was no mapping for key. * @throws ClassCastException if the key cannot be compared with the keys * currently in the map. * @throws NullPointerException if the key or value are null. */ public V put(K key, V value) { if (value == null) throw new NullPointerException(); return doPut(key, value, false); } /** * Removes the mapping for this key from this Map if present. * * @param key key for which mapping should be removed * @return previous value associated with specified key, or null * if there was no mapping for key. * * @throws ClassCastException if the key cannot be compared with the keys * currently in the map. * @throws NullPointerException if the key is null. */ public V remove(Object key) { return doRemove(key, null); } /** * Returns true if this map maps one or more keys to the * specified value. This operation requires time linear in the * Map size. * * @param value value whose presence in this Map is to be tested. * @return true if a mapping to value exists; * false otherwise. * @throws NullPointerException if the value is null. */ public boolean containsValue(Object value) { if (value == null) throw new NullPointerException(); for (Node n = findFirst(); n != null; n = n.next) { V v = n.getValidValue(); if (v != null && value.equals(v)) return true; } return false; } /** * Returns the number of elements in this map. If this map * contains more than Integer.MAX_VALUE elements, it * returns Integer.MAX_VALUE. * *

Beware that, unlike in most collections, this method is * NOT a constant-time operation. Because of the * asynchronous nature of these maps, determining the current * number of elements requires traversing them all to count them. * Additionally, it is possible for the size to change during * execution of this method, in which case the returned result * will be inaccurate. Thus, this method is typically not very * useful in concurrent applications. * * @return the number of elements in this map. */ public int size() { long count = 0; for (Node n = findFirst(); n != null; n = n.next) { if (n.getValidValue() != null) ++count; } return (count >= Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int)count; } /** * Returns true if this map contains no key-value mappings. * @return true if this map contains no key-value mappings. */ public boolean isEmpty() { return findFirst() == null; } /** * Removes all mappings from this map. */ public void clear() { initialize(); } /** * Returns a set view of the keys contained in this map. The set is * backed by the map, so changes to the map are reflected in the set, and * vice-versa. The set supports element removal, which removes the * corresponding mapping from this map, via the Iterator.remove, * Set.remove, removeAll, retainAll, and * clear operations. It does not support the add or * addAll operations. * The view's iterator is a "weakly consistent" iterator that * will never throw {@link java.util.ConcurrentModificationException}, * and guarantees to traverse elements as they existed upon * construction of the iterator, and may (but is not guaranteed to) * reflect any modifications subsequent to construction. * * @return a set view of the keys contained in this map. */ public Set keySet() { /* * Note: Lazy intialization works here and for other views * because view classes are stateless/immutable so it doesn't * matter wrt correctness if more than one is created (which * will only rarely happen). Even so, the following idiom * conservatively ensures that the method returns the one it * created if it does so, not one created by another racing * thread. */ KeySet ks = keySet; return (ks != null) ? ks : (keySet = new KeySet()); } /** * Returns a set view of the keys contained in this map in * descending order. The set is backed by the map, so changes to * the map are reflected in the set, and vice-versa. The set * supports element removal, which removes the corresponding * mapping from this map, via the Iterator.remove, * Set.remove, removeAll, retainAll, * and clear operations. It does not support the * add or addAll operations. The view's * iterator is a "weakly consistent" iterator that will * never throw {@link java.util.ConcurrentModificationException}, * and guarantees to traverse elements as they existed upon * construction of the iterator, and may (but is not guaranteed * to) reflect any modifications subsequent to construction. * * @return a set view of the keys contained in this map. */ public Set descendingKeySet() { /* * Note: Lazy intialization works here and for other views * because view classes are stateless/immutable so it doesn't * matter wrt correctness if more than one is created (which * will only rarely happen). Even so, the following idiom * conservatively ensures that the method returns the one it * created if it does so, not one created by another racing * thread. */ DescendingKeySet ks = descendingKeySet; return (ks != null) ? ks : (descendingKeySet = new DescendingKeySet()); } /** * Returns a collection view of the values contained in this map. * The collection is backed by the map, so changes to the map are * reflected in the collection, and vice-versa. The collection * supports element removal, which removes the corresponding * mapping from this map, via the Iterator.remove, * Collection.remove, removeAll, * retainAll, and clear operations. It does not * support the add or addAll operations. The * view's iterator is a "weakly consistent" iterator that * will never throw {@link * java.util.ConcurrentModificationException}, and guarantees to * traverse elements as they existed upon construction of the * iterator, and may (but is not guaranteed to) reflect any * modifications subsequent to construction. * * @return a collection view of the values contained in this map. */ public Collection values() { Values vs = values; return (vs != null) ? vs : (values = new Values()); } /** * Returns a collection view of the mappings contained in this * map. Each element in the returned collection is a * Map.Entry. The collection is backed by the map, so * changes to the map are reflected in the collection, and * vice-versa. The collection supports element removal, which * removes the corresponding mapping from the map, via the * Iterator.remove, Collection.remove, * removeAll, retainAll, and clear * operations. It does not support the add or * addAll operations. The view's iterator is a * "weakly consistent" iterator that will never throw {@link * java.util.ConcurrentModificationException}, and guarantees to * traverse elements as they existed upon construction of the * iterator, and may (but is not guaranteed to) reflect any * modifications subsequent to construction. The * Map.Entry elements returned by * iterator.next() do not support the * setValue operation. * * @return a collection view of the mappings contained in this map. */ public Set> entrySet() { EntrySet es = entrySet; return (es != null) ? es : (entrySet = new EntrySet()); } /** * Returns a collection view of the mappings contained in this * map, in descending order. Each element in the returned * collection is a Map.Entry. The collection is backed * by the map, so changes to the map are reflected in the * collection, and vice-versa. The collection supports element * removal, which removes the corresponding mapping from the map, * via the Iterator.remove, Collection.remove, * removeAll, retainAll, and clear * operations. It does not support the add or * addAll operations. The view's iterator is a * "weakly consistent" iterator that will never throw {@link * java.util.ConcurrentModificationException}, and guarantees to * traverse elements as they existed upon construction of the * iterator, and may (but is not guaranteed to) reflect any * modifications subsequent to construction. The * Map.Entry elements returned by * iterator.next() do not support the * setValue operation. * * @return a collection view of the mappings contained in this map. */ public Set> descendingEntrySet() { DescendingEntrySet es = descendingEntrySet; return (es != null) ? es : (descendingEntrySet = new DescendingEntrySet()); } /* ---------------- AbstractMap Overrides -------------- */ /** * Compares the specified object with this map for equality. * Returns true if the given object is also a map and the * two maps represent the same mappings. More formally, two maps * t1 and t2 represent the same mappings if * t1.keySet().equals(t2.keySet()) and for every key * k in t1.keySet(), (t1.get(k)==null ? * t2.get(k)==null : t1.get(k).equals(t2.get(k))) . This * operation may return misleading results if either map is * concurrently modified during execution of this method. * * @param o object to be compared for equality with this map. * @return true if the specified object is equal to this map. */ public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof Map)) return false; Map t = (Map) o; try { return (containsAllMappings(this, t) && containsAllMappings(t, this)); } catch (ClassCastException unused) { return false; } catch (NullPointerException unused) { return false; } } /** * Helper for equals -- check for containment, avoiding nulls. */ static boolean containsAllMappings(Map a, Map b) { Iterator> it = b.entrySet().iterator(); while (it.hasNext()) { Entry e = it.next(); Object k = e.getKey(); Object v = e.getValue(); if (k == null || v == null || !v.equals(a.get(k))) return false; } return true; } /* ------ ConcurrentMap API methods ------ */ /** * If the specified key is not already associated * with a value, associate it with the given value. * This is equivalent to *

     *   if (!map.containsKey(key))
     *      return map.put(key, value);
     *   else
     *      return map.get(key);
     * 
* except that the action is performed atomically. * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or null * if there was no mapping for key. * * @throws ClassCastException if the key cannot be compared with the keys * currently in the map. * @throws NullPointerException if the key or value are null. */ public V putIfAbsent(K key, V value) { if (value == null) throw new NullPointerException(); return doPut(key, value, true); } /** * Remove entry for key only if currently mapped to given value. * Acts as *
     *  if ((map.containsKey(key) && map.get(key).equals(value)) {
     *     map.remove(key);
     *     return true;
     * } else return false;
     * 
* except that the action is performed atomically. * @param key key with which the specified value is associated. * @param value value associated with the specified key. * @return true if the value was removed, false otherwise * @throws ClassCastException if the key cannot be compared with the keys * currently in the map. * @throws NullPointerException if the key or value are null. */ public boolean remove(Object key, Object value) { if (value == null) throw new NullPointerException(); return doRemove(key, value) != null; } /** * Replace entry for key only if currently mapped to given value. * Acts as *
     *  if ((map.containsKey(key) && map.get(key).equals(oldValue)) {
     *     map.put(key, newValue);
     *     return true;
     * } else return false;
     * 
* except that the action is performed atomically. * @param key key with which the specified value is associated. * @param oldValue value expected to be associated with the specified key. * @param newValue value to be associated with the specified key. * @return true if the value was replaced * @throws ClassCastException if the key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key, oldValue or newValue are * null. */ public boolean replace(K key, V oldValue, V newValue) { if (oldValue == null || newValue == null) throw new NullPointerException(); Comparable k = comparable(key); for (;;) { Node n = findNode(k); if (n == null) return false; Object v = n.value; if (v != null) { if (!oldValue.equals(v)) return false; if (n.casValue(v, newValue)) return true; } } } /** * Replace entry for key only if currently mapped to some value. * Acts as *
     *  if ((map.containsKey(key)) {
     *     return map.put(key, value);
     * } else return null;
     * 
* except that the action is performed atomically. * @param key key with which the specified value is associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or null * if there was no mapping for key. * @throws ClassCastException if the key cannot be compared with the keys * currently in the map. * @throws NullPointerException if the key or value are null. */ public V replace(K key, V value) { if (value == null) throw new NullPointerException(); Comparable k = comparable(key); for (;;) { Node n = findNode(k); if (n == null) return null; Object v = n.value; if (v != null && n.casValue(v, value)) return (V)v; } } /* ------ SortedMap API methods ------ */ /** * Returns the comparator used to order this map, or null * if this map uses its keys' natural order. * * @return the comparator associated with this map, or * null if it uses its keys' natural sort method. */ public Comparator comparator() { return comparator; } /** * Returns the first (lowest) key currently in this map. * * @return the first (lowest) key currently in this map. * @throws NoSuchElementException Map is empty. */ public K firstKey() { Node n = findFirst(); if (n == null) throw new NoSuchElementException(); return n.key; } /** * Returns the last (highest) key currently in this map. * * @return the last (highest) key currently in this map. * @throws NoSuchElementException Map is empty. */ public K lastKey() { Node n = findLast(); if (n == null) throw new NoSuchElementException(); return n.key; } /** * Returns a view of the portion of this map whose keys range from * fromKey, inclusive, to toKey, exclusive. (If * fromKey and toKey are equal, the returned sorted map * is empty.) The returned sorted map is backed by this map, so changes * in the returned sorted map are reflected in this map, and vice-versa. * * @param fromKey low endpoint (inclusive) of the subMap. * @param toKey high endpoint (exclusive) of the subMap. * * @return a view of the portion of this map whose keys range from * fromKey, inclusive, to toKey, exclusive. * * @throws ClassCastException if fromKey and toKey * cannot be compared to one another using this map's comparator * (or, if the map has no comparator, using natural ordering). * @throws IllegalArgumentException if fromKey is greater than * toKey. * @throws NullPointerException if fromKey or toKey is * null. */ public ConcurrentNavigableMap subMap(K fromKey, K toKey) { if (fromKey == null || toKey == null) throw new NullPointerException(); return new ConcurrentSkipListSubMap(this, fromKey, toKey); } /** * Returns a view of the portion of this map whose keys are * strictly less than toKey. The returned sorted map is * backed by this map, so changes in the returned sorted map are * reflected in this map, and vice-versa. * @param toKey high endpoint (exclusive) of the headMap. * @return a view of the portion of this map whose keys are * strictly less than toKey. * * @throws ClassCastException if toKey is not compatible * with this map's comparator (or, if the map has no comparator, * if toKey does not implement Comparable). * @throws NullPointerException if toKey is null. */ public ConcurrentNavigableMap headMap(K toKey) { if (toKey == null) throw new NullPointerException(); return new ConcurrentSkipListSubMap(this, null, toKey); } /** * Returns a view of the portion of this map whose keys are * greater than or equal to fromKey. The returned sorted * map is backed by this map, so changes in the returned sorted * map are reflected in this map, and vice-versa. * @param fromKey low endpoint (inclusive) of the tailMap. * @return a view of the portion of this map whose keys are * greater than or equal to fromKey. * @throws ClassCastException if fromKey is not * compatible with this map's comparator (or, if the map has no * comparator, if fromKey does not implement * Comparable). * @throws NullPointerException if fromKey is null. */ public ConcurrentNavigableMap tailMap(K fromKey) { if (fromKey == null) throw new NullPointerException(); return new ConcurrentSkipListSubMap(this, fromKey, null); } /* ---------------- Relational operations -------------- */ /** * Returns a key-value mapping associated with the least key * greater than or equal to the given key, or null if * there is no such entry. The returned entry does not * support the Entry.setValue method. * * @param key the key. * @return an Entry associated with ceiling of given key, or * null if there is no such Entry. * @throws ClassCastException if key cannot be compared with the * keys currently in the map. * @throws NullPointerException if key is null. */ public Map.Entry ceilingEntry(K key) { return getNear(key, GT|EQ); } /** * Returns least key greater than or equal to the given key, or * null if there is no such key. * * @param key the key. * @return the ceiling key, or null * if there is no such key. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null. */ public K ceilingKey(K key) { Node n = findNear(key, GT|EQ); return (n == null) ? null : n.key; } /** * Returns a key-value mapping associated with the greatest * key strictly less than the given key, or null if there is no * such entry. The returned entry does not support * the Entry.setValue method. * * @param key the key. * @return an Entry with greatest key less than the given * key, or null if there is no such Entry. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null. */ public Map.Entry lowerEntry(K key) { return getNear(key, LT); } /** * Returns the greatest key strictly less than the given key, or * null if there is no such key. * * @param key the key. * @return the greatest key less than the given * key, or null if there is no such key. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null. */ public K lowerKey(K key) { Node n = findNear(key, LT); return (n == null) ? null : n.key; } /** * Returns a key-value mapping associated with the greatest key * less than or equal to the given key, or null if there * is no such entry. The returned entry does not support * the Entry.setValue method. * * @param key the key. * @return an Entry associated with floor of given key, or null * if there is no such Entry. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null. */ public Map.Entry floorEntry(K key) { return getNear(key, LT|EQ); } /** * Returns the greatest key * less than or equal to the given key, or null if there * is no such key. * * @param key the key. * @return the floor of given key, or null if there is no * such key. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null. */ public K floorKey(K key) { Node n = findNear(key, LT|EQ); return (n == null) ? null : n.key; } /** * Returns a key-value mapping associated with the least key * strictly greater than the given key, or null if there * is no such entry. The returned entry does not support * the Entry.setValue method. * * @param key the key. * @return an Entry with least key greater than the given key, or * null if there is no such Entry. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null. */ public Map.Entry higherEntry(K key) { return getNear(key, GT); } /** * Returns the least key strictly greater than the given key, or * null if there is no such key. * * @param key the key. * @return the least key greater than the given key, or * null if there is no such key. * @throws ClassCastException if key cannot be compared with the keys * currently in the map. * @throws NullPointerException if key is null. */ public K higherKey(K key) { Node n = findNear(key, GT); return (n == null) ? null : n.key; } /** * Returns a key-value mapping associated with the least * key in this map, or null if the map is empty. * The returned entry does not support * the Entry.setValue method. * * @return an Entry with least key, or null * if the map is empty. */ public Map.Entry firstEntry() { for (;;) { Node n = findFirst(); if (n == null) return null; SnapshotEntry e = n.createSnapshot(); if (e != null) return e; } } /** * Returns a key-value mapping associated with the greatest * key in this map, or null if the map is empty. * The returned entry does not support * the Entry.setValue method. * * @return an Entry with greatest key, or null * if the map is empty. */ public Map.Entry lastEntry() { for (;;) { Node n = findLast(); if (n == null) return null; SnapshotEntry e = n.createSnapshot(); if (e != null) return e; } } /** * Removes and returns a key-value mapping associated with * the least key in this map, or null if the map is empty. * The returned entry does not support * the Entry.setValue method. * * @return the removed first entry of this map, or null * if the map is empty. */ public Map.Entry pollFirstEntry() { return (SnapshotEntry)doRemoveFirst(false); } /** * Removes and returns a key-value mapping associated with * the greatest key in this map, or null if the map is empty. * The returned entry does not support * the Entry.setValue method. * * @return the removed last entry of this map, or null * if the map is empty. */ public Map.Entry pollLastEntry() { return (SnapshotEntry)doRemoveLast(false); } /* ---------------- Iterators -------------- */ /** * Base of ten kinds of iterator classes: * ascending: {map, submap} X {key, value, entry} * descending: {map, submap} X {key, entry} */ abstract class Iter { /** the last node returned by next() */ Node last; /** the next node to return from next(); */ Node next; /** Cache of next value field to maintain weak consistency */ Object nextValue; Iter() {} public final boolean hasNext() { return next != null; } /** initialize ascending iterator for entire range */ final void initAscending() { for (;;) { next = findFirst(); if (next == null) break; nextValue = next.value; if (nextValue != null && nextValue != next) break; } } /** * initialize ascending iterator starting at given least key, * or first node if least is null, but not greater or * equal to fence, or end if fence is null. */ final void initAscending(K least, K fence) { for (;;) { next = findCeiling(least); if (next == null) break; nextValue = next.value; if (nextValue != null && nextValue != next) { if (fence != null && compare(fence, next.key) <= 0) { next = null; nextValue = null; } break; } } } /** advance next to higher entry */ final void ascend() { if ((last = next) == null) throw new NoSuchElementException(); for (;;) { next = next.next; if (next == null) break; nextValue = next.value; if (nextValue != null && nextValue != next) break; } } /** * Version of ascend for submaps to stop at fence */ final void ascend(K fence) { if ((last = next) == null) throw new NoSuchElementException(); for (;;) { next = next.next; if (next == null) break; nextValue = next.value; if (nextValue != null && nextValue != next) { if (fence != null && compare(fence, next.key) <= 0) { next = null; nextValue = null; } break; } } } /** initialize descending iterator for entire range */ final void initDescending() { for (;;) { next = findLast(); if (next == null) break; nextValue = next.value; if (nextValue != null && nextValue != next) break; } } /** * initialize descending iterator starting at key less * than or equal to given fence key, or * last node if fence is null, but not less than * least, or beginning if lest is null. */ final void initDescending(K least, K fence) { for (;;) { next = findLower(fence); if (next == null) break; nextValue = next.value; if (nextValue != null && nextValue != next) { if (least != null && compare(least, next.key) > 0) { next = null; nextValue = null; } break; } } } /** advance next to lower entry */ final void descend() { if ((last = next) == null) throw new NoSuchElementException(); K k = last.key; for (;;) { next = findNear(k, LT); if (next == null) break; nextValue = next.value; if (nextValue != null && nextValue != next) break; } } /** * Version of descend for submaps to stop at least */ final void descend(K least) { if ((last = next) == null) throw new NoSuchElementException(); K k = last.key; for (;;) { next = findNear(k, LT); if (next == null) break; nextValue = next.value; if (nextValue != null && nextValue != next) { if (least != null && compare(least, next.key) > 0) { next = null; nextValue = null; } break; } } } public void remove() { Node l = last; if (l == null) throw new IllegalStateException(); // It would not be worth all of the overhead to directly // unlink from here. Using remove is fast enough. ConcurrentSkipListMap.this.remove(l.key); } } final class ValueIterator extends Iter implements Iterator { ValueIterator() { initAscending(); } public V next() { Object v = nextValue; ascend(); return (V)v; } } final class KeyIterator extends Iter implements Iterator { KeyIterator() { initAscending(); } public K next() { Node n = next; ascend(); return n.key; } } class SubMapValueIterator extends Iter implements Iterator { final K fence; SubMapValueIterator(K least, K fence) { initAscending(least, fence); this.fence = fence; } public V next() { Object v = nextValue; ascend(fence); return (V)v; } } final class SubMapKeyIterator extends Iter implements Iterator { final K fence; SubMapKeyIterator(K least, K fence) { initAscending(least, fence); this.fence = fence; } public K next() { Node n = next; ascend(fence); return n.key; } } final class DescendingKeyIterator extends Iter implements Iterator { DescendingKeyIterator() { initDescending(); } public K next() { Node n = next; descend(); return n.key; } } final class DescendingSubMapKeyIterator extends Iter implements Iterator { final K least; DescendingSubMapKeyIterator(K least, K fence) { initDescending(least, fence); this.least = least; } public K next() { Node n = next; descend(least); return n.key; } } /** * Entry iterators use the same trick as in ConcurrentHashMap and * elsewhere of using the iterator itself to represent entries, * thus avoiding having to create entry objects in next(). */ abstract class EntryIter extends Iter implements Map.Entry { /** Cache of last value returned */ Object lastValue; EntryIter() { } public K getKey() { Node l = last; if (l == null) throw new IllegalStateException(); return l.key; } public V getValue() { Object v = lastValue; if (last == null || v == null) throw new IllegalStateException(); return (V)v; } public V setValue(V value) { throw new UnsupportedOperationException(); } public boolean equals(Object o) { // If not acting as entry, just use default. if (last == null) return super.equals(o); if (!(o instanceof Map.Entry)) return false; Map.Entry e = (Map.Entry)o; return (getKey().equals(e.getKey()) && getValue().equals(e.getValue())); } public int hashCode() { // If not acting as entry, just use default. if (last == null) return super.hashCode(); return getKey().hashCode() ^ getValue().hashCode(); } public String toString() { // If not acting as entry, just use default. if (last == null) return super.toString(); return getKey() + "=" + getValue(); } } final class EntryIterator extends EntryIter implements Iterator> { EntryIterator() { initAscending(); } public Map.Entry next() { lastValue = nextValue; ascend(); return this; } } final class SubMapEntryIterator extends EntryIter implements Iterator> { final K fence; SubMapEntryIterator(K least, K fence) { initAscending(least, fence); this.fence = fence; } public Map.Entry next() { lastValue = nextValue; ascend(fence); return this; } } final class DescendingEntryIterator extends EntryIter implements Iterator> { DescendingEntryIterator() { initDescending(); } public Map.Entry next() { lastValue = nextValue; descend(); return this; } } final class DescendingSubMapEntryIterator extends EntryIter implements Iterator> { final K least; DescendingSubMapEntryIterator(K least, K fence) { initDescending(least, fence); this.least = least; } public Map.Entry next() { lastValue = nextValue; descend(least); return this; } } // Factory methods for iterators needed by submaps and/or // ConcurrentSkipListSet Iterator keyIterator() { return new KeyIterator(); } Iterator descendingKeyIterator() { return new DescendingKeyIterator(); } SubMapEntryIterator subMapEntryIterator(K least, K fence) { return new SubMapEntryIterator(least, fence); } DescendingSubMapEntryIterator descendingSubMapEntryIterator(K least, K fence) { return new DescendingSubMapEntryIterator(least, fence); } SubMapKeyIterator subMapKeyIterator(K least, K fence) { return new SubMapKeyIterator(least, fence); } DescendingSubMapKeyIterator descendingSubMapKeyIterator(K least, K fence) { return new DescendingSubMapKeyIterator(least, fence); } SubMapValueIterator subMapValueIterator(K least, K fence) { return new SubMapValueIterator(least, fence); } /* ---------------- Views -------------- */ class KeySet extends AbstractSet { public Iterator iterator() { return new KeyIterator(); } public boolean isEmpty() { return ConcurrentSkipListMap.this.isEmpty(); } public int size() { return ConcurrentSkipListMap.this.size(); } public boolean contains(Object o) { return ConcurrentSkipListMap.this.containsKey(o); } public boolean remove(Object o) { return ConcurrentSkipListMap.this.removep(o); } public void clear() { ConcurrentSkipListMap.this.clear(); } public Object[] toArray() { Collection c = new ArrayList(); for (Iterator i = iterator(); i.hasNext(); ) c.add(i.next()); return c.toArray(); } public T[] toArray(T[] a) { Collection c = new ArrayList(); for (Iterator i = iterator(); i.hasNext(); ) c.add(i.next()); return c.toArray(a); } } class DescendingKeySet extends KeySet { public Iterator iterator() { return new DescendingKeyIterator(); } } final class Values extends AbstractCollection { public Iterator iterator() { return new ValueIterator(); } public boolean isEmpty() { return ConcurrentSkipListMap.this.isEmpty(); } public int size() { return ConcurrentSkipListMap.this.size(); } public boolean contains(Object o) { return ConcurrentSkipListMap.this.containsValue(o); } public void clear() { ConcurrentSkipListMap.this.clear(); } public Object[] toArray() { Collection c = new ArrayList(); for (Iterator i = iterator(); i.hasNext(); ) c.add(i.next()); return c.toArray(); } public T[] toArray(T[] a) { Collection c = new ArrayList(); for (Iterator i = iterator(); i.hasNext(); ) c.add(i.next()); return c.toArray(a); } } class EntrySet extends AbstractSet> { public Iterator> iterator() { return new EntryIterator(); } public boolean contains(Object o) { if (!(o instanceof Map.Entry)) return false; Map.Entry e = (Map.Entry)o; V v = ConcurrentSkipListMap.this.get(e.getKey()); return v != null && v.equals(e.getValue()); } public boolean remove(Object o) { if (!(o instanceof Map.Entry)) return false; Map.Entry e = (Map.Entry)o; return ConcurrentSkipListMap.this.remove(e.getKey(), e.getValue()); } public boolean isEmpty() { return ConcurrentSkipListMap.this.isEmpty(); } public int size() { return ConcurrentSkipListMap.this.size(); } public void clear() { ConcurrentSkipListMap.this.clear(); } public Object[] toArray() { Collection> c = new ArrayList>(); for (Map.Entry e : this) c.add(new SnapshotEntry(e.getKey(), e.getValue())); return c.toArray(); } public T[] toArray(T[] a) { Collection> c = new ArrayList>(); for (Map.Entry e : this) c.add(new SnapshotEntry(e.getKey(), e.getValue())); return c.toArray(a); } } class DescendingEntrySet extends EntrySet { public Iterator> iterator() { return new DescendingEntryIterator(); } } /** * Submaps returned by {@link ConcurrentSkipListMap} submap operations * represent a subrange of mappings of their underlying * maps. Instances of this class support all methods of their * underlying maps, differing in that mappings outside their range are * ignored, and attempts to add mappings outside their ranges result * in {@link IllegalArgumentException}. Instances of this class are * constructed only using the subMap, headMap, and * tailMap methods of their underlying maps. */ static class ConcurrentSkipListSubMap extends AbstractMap implements ConcurrentNavigableMap, java.io.Serializable { private static final long serialVersionUID = -7647078645895051609L; /** Underlying map */ private final ConcurrentSkipListMap m; /** lower bound key, or null if from start */ private final K least; /** upper fence key, or null if to end */ private final K fence; // Lazily initialized view holders private transient Set keySetView; private transient Set> entrySetView; private transient Collection valuesView; private transient Set descendingKeySetView; private transient Set> descendingEntrySetView; /** * Creates a new submap. * @param least inclusive least value, or null if from start * @param fence exclusive upper bound or null if to end * @throws IllegalArgumentException if least and fence non-null * and least greater than fence */ ConcurrentSkipListSubMap(ConcurrentSkipListMap map, K least, K fence) { if (least != null && fence != null && map.compare(least, fence) > 0) throw new IllegalArgumentException("inconsistent range"); this.m = map; this.least = least; this.fence = fence; } /* ---------------- Utilities -------------- */ boolean inHalfOpenRange(K key) { return m.inHalfOpenRange(key, least, fence); } boolean inOpenRange(K key) { return m.inOpenRange(key, least, fence); } ConcurrentSkipListMap.Node firstNode() { return m.findCeiling(least); } ConcurrentSkipListMap.Node lastNode() { return m.findLower(fence); } boolean isBeforeEnd(ConcurrentSkipListMap.Node n) { return (n != null && (fence == null || n.key == null || // pass by markers and headers m.compare(fence, n.key) > 0)); } void checkKey(K key) throws IllegalArgumentException { if (!inHalfOpenRange(key)) throw new IllegalArgumentException("key out of range"); } /** * Returns underlying map. Needed by ConcurrentSkipListSet * @return the backing map */ ConcurrentSkipListMap getMap() { return m; } /** * Returns least key. Needed by ConcurrentSkipListSet * @return least key or null if from start */ K getLeast() { return least; } /** * Returns fence key. Needed by ConcurrentSkipListSet * @return fence key or null of to end */ K getFence() { return fence; } /* ---------------- Map API methods -------------- */ public boolean containsKey(Object key) { K k = (K)key; return inHalfOpenRange(k) && m.containsKey(k); } public V get(Object key) { K k = (K)key; return (!inHalfOpenRange(k)) ? null : m.get(k); } public V put(K key, V value) { checkKey(key); return m.put(key, value); } public V remove(Object key) { K k = (K)key; return (!inHalfOpenRange(k)) ? null : m.remove(k); } public int size() { long count = 0; for (ConcurrentSkipListMap.Node n = firstNode(); isBeforeEnd(n); n = n.next) { if (n.getValidValue() != null) ++count; } return (count >= Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int)count; } public boolean isEmpty() { return !isBeforeEnd(firstNode()); } public boolean containsValue(Object value) { if (value == null) throw new NullPointerException(); for (ConcurrentSkipListMap.Node n = firstNode(); isBeforeEnd(n); n = n.next) { V v = n.getValidValue(); if (v != null && value.equals(v)) return true; } return false; } public void clear() { for (ConcurrentSkipListMap.Node n = firstNode(); isBeforeEnd(n); n = n.next) { if (n.getValidValue() != null) m.remove(n.key); } } /* ---------------- ConcurrentMap API methods -------------- */ public V putIfAbsent(K key, V value) { checkKey(key); return m.putIfAbsent(key, value); } public boolean remove(Object key, Object value) { K k = (K)key; return inHalfOpenRange(k) && m.remove(k, value); } public boolean replace(K key, V oldValue, V newValue) { checkKey(key); return m.replace(key, oldValue, newValue); } public V replace(K key, V value) { checkKey(key); return m.replace(key, value); } /* ---------------- SortedMap API methods -------------- */ public Comparator comparator() { return m.comparator(); } public K firstKey() { ConcurrentSkipListMap.Node n = firstNode(); if (isBeforeEnd(n)) return n.key; else throw new NoSuchElementException(); } public K lastKey() { ConcurrentSkipListMap.Node n = lastNode(); if (n != null) { K last = n.key; if (inHalfOpenRange(last)) return last; } throw new NoSuchElementException(); } public ConcurrentNavigableMap subMap(K fromKey, K toKey) { if (fromKey == null || toKey == null) throw new NullPointerException(); if (!inOpenRange(fromKey) || !inOpenRange(toKey)) throw new IllegalArgumentException("key out of range"); return new ConcurrentSkipListSubMap(m, fromKey, toKey); } public ConcurrentNavigableMap headMap(K toKey) { if (toKey == null) throw new NullPointerException(); if (!inOpenRange(toKey)) throw new IllegalArgumentException("key out of range"); return new ConcurrentSkipListSubMap(m, least, toKey); } public ConcurrentNavigableMap tailMap(K fromKey) { if (fromKey == null) throw new NullPointerException(); if (!inOpenRange(fromKey)) throw new IllegalArgumentException("key out of range"); return new ConcurrentSkipListSubMap(m, fromKey, fence); } /* ---------------- Relational methods -------------- */ public Map.Entry ceilingEntry(K key) { return (SnapshotEntry) m.getNear(key, m.GT|m.EQ, least, fence, false); } public K ceilingKey(K key) { return (K) m.getNear(key, m.GT|m.EQ, least, fence, true); } public Map.Entry lowerEntry(K key) { return (SnapshotEntry) m.getNear(key, m.LT, least, fence, false); } public K lowerKey(K key) { return (K) m.getNear(key, m.LT, least, fence, true); } public Map.Entry floorEntry(K key) { return (SnapshotEntry) m.getNear(key, m.LT|m.EQ, least, fence, false); } public K floorKey(K key) { return (K) m.getNear(key, m.LT|m.EQ, least, fence, true); } public Map.Entry higherEntry(K key) { return (SnapshotEntry) m.getNear(key, m.GT, least, fence, false); } public K higherKey(K key) { return (K) m.getNear(key, m.GT, least, fence, true); } public Map.Entry firstEntry() { for (;;) { ConcurrentSkipListMap.Node n = firstNode(); if (!isBeforeEnd(n)) return null; Map.Entry e = n.createSnapshot(); if (e != null) return e; } } public Map.Entry lastEntry() { for (;;) { ConcurrentSkipListMap.Node n = lastNode(); if (n == null || !inHalfOpenRange(n.key)) return null; Map.Entry e = n.createSnapshot(); if (e != null) return e; } } public Map.Entry pollFirstEntry() { return (SnapshotEntry) m.removeFirstEntryOfSubrange(least, fence, false); } public Map.Entry pollLastEntry() { return (SnapshotEntry) m.removeLastEntryOfSubrange(least, fence, false); } /* ---------------- Submap Views -------------- */ public Set keySet() { Set ks = keySetView; return (ks != null) ? ks : (keySetView = new KeySetView()); } class KeySetView extends AbstractSet { public Iterator iterator() { return m.subMapKeyIterator(least, fence); } public int size() { return ConcurrentSkipListSubMap.this.size(); } public boolean isEmpty() { return ConcurrentSkipListSubMap.this.isEmpty(); } public boolean contains(Object k) { return ConcurrentSkipListSubMap.this.containsKey(k); } public Object[] toArray() { Collection c = new ArrayList(); for (Iterator i = iterator(); i.hasNext(); ) c.add(i.next()); return c.toArray(); } public T[] toArray(T[] a) { Collection c = new ArrayList(); for (Iterator i = iterator(); i.hasNext(); ) c.add(i.next()); return c.toArray(a); } } public Set descendingKeySet() { Set ks = descendingKeySetView; return (ks != null) ? ks : (descendingKeySetView = new DescendingKeySetView()); } class DescendingKeySetView extends KeySetView { public Iterator iterator() { return m.descendingSubMapKeyIterator(least, fence); } } public Collection values() { Collection vs = valuesView; return (vs != null) ? vs : (valuesView = new ValuesView()); } class ValuesView extends AbstractCollection { public Iterator iterator() { return m.subMapValueIterator(least, fence); } public int size() { return ConcurrentSkipListSubMap.this.size(); } public boolean isEmpty() { return ConcurrentSkipListSubMap.this.isEmpty(); } public boolean contains(Object v) { return ConcurrentSkipListSubMap.this.containsValue(v); } public Object[] toArray() { Collection c = new ArrayList(); for (Iterator i = iterator(); i.hasNext(); ) c.add(i.next()); return c.toArray(); } public T[] toArray(T[] a) { Collection c = new ArrayList(); for (Iterator i = iterator(); i.hasNext(); ) c.add(i.next()); return c.toArray(a); } } public Set> entrySet() { Set> es = entrySetView; return (es != null) ? es : (entrySetView = new EntrySetView()); } class EntrySetView extends AbstractSet> { public Iterator> iterator() { return m.subMapEntryIterator(least, fence); } public int size() { return ConcurrentSkipListSubMap.this.size(); } public boolean isEmpty() { return ConcurrentSkipListSubMap.this.isEmpty(); } public boolean contains(Object o) { if (!(o instanceof Map.Entry)) return false; Map.Entry e = (Map.Entry) o; K key = e.getKey(); if (!inHalfOpenRange(key)) return false; V v = m.get(key); return v != null && v.equals(e.getValue()); } public boolean remove(Object o) { if (!(o instanceof Map.Entry)) return false; Map.Entry e = (Map.Entry) o; K key = e.getKey(); if (!inHalfOpenRange(key)) return false; return m.remove(key, e.getValue()); } public Object[] toArray() { Collection> c = new ArrayList>(); for (Map.Entry e : this) c.add(new SnapshotEntry(e.getKey(), e.getValue())); return c.toArray(); } public T[] toArray(T[] a) { Collection> c = new ArrayList>(); for (Map.Entry e : this) c.add(new SnapshotEntry(e.getKey(), e.getValue())); return c.toArray(a); } } public Set> descendingEntrySet() { Set> es = descendingEntrySetView; return (es != null) ? es : (descendingEntrySetView = new DescendingEntrySetView()); } class DescendingEntrySetView extends EntrySetView { public Iterator> iterator() { return m.descendingSubMapEntryIterator(least, fence); } } } } jsr166/src/jsr166x/LinkedBlockingDeque.java0000644000000000000000000005121111551700072015515 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166x; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; /** * An optionally-bounded {@linkplain BlockingDeque blocking deque} based on * linked nodes. * *

The optional capacity bound constructor argument serves as a * way to prevent excessive expansion. The capacity, if unspecified, * is equal to {@link Integer#MAX_VALUE}. Linked nodes are * dynamically created upon each insertion unless this would bring the * deque above capacity. * *

Most operations run in constant time (ignoring time spent * blocking). Exceptions include {@link #remove(Object) remove}, * {@link #removeFirstOccurrence removeFirstOccurrence}, {@link * #removeLastOccurrence removeLastOccurrence}, {@link #contains * contains }, {@link #iterator iterator.remove()}, and the bulk * operations, all of which run in linear time. * *

This class and its iterator implement all of the * optional methods of the {@link Collection} and {@link * Iterator} interfaces. This class is a member of the Java Collections * Framework. * * @since 1.6 * @author Doug Lea * @param the type of elements held in this collection */ public class LinkedBlockingDeque extends AbstractQueue implements BlockingDeque, java.io.Serializable { /* * Implemented as a simple doubly-linked list protected by a * single lock and using conditions to manage blocking. */ private static final long serialVersionUID = -387911632671998426L; /** Doubly-linked list node class */ static final class Node { E item; Node prev; Node next; Node(E x, Node p, Node n) { item = x; prev = p; next = n; } } /** Pointer to first node */ private transient Node first; /** Pointer to last node */ private transient Node last; /** Number of items in the deque */ private transient int count; /** Maximum number of items in the deque */ private final int capacity; /** Main lock guarding all access */ private final ReentrantLock lock = new ReentrantLock(); /** Condition for waiting takes */ private final Condition notEmpty = lock.newCondition(); /** Condition for waiting puts */ private final Condition notFull = lock.newCondition(); /** * Creates a LinkedBlockingDeque with a capacity of * {@link Integer#MAX_VALUE}. */ public LinkedBlockingDeque() { this(Integer.MAX_VALUE); } /** * Creates a LinkedBlockingDeque with the given (fixed) * capacity. * @param capacity the capacity of this deque * @throws IllegalArgumentException if capacity is less than 1 */ public LinkedBlockingDeque(int capacity) { if (capacity <= 0) throw new IllegalArgumentException(); this.capacity = capacity; } /** * Creates a LinkedBlockingDeque with a capacity of * {@link Integer#MAX_VALUE}, initially containing the elements of the * given collection, * added in traversal order of the collection's iterator. * @param c the collection of elements to initially contain * @throws NullPointerException if c or any element within it * is null */ public LinkedBlockingDeque(Collection c) { this(Integer.MAX_VALUE); for (E e : c) add(e); } // Basic linking and unlinking operations, called only while holding lock /** * Link e as first element, or return false if full */ private boolean linkFirst(E e) { if (count >= capacity) return false; ++count; Node f = first; Node x = new Node(e, null, f); first = x; if (last == null) last = x; else f.prev = x; notEmpty.signal(); return true; } /** * Link e as last element, or return false if full */ private boolean linkLast(E e) { if (count >= capacity) return false; ++count; Node l = last; Node x = new Node(e, l, null); last = x; if (first == null) first = x; else l.next = x; notEmpty.signal(); return true; } /** * Remove and return first element, or null if empty */ private E unlinkFirst() { Node f = first; if (f == null) return null; Node n = f.next; first = n; if (n == null) last = null; else n.prev = null; --count; notFull.signal(); return f.item; } /** * Remove and return last element, or null if empty */ private E unlinkLast() { Node l = last; if (l == null) return null; Node p = l.prev; last = p; if (p == null) first = null; else p.next = null; --count; notFull.signal(); return l.item; } /** * Unlink e */ private void unlink(Node x) { Node p = x.prev; Node n = x.next; if (p == null) { if (n == null) first = last = null; else { n.prev = null; first = n; } } else if (n == null) { p.next = null; last = p; } else { p.next = n; n.prev = p; } --count; notFull.signalAll(); } // Deque methods public boolean offerFirst(E o) { if (o == null) throw new NullPointerException(); lock.lock(); try { return linkFirst(o); } finally { lock.unlock(); } } public boolean offerLast(E o) { if (o == null) throw new NullPointerException(); lock.lock(); try { return linkLast(o); } finally { lock.unlock(); } } public void addFirst(E e) { if (!offerFirst(e)) throw new IllegalStateException("Deque full"); } public void addLast(E e) { if (!offerLast(e)) throw new IllegalStateException("Deque full"); } public E pollFirst() { lock.lock(); try { return unlinkFirst(); } finally { lock.unlock(); } } public E pollLast() { lock.lock(); try { return unlinkLast(); } finally { lock.unlock(); } } public E removeFirst() { E x = pollFirst(); if (x == null) throw new NoSuchElementException(); return x; } public E removeLast() { E x = pollLast(); if (x == null) throw new NoSuchElementException(); return x; } public E peekFirst() { lock.lock(); try { return (first == null) ? null : first.item; } finally { lock.unlock(); } } public E peekLast() { lock.lock(); try { return (last == null) ? null : last.item; } finally { lock.unlock(); } } public E getFirst() { E x = peekFirst(); if (x == null) throw new NoSuchElementException(); return x; } public E getLast() { E x = peekLast(); if (x == null) throw new NoSuchElementException(); return x; } // BlockingDeque methods public void putFirst(E o) throws InterruptedException { if (o == null) throw new NullPointerException(); lock.lock(); try { while (!linkFirst(o)) notFull.await(); } finally { lock.unlock(); } } public void putLast(E o) throws InterruptedException { if (o == null) throw new NullPointerException(); lock.lock(); try { while (!linkLast(o)) notFull.await(); } finally { lock.unlock(); } } public E takeFirst() throws InterruptedException { lock.lock(); try { E x; while ( (x = unlinkFirst()) == null) notEmpty.await(); return x; } finally { lock.unlock(); } } public E takeLast() throws InterruptedException { lock.lock(); try { E x; while ( (x = unlinkLast()) == null) notEmpty.await(); return x; } finally { lock.unlock(); } } public boolean offerFirst(E o, long timeout, TimeUnit unit) throws InterruptedException { if (o == null) throw new NullPointerException(); lock.lockInterruptibly(); try { long nanos = unit.toNanos(timeout); for (;;) { if (linkFirst(o)) return true; if (nanos <= 0) return false; nanos = notFull.awaitNanos(nanos); } } finally { lock.unlock(); } } public boolean offerLast(E o, long timeout, TimeUnit unit) throws InterruptedException { if (o == null) throw new NullPointerException(); lock.lockInterruptibly(); try { long nanos = unit.toNanos(timeout); for (;;) { if (linkLast(o)) return true; if (nanos <= 0) return false; nanos = notFull.awaitNanos(nanos); } } finally { lock.unlock(); } } public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException { lock.lockInterruptibly(); try { long nanos = unit.toNanos(timeout); for (;;) { E x = unlinkFirst(); if (x != null) return x; if (nanos <= 0) return null; nanos = notEmpty.awaitNanos(nanos); } } finally { lock.unlock(); } } public E pollLast(long timeout, TimeUnit unit) throws InterruptedException { lock.lockInterruptibly(); try { long nanos = unit.toNanos(timeout); for (;;) { E x = unlinkLast(); if (x != null) return x; if (nanos <= 0) return null; nanos = notEmpty.awaitNanos(nanos); } } finally { lock.unlock(); } } // Queue and stack methods public boolean offer(E e) { return offerLast(e); } public boolean add(E e) { addLast(e); return true; } public void push(E e) { addFirst(e); } public E poll() { return pollFirst(); } public E remove() { return removeFirst(); } public E pop() { return removeFirst(); } public E peek() { return peekFirst(); } public E element() { return getFirst(); } public boolean remove(Object o) { return removeFirstOccurrence(o); } // BlockingQueue methods public void put(E o) throws InterruptedException { putLast(o); } public E take() throws InterruptedException { return takeFirst(); } public boolean offer(E o, long timeout, TimeUnit unit) throws InterruptedException { return offerLast(o, timeout, unit); } public E poll(long timeout, TimeUnit unit) throws InterruptedException { return pollFirst(timeout, unit); } /** * Returns the number of elements in this deque. * * @return the number of elements in this deque. */ public int size() { lock.lock(); try { return count; } finally { lock.unlock(); } } /** * Returns the number of elements that this deque can ideally (in * the absence of memory or resource constraints) accept without * blocking. This is always equal to the initial capacity of this deque * less the current size of this deque. *

Note that you cannot always tell if * an attempt to add an element will succeed by * inspecting remainingCapacity because it may be the * case that a waiting consumer is ready to take an * element out of an otherwise full deque. */ public int remainingCapacity() { lock.lock(); try { return capacity - count; } finally { lock.unlock(); } } public boolean contains(Object o) { if (o == null) return false; lock.lock(); try { for (Node p = first; p != null; p = p.next) if (o.equals(p.item)) return true; return false; } finally { lock.unlock(); } } public boolean removeFirstOccurrence(Object e) { if (e == null) throw new NullPointerException(); lock.lock(); try { for (Node p = first; p != null; p = p.next) { if (e.equals(p.item)) { unlink(p); return true; } } return false; } finally { lock.unlock(); } } public boolean removeLastOccurrence(Object e) { if (e == null) throw new NullPointerException(); lock.lock(); try { for (Node p = last; p != null; p = p.prev) { if (e.equals(p.item)) { unlink(p); return true; } } return false; } finally { lock.unlock(); } } /** * Variant of removeFirstOccurrence needed by iterator.remove. * Searches for the node, not its contents. */ boolean removeNode(Node e) { lock.lock(); try { for (Node p = first; p != null; p = p.next) { if (p == e) { unlink(p); return true; } } return false; } finally { lock.unlock(); } } public Object[] toArray() { lock.lock(); try { Object[] a = new Object[count]; int k = 0; for (Node p = first; p != null; p = p.next) a[k++] = p.item; return a; } finally { lock.unlock(); } } public T[] toArray(T[] a) { lock.lock(); try { if (a.length < count) a = (T[])java.lang.reflect.Array.newInstance( a.getClass().getComponentType(), count ); int k = 0; for (Node p = first; p != null; p = p.next) a[k++] = (T)p.item; if (a.length > k) a[k] = null; return a; } finally { lock.unlock(); } } public String toString() { lock.lock(); try { return super.toString(); } finally { lock.unlock(); } } /** * Atomically removes all of the elements from this deque. * The deque will be empty after this call returns. */ public void clear() { lock.lock(); try { first = last = null; count = 0; notFull.signalAll(); } finally { lock.unlock(); } } public int drainTo(Collection c) { if (c == null) throw new NullPointerException(); if (c == this) throw new IllegalArgumentException(); lock.lock(); try { for (Node p = first; p != null; p = p.next) c.add(p.item); int n = count; count = 0; first = last = null; notFull.signalAll(); return n; } finally { lock.unlock(); } } public int drainTo(Collection c, int maxElements) { if (c == null) throw new NullPointerException(); if (c == this) throw new IllegalArgumentException(); lock.lock(); try { int n = 0; while (n < maxElements && first != null) { c.add(first.item); first.prev = null; first = first.next; --count; ++n; } if (first == null) last = null; notFull.signalAll(); return n; } finally { lock.unlock(); } } /** * Returns an iterator over the elements in this deque in proper sequence. * The returned Iterator is a "weakly consistent" iterator that * will never throw {@link java.util.ConcurrentModificationException}, * and guarantees to traverse elements as they existed upon * construction of the iterator, and may (but is not guaranteed to) * reflect any modifications subsequent to construction. * * @return an iterator over the elements in this deque in proper sequence. */ public Iterator iterator() { return new Itr(); } /** * Iterator for LinkedBlockingDeque */ private class Itr implements Iterator { private Node next; /** * nextItem holds on to item fields because once we claim that * an element exists in hasNext(), we must return item read * under lock (in advance()) even if it was in the process of * being removed when hasNext() was called. **/ private E nextItem; /** * Node returned by most recent call to next. Needed by remove. * Reset to null if this element is deleted by a call to remove. */ private Node last; Itr() { advance(); } /** * Advance next, or if not yet initialized, set to first node. */ private void advance() { final ReentrantLock lock = LinkedBlockingDeque.this.lock; lock.lock(); try { next = (next == null) ? first : next.next; nextItem = (next == null) ? null : next.item; } finally { lock.unlock(); } } public boolean hasNext() { return next != null; } public E next() { if (next == null) throw new NoSuchElementException(); last = next; E x = nextItem; advance(); return x; } public void remove() { Node n = last; if (n == null) throw new IllegalStateException(); last = null; // Note: removeNode rescans looking for this node to make // sure it was not already removed. Otherwwise, trying to // re-remove could corrupt list. removeNode(n); } } /** * Save the state to a stream (that is, serialize it). * * @serialData The capacity (int), followed by elements (each an * Object) in the proper order, followed by a null * @param s the stream */ private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { lock.lock(); try { // Write out capacity and any hidden stuff s.defaultWriteObject(); // Write out all elements in the proper order. for (Node p = first; p != null; p = p.next) s.writeObject(p.item); // Use trailing null as sentinel s.writeObject(null); } finally { lock.unlock(); } } /** * Reconstitute this deque instance from a stream (that is, * deserialize it). * @param s the stream */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { s.defaultReadObject(); count = 0; first = null; last = null; // Read in all elements and place in queue for (;;) { E item = (E)s.readObject(); if (item == null) break; add(item); } } } jsr166/src/jsr166x/BlockingDeque.java0000644000000000000000000002274411537741066014413 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166x; // XXX This belongs in java.util!!! XXX import java.util.concurrent.*; // XXX This import goes away XXX import java.util.*; /** * A {@link Deque} that additionally supports operations that wait for * the deque to become non-empty when retrieving an element, and wait * for space to become available in the deque when storing an * element. These methods are summarized in the following table:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
First Element (Head) Last Element (Tail)
BlockTime outBlockTime out
Insert{@link #putFirst putFirst(e)}{@link #offerFirst(Object, long, TimeUnit) offerFirst(e, time, unit)}{@link #putLast putLast(e)}{@link #offerLast(Object, long, TimeUnit) offerLast(e, time, unit)}
Remove{@link #takeFirst takeFirst()}{@link #pollFirst(long, TimeUnit) pollFirst(time, unit)}{@link #takeLast takeLast()}{@link #pollLast(long, TimeUnit) pollLast(time, unit)}
* *

Like any {@link BlockingQueue}, a BlockingDeque is * thread safe and may (or may not) be capacity-constrained. A * BlockingDeque implementation may be used directly as a * FIFO BlockingQueue. The blocking methods inherited from * the BlockingQueue interface are precisely equivalent to * BlockingDeque methods as indicated in the following table:

* * * * * * * * * * * * * * * * * * * * * * * *
BlockingQueue Method Equivalent BlockingDeque Method
{@link java.util.concurrent.BlockingQueue#put put(e)}{@link #putLast putLast(e)}
{@link java.util.concurrent.BlockingQueue#take take()}{@link #takeFirst takeFirst()}
{@link java.util.concurrent.BlockingQueue#offer(Object, long, TimeUnit) offer(e, time. unit)}{@link #offerLast(Object, long, TimeUnit) offerLast(e, time, unit)}
{@link java.util.concurrent.BlockingQueue#poll(long, TimeUnit) poll(time, unit)}{@link #pollFirst(long, TimeUnit) pollFirst(time, unit)}
* * *

This interface is a member of the * * Java Collections Framework. * * @since 1.6 * @author Doug Lea * @param the type of elements held in this collection */ public interface BlockingDeque extends Deque, BlockingQueue { /** * Adds the specified element as the first element of this deque, * waiting if necessary for space to become available. * @param o the element to add * @throws InterruptedException if interrupted while waiting. * @throws NullPointerException if the specified element is null. */ void putFirst(E o) throws InterruptedException; /** * Adds the specified element as the last element of this deque, * waiting if necessary for space to become available. * @param o the element to add * @throws InterruptedException if interrupted while waiting. * @throws NullPointerException if the specified element is null. */ void putLast(E o) throws InterruptedException; /** * Retrieves and removes the first element of this deque, waiting * if no elements are present on this deque. * @return the head of this deque * @throws InterruptedException if interrupted while waiting. */ E takeFirst() throws InterruptedException; /** * Retrieves and removes the last element of this deque, waiting * if no elements are present on this deque. * @return the head of this deque * @throws InterruptedException if interrupted while waiting. */ E takeLast() throws InterruptedException; /** * Inserts the specified element as the first element of this deque, * waiting if necessary up to the specified wait time for space to * become available. * @param o the element to add * @param timeout how long to wait before giving up, in units of * unit * @param unit a TimeUnit determining how to interpret the * timeout parameter * @return true if successful, or false if * the specified waiting time elapses before space is available. * @throws InterruptedException if interrupted while waiting. * @throws NullPointerException if the specified element is null. */ boolean offerFirst(E o, long timeout, TimeUnit unit) throws InterruptedException; /** * Inserts the specified element as the last element of this deque, * waiting if necessary up to the specified wait time for space to * become available. * @param o the element to add * @param timeout how long to wait before giving up, in units of * unit * @param unit a TimeUnit determining how to interpret the * timeout parameter * @return true if successful, or false if * the specified waiting time elapses before space is available. * @throws InterruptedException if interrupted while waiting. * @throws NullPointerException if the specified element is null. */ boolean offerLast(E o, long timeout, TimeUnit unit) throws InterruptedException; /** * Retrieves and removes the first element of this deque, waiting * if necessary up to the specified wait time if no elements are * present on this deque. * @param timeout how long to wait before giving up, in units of * unit * @param unit a TimeUnit determining how to interpret the * timeout parameter * @return the head of this deque, or null if the * specified waiting time elapses before an element is present. * @throws InterruptedException if interrupted while waiting. */ E pollFirst(long timeout, TimeUnit unit) throws InterruptedException; /** * Retrieves and removes the last element of this deque, waiting * if necessary up to the specified wait time if no elements are * present on this deque. * @param timeout how long to wait before giving up, in units of * unit * @param unit a TimeUnit determining how to interpret the * timeout parameter * @return the head of this deque, or null if the * specified waiting time elapses before an element is present. * @throws InterruptedException if interrupted while waiting. */ E pollLast(long timeout, TimeUnit unit) throws InterruptedException; /** * Adds the specified element as the last element of this deque, * waiting if necessary for space to become available. This * method is equivalent to putLast * @param o the element to add * @throws InterruptedException if interrupted while waiting. * @throws NullPointerException if the specified element is null. */ void put(E o) throws InterruptedException; /** * Inserts the specified element as the lest element of this * deque, if possible. When using deques that may impose * insertion restrictions (for example capacity bounds), method * offer is generally preferable to method {@link * Collection#add}, which can fail to insert an element only by * throwing an exception. This method is equivalent to * offerLast * * @param o the element to add. * @return true if it was possible to add the element to * this deque, else false * @throws NullPointerException if the specified element is null */ boolean offer(E o, long timeout, TimeUnit unit) throws InterruptedException; /** * Retrieves and removes the first element of this deque, waiting * if no elements are present on this deque. * This method is equivalent to takeFirst * @return the head of this deque * @throws InterruptedException if interrupted while waiting. */ E take() throws InterruptedException; /** * Retrieves and removes the first element of this deque, waiting * if necessary up to the specified wait time if no elements are * present on this deque. This method is equivalent to * pollFirst * @param timeout how long to wait before giving up, in units of * unit * @param unit a TimeUnit determining how to interpret the * timeout parameter * @return the head of this deque, or null if the * specified waiting time elapses before an element is present. * @throws InterruptedException if interrupted while waiting. */ E poll(long timeout, TimeUnit unit) throws InterruptedException; } jsr166/src/jsr166x/NavigableSet.java0000644000000000000000000001670311537741066014241 0ustar /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166x; import java.util.*; /** * A {@link SortedSet} extended with navigation methods reporting * closest matches for given search targets. Methods lower, * floor, ceiling, and higher return keys * respectively less than, less than or equal, greater than or equal, * and greater than a given key, returning null if there is * no such key. A NavigableSet may be viewed and traversed * in either ascending or descending order. The Collection * iterator method returns an ascending Iterator and * the additional method descendingIterator returns * descending iterator. The performance of ascending traversals is * likely to be faster than descending traversals. This interface * additionally defines methods pollFirst and * pollLast that return and remove the lowest and highest key, * if one exists, else returning null. * *

The return values of navigation methods may be ambiguous in * implementations that permit null elements. However, even * in this case the result can be disambiguated by checking * contains(null). To avoid such issues, implementations of * this interface are encouraged not to permit insertion of * null elements. (Note that sorted sets of {@link * Comparable} elements intrinsically do not permit null.) * * @author Doug Lea * @param the type of elements maintained by this set */ public interface NavigableSet extends SortedSet { /** * Returns an element greater than or equal to the given element, or * null if there is no such element. * * @param o the value to match * @return an element greater than or equal to given element, or * null if there is no such element. * @throws ClassCastException if o cannot be compared with the elements * currently in the set. * @throws NullPointerException if o is null * and this set deas not permit null elements */ public E ceiling(E o); /** * Returns an element strictly less than the given element, or * null if there is no such element. * * @param o the value to match * @return the greatest element less than the given element, or * null if there is no such element. * @throws ClassCastException if o cannot be compared with the elements * currently in the set. * @throws NullPointerException if o is null * and this set deas not permit null elements */ public E lower(E o); /** * Returns an element less than or equal to the given element, or * null if there is no such element. * * @param o the value to match * @return the greatest element less than or equal to given * element, or null if there is no such element. * @throws ClassCastException if o cannot be compared with the elements * currently in the set. * @throws NullPointerException if o is null. * and this set deas not permit null elements */ public E floor(E o); /** * Returns an element strictly greater than the given element, or * null if there is no such element. * * @param o the value to match * @return the least element greater than the given element, or * null if there is no such element. * @throws ClassCastException if o cannot be compared with the elements * currently in the set. * @throws NullPointerException if o is null * and this set deas not permit null elements */ public E higher(E o); /** * Retrieves and removes the first (lowest) element. * * @return the first element, or null if empty. */ public E pollFirst(); /** * Retrieves and removes the last (highest) element. * * @return the last element, or null if empty. */ public E pollLast(); /** * Returns an iterator over the elements in this collection, in * descending order. * * @return an Iterator over the elements in this collection */ Iterator descendingIterator(); /** * Returns a view of the portion of this set whose elements range from * fromElement, inclusive, to toElement, exclusive. (If * fromElement and toElement are equal, the returned * sorted set is empty.) The returned sorted set is backed by this set, * so changes in the returned sorted set are reflected in this set, and * vice-versa. * @param fromElement low endpoint (inclusive) of the subSet. * @param toElement high endpoint (exclusive) of the subSet. * @return a view of the portion of this set whose elements range from * fromElement, inclusive, to toElement, * exclusive. * @throws ClassCastException if fromElement and * toElement cannot be compared to one another using * this set's comparator (or, if the set has no comparator, * using natural ordering). * @throws IllegalArgumentException if fromElement is * greater than toElement. * @throws NullPointerException if fromElement or * toElement is null * and this set deas not permit null elements */ public NavigableSet subSet(E fromElement, E toElement); /** * Returns a view of the portion of this set whose elements are strictly * less than toElement. The returned sorted set is backed by * this set, so changes in the returned sorted set are reflected in this * set, and vice-versa. * @param toElement high endpoint (exclusive) of the headSet. * @return a view of the portion of this set whose elements are strictly * less than toElement. * @throws ClassCastException if toElement is not compatible * with this set's comparator (or, if the set has no comparator, * if toElement does not implement Comparable). * @throws NullPointerException if toElement is null * and this set deas not permit null elements */ public NavigableSet headSet(E toElement); /** * Returns a view of the portion of this set whose elements are * greater than or equal to fromElement. The returned * sorted set is backed by this set, so changes in the returned * sorted set are reflected in this set, and vice-versa. * @param fromElement low endpoint (inclusive) of the tailSet. * @return a view of the portion of this set whose elements are * greater than or equal to fromElement. * @throws ClassCastException if fromElement is not * compatible with this set's comparator (or, if the set has no * comparator, if fromElement does not implement * Comparable). * @throws NullPointerException if fromElement is null * and this set deas not permit null elements */ public NavigableSet tailSet(E fromElement); } jsr166/src/main/0000755000000000000000000000000011652013242010506 5ustar