--- intro.html 2003/05/16 14:13:04 1.1 +++ intro.html 2003/06/04 11:33:01 1.2 @@ -75,7 +75,7 @@ java.util.Collections will be introduced into java.util. Also, although it is at the borders of being in scope of JSR-166, java.util.LinkedList will be adapted to support Queue, and -a new non-thread-safe java.util.HeapPriorityQueue will be added. +a new non-thread-safe java.util.PriorityQueue will be added.
Five implementations in java.util.concurrent support the extended BlockingQueue interface, that defines blocking versions of put and @@ -97,22 +97,35 @@ calling threads that compute functions returning results, via Futures. This is supported in part by defining interface Callable, the argument/result analog of Runnable. + +
Executors provide a framework for executing Runnables. The +Executor manages queueing and scheduling of tasks, and creation and +teardown of threads. Depending on which concrete Executor class is +being used, tasks may execute in a newly created thread, an existing +task-execution thread, or the thread calling execute(), and may +execute sequentially or concurrently. + +
Several concrete implementations of Executor are included in +java.util.concurrent, including ThreadPoolExecutor, a flexible thread +pool and ScheduledExecutor, which adds support for delayed and +periodic task execution. Executor can be used in conjunction with +FutureTask (which implements Runnable) to asynchronously start a +potentially long-running computation and query the FutureTask to +determine if its execution has completed. + +
The Executors class provides factory methods for all +of the types of executors provided in +java.util.concurrent. -
While the Executor framework is intended to be extensible the most -commonly used Executor will be ThreadExecutor, which can be configured -to act as all sorts of thread pools, background threads, etc. The -class is designed to be general enough to suffice for the vast -majority of usages, even sophisticated ones, yet also includes methods -and functionality that simplify routine usage.
The Locks class additionally supports trylock-designs using builtin @@ -142,45 +155,38 @@ people can make the mistake of calling cond.notify instead of cond.signal. However, they will get IllegalMonitorState exceptions if they do, so they can detect the error if they ever run the code. -
-The implementation requires VM magic to atomically suspend and release -lock. But it is unlikely to be very challenging for JVM providers, -since most layer Java monitors on top of posix condvars or similar -low-level functionality anyway. -
-Additionally, ThreadLocals will now support a means to -remove a ThreadLocals, which is needed in some thread-pool and -worker-thread designs. + +
Additionally, ThreadLocals will now support a means to remove a +ThreadLocal, which is needed in some thread-pool and worker-thread +designs.