EDU.oswego.cs.dl.util.concurrent |
|
Java Source File Name | Type | Comment |
Barrier.java | Interface | Barriers serve
as synchronization points for groups of threads that
must occasionally wait for each other. |
BoundedBuffer.java | Class | Efficient array-based bounded buffer class.
Adapted from CPJ, chapter 8, which describes design.
[ Introduction to this package. |
BoundedChannel.java | Interface | A channel that is known to have a capacity, signifying
that put operations may block when the
capacity is reached. |
BoundedLinkedQueue.java | Class | A bounded variant of
LinkedQueue
class. |
BoundedPriorityQueue.java | Class | A heap-based priority queue, using semaphores for
concurrency control. |
BrokenBarrierException.java | Class | |
Callable.java | Interface | Interface for runnable actions that bear results and/or throw Exceptions.
This interface is designed to provide a common protocol for
result-bearing actions that can be run independently in threads,
in which case
they are ordinarily used as the bases of Runnables that set
FutureResults
[ Introduction to this package. |
Channel.java | Interface | Main interface for buffers, queues, pipes, conduits, etc.
A Channel represents anything that you can put items
into and take them out of. |
ClockDaemon.java | Class | A general-purpose time-based daemon, vaguely similar in functionality
to common system-level utilities such as at
(and the associated crond) in Unix.
Objects of this class maintain a single thread and a task queue
that may be used to execute Runnable commands in any of three modes --
absolute (run at a given time), relative (run after a given delay),
and periodic (cyclically run with a given delay).
All commands are executed by the single background thread. |
CondVar.java | Class | This class is designed for fans of POSIX pthreads programming.
If you restrict yourself to Mutexes and CondVars, you can
use most of your favorite constructions. |
CountDown.java | Class | A CountDown can serve as a simple one-shot barrier. |
CyclicBarrier.java | Class | A cyclic barrier is a reasonable choice for a barrier in contexts
involving a fixed sized group of threads that
must occasionally wait for each other. |
DefaultChannelCapacity.java | Class | A utility class to set the default capacity of
BoundedChannel
implementations that otherwise require a capacity argument
See Also: BoundedChannel See Also: [ Introduction to this package. |
DirectExecutor.java | Class | An implementation of Executor that
invokes the run method of the supplied command and then returns.
[ Introduction to this package. |
Executor.java | Interface | Interface for objects that execute Runnables,
as well as various objects that can be wrapped
as Runnables.
The main reason to use Executor throughout a program or
subsystem is to provide flexibility: You can easily
change from using thread-per-task to using pools or
queuing, without needing to change most of your code that
generates tasks.
The general intent is that execution be asynchronous,
or at least independent of the caller. |
FIFOReadWriteLock.java | Class | This class implements a policy for reader/writer locks in which
threads contend in a First-in/First-out manner for access (modulo
the limitations of FIFOSemaphore, which is used for queuing). |
FIFOSemaphore.java | Class | A First-in/First-out implementation of a Semaphore.
Waiting requests will be satisified in
the order that the processing of those requests got to a certain point.
If this sounds vague it is meant to be. |
FJTask.java | Class | Abstract base class for Fork/Join Tasks.
FJTasks are lightweight, stripped-down analogs of Threads. |
FJTaskRunner.java | Class | Specialized Thread subclass for running FJTasks.
Each FJTaskRunner keeps FJTasks in a double-ended queue (DEQ).
Double-ended queues support stack-based operations
push and pop, as well as queue-based operations put and take.
Normally, threads run their own tasks. |
FJTaskRunnerGroup.java | Class | A stripped down analog of a ThreadGroup used for
establishing and managing FJTaskRunner threads.
ThreadRunnerGroups serve as the control boundary separating
the general world of normal threads from the specialized world
of FJTasks. |
FutureResult.java | Class | A class maintaining a single reference variable serving as the result
of an operation. |
Heap.java | Class | A heap-based priority queue, without any concurrency control
(i.e., no blocking on empty/full states).
This class provides the data structure mechanics for BoundedPriorityQueue.
The class currently uses a standard array-based heap, as described
in, for example, Sedgewick's Algorithms text. |
Latch.java | Class | A latch is a boolean condition that is set at most once, ever.
Once a single release is issued, all acquires will pass.
Sample usage. Here are a set of classes that use
a latch as a start signal for a group of worker threads that
are created and started beforehand, and then later enabled.
class Worker implements Runnable {
private final Latch startSignal;
Worker(Latch l) { startSignal = l; }
public void run() {
startSignal.acquire();
doWork();
}
void doWork() { ... |
LayeredSync.java | Class | A class that can be used to compose Syncs.
A LayeredSync object manages two other Sync objects,
outer and inner. |
LinkedNode.java | Class | |
LinkedQueue.java | Class | A linked list based channel implementation.
The algorithm avoids contention between puts
and takes when the queue is not empty. |
LockedExecutor.java | Class | An implementation of Executor that
invokes the run method of the supplied command within
a synchronization lock and then returns.
[ Introduction to this package. |
Mutex.java | Class | A simple non-reentrant mutual exclusion lock.
The lock is free upon construction. |
NullSync.java | Class | A No-Op implementation of Sync. |
PooledExecutor.java | Class | A tunable, extensible thread pool class. |
PrioritySemaphore.java | Class | A Semaphore that grants requests to threads with higher
Thread priority rather than lower priority when there is
contention. |
PropertyChangeMulticaster.java | Class | This class is interoperable with java.beans.PropertyChangeSupport,
but relies on a streamlined copy-on-write scheme similar to
that used in CopyOnWriteArrayList. |
Puttable.java | Interface | This interface exists to enable stricter type checking
for channels. |
QueuedExecutor.java | Class | An implementation of Executor that queues incoming
requests until they can be processed by a single background
thread.
The thread is not actually started until the first
execute request is encountered. |
QueuedSemaphore.java | Class | Abstract base class for semaphores relying on queued wait nodes.
[ Introduction to this package. |
ReaderPreferenceReadWriteLock.java | Class | A ReadWriteLock that prefers waiting readers over
waiting writers when there is contention. |
ReadWriteLock.java | Interface | ReadWriteLocks maintain a pair of associated locks.
The readLock may be held simultanously by multiple
reader threads, so long as there are no writers. |
ReentrantLock.java | Class | A lock with the same semantics as builtin
Java synchronized locks: Once a thread has a lock, it
can re-obtain it any number of times without blocking.
The lock is made available to other threads when
as many releases as acquires have occurred.
[ Introduction to this package. |
ReentrantWriterPreferenceReadWriteLock.java | Class | A writer-preference ReadWriteLock that allows both readers and
writers to reacquire
read or write locks in the style of a ReentrantLock.
Readers are not allowed until all write locks held by
the writing thread have been released.
Among other applications, reentrancy can be useful when
write locks are held during calls or callbacks to methods that perform
reads under read locks.
Sample usage. |
Rendezvous.java | Class | A rendezvous is a barrier that:
- Unlike a CyclicBarrier, is not restricted to use
with fixed-sized groups of threads.
Any number of threads can attempt to enter a rendezvous,
but only the predetermined number of parties enter
and later become released from the rendezvous at any give time.
- Enables each participating thread to exchange information
with others at the rendezvous point.
|
Semaphore.java | Class | Base class for counting semaphores.
Conceptually, a semaphore maintains a set of permits.
Each acquire() blocks if necessary
until a permit is available, and then takes it. |
SemaphoreControlledChannel.java | Class | Abstract class for channels that use Semaphores to
control puts and takes.
[ Introduction to this package. |
Slot.java | Class | A one-slot buffer, using semaphores to control access.
Slots are usually more efficient and controllable than using other
bounded buffers implementations with capacity of 1.
Among other applications, Slots can be convenient in token-passing
designs: Here. |
Sync.java | Interface | Main interface for locks, gates, and conditions.
Sync objects isolate waiting and notification for particular
logical states, resource availability, events, and the like that are
shared across multiple threads. |
SyncCollection.java | Class | SyncCollections wrap Sync-based control around java.util.Collections.
They are similar in operation to those provided
by java.util.Collection.synchronizedCollection, but have
several extended capabilities.
The Collection interface is conceptually broken into two
parts for purposes of synchronization control. |
SynchronizedBoolean.java | Class | A class useful for offloading synch for boolean instance variables.
[ Introduction to this package. |
SynchronizedByte.java | Class | A class useful for offloading synch for byte instance variables.
[ Introduction to this package. |
SynchronizedChar.java | Class | A class useful for offloading synch for char instance variables.
[ Introduction to this package. |
SynchronizedDouble.java | Class | A class useful for offloading synch for double instance variables.
[ Introduction to this package. |
SynchronizedFloat.java | Class | A class useful for offloading synch for float instance variables.
[ Introduction to this package. |
SynchronizedInt.java | Class | A class useful for offloading synch for int instance variables.
[ Introduction to this package. |
SynchronizedLong.java | Class | A class useful for offloading synch for long instance variables.
[ Introduction to this package. |
SynchronizedRef.java | Class | A simple class maintaining a single reference variable that
is always accessed and updated under synchronization.
[ Introduction to this package. |
SynchronizedShort.java | Class | A class useful for offloading synch for short instance variables.
[ Introduction to this package. |
SynchronizedVariable.java | Class | Base class for simple, small classes
maintaining single values that are always accessed
and updated under synchronization. |
SynchronousChannel.java | Class | A rendezvous channel, similar to those used in CSP and Ada. |
SyncList.java | Class | SyncLists wrap Sync-based control around java.util.Lists.
They support the following additional reader operations over
SyncCollection: hashCode, equals, get, indexOf, lastIndexOf,
subList. |
SyncMap.java | Class | SyncMaps wrap Sync-based control around java.util.Maps.
They operate in the same way as SyncCollection.
Reader operations are
- size
- isEmpty
- get
- containsKey
- containsValue
- keySet
- entrySet
- values
Writer operations are:
[ Introduction to this package. |
SyncSet.java | Class | SyncSets wrap Sync-based control around java.util.Sets.
They support two additional reader operations than do
SyncCollection: hashCode and equals.
[ Introduction to this package. |
SyncSortedMap.java | Class | SyncSortedMaps wrap Sync-based control around java.util.SortedMaps.
They support the following additional reader operations over
SyncMap: comparator, subMap, headMap, tailMap, firstKey, lastKey.
[ Introduction to this package. |
SyncSortedSet.java | Class | SyncSortedSets wrap Sync-based control around java.util.SortedSets.
They support the following additional reader operations over
SyncCollection: comparator, subSet, headSet, tailSet, first, last.
[ Introduction to this package. |
Takable.java | Interface | This interface exists to enable stricter type checking
for channels. |
ThreadedExecutor.java | Class | An implementation of Executor that creates a new
Thread that invokes the run method of the supplied command.
[ Introduction to this package. |
ThreadFactory.java | Interface | Interface describing any class that can generate
new Thread objects. |
ThreadFactoryUser.java | Class | Base class for Executors and related classes that rely on thread factories.
Generally intended to be used as a mixin-style abstract class, but
can also be used stand-alone.
[ Introduction to this package. |
TimedCallable.java | Class | TimedCallable runs a Callable function for a given length of time.
The function is run in its own thread. |
TimeoutException.java | Class | Thrown by synchronization classes that report
timeouts via exceptions. |
TimeoutSync.java | Class | A TimeoutSync is an adaptor class that transforms all
calls to acquire to instead invoke attempt with a predetermined
timeout value.
Sample Usage. |
VetoableChangeMulticaster.java | Class | This class is interoperable with java.beans.VetoableChangeSupport,
but relies on a streamlined copy-on-write scheme similar to
that used in CopyOnWriteArrayList. |
WaitableBoolean.java | Class | A class useful for offloading synch for boolean instance variables.
[ Introduction to this package. |
WaitableByte.java | Class | A class useful for offloading waiting and signalling operations
on single byte variables. |
WaitableChar.java | Class | A class useful for offloading waiting and signalling operations
on single char variables. |
WaitableDouble.java | Class | A class useful for offloading waiting and signalling operations
on single double variables. |
WaitableFloat.java | Class | A class useful for offloading waiting and signalling operations
on single float variables. |
WaitableInt.java | Class | A class useful for offloading waiting and signalling operations
on single int variables. |
WaitableLong.java | Class | A class useful for offloading waiting and signalling operations
on single long variables. |
WaitableRef.java | Class | A class useful for offloading synch for Object reference instance variables.
[ Introduction to this package. |
WaitableShort.java | Class | A class useful for offloading waiting and signalling operations
on single short variables. |
WaiterPreferenceSemaphore.java | Class | An implementation of counting Semaphores that
enforces enough fairness for applications that
need to avoid indefinite overtaking without
necessarily requiring FIFO ordered access.
Empirically, very little is paid for this property
unless there is a lot of contention among threads
or very unfair JVM scheduling.
The acquire method waits even if there are permits
available but have not yet been claimed by threads that have
been notified but not yet resumed. |
WaitFreeQueue.java | Class | A wait-free linked list based queue implementation.
While this class conforms to the full Channel interface, only the
put and poll methods are useful in most
applications. |
WriterPreferenceReadWriteLock.java | Class | A ReadWriteLock that prefers waiting writers over
waiting readers when there is contention. |