![]() |
OpenSplice Java 5 DCPS
v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
|
Since a org.omg.dds.pub.DataWriter is a kind of org.omg.dds.core.Entity, it has the ability to have a listener associated with it. More...
Public Member Functions | |
void | onLivelinessLost (LivelinessLostEvent< TYPE > status) |
This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the org.omg.dds.core.status.LivelinessLostStatus changes. More... | |
void | onOfferedDeadlineMissed (OfferedDeadlineMissedEvent< TYPE > status) |
This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the org.omg.dds.core.status.OfferedDeadlineMissedStatus changes. More... | |
void | onOfferedIncompatibleQos (OfferedIncompatibleQosEvent< TYPE > status) |
This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the org.omg.dds.core.status.OfferedIncompatibleQosStatus changes. More... | |
void | onPublicationMatched (PublicationMatchedEvent< TYPE > status) |
This operation must be implemented by the application and is called by the Data Distribution Service when a new match has been discovered for the current publication, or when an existing match has ceased to exist. More... | |
Since a org.omg.dds.pub.DataWriter is a kind of org.omg.dds.core.Entity, it has the ability to have a listener associated with it.
In this case, the associated listener must be of concrete type DataWriterListener.
This interface must be implemented by the application. A user-defined class must be provided by the application which must implement the DataWriterListener interface. All DataWriterListener operations must be implemented in the user-defined class, it is up to the application whether an operation is empty or contains some functionality.
A convenience class org.omg.dds.pub.DataWriterAdapter is offered in Java 5 which has an empty implementation of all listener callback functions when the application extends from this class only the used callback functions that the user wants to use need to be implemented.
Example
public class MyDataWriterListener extends DataWriterAdapter<Foo>
{
public void onLivelinessLost(LivelinessLostEvent<Foo> status)
// Handle the lost data here.
}
public void onOfferedIncompatibleQos(OfferedIncompatibleQosEvent<Foo> status)
// Handle the incompatibility here.
}
}
//Instantiate a DataWriterListener.
MyDataWriterListener listener = new MyDataWriterListener();
// Instantiate and add the status masks.
Collection<Class<? extends Status>> statuses = new HashSet<Class<? extends Status>>();
statuses.add(LivelinessLostStatus.class);
statuses.add(OfferedIncompatibleQosStatus.class);
// Create the DataWriter with the listener and the bit-mask.
publisher.createDataWriter(fooTopic, publisher.getDefaultDataWriterQos(), listener, statuses);
<TYPE> | The concrete type of the data written by the DataWriter. |
Definition at line 69 of file DataWriterListener.java.
void org.omg.dds.pub.DataWriterListener< TYPE >.onLivelinessLost | ( | LivelinessLostEvent< TYPE > | status | ) |
This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the org.omg.dds.core.status.LivelinessLostStatus changes.
The implementation may be left empty when this functionality is not needed. This operation will only be called when the relevant DataWriterListener is installed and enabled for the liveliness lost status. The liveliness lost status will change when the liveliness that the DataWriter has committed through its LivelinessQosPolicy was not respected. In other words, the DataWriter failed to actively signal its liveliness within the offered liveliness period. As a result, the DataReader objects will consider the DataWriter as no longer "alive". The Data Distribution Service will call the DataWriterListener operation with a parameter status, which will contain the LivelinessLostStatus object.
status | Contains the LivelinessLostStatus object (this is an input to the application) |
Implemented in org.omg.dds.pub.DataWriterAdapter< TYPE >.
void org.omg.dds.pub.DataWriterListener< TYPE >.onOfferedDeadlineMissed | ( | OfferedDeadlineMissedEvent< TYPE > | status | ) |
This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the org.omg.dds.core.status.OfferedDeadlineMissedStatus changes.
The implementation may be left empty when this functionality is not needed. This operation will only be called when the relevant DataWriterListener is installed and enabled for the offered deadline missed status. The offered deadline missed status will change when the deadline that the DataWriter has committed through its DeadlineQosPolicy was not respected for a specific instance. The Data Distribution Service will call the DataWriterListener operation with a parameter status, which will contain the OfferedDeadlineMissedStatus object.
status | Contains the OfferedDeadlineMissedStatus object (this is an input to the application). |
Implemented in org.omg.dds.pub.DataWriterAdapter< TYPE >.
void org.omg.dds.pub.DataWriterListener< TYPE >.onOfferedIncompatibleQos | ( | OfferedIncompatibleQosEvent< TYPE > | status | ) |
This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the org.omg.dds.core.status.OfferedIncompatibleQosStatus changes.
The implementation may be left empty when this functionality is not needed. This operation will only be called when the relevant DataWriterListener is installed and enabled for the OfferedIncompatibleQosStatus. The incompatible Qos status will change when a DataReader object has been discovered by the DataWriter with the same Topic and a requested DataReaderQos that was incompatible with the one offered by the DataWriter. The Data Distribution Service will call the DataWriterListener operation with a parameter status, which will contain the OfferedIncompatibleQosStatus object.
status | Contain the OfferedIncompatibleQosStatus object (this is an input to the application). |
Implemented in org.omg.dds.pub.DataWriterAdapter< TYPE >.
void org.omg.dds.pub.DataWriterListener< TYPE >.onPublicationMatched | ( | PublicationMatchedEvent< TYPE > | status | ) |
This operation must be implemented by the application and is called by the Data Distribution Service when a new match has been discovered for the current publication, or when an existing match has ceased to exist.
Usually this means that a new DataReader that matches the Topic and that has compatible Qos as the current DataWriter has either been discovered, or that a previously discovered DataReader has ceased to be matched to the current DataWriter. A DataReader may cease to match when it gets deleted, when it changes its Qos to a value that is incompatible with the current DataWriter or when either the DataWriter or the DataReader has chosen to put its matching counterpart on its ignore-list using the ignoreSubcription or ignorePublication operations on the DomainParticipant. The implementation of this Listener operation may be left empty when this functionality is not needed: it will only be called when the relevant DataWriterListener is installed and enabled for the org.omg.dds.core.status.PublicationMatchedStatus. The Data Distribution Service will provide a reference to the PublicationMatchedStatus object in the parameter status for use by the application.
status | Contains the PublicationMatchedStatus object (this is an input to the application provided by the Data Distribution Service). |
Implemented in org.omg.dds.pub.DataWriterAdapter< TYPE >.