public abstract class

AbstractQueuedCallbackSink

extends Object
implements VehicleDataSink
java.lang.Object
   ↳ com.openxc.sinks.AbstractQueuedCallbackSink
Known Direct Subclasses

Class Overview

Functionality to notify multiple clients asynchronously of new measurements. This class encapsulates the functionality to keep a thread-safe list of listeners that want to be notified of updates asynchronously. Subclasses need only to implement the propagateMessage(VehicleMessage) to add the actual logic for looping over the list of receivers and send them new values. New measurements are queued up and propagated to receivers in a separate thread, to avoid blocking the original sender of the data.

Summary

Public Constructors
AbstractQueuedCallbackSink()
Public Methods
void clearQueue()
void receive(VehicleMessage message)
Receive a data point with a name, a value and a event value.
synchronized void stop()
Release any acquired resources and either stop sending measurements (if a source) or stop expecting to receive them (if a sink).
Protected Methods
abstract void propagateMessage(VehicleMessage message)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.openxc.sinks.VehicleDataSink

Public Constructors

public AbstractQueuedCallbackSink ()

Public Methods

public void clearQueue ()

public void receive (VehicleMessage message)

Receive a data point with a name, a value and a event value. The implementation of this method should not block, lest the vehicle data source get behind in processing data from a source potentially external to the system.

Parameters
message The new measurement.

public synchronized void stop ()

Release any acquired resources and either stop sending measurements (if a source) or stop expecting to receive them (if a sink).

Protected Methods

protected abstract void propagateMessage (VehicleMessage message)