Omaha #4105 synchronize forcastTimeMap to prevent ConcurrentModificationException.
Change-Id: Ie6dbeff173ce0165638301625f285601d649dd1b Former-commit-id: 95f8fbb4fafd7e6e2235e4baac42b75c21ce0549
This commit is contained in:
parent
c9176a7153
commit
6442e88fe3
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.JobChangeAdapter;
|
||||
|
||||
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
||||
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.viz.datacube.DataCubeContainer;
|
||||
|
||||
|
@ -47,6 +47,7 @@ import com.raytheon.uf.viz.datacube.DataCubeContainer;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 10, 2009 #2592 jelkins Initial creation
|
||||
* Jan 4, 2010 #3960 jelkins Perform inventory updates in separate thread
|
||||
* Feb 12, 2015 4105 rferrel Synchronize forecastTimeMap to prevent ConcurrentModificationException.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -166,6 +167,7 @@ public class ProductInventory extends Job {
|
|||
}
|
||||
|
||||
// find the latest time
|
||||
synchronized (forecastTimeMap) {
|
||||
for (DataTime dataTime : productTimes) {
|
||||
if (dataTime.getRefTime().after(latestForecastTime)) {
|
||||
latestForecastTime = dataTime.getRefTime();
|
||||
|
@ -178,6 +180,7 @@ public class ProductInventory extends Job {
|
|||
forecastTimeMap.put(newFcstTime, dataTime.getRefTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.schedule();
|
||||
|
||||
|
@ -185,14 +188,17 @@ public class ProductInventory extends Job {
|
|||
|
||||
public List<String> getForecastTimes() {
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = null;
|
||||
|
||||
synchronized (forecastTimeMap) {
|
||||
list = new ArrayList<String>(forecastTimeMap.size());
|
||||
for (Integer forcastHour : forecastTimeMap.keySet()) {
|
||||
|
||||
list.add(getAWIPSDayHour(forecastTimeMap.get(forcastHour))
|
||||
.substring(0, 5) + " " + (forcastHour / 3600) + "HR");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -208,6 +214,7 @@ public class ProductInventory extends Job {
|
|||
public String getInventoryStatusString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
synchronized (forecastTimeMap) {
|
||||
for (Integer forcastHour : forecastTimeMap.keySet()) {
|
||||
if (forecastTimeMap.get(forcastHour).equals(latestForecastTime)) {
|
||||
sb.append("+");
|
||||
|
@ -215,6 +222,7 @@ public class ProductInventory extends Job {
|
|||
sb.append("-");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ import com.vividsolutions.jts.geom.LineString;
|
|||
* exception" when loading contours and
|
||||
* Image combo
|
||||
* Aug 20, 2013 2259 bsteffen Delete old skewt plugin.
|
||||
* Feb 12, 2015 4105 rferrel Remove duplicate update of table item in addProduct.
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -1209,12 +1210,6 @@ public class ProductTableComp extends Composite {
|
|||
|
||||
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() {
|
||||
|
||||
@Override
|
||||
|
@ -1235,6 +1230,8 @@ public class ProductTableComp extends Composite {
|
|||
try {
|
||||
ti.setText(0, tblData.getProductInventory()
|
||||
.getLatestForecastTime());
|
||||
ti.setText(1, tblData.getName());
|
||||
ti.setFont(2, tiFont);
|
||||
ti.setText(2, tblData.getProductInventory()
|
||||
.getInventoryStatusString());
|
||||
updateScrollBar();
|
||||
|
|
Loading…
Add table
Reference in a new issue