|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.graemestevenson.notifier.AbstractNotifier<T>
com.graemestevenson.notifier.NonBlockingNotifier<T>
T - the type of data that the Notifier object handles.public final class NonBlockingNotifier<T>
The non-blocking notifier is used to publish data to a set of interested subscribers, or Notifyees in an asynchronous fashion.
A notifyee may be any object that implements interface Notifyee. When an
application calling the Notifer's publish method causes all of its
notifyees to be notified of the change by a call to their update method.
The order in which notifications will be delivered is the order in which they registered
interest. This implementation carries out delivery on a different thread to the
publish call, and therefore does not block. It is up to the creator of this
object to start this Runnable.
When a notifier object is newly created, its set of notifyees is empty.
| Constructor Summary | |
|---|---|
NonBlockingNotifier()
|
|
| Method Summary | |
|---|---|
void |
publish(T some_data)
Passes the some_data argument to all registered notifyees via their
update method. |
void |
run()
Monitor the queue and notify all observers when new events are received. |
| Methods inherited from class com.graemestevenson.notifier.AbstractNotifier |
|---|
addNotifyee, countNotifyees, deleteNotifyee, deleteNotifyees, shutdown |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NonBlockingNotifier()
| Method Detail |
|---|
public void publish(T some_data)
some_data argument to all registered notifyees via their
update method. How this is handled is left to subclasses.
publish in interface Notifier<T>publish in class AbstractNotifier<T>some_data - the data to be passed to notifyees.public void run()
run in interface java.lang.Runnable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||