Duration_t timeout = new Duration_t(0, 1000000);
ConditionSeq active_conditions = new ConditionSeq();
boolean is_cond1_triggered = false;
boolean is_cond2_triggered = false;
try {
waitset.wait(active_conditions, timeout);
for (int i = 0; i < active_conditions.size(); ++i) {
if (active_conditions.get(i) == cond1) {
System.out.println("Cond1 was triggered!");
is_cond1_triggered = true;
}
if (active_conditions.get(i) == cond2) {
System.out.println("Cond2 was triggered!");
is_cond2_triggered = true;
}
}
if (is_cond1_triggered) {
}
if (is_cond2_triggered) {
}
} catch (RETCODE_TIMEOUT timed_out) {
System.out.println(
"Wait timed out!! None of the conditions was triggered.");
} catch (RETCODE_ERROR ex) {
throw ex;
}