1. INTRODUCTION
The Threading Goodies package provides a set of Java interfaces
and classes useful in coordinating and communication between multiple threads
in a server environment. The following interfaces are included:
- Notifier - A background thread that delivers published
objects to the specified list of Subscribers.
- Publisher - An object that accepts subscriptions from
interested Subscribers and delivers published messages (i.e. arbitrary
Java objects) to all Subscribers.
- Queue - Message queue that supports multiple readers and
multiple writers. Different implementations have different behavioral
characteristics.
- Semaphore - A lock that can be acquired by only one
thread at a time (with optional timeout on acquiring the lock).
- Subscriber - An object that expresses interest in messages
transmitted by a Publisher by subscribing to that Publisher.
The following implementations of these interfaces are included:
- Alarm - A Publisher that fires timer events either
continuously or as one-shot requests.
- AsynchPublisher - A Publisher that uses a Notifier for
message delivery via a background thread. Multiple publishers can share
the same Notifier, or use different ones.
- Counter - A Semaphore that maintains a counter, which
is initialized in the constructor. Calls to
acquire()
will
not block unless the count hits zero, so this object can be used (for
example), to maintain the number of available elements in a Queue and
automatically support thread coordination.
- FIFONotifier - A Notifier that guarantees to deliver
notifications in the order received, even in the face of usage from
multiple threads or very rapid calls from the same thread.
- FIFOQueue - A Queue that operates in a
first-in/first-out manner (analogous to a LinkedList).
- LIFOQueue - A Queue that operates in a
last-in/first-out manner (analogous to a Stack).
- Mutex - A Semaphore that can be locked by only one
Thread at a time.
- SynchPublisher - A Publisher that uses the caller's
thread for message delivery.
In addition, the following classes are also included:
- Condition - A simple condition variable that can be
used (for example) as a "queue not empty" flag on a Queue implementation.
- MultiSemaphore - Utility class that supports locking
and unlocking of multiple semaphores at once.
- Timer - A stopwatch class that measures elapsed time
in milliseconds. A Timer instance can be started, stopped, and reset
any number of times.
Most of the classes in the proposal were originally inspired by a series
of articles called "Java Threads in the Real World" in JavaWorld (09/1998 -
04/1999) by Allen Holub.
2. DEPENDENCIES
The Threading component is dependent upon the following external
components for development and use:
3. RELEASE INFO
Current Release: Unreleased, SVN repository Only
Planned Next Release: Version 1.0, by April 30, 2001. See the
Action Items list for tasks that need to be
completed prior to this release.
4. COMMITTERS
The following individuals are the primary developers and maintainers of this
component. Developers who plan to use Threading in their own
projects are encouraged to collaborate on the future development of this
component to ensure that it continues to meet a variety of needs.
5. ACTION ITEMS
The following action items need to be completed prior to a Version 1.0
release of this component:
Action Item |
Volunteer |
Unit Tests. Create unit tests for all of the
included classes. |
|
Install / Use Documentation. Create simple
installation and User's Guide documentation for this component. |
|