Public Member Functions | Private Attributes | Static Private Attributes
org.ros.concurrent.ListenerGroup< T > Class Reference

List of all members.

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

Detailed Description

A group of listeners.

Author:
damonkohler@google.com (Damon Kohler)

Definition at line 31 of file ListenerGroup.java.


Constructor & Destructor Documentation

org.ros.concurrent.ListenerGroup< T >.ListenerGroup ( ExecutorService  executorService) [inline]

Definition at line 38 of file ListenerGroup.java.


Member Function Documentation

EventDispatcher<T> org.ros.concurrent.ListenerGroup< T >.add ( listener,
int  queueCapacity 
) [inline]

Adds a listener to the ListenerGroup.

Parameters:
listenerthe listener to add
queueCapacitythe maximum number of events to buffer
Returns:
the EventDispatcher responsible for calling the specified listener

Definition at line 53 of file ListenerGroup.java.

EventDispatcher<T> org.ros.concurrent.ListenerGroup< T >.add ( listener) [inline]

Adds the specified listener to the ListenerGroup with the queue limit set to DEFAULT_QUEUE_CAPACITY.

Parameters:
listenerthe listener to add
Returns:
the EventDispatcher responsible for calling the specified listener

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.

Parameters:
listenersthe listeners to add
limitthe maximum number of events to buffer
Returns:
a Collection of EventDispatchers responsible for calling the specified listeners

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.

Parameters:
listenersthe listeners to add
Returns:
a Collection of EventDispatchers responsible for calling the specified listeners

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.

Returns:
 true 
if all listeners completed within the specified time limit,
 false 
otherwise
Exceptions:
InterruptedException

Definition at line 134 of file ListenerGroup.java.

int org.ros.concurrent.ListenerGroup< T >.size ( ) [inline]
Returns:
the number of listeners in the group

Definition at line 107 of file ListenerGroup.java.


Member Data Documentation

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.


The documentation for this class was generated from the following file:


rosjava_core
Author(s):
autogenerated on Wed Aug 26 2015 16:06:50