File: intro.html

package info (click to toggle)
concurrent-dfsg 1.3.4-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 976 kB
  • ctags: 2,018
  • sloc: java: 10,704; xml: 49; makefile: 12
file content (998 lines) | stat: -rw-r--r-- 58,622 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html>
<head>
  <title>
   Overview of package util.concurrent Release 1.3.4.
  </title>
</head>
<body bgcolor="#ffffee" vlink="#0000aa" link="#cc0000">
<h1>Overview of package util.concurrent Release 1.3.4.</h1>

  by <a href="http://gee.cs.oswego.edu/dl">Doug Lea</a>
  <p>

Note: Upon release of J2SE 1.5, this package enters maintenance mode:
Only essential corrections will be released. JDK1.5 package <a
href="http://gee.cs.oswego.edu/dl/concurrency-interest/index.html">
java.util.concurrent </a> includes improved, more efficient,
standardized versions of the main components in this package. Please
plan to convert your applications to use them. (A few niche classes
here have no equivalents in java.util.concurrent. They will become
part of a follow-up add-on package that will also include other
unstandardized classes.)


<p>
   This package provides standardized, efficient versions of utility
   classes commonly encountered in concurrent Java programming.  This
   code consists of implementations of ideas that have been around for
   ages, and is merely intended to save you the trouble of coding them.
   Discussions of the rationale and applications of several of these
   classes can be found in the second edition of <a href="http://gee.cs.oswego.edu/dl/cpj">Concurrent Programming in
   Java</a>.  There are also <a href="http://gee.cs.oswego.edu/dl/cpjslides/util.pdf">pdf
   slides</a> providing an overview of the package.
    </a>

  </p><p>
   The package mainly consists of implementations of a few interfaces:
   <br>
  </p><ul>
   <li><code>Sync</code> -- locks, conditions <br>
   </li><li><code>Channel</code> -- queues, buffers <br>
   </li><li><code>Barrier</code> -- multi-party synchronization <br>

   </li><li><code>SynchronizedVariable</code> -- atomic ints, refs etc <br>

   </li><li><code>java.util.Collection</code> -- collections <br>

   </li><li><code>Executor</code> -- replacements for direct use of Thread <br>
  </li></ul>
   
   Plus some utilities and frameworks that build upon these.
  <p>
   If you arrived at page<br>
   http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html
   <br>
   following links from your local documentation, please check the
   version number and get an update if you are running an outdated
   version.


</p><h2>Installation</h2>

  This package, currently declared as
  <blockquote>
   <code>EDU.oswego.cs.dl.util.concurrent</code> 
  </blockquote>

  is available in (<a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/current/concurrent.tar.gz">tar.gz
format</a>) or (<a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/current/concurrent.zip">zip
format</a>).

  <p>

  It is currently distributed in source form only. To build it, use a
   Java 1.2+ compiler to:
</p><pre>  javac -d <em>[SOMEWHERE IN YOUR CLASSPATH]</em> *.java
</pre>
  Or use this <a href="build.xml" >ant build file</a> donated by
  Travell Perkins.
  <p>
   The classes in the <code>misc</code> directory can be built the
   same way.
  </p><p>
   To use it, add to java files:
</p><pre>  import EDU.oswego.cs.dl.util.concurrent.*
</pre>
  <p> You can also create a jar or zip file of the compiled classes
   and add them to your classpath.
  </p><p>
   All <a href="http://gee.cs.oswego.edu/dl/classes/index.html"> documentation</a>
    except for this file was produced by javadoc, which
    places some index and summary files outside the current
    directory. This can cause some broken links on unpacked versions.
    You can avoid this, and integrate with your local javadoc-produced
    documentation by running:
</p><pre>  javadoc -public -d <em>[BASE OF SOME JAVADOC PATH]</em> *.java
</pre>
 
<h2>Contents</h2>
  
  <dl><dt><b><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/EDU/oswego/cs/dl/util/concurrent/Sync.html">Sync</a> </b>

   </dt><dd>Interface for classes used as exclusion, resource management,
   and related synchronization aids, supporting methods
   <code>acquire</code>, <code>attempt(msecs)</code>, and
   <code>release</code>.
    <p>
     <b>Implementations</b>

    </p></dd><dl><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Semaphore.html">Semaphore</a>
     </dt><dd>Default implementation of Semaphores, providing no 
      special ordering guarantees. 

     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaiterPreferenceSemaphore.html">WaiterPreferenceSemaphore</a>
     </dt><dd>Provides protection against barging (infinite overtaking)
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/FIFOSemaphore.html">FIFOSemaphore</a>
     </dt><dd>Provides first-in/first-out ordering
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PrioritySemaphore.html">PrioritySemaphore</a>
     </dt><dd>Prefers notifications to higher-priority threads

     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Mutex.html">Mutex</a>
     </dt><dd>Basic non-reentrant mutual exclusion lock
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ReentrantLock.html">ReentrantLock</a>
     </dt><dd>Java-style per-thread mutual exclusion lock
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Latch.html">Latch</a>
     </dt><dd>A condition that is acquirable forever more after the first release
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/CountDown.html">CountDown</a>
     </dt><dd>A condition that is acquirable forever more after the <em>nth</em> 
      release.
    </dd></dl><p>
 
    The following implementation classes do not themselves perform any
    synchronization, but serve as adaptors, glue, and extensibility
    hooks for those that do. They may also be helpful when using Syncs
    in generic before/after constructions:

    </p><dl><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/NullSync.html">NullSync</a>
     </dt><dd>A no-op implementation: acquire and attempt always succeed.
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/TimeoutSync.html">TimeoutSync</a>
     </dt><dd>Routes all calls to acquire to use attempt with a predefined
      timeout value.
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/LayeredSync.html">LayeredSync</a>
     </dt><dd>Cascades operations of two Syncs
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ObservableSync.html">ObservableSync</a>
     </dt><dd>Issues calls to SyncObservers upon each acquire and release.
    </dd></dl><p>
     <b>Related Classes</b>
    </p><dl><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/CondVar.html">CondVar</a>
     </dt><dd>Support for POSIX (pthreads) style condition variables
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/TimeoutException.html">TimeoutException</a>
     </dt><dd>A standardized time-out exception class
    </dd></dl><p></p><p>


   </p><dt><b><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ReadWriteLock.html">ReadWriteLock</a></b>
   </dt><dd>Interface for pairs of locks, one for reading, and one for
   writing.

    <p>
     <b>Implementations</b>
    </p></dd><dl><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WriterPreferenceReadWriteLock.html">WriterPreferenceReadWriteLock</a>
     </dt><dd>The most useful and common policy

     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ReentrantWriterPreferenceReadWriteLock.html">ReentrantWriterPreferenceReadWriteLock</a>
     </dt><dd>Allows multiple lock holds as well as lock downgrading by writers.

     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ReaderPreferenceReadWriteLock.html">ReaderPreferenceReadWriteLock</a>
     </dt><dd>Prefers waiting readers to waiting writers.

     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/FIFOReadWriteLock.html">FIFOReadWriteLock</a>
     </dt><dd>Prefers earliest threads (whether readers or writers).
    </dd></dl><p>

   </p><dt><b><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Barrier.html">Barrier</a></b>
   </dt><dd> Synchronization points for groups of threads. 
    <p>
     <b>Implementations</b>
    </p></dd><dl><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/CyclicBarrier.html">CyclicBarrier</a>
     </dt><dd> A tool to force multiple threads to synchronize at a given point
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Rendezvous.html">Rendezvous</a>
     </dt><dd>A cyclic barrier that does not rely on there being a
      predetermined number of participant threads, and allows threads
      to exchange information at each barrier point.
    </dd></dl><p>
     <b>Related Classes</b>
    </p><dl><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/BrokenBarrierException.html">BrokenBarrierException</a>
     </dt><dd>A standardized exception for barrier synchronization failures
    </dd></dl><p>

   </p><dt><b><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Channel.html">Channel</a></b> 

   </dt><dd> Interface for queues, buffers, conduits and pipes supporting
    blocking <code>put</code> and <code>take</code>, as well as
    timeout-based <code>offer</code> and <code>poll</code>.  To assist
    efforts to use channels with somewhat greater type safety, Channel
    is defined as a subinterface of <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Puttable.html">Puttable</a> and <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Takable.html">Takable</a>, each defining only one side of
    the channel.  Also, the <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/BoundedChannel.html">BoundedChannel</a> subinterface is used
    for channels with finite capacities.
    <p>
     <b>Implementations</b>

    </p></dd><dl><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/LinkedQueue.html">LinkedQueue</a>
     </dt><dd>An unbounded linked-list-based queue. This is usually the
     best choice for a general-purpose queue.
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/BoundedLinkedQueue.html">BoundedLinkedQueue</a>
     </dt><dd>A linked queue with a capacity bound
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/BoundedBuffer.html">BoundedBuffer</a>
     </dt><dd>An array-based bounded buffer
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Slot.html">Slot</a>
     </dt><dd>A one-slot bounded buffer. (Note that this can also
      serve as a restricted form of Synchronized variable.)
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronousChannel.html">SynchronousChannel</a>
     </dt><dd>A zero-slot CSP/Ada-style channel in which every put must
      wait for a take, and vice versa.
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/BoundedPriorityQueue.html">BoundedPriorityQueue</a>
     </dt><dd>A channel based on a Heap data structure. Elements
      must either be Comparable, or comparable using a supplied Comparator
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitFreeQueue.html">WaitFreeQueue</a>
     </dt><dd>An unbounded linked-list-based queue relying on atomic
      commits and retries rather than wait/notify.

    </dd></dl><p>
     <b>Related Classes</b>
    </p><dl><dt> <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/DefaultChannelCapacity.html">DefaultChannelCapacity</a>
     </dt><dd> A utility class that makes it easier to set default
      capacities for channels that have a capacity that must otherwise
      be set in constructors.
    </dd></dl><p>

   </p><dt><b> <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Executor.html">Executor</a></b>
   </dt><dd> Interface for objects that <code>execute</code> Runnable commands.

    <p>
     <b>Implementations</b>
    </p></dd><dl><dt> <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/DirectExecutor.html">DirectExecutor</a>
     </dt><dd> An implementation that just directly runs command
      in current thread.

     </dd><dt> <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/LockedExecutor.html">LockedExecutor</a>
     </dt><dd> An implementation that directly runs command
      within a supplied Sync lock in current thread.

     </dd><dt> <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ThreadedExecutor.html">ThreadedExecutor</a>
     </dt><dd> An implementation that runs each command
      in a new thread.

     </dd><dt> <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/QueuedExecutor.html">QueuedExecutor</a>
     </dt><dd> An implementation that queues commands for execution
      by a single background thread.

     </dd><dt> <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PooledExecutor.html">PooledExecutor</a>
     </dt><dd>A tunable, extensible thread pool class
    </dd></dl><p>
    <b>Related classes</b>
    </p><dl><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Callable.html">Callable</a>
     </dt><dd>Interface for runnable actions that return results
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/FutureResult.html">FutureResult</a>
     </dt><dd>Holder for results of actions that can be set by Callables.
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ThreadFactory.html">ThreadFactory</a>
     </dt><dd>Interface for objects that create Thread objects
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ThreadFactoryUser.html">ThreadFactoryUser</a>
     </dt><dd>Convenient base for classes that use ThreadFactories.
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ClockDaemon.html">ClockDaemon</a>
     </dt><dd> A utility for executing commands at given times,
      after given delays, or periodically with given cycles.
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/TimedCallable.html">TimedCallable</a>
     </dt><dd>Invokes a Callable in its own thread, but cancels it if not
      completed by a given maximum time.
    </dd></dl><p>

   </p><dt> <b>Fork/Join Tasks</b>

   </dt><dd> A fast lightweight task framework built upon Java threads, and
   geared for parallel computation. 

    </dd><dl><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/FJTask.html">FJTask</a>
     </dt><dd>Abstract Base class for tasks.
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/FJTaskRunnerGroup.html">FJTaskRunnerGroup</a>
     </dt><dd>Control class for running Tasks.
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/FJTaskRunner.html">FJTaskRunner</a>
     </dt><dd>Underlying specialized Thread subclass for running Tasks.
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/taskDemo/demos.html">Demos and examples</a>
     </dt><dd>A directory of sample programs that use the Task framework.
      (See also a paper on <a href="http://gee.cs.oswego.edu/dl/papers/fj.pdf">the design and
      performance of this framework</a>.)
      
    </dd></dl><p>


   </p><dt> <b>Collections</b>
   </dt><dd> Implementations of java.util.Collection and related classes that
    can help solve concurrency problems. 
    </dd><dl><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ConcurrentReaderHashMap.html">ConcurrentReaderHashMap</a>
     </dt><dd>An analog of java.util.Hashtable that allows retrievals
      during updates.

     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap.html">ConcurrentHashMap</a>
     </dt><dd>An analog of java.util.Hashtable that allows 
      both concurrent retrievals and concurrent updates.

     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/CopyOnWriteArrayList.html">CopyOnWriteArrayList</a>
     </dt><dd>A copy-on-write analog of java.util.ArrayList 
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/CopyOnWriteArraySet.html">CopyOnWriteArraySet</a>
     </dt><dd>A java.util.Set based on CopyOnWriteArrayList.
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncCollection.html">SyncCollection</a>
     </dt><dd>A wrapper class placing either Syncs or ReadWriteLocks 
      around java.util.Collection
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncSet.html">SyncSet</a>
     </dt><dd>A wrapper around java.util.Set
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncSortedSet.html">SyncSortedSet</a>
     </dt><dd>A wrapper around java.util.SortedSet
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncList.html">SyncList</a>
     </dt><dd>A wrapper around java.util.List
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncMap.html">SyncMap</a>
     </dt><dd>A wrapper around java.util.Map
     </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncSortedMap.html">SyncSortedMap</a>
     </dt><dd>A wrapper around java.util.SortedMap
     </dd><dt><b>Related classes</b>
     </dt><dd> 
      </dd><dl><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PropertyChangeMulticaster.html">PropertyChangeMulticaster</a>
       </dt><dd>A copy-on-write replacement for java.beans.PropertyChangeSupport
       </dd><dt><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/VetoableChangeMulticaster.html">VetoableChangeMulticaster</a>
       </dt><dd>A copy-on-write replacement for java.beans.VetoableChangeSupport

    </dd></dl></dl><p>

   </p><dt> <b><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedVariable.html">SynchronizedVariable</a></b>

   </dt><dd> Simple synchronized analogs of Number and Ref classes in
   java.lang. Each has a subclass that in addition to maintaining
   synchronization, also provides notifications upon value changes and
   supports guarded waits.
    <ul>
     <li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedRef.html">SynchronizedRef</a> and
      <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableRef.html">WaitableRef</a>
     </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedInt.html">SynchronizedInt</a> and
      <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableInt.html">WaitableInt</a>
     </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedLong.html">SynchronizedLong</a> and
      <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableLong.html">WaitableLong</a>
     </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedFloat.html">SynchronizedFloat</a> and
      <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableFloat.html">WaitableFloat</a>
     </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedDouble.html">SynchronizedDouble</a> and
      <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableDouble.html">WaitableDouble</a>
     </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedBoolean.html">SynchronizedBoolean</a> and
      <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableBoolean.html">WaitableBoolean</a>
     </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedByte.html">SynchronizedByte</a> and
      <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableByte.html">WaitableByte</a>
     </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedChar.html">SynchronizedChar</a> and
      <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableChar.html">WaitableChar</a>
     </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedShort.html">SynchronizedShort</a> and
      <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableShort.html">WaitableShort</a>
    </li></ul>
    <p>

    </p></dd><dt> <b><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/misc">Miscellany</a></b>

    </dt><dd> There are some classes in the <code>misc</code> directory
    that might be of interest but aren't really part of this
    package. They include:
    <ul>
     <li> <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/misc/SynchronizationTimer.html">SynchronizationTimer</a>,
    that can be used to experiment with different synchronization
    schemes. It requires Swing (JFC). (To run it, compile misc/*.java, and
    then java EDU.oswego.cs.dl.util.concurrent.misc.SynchronizationTimer .)
     </li><li>An immutable <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/misc/Fraction.html">Fraction</a> class.
     </li><li>Joe Bowbeer's 
      <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/misc/SwingWorker.html">SwingWorker</a>
      class,  discussed in his
      <a href="http://java.sun.com/products/jfc/tsc/articles/threads/threads3.html#swing-worker">"The Last Word in Swing Threads"</a> article.
     </li><li>Other implementations of the above interfaces that 
      are not valuable or stable enough to include here.
    </li></ul>
    If you would like to contribute other related classes, demos,
    usage examples, etc., please contact me. People frequently write
    me asking for such things.
  </dd></dl>



  <h2>Notes</h2>
  <ul>

   <li>All classes are released to the public domain and may be used
   for any purpose whatsoever without permission or
   acknowledgment. Portions of the CopyOnWriteArrayList and
   ConcurrentReaderHashMap classes are adapted from Sun JDK source
   code. These are copyright of Sun Microsystems, Inc, and are used
   with their kind permission,  <a href="../sun-u.c.license.pdf" >
   as described in this license</a>.

    <p>

   </p></li><li>Version numbers for this package are of the form
   Major.minor.fix. Fix numbers reflect corrections of small errors
   and release problems (missing files, portability enhancements,
   etc). Minor numbers are incremented on additions. Major numbers
   reflect serious incompatibilities and restructurings.  I may also
   sometimes make minor updates to this page and related files before
   packaging up all files as a release. During early releases of added
   classes, I expect to make frequent small changes and releases, as
   soon as problems are noticed. Other ongoing changes are reflected
   in individual source files, that you can get individual updates on
   if you need them.
    <p>

   </p></li><li>Most of the interfaces and classes contain usage notes and
   examples. I hope to add more.  Please send suggestions to <a href="mailto:dl@cs.oswego.edu">dl@cs.oswego.edu</a>
    <p>

   </p></li><li> You can get e-mail notification when this page (or any other
   URL for that matter) changes via <a href="http://www.changedetection.com/">ChangeDetecion.com</a> or
   other such services.
    <p>

   </p></li><li>These have been tested with JDK1.2+, but all except those
   relying on JDK1.2 java.util.collections (i.e., BoundedPriorityQueue
   and CopyOnWriteArrayList) should also work with
   JDK1.1.x. Workarounds exist for those relying on collections by
   obtaining the <a href="http://java.sun.com/beans/infobus/#DOWNLOAD_COLLECTIONS">backported
   1.1 versions</a> and follow the <a href="http://java.sun.com/beans/infobus/collectionsreadme.html">instructions.
</a>
  You can then use "sed" or somesuch to replace all occurrences of
   "java.util." with "com.sun.java.util".  Also, I'm told that some
   1.1 compilers have some problems compiling some of the blank finals
   used. And while the 1.1port of collections also includes a
   1.2-compliant version of java.util.Random, you can alternatively
   use the following version contributed by Andrew Cooke:

<pre>package EDU.oswego.cs.dl.util.concurrent ;

class Random extends java.util.Random {

� public Random() {super() ;}
� public Random(long l) {super(l) ;}

� public int nextInt(int i) {
��� int ii = (int)(i * nextDouble()) ;
��� if (ii &gt;= i) {ii = i-1 ;} // should (almost?) never happen...
��� return ii ;
� }

}
</pre>
    <p>

    Konstantin L�ufer has generously placed a version compiled for JDK1.1 
    at <a href="http://www.cs.luc.edu/%7Elaufer/courses/337/handouts/concurrent11.zip">http://www.cs.luc.edu/~laufer/courses/337/handouts/concurrent11.zip</a>
    </p><p>

   </p></li><li>Many of these classes are adapted from versions described in
   the second edition of <a href="http://gee.cs.oswego.edu/dl/cpj">
   Concurrent Programming in Java</a> (CPJ) and examples from
   tutorials based on the book.
    <p>

   </p></li><li>Several classes were developed with the help of <a href="http://www.mri.mq.edu.au/%7Edholmes">David Holmes</a> and <a href="http://ourworld.compuserve.com/homepages/jozart/">Joe
   Bowbeer</a>. Many have benefited from discussions and comments from
   other people, including Tom Cargill, Tom May, Wayne Boucher,
   Matthias Ernst, Michael Banks, Richard Emberson, Piotr Kaminski,
   Bill Pugh, Peter Buhr, Alexander Terekhov, Alex Yiu-Man Chan,
   Andrew Kelly, Markos Kapes, Boris Dimitshteyn.

  </li></ul>
   
<h2>Some Questions and Answers about Design and Implementation</h2>

  <dl><dt>Isn't it annoying that so many methods throw InterruptedException?

   </dt><dd> Maybe, but synchronization points are among the best points to
   detect interruption. Since this a package of synchronization aids,
   most methods detect interruption as early and often as reasonable
   to help avoid becoming stuck when the thread should be stopping
   anyway. In particular, interruption is normally checked before
   trying to obtain locks used in Syncs, which minimizes the
   vulnerability window for getting stuck when an activity is
   cancelled.  (Between this and the finite durations that internal
   java synchronization locks are held in Sync classes, it is normally
   impossible for threads to become stuck waiting on internal locks
   when they have been interrupted.)  These classes fail cleanly upon
   interruption. Normally, all you need to do upon catching an
   InterruptedException is either rethrow it, or clean up and then set
    <code>Thread.currentThread().interrupt()</code> to propagate
    status.
    <p>

  If you need to invoke such methods even when the thread is in an
  interrupted state (for example, during recovery actions) you can do:
</p><pre>  void quietlyAcquire(Sync sync) {
    boolean wasInterrupted = Thread.interrupted(); // record and clear
    for (;;) {
      try {
        sync.acquire();   // or any other method throwing InterruptedException
        break;
      }
      catch (InterruptedException ex) { // re-interrupted; try again
        wasInterrupted = true;
      }
    }
    if (wasInterrupted) {              // re-establish interrupted state
      Thread.currentThread().interrupt();
    }
 }
</pre>
    <p>
     The heavy use of InterruptedException makes it possible to write
     very responsive and robust code, at the expense of forcing class
     and method authors to contemplate possible exception handling
     actions at each interruption (and time-out) point. See the <a href="http://gee.cs.oswego.edu/dl/cpj/cancel.html">CPJ supplement
     page on cancellation</a> for more discussion of some associated
     design issues.

    </p><p>

   </p></dd><dt>Why is there so much near-duplication of code?

   </dt><dd> You'd think there would be some nice way to unify more classes
   to share significant aspects of synchronization mechanics.  But
   standard lines of attack for doing this turn out unsatisfying at
   best.  The main reason for creating this package is that even
   simple classes involving concurrency control mechanics are
   sometimes tedious, repetitive, tricky, and/or error-prone to write,
   so it is nice to have them written already.
    <p>

   </p></dd><dt>Why do most methods return false/null after timeouts rather
   than throwing TimeoutException?

   </dt><dd> Because I think it would normally be misleading to throw
   exceptions. In Java, timeout arguments merely provide hints about
   when threads should be woken to check out the state of the world.
   Due to scheduling delays, threads need not resume immediately after
   their timeouts elapse, so real-time-based timeout exceptions would
   not be appropriate. The simplest course of action is just to report
   whether the condition the thread is waiting for does hold after
   waiting for at least this period. Returning false/null is not
   necessarily an exceptional situation.  In those classes where it is
   exceptional (in some classes layered on top of basic Syncs and
   Channels) failed timeouts are converted to TimeoutExceptions. You
   can do the same in your own code using these classes. As of version
   1.1.0, this is made simpler to carry out, since TimeoutException
   now extends InterruptedException.
    <p>

   </p></dd><dt>Why aren't there deadlock-detecting Syncs or related classes for
    detecting lockups?

   </dt><dd>Because timeouts appear to be more generally useful. In fact,
   it is hard to imagine contexts where deadlock detection is a better
   option than timeouts in Java. A timeout can serve as a heuristic
   deadlock detection device, but can also serve to detect stalled IO,
   network partitions, and related failures. Program responses to
   deadlock are hardly ever different than responses to these other
   failures. So, it is usually a good idea to use timeouts as
   general-purpose heuristic detectors for all liveness problems,
   subdividing responses to particular failures (for example, by
   subclassing TimeoutException), only when necessary. Additionally,
   there are two problems with implementing deadlock-detecting Syncs
   that make them unattractive choices: (1) They can only detect
   deadlock among uses of the particular Sync classes being used, so
   cannot deal with deadlocks involving builtin synchronization (2)
   lock cycle detection adds overhead to each lock acquire and
   release.  The main context in which deadlock detection would be
   useful is during program debugging, but here, it would be better to
   rely on specially instrumented JVMs. (Note that it is easy to
   transform code that relies on acquire to instead use timeouts via
   the TimeoutSync class. This can be a good way to make code more
   robust with respect to locking problems.)
    <p>

   </p></dd><dt> Why isn't there a distinct Lock or MutualExclusionLock interface?

   </dt><dd> Because many objects implementing the Sync interface can be
   used as locks if they are in appropriate states, but not all of
   them can always be used as such. Additionally, there are several
   senses of mutual exclusion (for example, reentrant vs
   non-reentrant, full vs read/write).  Since there is no way to say
   that a given class only sometimes conforms to the intended sense of
   a subinterface, the flexibility and simplicity of only using a
   single principle interface (Sync) for all such types outweighs the
   potential advantages of finer-grained categorizations.
    <p>

    </p></dd><dt> Why do so many methods perform notify within InterruptedException 
    catches?
    
    </dt><dd> Because when notify's and interrupt's happen at about the
    same time, JVMs are currently free to treat them independently, so
    a notified thread could return out as interrupted.  In classes
    using notify rather than notifyAll, the extra notify in the catch
    clause is a safeguard to ensure that a non-interrupted thread, if
    one exists, will be notified. See my CPJ book for more details.
    <p>

   </p></dd><dt> How efficient are these classes?

   </dt><dd> Most of these classes use the most efficient implementations I
   know of for general-purpose concurrent programming, yet also try to
   be conservative about differences across common JVMs, and to
   minimize surprising limitations and side-effects.  This is always a
   bit of a trade-off though. Some could be made more efficient at the
   cost of supporting fewer operations, relying on properties of
   particular JVMs, or having more usage constraints. Conversely some
   could support more contexts or operations, or simpler usage, at the
   cost of efficiency.

    <p>

     You will almost surely trade off some cost in efficiency for the
     flexibility of using Syncs and classes built out of them rather
     than built-in <code>synchronized</code> method/block locks. On
     some JVMs the cost is very low. (You can check approximate impact
     using <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/misc/SynchronizationTimer.html">SynchronizationTimer</a>.)
     But, while Java VMs are getting much faster about
     <code>synchronized</code> locks, most of the classes in this
     package rely heavily on wait/notify and interruption mechanics,
     which are not currently as heavily optimized. (Also, they seem to
     be subject to more variation in behavior than other Java
     constructs.)  Class implementations generally ignore the fact
     that the JVM overhead for these operations might be slower than
     you'd wish they were on some JVMs.

    </p><p>

   </p></dd><dt> Are there any programming errors?

   </dt><dd> I don't believe so. Please try to prove me wrong. If you are
    the first person to discover a particular coding error in a
    current release, I'll send you a free copy of my CPJ book.  Also,
    I would greatly appreciate receiving any sample applications that
    can help serve as useful tests, so as to build up a more extensive
    test suite.
    <p>

   </p></dd><dt> Should I worry about the use of <tt>volatile</tt> in these
   classes?

   </dt><dd> Many JVMs are known not to correctly implement the JLS spec
   (either the original or the upcoming revision) for volatile fields.
   However, volatiles are used in conservative ways in this package,
   that don't encounter problems at least on recent Sun and IBM JVMs.

    <p>


   </p></dd><dt> Why do classes declare practically all internal matters as
    <code>protected</code>?

   </dt><dd> While probably 99% of the uses of these classes should
   just treat them as black-box utility components, these classes are
   intended to be extensible, to allow more specialized
   synchronization control to be customized for different
   applications.  However, it takes a lot of expertise to extend or
   modify most of them via subclassing. If you do try to extend,
   consider first running javadoc on these classes with switches that
   generate documentation for non-public classes, methods, and
   fields. Also, if you encounter problems making subclasses due to
   inflexibility in base classes, I'd like to hear about it, so I can
   try to come up with a better factoring.
    <p>

    </p></dd><dt> Why aren't most classes <code>Serializable</code>?
    </dt><dd> I don't know what to about this. On one hand, it wouldn't
    make sense in a lot of contexts to serialize, say, a Semaphore. On
    the other hand, maybe it ought not be precluded.  Opinions
    welcome. One suggestion is to only declare as serializable those
    classes specifically designed to work with other persistent or
    distributed concurrency control frameworks. (No such classes
    currently exist.)
    <p>

    </p></dd><dt> Why didn't using ReadWriteLocks instead of plain
    synchronization speed up my program?
    </dt><dd> ReadWriteLocks have more overhead than do synchronized
    methods or blocks.  They pay off only when the code being
    protected by the locks is time-consuming, and when readers
    outnumber writers, so the increased concurrency outweighs the
    increased bookkeeping.  (They are also sometimes of use in
    avoiding deadlock.)  Special-purpose data structures such as the
    Concurrent hash tables in this package have far less overhead, and
    typically much better performance than placing ReadWriteLocks
    around most sequential data structures.
    <p>

   </p></dd><dt>Are instances of these classes externally lockable -- that is,
    can I control object <code>x</code> via <code>synchronized(x) {
    ... }</code> ?
   </dt><dd> Not necessarily. Some objects rely on their own
    synchronization locks, some rely on internal locks, some rely on
    other synchronization objects.  So in general, you cannot know the
    effect of <code>synchronized(x)</code> and so probably ought never
    use it.
    <p>

   </p></dd><dt> Why do I get strict alternation of producer and consumer
    threads when using buffered channels such as BoundedBuffer?

   </dt><dd> Although it depends on details of JVM scheduling policies,
   this is the most likely result when producer and consumer actions
   both take about the same amount of time to process, since both put
   and take operations signal waiting threads. The point of buffering
   is to decouple producers and consumers when one or the other is
   bursty, so temporarily gets ahead or behind its average rate. (If
   the average rates of producers and consumers are not approximately
   equal, buffering is not of much use.) While it again relies on JVM
   details, unbounded buffers (for example LinkedQueue) typically do
   not result in alternation, allowing producers to get arbitrarily
   ahead of consumers, at the expense of potential resource
   exhaustion.

    <p>

   </p></dd><dt>Why aren't there timeout methods supporting nanosecond
   arguments?
   </dt><dd> Because most JVMs only time to millisecond accuracy (at best)
    anyway.  If this changes, nanosecond versions could be added.
    <p>

   </p></dd><dt>Why is the package named <code>EDU</code>..., not <code>edu</code>?
   </dt><dd>I've been using the initially-recommended upper-case EDU prefix
    for a long time for my packages. It would take a lot of busy-work
    to convert everything to the now-recommended practice of using
    lower-case. Someday I will do this though.

    <p>


   </p></dd><dt> Why do you use those ugly underscores?!
   </dt><dd> Because otherwise I tend to make coding mistakes surrounding
   instance variables versus local variables. See my <a href="http://gee.cs.oswego.edu/dl/html/javaCodingStd.html"> Sample
   Java Coding Standard</a>. But I think I've decided to reform :-)
   Newer classes use a more JDK-like set of conventions.
    <p>

   </p></dd><dt> Why don't you supply Ant build scripts? Or Jar files?  Or
   rearrange into separate src/doc/lib directories? Or CVS? Or ...?
   </dt><dd> There are too many different ways people would like to use
   this package for me to keep up with.  So I release it in a simple
   way that should be very easy to adapt to all sorts of different
   needs and conventions.
   <p>

   </p></dd><dt> Is this code in any way tied to Sun JDK releases?

   </dt><dd> No.  The acknowlegdment to Sun Labs in headers recognizes
   their generous donations of equipment and release time support that
   help make this work possible. But this software is not in any way
   tied to Sun. However, work is underway to create a JSR with the
   goal of including a similar package in a future JDK release.

    <p>

   </p></dd><dt>Can I use this code in commercial products?
   </dt><dd>Yes. Many people appear to do so.
    <p>

   </p></dd><dt>Do I need a license to use it? Can I get one?
   </dt><dd>No!
    <p>

   </p></dd><dt>Can I get commercial support for this package?
   </dt><dd>I don't know of any place to get it. I can't think of any
    technical reason that you'd want it.
    <p>

  </p></dd></dl>


<h2>Sources</h2>

  <ul>

    <li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Barrier.java">Barrier.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/BoundedBuffer.java">BoundedBuffer.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/BoundedChannel.java">BoundedChannel.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/BoundedLinkedQueue.java">BoundedLinkedQueue.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/BoundedPriorityQueue.java">BoundedPriorityQueue.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/BrokenBarrierException.java">BrokenBarrierException.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Callable.java">Callable.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Channel.java">Channel.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ClockDaemon.java">ClockDaemon.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap.java">ConcurrentHashMap.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ConcurrentReaderHashMap.java">ConcurrentReaderHashMap.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/CondVar.java">CondVar.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/CopyOnWriteArrayList.java">CopyOnWriteArrayList.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/CopyOnWriteArraySet.java">CopyOnWriteArraySet.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/CountDown.java">CountDown.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/CyclicBarrier.java">CyclicBarrier.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/DefaultChannelCapacity.java">DefaultChannelCapacity.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/DirectExecutor.java">DirectExecutor.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Executor.java">Executor.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/FIFOReadWriteLock.java">FIFOReadWriteLock.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/FIFOSemaphore.java">FIFOSemaphore.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/FJTask.java">FJTask.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/FJTaskRunner.java">FJTaskRunner.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/FJTaskRunnerGroup.java">FJTaskRunnerGroup.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Heap.java">Heap.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Latch.java">Latch.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/LayeredSync.java">LayeredSync.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/LinkedNode.java">LinkedNode.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/LinkedQueue.java">LinkedQueue.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/LockedExecutor.java">LockedExecutor.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Mutex.java">Mutex.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/NullSync.java">NullSync.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ObservableSync.java">ObservableSync.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PooledExecutor.java">PooledExecutor.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PrioritySemaphore.java">PrioritySemaphore.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PropertyChangeMulticaster.java">PropertyChangeMulticaster.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Puttable.java">Puttable.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/QueuedExecutor.java">QueuedExecutor.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/QueuedSemaphore.java">QueuedSemaphore.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ReadWriteLock.java">ReadWriteLock.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ReaderPreferenceReadWriteLock.java">ReaderPreferenceReadWriteLock.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ReentrantLock.java">ReentrantLock.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ReentrantWriterPreferenceReadWriteLock.java">ReentrantWriterPreferenceReadWriteLock.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Rendezvous.java">Rendezvous.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Semaphore.java">Semaphore.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SemaphoreControlledChannel.java">SemaphoreControlledChannel.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Slot.java">Slot.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Sync.java">Sync.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncCollection.java">SyncCollection.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncList.java">SyncList.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncMap.java">SyncMap.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncSet.java">SyncSet.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncSortedMap.java">SyncSortedMap.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SyncSortedSet.java">SyncSortedSet.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedRef.java">SynchronizedRef.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedInt.java">SynchronizedInt.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedLong.java">SynchronizedLong.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedFloat.java">SynchronizedFloat.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedDouble.java">SynchronizedDouble.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedBoolean.java">SynchronizedBoolean.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedByte.java">SynchronizedByte.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedChar.java">SynchronizedChar.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedShort.java">SynchronizedShort.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronizedVariable.java">SynchronizedVariable.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/SynchronousChannel.java">SynchronousChannel.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Takable.java">Takable.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ThreadedExecutor.java">ThreadedExecutor.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ThreadFactory.java">ThreadFactory.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/ThreadFactoryUser.java">ThreadFactoryUser.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/TimedCallable.java">TimedCallable.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/TimeoutException.java">TimeoutException.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/TimeoutSync.java">TimeoutSync.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/VetoableChangeMulticaster.java">VetoableChangeMulticaster.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableRef.java">WaitableRef.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableInt.java">WaitableInt.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableLong.java">WaitableLong.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableFloat.java">WaitableFloat.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableDouble.java">WaitableDouble.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableBoolean.java">WaitableBoolean.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableByte.java">WaitableByte.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableChar.java">WaitableChar.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitableShort.java">WaitableShort.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaitFreeQueue.java">WaitFreeQueue.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WaiterPreferenceSemaphore.java">WaiterPreferenceSemaphore.java</a>
    </li><li><a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/WriterPreferenceReadWriteLock.java">WriterPreferenceReadWriteLock.java</a>

  </li></ul>

<h2>History</h2>

  <ul>
   <li> 10Jul1998 1.0
   </li><li> 11Jul1998 1.0.1: removed .class files from release, Fixed
    documentation error, included Barrier interface.
   </li><li>12Jul1998 1.0.2: Fixed return value for swap; fixed documentation errors.
   </li><li>15Jul1998 1.0.3: Fixed more documentation errors; re-fixed swap; 
    other cosmetic improvements.
   </li><li>18Jul1998 1.0.4: Simplified some classes by removing
    some alleged optimizations that do not actually help on some platforms;
    improved SynchronizationTimer; added some documentation.
   </li><li> 1Sep1998 version 1.1.0:
    <ul>
     <li>Replace SynchronousChannel algorithm with fairer, more scalable one
     </li><li>TimeoutException now extends InterruptedException
     </li><li>Replace int counters with longs to avoid wrapping.
     </li><li>new LayeredSync class
     </li><li>new ObservableSync class
     </li><li>new NullSync class
     </li><li>new TimeoutSync class
     </li><li>new SyncCollection classes
     </li><li>new ReentrantWriterPreferenceReadWriteLock class
     </li><li>peek added to Channel
     </li><li>new ClockDaemon class
     </li><li>Refactorings to standardize usage of thread factories
     </li><li>removed reliance on ThreadGroups in PooledExecutor
    </li></ul>
    </li><li> 7Jan 1999 Version 1.2 
    <ul>
     <li> ClockDaemon.shutdown allows immediate restart
     </li><li> Callable.call throws Throwable, not Exception
     </li><li> new Task, TaskRunner, TaskRunnerGroup classes
     </li><li> new taskDemo subdirectory
    </li></ul>
   </li><li>13Jan1999 version 1.2.1
    <ul>
     <li>Minor cleanup of Task classes
    </li></ul>

   </li><li> 17Jan1999 version 1.2.2:
    <ul>
     <li> Simplify Task classes; improve documentation;
      add priority control; they are no longer labeled as `preliminary'.
     </li><li> More sample programs in taskDemos
     </li><li> Add warnings about reentrancy to RW locks
     </li><li> Callable throws Exception again, but FutureResult handles Throwables
    </li></ul>

   </li><li>25Mar1999 version 1.2.3
    <ul>
     <li>PooledExecutor -- allow pool to shrink when max size decreased
     </li><li>Task -- add reset, array-based operations
     </li><li>new PropertyChangeMulticaster, VetoableChangeMulticaster
    </li></ul>

   </li><li>21may1999 version 1.2.4
    <ul>
     <li>PooledExecutor -- allow supplied Channel in constructor;
      new methods createThreads(), drain()
     </li><li> Task, TaskRunner, TaskRunnerGroup renamed to
         FJTask, FJTaskRunner, FJTaskRunnerGroup to avoid
         clashes with commonly used class name of `Task'.
     </li><li>Misc documentation improvements
     </li><li>WriterPreferenceReadWriteLock -- fix to notify on interrupt
    </li></ul>

   </li><li>23oct1999 version 1.2.5
    <ul>
     <li>PooledExecutor -- add minimumPoolSize settings
     </li><li>LU in taskDemo
     </li><li>Minor improvements to LinkedQueue, FJTaskRunner
    </li></ul>


   </li><li>29dec1999 version 1.2.6
    <ul>
     <li>FJTaskRunner -- now works on MP JVMs that do not
      correctly implement read-after-write of volatiles.
     </li><li>added TimedCallable
    </li></ul>


   </li><li>12jan2001 version 1.3.0
    <ul>
     <li> new ConcurrentHashMap, ConcurrentReaderHashMap classes.
     </li><li>BoundedLinkedQueue.setCapacity: immediately reconcile permits.
     </li><li>ReentrantWriterPreferenceReadWriteLock: Both readers and writers
      are now reentrant.
     </li><li>PooledExecutor: policy now an interface, not abstract class.
     </li><li>QueuedExecutor, PooledExecutor: new shutdown methods
    </li></ul>

   </li><li>2dec2001 Version 1.3.1
    <ul>
     <li> PooledExecutor: declare inner class constructor as protected,
      more flexible shutdown support, blocked exec handlers can
      throw InterruptedExceptions.
     </li><li>Ensure all serialization methods are <tt>private</tt>.
     </li><li>Joe Bowbeer's SwingWorker now in misc
     </li><li> Improvements to ConcurrentHashMap, ConcurrentReaderHashMap,
     FIFOReadWriteLock, ReentrantWriterPreferenceReadWriteLock.
     WaitFreeQueue, SynchronousChannel.
    </li></ul>

   </li><li>12dec2002 Version 1.3.2
    <ul>
     <li> SemaphoreControlledChannel - fix constructor to
     use longs, not ints.
     </li><li>Improvements to Heap.
     </li><li>Fix interference check in ConcurrentReaderHashMap.
     </li><li> ReentrantWriterPreferenceReadWriteLock throw IllegalStateException
      instead of NullPointerException on release errors.
    </li></ul>
    <li> 20feb2004 Version 1.3.3
    <ul>
      <li> PooledExecutor: Create new threads if needed when terminating.
      (Thanks to Bruno Dumon), and replace dying thread if it is only one.
      <li> Clarify by-permission wordings.
      <li> Fix synchronization scope error in SynchronizedLong (Thanks to
      Aaron Greenhouse.)
    </ul>
    <li> 20may2004 Version 1.3.4
    <ul>
      <li> WaitableX: notify on bitwise operations
      <li> QueuedExecutor: can shutdown before thread created (thanks to
      Wolfgang Hoschek)
    </ul>
   </li><li>Coming attractions
    <ul>
     <li> This package is entering maintenance mode because improved
      versions of main functionality are part of JDK1.5 java.util.concurrent
      via <a href="http://gee.cs.oswego.edu/dl/concurrency-interest/index.html">
    JSR 166. </a>
     </li>
    </ul>
  </li></ul>

</body></html>