[cvs] / jsr166 / src / main / intro.html Repository:
ViewVC logotype

Diff of /jsr166/src/main/intro.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Fri May 16 14:13:04 2003 UTC revision 1.2, Wed Jun 4 11:33:01 2003 UTC
# Line 75  Line 75 
75  java.util.Collections will be introduced into java.util. Also,  java.util.Collections will be introduced into java.util. Also,
76  although it is at the borders of being in scope of JSR-166,  although it is at the borders of being in scope of JSR-166,
77  java.util.LinkedList will be adapted to support Queue, and  java.util.LinkedList will be adapted to support Queue, and
78  a new non-thread-safe java.util.HeapPriorityQueue will be added.  a new non-thread-safe java.util.PriorityQueue will be added.
79    
80  <p> Five implementations in java.util.concurrent support the extended  <p> Five implementations in java.util.concurrent support the extended
81  BlockingQueue interface, that defines blocking versions of put and  BlockingQueue interface, that defines blocking versions of put and
# Line 98  Line 98 
98  Futures. This is supported in part by defining interface Callable, the  Futures. This is supported in part by defining interface Callable, the
99  argument/result analog of Runnable.  argument/result analog of Runnable.
100    
101  <p> While the Executor framework is intended to be extensible the most  <p> Executors provide a framework for executing Runnables.  The
102  commonly used Executor will be ThreadExecutor, which can be configured  Executor manages queueing and scheduling of tasks, and creation and
103  to act as all sorts of thread pools, background threads, etc. The  teardown of threads.  Depending on which concrete Executor class is
104  class is designed to be general enough to suffice for the vast  being used, tasks may execute in a newly created thread, an existing
105  majority of usages, even sophisticated ones, yet also includes methods  task-execution thread, or the thread calling execute(), and may
106  and functionality that simplify routine usage.  execute sequentially or concurrently.
107    
108    <p> Several concrete implementations of Executor are included in
109    java.util.concurrent, including ThreadPoolExecutor, a flexible thread
110    pool and ScheduledExecutor, which adds support for delayed and
111    periodic task execution.  Executor can be used in conjunction with
112    FutureTask (which implements Runnable) to asynchronously start a
113    potentially long-running computation and query the FutureTask to
114    determine if its execution has completed.
115    
116    <p> The <tt>Executors</tt> class provides factory methods for all
117    of the types of executors provided in
118    <tt>java.util.concurrent</tt>.
119    
120    
121  <h2>Locks</h2>  <h2>Locks</h2>
122    
123  The Lock interface supports locking disciplines that differ in  The Lock interface supports locking disciplines that differ in
124  semantics (reentrant, semaphore-based, etc), and that can be used in  semantics (reentrant, fair, etc), and that can be used in
125  non-block-structured contexts including hand-over-hand and lock  non-block-structured contexts including hand-over-hand and lock
126  reordering algorithms. This flexibility comes at the price of more  reordering algorithms. This flexibility comes at the price of more
127  awkward syntax.  Implementations include Semaphore, ReentrantMutex  awkward syntax.  Implementations include ReentrantLock and
128  FIFOSemaphore, and CountDownLatch.  FairReentrantLock.
129    
130  <p>  <p>
131  The Locks class additionally supports trylock-designs using builtin  The Locks class additionally supports trylock-designs using builtin
# Line 142  Line 155 
155  people can make the mistake of calling cond.notify instead of  people can make the mistake of calling cond.notify instead of
156  cond.signal. However, they will get IllegalMonitorState exceptions if  cond.signal. However, they will get IllegalMonitorState exceptions if
157  they do, so they can detect the error if they ever run the code.  they do, so they can detect the error if they ever run the code.
 <p>  
 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.  
158    
 <h2>Atomic variables</h2>  
159    
160  Classes AtomicInteger, AtomicLong, AtomicDouble, AtomicFloat, and  <h2>Atomic variables</h2>
 AtomicReference provide simple scalar variables supporting  
 compareAndSwap (CAS) and related atomic operations. These are  
 desparately needed by those performing low-level concurrent system  
 programming, but much less commonly useful in higher-level frameworks.  
161    
162    The atomic subpackage includes a small library of classes, including
163    AtomicInteger, AtomicLong, and AtomicReference that support variables
164    performinf compareAndSet (CAS) and related atomic operations.
165    
166  <h2>Timing</h2>  <h2>Timing</h2>
167    
168  Java has always supported sub-millisecond versions of several native  Java has always supported sub-millisecond versions of several native
169  time-out-based methods (such as Object.wait), but not methods to  time-out-based methods (such as Object.wait), but not methods to
170  actually perform timing in finer-grained units. We address this by  actually perform timing in finer-grained units. We address this by
171  introducing class Clock, which provides multiple granularities for  introducing class TimeUnit, which provides multiple granularities for
172  both accessing time and performing time-out based operations.  both accessing time and performing time-out based operations.
173    
174    
175  <h2>Synchronizers</h2>  <h2>Synchronizers</h2>
176    
177  Five classes aid common special-purpose synchronization idioms.  Five classes aid common special-purpose synchronization idioms.
178  Semaphores and FifoSemaphores are classic concurrency tools.  Latches  Semaphores and FairSemaphores are classic concurrency tools.
179  are very simple yet very common objects useful for blocking until a  CountDownLatches are very simple yet very common objects useful for
180  single signal, event, or condition holds.  CyclicBarriers are  blocking until a single signal, event, or condition holds.
181  resettable multiway synchronization points very common in some styles  CyclicBarriers are resettable multiway synchronization points very
182  of parallel programming. Exchangers allow two threads to exchange  common in some styles of parallel programming. Exchangers allow two
183  objects at a rendezvous point.  threads to exchange objects at a rendezvous point.
184    
185    
186  <h2>Concurrent Collections</h2>  <h2>Concurrent Collections</h2>
187    
188  JSR 166 will supply a few Collection implementations designed for use  JSR 166 will supply a few Collection implementations designed for use
189  in multithreaded contexts: ConcurrentHashTable, CopyOnWriteArrayList,  in multithreaded contexts: ConcurrentHashMap, CopyOnWriteArrayList,
190  and CopyOnWriteArraySet.  and CopyOnWriteArraySet.
191    
192  <h2>Uncaught Exception Handlers</h2>  <h2>Uncaught Exception Handlers</h2>
# Line 191  Line 197 
197  too inflexible in many multithreaded programs. (Note that the combination  too inflexible in many multithreaded programs. (Note that the combination
198  of features in JSR 166 make ThreadGroups even less likely to  of features in JSR 166 make ThreadGroups even less likely to
199  be used in most programs. Perhaps they will eventually be deprecated.)  be used in most programs. Perhaps they will eventually be deprecated.)
200  <p>  
201  Additionally,  ThreadLocals will now support a means to  <p> Additionally, ThreadLocals will now support a means to remove a
202  remove a ThreadLocals, which is needed in some thread-pool and  ThreadLocal, which is needed in some thread-pool and worker-thread
203  worker-thread designs.  designs.
204    
205    <hr>    <hr>
206    <address><A HREF="http://gee.cs.oswego.edu/dl">Doug Lea</A></address>    <address><A HREF="http://gee.cs.oswego.edu/dl">Doug Lea</A></address>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8