Skip to content
Snippets Groups Projects
Commit 96454f8a authored by Guillaume PICHON's avatar Guillaume PICHON
Browse files

New variable resolution system to guarantee that there will be only one read...

New variable resolution system to guarantee that there will be only one read per tango attribute for an equation computation.
parent 40b58f17
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@
<groupId>fr.soleil.deviceservers</groupId>
<artifactId>TangoParser</artifactId>
<version>3.3.9</version>
<version>3.3.10</version>
<name>TangoParser</name>
<description>TangoParser Device</description>
......
......@@ -175,11 +175,11 @@ public abstract class AJepParser {
} catch (final ParseException e1) {
logger.error("Error in parsing of '{}' with expression '{}'.", name, expression);
setVector(false);
DevFailedUtils.throwDevFailed(e1);
throw DevFailedUtils.newDevFailed(e1);
}
} else {
logger.error("Error in parsing of '{}' with expression '{}'.", name);
DevFailedUtils.throwDevFailed(e);
logger.error("Error in parsing of '{}' with expression '{}'.", name, expression);
throw DevFailedUtils.newDevFailed(e);
}
}
logger.debug("result is {} = {}", expression, result);
......@@ -246,12 +246,17 @@ public abstract class AJepParser {
* @throws DevFailed
*/
public Object getValue(boolean lock) throws DevFailed {
return getValue(lock, new HashMap<>());
}
private Object getValue(boolean lock, Map<String, Object> tangoVariable) throws DevFailed {
if (lock) {
locker.lock();
}
try {
// get results for tango attributes
for (final String variableName : variables.values()) {
if(!tangoVariable.containsKey(variableName)) {
final AttributeResult r = dataSource.getResult(sourceName, variableName);
if (r != null) {
final Object value = r.getValue();
......@@ -259,15 +264,20 @@ public abstract class AJepParser {
if (e != null && attributes.containsValue(variableName)) {
throw e;
} else if (value != null) {
tangoVariable.put(variableName, value);
jep.addVariable(variableName, fromStandardToJepType(value));
logger.debug("add tango result : {}={}", variableName, value);
}
}
} else {
final Object value = tangoVariable.get(variableName);
jep.addVariable(variableName, fromStandardToJepType(value));
}
}
// get results for variables
for (final AJepParser variable : variablesJepToRead.values()) {
final Object r = variable.getValue(lock);
final Object r = variable.getValue(lock, tangoVariable);
logger.debug("get input variable {} = {}", variable, r);
jep.addVariable(variable.getName(), fromStandardToJepType(r));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment