Omaha #4105 synchronize forcastTimeMap to prevent ConcurrentModificationException.
Change-Id: Ie6dbeff173ce0165638301625f285601d649dd1b Former-commit-id: 95f8fbb4fafd7e6e2235e4baac42b75c21ce0549
This commit is contained in:
parent
90d42c70d3
commit
aa6f2d3270
2 changed files with 31 additions and 26 deletions
|
@ -32,8 +32,8 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||||
|
|
||||||
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
|
||||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||||
|
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.viz.datacube.DataCubeContainer;
|
import com.raytheon.uf.viz.datacube.DataCubeContainer;
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ import com.raytheon.uf.viz.datacube.DataCubeContainer;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jul 10, 2009 #2592 jelkins Initial creation
|
* Jul 10, 2009 #2592 jelkins Initial creation
|
||||||
* Jan 4, 2010 #3960 jelkins Perform inventory updates in separate thread
|
* Jan 4, 2010 #3960 jelkins Perform inventory updates in separate thread
|
||||||
|
* Feb 12, 2015 4105 rferrel Synchronize forecastTimeMap to prevent ConcurrentModificationException.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -166,16 +167,18 @@ public class ProductInventory extends Job {
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the latest time
|
// find the latest time
|
||||||
for (DataTime dataTime : productTimes) {
|
synchronized (forecastTimeMap) {
|
||||||
if (dataTime.getRefTime().after(latestForecastTime)) {
|
for (DataTime dataTime : productTimes) {
|
||||||
latestForecastTime = dataTime.getRefTime();
|
if (dataTime.getRefTime().after(latestForecastTime)) {
|
||||||
}
|
latestForecastTime = dataTime.getRefTime();
|
||||||
Integer newFcstTime = dataTime.getFcstTime();
|
}
|
||||||
if (!forecastTimeMap.containsKey(newFcstTime)) {
|
Integer newFcstTime = dataTime.getFcstTime();
|
||||||
forecastTimeMap.put(newFcstTime, dataTime.getRefTime());
|
if (!forecastTimeMap.containsKey(newFcstTime)) {
|
||||||
} else if (forecastTimeMap.get(newFcstTime).before(
|
forecastTimeMap.put(newFcstTime, dataTime.getRefTime());
|
||||||
dataTime.getRefTime())) {
|
} else if (forecastTimeMap.get(newFcstTime).before(
|
||||||
forecastTimeMap.put(newFcstTime, dataTime.getRefTime());
|
dataTime.getRefTime())) {
|
||||||
|
forecastTimeMap.put(newFcstTime, dataTime.getRefTime());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,13 +188,16 @@ public class ProductInventory extends Job {
|
||||||
|
|
||||||
public List<String> getForecastTimes() {
|
public List<String> getForecastTimes() {
|
||||||
|
|
||||||
List<String> list = new ArrayList<String>();
|
List<String> list = null;
|
||||||
|
|
||||||
for (Integer forcastHour : forecastTimeMap.keySet()) {
|
synchronized (forecastTimeMap) {
|
||||||
|
list = new ArrayList<String>(forecastTimeMap.size());
|
||||||
|
for (Integer forcastHour : forecastTimeMap.keySet()) {
|
||||||
|
|
||||||
list.add(getAWIPSDayHour(forecastTimeMap.get(forcastHour))
|
list.add(getAWIPSDayHour(forecastTimeMap.get(forcastHour))
|
||||||
.substring(0, 5) + " " + (forcastHour / 3600) + "HR");
|
.substring(0, 5) + " " + (forcastHour / 3600) + "HR");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -208,11 +214,13 @@ public class ProductInventory extends Job {
|
||||||
public String getInventoryStatusString() {
|
public String getInventoryStatusString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
for (Integer forcastHour : forecastTimeMap.keySet()) {
|
synchronized (forecastTimeMap) {
|
||||||
if (forecastTimeMap.get(forcastHour).equals(latestForecastTime)) {
|
for (Integer forcastHour : forecastTimeMap.keySet()) {
|
||||||
sb.append("+");
|
if (forecastTimeMap.get(forcastHour).equals(latestForecastTime)) {
|
||||||
} else {
|
sb.append("+");
|
||||||
sb.append("-");
|
} else {
|
||||||
|
sb.append("-");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,7 @@ import com.vividsolutions.jts.geom.LineString;
|
||||||
* exception" when loading contours and
|
* exception" when loading contours and
|
||||||
* Image combo
|
* Image combo
|
||||||
* Aug 20, 2013 2259 bsteffen Delete old skewt plugin.
|
* Aug 20, 2013 2259 bsteffen Delete old skewt plugin.
|
||||||
|
* Feb 12, 2015 4105 rferrel Remove duplicate update of table item in addProduct.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author lvenable
|
* @author lvenable
|
||||||
|
@ -1209,12 +1210,6 @@ public class ProductTableComp extends Composite {
|
||||||
|
|
||||||
final TableItem ti = new TableItem(prodSelTable, SWT.NONE);
|
final TableItem ti = new TableItem(prodSelTable, SWT.NONE);
|
||||||
|
|
||||||
ti.setText(0, tblData.getTime());
|
|
||||||
ti.setText(1, tblData.getName());
|
|
||||||
ti.setFont(2, tiFont);
|
|
||||||
ti.setText(2, tblData.getProductInventory()
|
|
||||||
.getInventoryStatusString());
|
|
||||||
|
|
||||||
ti.addDisposeListener(new DisposeListener() {
|
ti.addDisposeListener(new DisposeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1235,6 +1230,8 @@ public class ProductTableComp extends Composite {
|
||||||
try {
|
try {
|
||||||
ti.setText(0, tblData.getProductInventory()
|
ti.setText(0, tblData.getProductInventory()
|
||||||
.getLatestForecastTime());
|
.getLatestForecastTime());
|
||||||
|
ti.setText(1, tblData.getName());
|
||||||
|
ti.setFont(2, tiFont);
|
||||||
ti.setText(2, tblData.getProductInventory()
|
ti.setText(2, tblData.getProductInventory()
|
||||||
.getInventoryStatusString());
|
.getInventoryStatusString());
|
||||||
updateScrollBar();
|
updateScrollBar();
|
||||||
|
|
Loading…
Add table
Reference in a new issue