QueueAdapter

public class QueueAdapter<DataType> extends AbstractDataHandler<DataType>

Synchronized queue implementing the rsb.DataHandler interface. Can be directly registered as handler in rsb.Listener instance and used for receiving and storing dispatched events.

Author

swrede, dklotz

Parameters

<DataType> – type of data to be handled

Constructors

QueueAdapter

public QueueAdapter()

Creates an adapter with a preset unlimited queue inside.

QueueAdapter

public QueueAdapter(int capacity, boolean discardOldest)

Creates an adapter with a preset queue inside that is limited to capacity elements.

Parameters
  • capacity – capacity of the internal queue

  • discardOldest – if true, remove older events if the queue is full, otherwise block until space is available on inserts

QueueAdapter

public QueueAdapter(BlockingQueue<DataType> queue)

Creates an adapter that uses the specified queue as target for new data.

Parameters

queue – queue for new data

Methods

getQueue

public BlockingQueue<DataType> getQueue()

Returns the queue instance used for new data.

Returns

queue instance

handleEvent

public void handleEvent(DataType data)