|
JIVE Platform Release 0.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.bsu.cs.jive.util.Publisher<T>
T
- the type to which notification will be sentpublic final class Publisher<T>
Provides an efficient, thread-safe means of notifying listeners of an event. This technique has been taken from Allen Holub's book Holub on Patterns: Learning Design Patterns by Looking at Code (Apress, 2004). It has been extended to use generics.
Nested Class Summary | |
---|---|
static interface |
Publisher.Distributor<S>
Specifies an object that delivers messages to subcribers. |
Constructor Summary | |
---|---|
Publisher()
|
Method Summary | |
---|---|
void |
publish(Publisher.Distributor<T> deliveryAgent)
Publish an event using a delivery agent. |
void |
subscribe(T subscriber)
Add a new subscriber to this publisher. |
void |
unsubscribe(T subscriber)
Cancel a subscription |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Publisher()
Method Detail |
---|
public void publish(Publisher.Distributor<T> deliveryAgent)
deliveryAgent
- the agent that delivers the eventpublic void subscribe(T subscriber)
subscriber
- public void unsubscribe(T subscriber)
subscriber
- the subscriber to remove
|
JIVE Platform Release 0.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |