Commit in lcsim-conditions/src/main/java/org/lcsim/conditions on MAIN | |||
ConditionsManagerImplementation.java | +15 | -23 | 1.3 -> 1.4 |
Fix a bug in ConditionsManagerImplementation
diff -u -r1.3 -r1.4 --- ConditionsManagerImplementation.java 19 Mar 2012 20:55:58 -0000 1.3 +++ ConditionsManagerImplementation.java 20 Sep 2012 01:57:24 -0000 1.4 @@ -39,45 +39,37 @@
public void setDetector(String detectorName, int run) throws ConditionsNotFoundException { if (this.run != run || !detectorName.equals(this.detectorName)) {
+ ConditionsReader newReader = null;
if (reader == null) {
- setConditionsReader(ConditionsReader.create(this, detectorName, run), detectorName);
+ newReader = ConditionsReader.create(this, detectorName, run);
} else { try {
- if (reader.update(this, detectorName, run)) { - fireConditionsChanged(); - logger.log(Level.FINE, "Detector changed: {0} {1}", new Object[]{detectorName, run}); - }
+ if (reader.update(this, detectorName, run)) newReader = reader;
} catch (IllegalArgumentException x) {
- setConditionsReader(ConditionsReader.create(this, detectorName, run), detectorName);
+ newReader = ConditionsReader.create(this, detectorName, run);
} catch (IOException x) { throw new ConditionsSetNotFoundException("Failed to update conditions reader, detector: "+ detectorName +", run: "+ run, x); } } this.run = run;
+ if (newReader != null) setConditionsReader(newReader, detectorName);
}
- -// this.run = run; -// if (!name.equals(detectorName)) -// { -// setConditionsReader(ConditionsReader.create(name,run),name); -// logger.log(Level.FINE, "Detector changed: {0} {1}", new Object[]{name, run}); -// }
} public void setConditionsReader(ConditionsReader newReader, String name) {
- ConditionsReader oldReader = reader; - reader = newReader;
detectorName = name;
- fireConditionsChanged(); - try - { - if (oldReader != null) oldReader.close(); - } - catch (IOException x) - { -
+ if (newReader != reader) { + ConditionsReader oldReader = reader; + reader = newReader; + if (oldReader != null) { + try { + oldReader.close(); + } catch (IOException x) {} + }
}
+ fireConditionsChanged(); + logger.log(Level.FINE, "Detector changed: {0} {1}", new Object[]{detectorName, run});
} public void removeConditionsConverter(ConditionsConverter conv)
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1