Issue #2203 synchronize init and dispose of frames

Change-Id: I94504a039f321ff40830b3bb7e21d31bf586a0d0

Former-commit-id: b053fea59b [formerly ed75a28d871dc1e97717fa44636df635eed8b4fc]
Former-commit-id: 162a1ba48f
This commit is contained in:
Nate Jensen 2013-07-24 16:17:43 -05:00
parent 9c4070b8d5
commit ac310f7bbf

View file

@ -85,6 +85,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 24, 2010 1029 dfriedma Initial creation
* Jul 24, 2013 2203 njensen Synchronized init and dispose of frames
*
* </pre>
*
@ -390,21 +391,28 @@ public class RedbookUpperAirResource extends
}
}
synchronized (this) {
if (pointData != null) {
images = new IImage[pointData.getCurrentSz()];
for (int i = 0; i < pointData.getCurrentSz(); ++i) {
PointDataView pdv = pointData.readRandom(i);
float lat = pdv.getFloat(RedbookUpperAirDecoder.P_LATITUDE);
float lon = pdv.getFloat(RedbookUpperAirDecoder.P_LONGITUDE);
float lat = pdv
.getFloat(RedbookUpperAirDecoder.P_LATITUDE);
float lon = pdv
.getFloat(RedbookUpperAirDecoder.P_LONGITUDE);
PlotData pd = new PlotData();
pd.addData(pdv);
BufferedImage bImage = pmf.getStationPlot(pd, lat, lon);
IImage image = null;
if (bImage != null)
image = target.initializeRaster(new IODataPreparer(bImage,
"rbua"/* UUID.randomUUID().toString() */, 0), null);
image = target.initializeRaster(new IODataPreparer(
bImage, "rbua"/*
* UUID.randomUUID().toString()
*/, 0), null);
images[i] = image;
}
}
}
synchronized (job) {
if (!plotSettingsChanged)
@ -413,6 +421,7 @@ public class RedbookUpperAirResource extends
}
public void dispose() {
synchronized (this) {
if (images != null)
for (int i = 0; i < images.length; ++i) {
if (images[i] != null) {
@ -424,6 +433,7 @@ public class RedbookUpperAirResource extends
redbookRecord = null;
pointData = null;
}
}
public void paint(IGraphicsTarget target, PaintProperties paintProps)
throws VizException {