Skip to content

Commit

Permalink
Update ApplianceValueIterator.java
Browse files Browse the repository at this point in the history
Adding additional synchronization to resolve the issue of the msgIterator being created with missing data.
This lock can and should be removed once the dataretrieval is made thread safe.
  • Loading branch information
shroffk committed Jun 23, 2016
1 parent 6ab6fd5 commit d902628
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -53,6 +53,8 @@ public abstract class ApplianceValueIterator implements ValueIterator {
private final IteratorListener listener;

protected boolean closed = false;

private static Object lock = new Object();

/**
* Constructs a new ApplianceValueIterator.
Expand Down Expand Up @@ -92,7 +94,9 @@ protected void fetchDataInternal(String pvName) throws ArchiverApplianceExceptio
java.sql.Timestamp sqlEndTimestamp = TimestampHelper.toSQLTimestamp(end);

DataRetrieval dataRetrieval = reader.createDataRetriveal(reader.getDataRetrievalURL());
mainStream = dataRetrieval.getDataForPV(pvName, sqlStartTimestamp, sqlEndTimestamp);
synchronized(lock){
mainStream = dataRetrieval.getDataForPV(pvName, sqlStartTimestamp, sqlEndTimestamp);
}
if (mainStream != null) {
mainIterator = mainStream.iterator();
} else {
Expand Down Expand Up @@ -316,4 +320,4 @@ protected static AlarmSeverity getSeverity(int severity) {
return AlarmSeverity.UNDEFINED;
}
}
}
}

0 comments on commit d902628

Please sign in to comment.