OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
org.omg.dds.sub.ReadCondition< TYPE > Interface Template Reference

ReadCondition objects are conditions specifically dedicated to read operations and attached to one org.omg.dds.sub.DataReader. More...

Inheritance diagram for org.omg.dds.sub.ReadCondition< TYPE >:
Inheritance graph
Collaboration diagram for org.omg.dds.sub.ReadCondition< TYPE >:
Collaboration graph

Public Member Functions

void close ()
 Reclaim any resources associated with this condition. More...
 
ServiceEnvironment getEnvironment ()
 
Set< InstanceStategetInstanceStates ()
 This operation returns the set of instance states that are taken into account to determine the triggerValue of the ReadCondition. More...
 
DataReader< TYPE > getParent ()
 
Set< SampleStategetSampleStates ()
 This operation returns the set of sample states that are taken into account to determine the triggerValue of the ReadCondition. More...
 
boolean getTriggerValue ()
 
Set< ViewStategetViewStates ()
 This operation returns the set of view states that are taken into account to determine the triggerValue of the ReadCondition. More...
 

Detailed Description

ReadCondition objects are conditions specifically dedicated to read operations and attached to one org.omg.dds.sub.DataReader.

ReadCondition objects allow an application to specify the data samples it is interested in by specifying the desired sample states, view states, and instance states. (See Subscriber.DataState.) This allows the middleware to enable the condition only when suitable information is available. They are to be used in conjunction with a org.omg.dds.core.WaitSet as normal conditions. More than one ReadCondition may be attached to the same DataReader.

Similar to the org.omg.dds.core.StatusCondition, a ReadCondition also has a triggerValue that determines whether the attached org.omg.dds.core.WaitSet is BLOCKED or UNBLOCKED. However, unlike the StatusCondition, the triggerValue of the ReadCondition is tied to the presence of at least a sample managed by the Service with org.omg.dds.sub.SampleState, org.omg.dds.sub.ViewState, and org.omg.dds.sub.InstanceState matching those of the ReadCondition.

The fact that the triggerValue of a ReadCondition is dependent on the presence of samples on the associated DataReader implies that a single org.omg.dds.sub.DataReader#take() operation can potentially change the triggerValue of several ReadCondition or org.omg.dds.sub.QueryCondition conditions. For example, if all samples are taken, any ReadCondition and QueryCondition conditions associated with the DataReader that had their triggerValue == true before will see the triggerValue change to false. Note that this does not guarantee that WaitSet objects that were separately attached to those conditions will not be woken up. Once we have triggerValue == true on a condition it may wake up the attached WaitSet, the condition transitioning to triggerValue == false does not necessarily 'unwakeup' the WaitSet as 'unwakening' may not be possible in general. The consequence is that an application blocked on a WaitSet may return from the wait with a list of conditions. some of which are no longer "active." This is unavoidable if multiple threads are concurrently waiting on separate WaitSet objects and taking data associated with the same DataReader entity.

To elaborate further, consider the following example: A ReadCondition that has a sample state collection of {NOT_READ} will have triggerValue of true whenever a new sample arrives and will transition to false as soon as all the newly-arrived samples are either read (so their status changes to org.omg.dds.sub.SampleState#READ) or taken (so they are no longer managed by the Service). However if the same ReadCondition had a sample_statesample state collection of {READ, NOT_READ}, then the triggerValue would only become false once all the newly-arrived samples are taken (it is not sufficient to read them as that would only change the SampleState to READ, which overlaps the collection on the ReadCondition.

Example:

// This example assumes a DataReader of type "Foo" in module "example" to be stored in the "fooDR" variable.
// Create a readcondition.
DataState ds = subscriber.createDataState();
ds = ds.with(SampleState.NOT_READ)
       .with(ViewState.NEW)
       .with(InstanceState.ALIVE);
ReadCondition<Foo> readCond = fooDR.createReadCondition(ds);
// Instantiate a WaitSet and attach the condition.
WaitSet myWS = WaitSet.newWaitSet(env);
myWS.attachCondition(readCond);
Duration waitTimeout = Duration.newDuration(60, TimeUnit.SECONDS, env);
// Wait for the readcondition to trigger.
try
{
    w.waitForConditions(waitTimeout);
    List<Sample<Foo>> samples = new ArrayList<Sample<Foo>>();
    fooDR.select().dataState(ds).read(samples);
}
catch (TimeoutException e) {}

Parameters
<TYPE>The concrete type of the data that can be read using the the org.omg.dds.sub.DataReader that created this ReadCondition.

Definition at line 103 of file ReadCondition.java.

Member Function Documentation

◆ close()

void org.omg.dds.sub.ReadCondition< TYPE >.close ( )

Reclaim any resources associated with this condition.

Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.

◆ getEnvironment()

ServiceEnvironment org.omg.dds.core.DDSObject.getEnvironment ( )
inherited
Returns
the org.omg.dds.core.ServiceEnvironment object that directly or indirectly was used to create this object.

Implemented in org.omg.dds.core.ServiceEnvironment, org.opensplice.dds.sub.ReflectionDataReader< TYPE, OUT_TYPE >, org.opensplice.dds.core.ModifiableTimeImpl, org.opensplice.dds.pub.ReflectionDataWriter< TYPE >, org.opensplice.dds.core.DurationImpl, org.opensplice.dds.topic.ContentFilteredTopicImpl< TYPE >, org.opensplice.dds.sub.ReadConditionImpl< TYPE >, org.opensplice.dds.core.EntityQosImpl< T extends QosPolicy >, org.opensplice.dds.type.TypeSupportImpl< TYPE >, org.opensplice.dds.topic.PublicationBuiltinTopicDataImpl, org.opensplice.dds.topic.SubscriptionBuiltinTopicDataImpl, org.opensplice.dds.topic.TopicBuiltinTopicDataImpl, org.opensplice.dds.domain.DomainParticipantFactoryImpl, org.opensplice.dds.core.QosProviderImpl, org.opensplice.dds.core.status.OfferedIncompatibleQosStatusImpl, org.opensplice.dds.core.status.RequestedIncompatibleQosStatusImpl, org.opensplice.dds.core.InstanceHandleImpl, org.opensplice.dds.core.StatusConditionImpl< T extends Entity<?, ?>, org.opensplice.dds.core.status.LivelinessChangedStatusImpl, org.opensplice.dds.core.status.PublicationMatchedStatusImpl, org.opensplice.dds.core.status.SubscriptionMatchedStatusImpl, org.opensplice.dds.sub.SampleImpl< TYPE >, org.opensplice.dds.core.policy.ShareImpl, org.opensplice.dds.core.status.OfferedDeadlineMissedStatusImpl, org.opensplice.dds.core.status.SampleRejectedStatusImpl, org.opensplice.dds.core.WaitSetImpl, org.opensplice.dds.topic.ParticipantBuiltinTopicDataImpl, org.opensplice.dds.core.status.RequestedDeadlineMissedStatusImpl, org.opensplice.dds.topic.BuiltinTopicKeyImpl, org.opensplice.dds.core.GuardConditionImpl, org.opensplice.dds.core.event.AllDataDisposedEventImpl< TYPE >, org.opensplice.dds.core.policy.QosPolicyCountImpl, org.opensplice.dds.core.status.InconsistentTopicStatusImpl, org.opensplice.dds.core.status.LivelinessLostStatusImpl, org.opensplice.dds.core.status.SampleLostStatusImpl, org.opensplice.dds.core.policy.QosPolicyImpl, org.opensplice.dds.core.status.AllDataDisposedStatusImpl, org.opensplice.dds.core.IllegalArgumentExceptionImpl, org.opensplice.dds.core.InconsistentPolicyExceptionImpl, org.opensplice.dds.core.policy.PolicyFactoryImpl, org.opensplice.dds.core.policy.TypeConsistencyEnforcementImpl, org.opensplice.dds.core.PreconditionNotMetExceptionImpl, org.opensplice.dds.core.AlreadyClosedExceptionImpl, org.opensplice.dds.core.IllegalOperationExceptionImpl, org.opensplice.dds.core.ImmutablePolicyExceptionImpl, org.opensplice.dds.core.NotEnabledExceptionImpl, org.opensplice.dds.core.OutOfResourcesExceptionImpl, org.opensplice.dds.core.DDSExceptionImpl, org.opensplice.dds.core.status.DataAvailableStatusImpl, and org.opensplice.dds.core.status.DataOnReadersStatusImpl.

◆ getInstanceStates()

Set<InstanceState> org.omg.dds.sub.ReadCondition< TYPE >.getInstanceStates ( )

This operation returns the set of instance states that are taken into account to determine the triggerValue of the ReadCondition.

These are the instance states specified when the ReadCondition was created.

Returns
an unmodifiable set.

Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.

◆ getParent()

DataReader<TYPE> org.omg.dds.sub.ReadCondition< TYPE >.getParent ( )
Returns
the DataReader associated with the ReadCondition. Note that there is exactly one DataReader associated with each ReadCondition.

Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.

◆ getSampleStates()

Set<SampleState> org.omg.dds.sub.ReadCondition< TYPE >.getSampleStates ( )

This operation returns the set of sample states that are taken into account to determine the triggerValue of the ReadCondition.

These are the sample states specified when the ReadCondition was created.

Returns
an unmodifiable set.

Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.

◆ getTriggerValue()

boolean org.omg.dds.core.Condition.getTriggerValue ( )
inherited

◆ getViewStates()

Set<ViewState> org.omg.dds.sub.ReadCondition< TYPE >.getViewStates ( )

This operation returns the set of view states that are taken into account to determine the triggerValue of the ReadCondition.

These are the view states specified when the ReadCondition was created.

Returns
an unmodifiable set.

Implemented in org.opensplice.dds.sub.ReadConditionImpl< TYPE >.


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