Public Member Functions | |
EventDispatcher< T > | add (T listener, int queueCapacity) |
EventDispatcher< T > | add (T listener) |
Collection< EventDispatcher< T > > | addAll (Collection< T > listeners, int limit) |
Collection< EventDispatcher< T > > | addAll (Collection< T > listeners) |
ListenerGroup (ExecutorService executorService) | |
void | shutdown () |
void | signal (SignalRunnable< T > signalRunnable) |
boolean | signal (final SignalRunnable< T > signalRunnable, long timeout, TimeUnit unit) throws InterruptedException |
int | size () |
Private Attributes | |
final Collection < EventDispatcher< T > > | eventDispatchers |
final ExecutorService | executorService |
Static Private Attributes | |
static final int | DEFAULT_QUEUE_CAPACITY = 128 |
A group of listeners.
Definition at line 31 of file ListenerGroup.java.
org.ros.concurrent.ListenerGroup< T >.ListenerGroup | ( | ExecutorService | executorService | ) | [inline] |
Definition at line 38 of file ListenerGroup.java.
EventDispatcher<T> org.ros.concurrent.ListenerGroup< T >.add | ( | T | listener, |
int | queueCapacity | ||
) | [inline] |
Adds a listener to the ListenerGroup.
listener | the listener to add |
queueCapacity | the maximum number of events to buffer |
Definition at line 53 of file ListenerGroup.java.
EventDispatcher<T> org.ros.concurrent.ListenerGroup< T >.add | ( | T | listener | ) | [inline] |
Adds the specified listener to the ListenerGroup with the queue limit set to DEFAULT_QUEUE_CAPACITY.
listener | the listener to add |
Definition at line 69 of file ListenerGroup.java.
Collection<EventDispatcher<T> > org.ros.concurrent.ListenerGroup< T >.addAll | ( | Collection< T > | listeners, |
int | limit | ||
) | [inline] |
Adds all the specified listeners to the ListenerGroup.
listeners | the listeners to add |
limit | the maximum number of events to buffer |
Definition at line 83 of file ListenerGroup.java.
Collection<EventDispatcher<T> > org.ros.concurrent.ListenerGroup< T >.addAll | ( | Collection< T > | listeners | ) | [inline] |
Adds all the specified listeners to the ListenerGroup with the queue capacity for each set to Integer#MAX_VALUE.
listeners | the listeners to add |
Definition at line 100 of file ListenerGroup.java.
void org.ros.concurrent.ListenerGroup< T >.shutdown | ( | ) | [inline] |
Definition at line 150 of file ListenerGroup.java.
void org.ros.concurrent.ListenerGroup< T >.signal | ( | SignalRunnable< T > | signalRunnable | ) | [inline] |
Signals all listeners.
Each SignalRunnable is executed in a separate thread.
Definition at line 116 of file ListenerGroup.java.
boolean org.ros.concurrent.ListenerGroup< T >.signal | ( | final SignalRunnable< T > | signalRunnable, |
long | timeout, | ||
TimeUnit | unit | ||
) | throws InterruptedException [inline] |
Signals all listeners and waits for the result.
Each SignalRunnable is executed in a separate thread. In the event that the SignalRunnable is be dropped from the EventDispatcher's queue and thus not executed, this method will block for the entire specified timeout.
true
false
InterruptedException |
Definition at line 134 of file ListenerGroup.java.
int org.ros.concurrent.ListenerGroup< T >.size | ( | ) | [inline] |
Definition at line 107 of file ListenerGroup.java.
final int org.ros.concurrent.ListenerGroup< T >.DEFAULT_QUEUE_CAPACITY = 128 [static, private] |
Definition at line 33 of file ListenerGroup.java.
final Collection<EventDispatcher<T> > org.ros.concurrent.ListenerGroup< T >.eventDispatchers [private] |
Definition at line 36 of file ListenerGroup.java.
final ExecutorService org.ros.concurrent.ListenerGroup< T >.executorService [private] |
Definition at line 35 of file ListenerGroup.java.