OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
org.omg.dds.core.GuardCondition Class Referenceabstract

A GuardCondition object is a specific Condition whose triggerValue is completely under the control of the application. More...

Inheritance diagram for org.omg.dds.core.GuardCondition:
Inheritance graph
Collaboration diagram for org.omg.dds.core.GuardCondition:
Collaboration graph

Public Member Functions

ServiceEnvironment getEnvironment ()
 
boolean getTriggerValue ()
 
static GuardCondition newGuardCondition (ServiceEnvironment env)
 Creates a new GuardCondition object which can be used in alink org.omg.dds.core.WaitSet}. More...
 
abstract void setTriggerValue (boolean value)
 This operation sets the triggerValue of the GuardCondition. More...
 

Detailed Description

A GuardCondition object is a specific Condition whose triggerValue is completely under the control of the application.

When it is first created, the triggerValue is set to false.

The purpose of the GuardCondition is to provide the means for the application to manually wake up a org.omg.dds.core.WaitSet. This is accomplished by attaching the GuardCondition to the WaitSet and then setting the triggerValue by means of the setTriggerValue(boolean) operation.

Example

//Instantiate a GuardCondition.
GuardCondition myGC = GuardCondition.newGuardCondition(env);
//Attach the GuardCondition to the WaitSet defined as before.
waitset.attachCondition(myGC);
HashSet<Condition> triggeredConditions = new HashSet<Condition>();
Duration timeout = Duration.infiniteDuration(env);
// Wait infinitely for the status to trigger.
waitset.waitForConditions(triggeredConditions, timeout);
// walk over the triggered conditions
for (Condition cond : triggeredConditions) {
  // check condition and do an action
}

In another thread, trigger the GuardCondition.


myGC.setTriggerValue(true);

Definition at line 58 of file GuardCondition.java.

Member Function Documentation

◆ 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.

◆ getTriggerValue()

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

◆ newGuardCondition()

static GuardCondition org.omg.dds.core.GuardCondition.newGuardCondition ( ServiceEnvironment  env)
static

Creates a new GuardCondition object which can be used in alink org.omg.dds.core.WaitSet}.

Parameters
envIdentifies the Service instance to which the new object will belong.

Definition at line 69 of file GuardCondition.java.

◆ setTriggerValue()

abstract void org.omg.dds.core.GuardCondition.setTriggerValue ( boolean  value)
abstract

This operation sets the triggerValue of the GuardCondition.

org.omg.dds.core.WaitSet objects' behavior depends on the changes of the triggerValue of their attached conditions. Therefore, any WaitSet to which the GuardCondition is attached is potentially affected by this operation.

See also
Condition::getTriggerValue()
Exceptions
org.omg.dds.core.DDSExceptionAn internal error has occurred.

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