Issue #1004 change plots to synchronize with dispose instead of joining since join allows paint to happen

Change-Id: I6011a5fedc155ab8d515d3c6eb5d368f582c59bd

Former-commit-id: 603a9c90e4 [formerly 603a9c90e4 [formerly aece671b35405e1f278439c9a1a8230dad5cf4c2]]
Former-commit-id: 559efb19fb
Former-commit-id: 3f258a2bf8
This commit is contained in:
Ben Steffensmeier 2012-08-10 16:22:45 -05:00
parent dc8d05c1be
commit fa8ea385d9
3 changed files with 34 additions and 37 deletions

View file

@ -145,13 +145,15 @@ public class PlotModelDataRequestJob extends Job {
// TODO need to determine if this type of plot is a combination or // TODO need to determine if this type of plot is a combination or
// not // not
combineData(stationQuery); combineData(stationQuery);
synchronized (this) {
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
break; break;
} }
for (PlotInfo[] infos : stationQuery) { for (PlotInfo[] infos : stationQuery) {
// schedule next work for other jobs // schedule next work for other jobs
// TODO investigate further, shouldn't be possible to get a null // TODO investigate further, shouldn't be possible to get a
// null
// here, but somehow we do // here, but somehow we do
if (infos[0].pdv != null) { if (infos[0].pdv != null) {
switch (task.getRequestType()) { switch (task.getRequestType()) {
@ -168,6 +170,7 @@ public class PlotModelDataRequestJob extends Job {
} }
} }
} }
}
} // end of while !stationQueue.isEmpty() } // end of while !stationQueue.isEmpty()
@ -342,13 +345,8 @@ public class PlotModelDataRequestJob extends Job {
&& generatorJob.isDone(); && generatorJob.isDone();
} }
public void shutdown() { public synchronized void shutdown() {
this.cancel(); this.cancel();
try {
join();
} catch (InterruptedException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
this.generatorJob.shutdown(); this.generatorJob.shutdown();
} }

View file

@ -32,7 +32,6 @@ import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.data.IRenderedImageCallback; import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IImage; import com.raytheon.uf.viz.core.drawables.IImage;
@ -119,10 +118,15 @@ public class PlotModelGeneratorJob extends Job {
} }
} }
} }
synchronized (this) {
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
if(image != null){
image.dispose();
}
break; break;
} }
caller.modelGenerated(infos, image); caller.modelGenerated(infos, image);
}
} catch (Exception e) { } catch (Exception e) {
statusHandler.error("Error creating plot", e); statusHandler.error("Error creating plot", e);
} }
@ -153,14 +157,9 @@ public class PlotModelGeneratorJob extends Job {
return getState() != Job.RUNNING && getState() != Job.WAITING; return getState() != Job.RUNNING && getState() != Job.WAITING;
} }
protected void shutdown() { protected synchronized void shutdown() {
cancel(); cancel();
taskQueue.clear(); taskQueue.clear();
try {
join();
} catch (InterruptedException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
clearImageCache(); clearImageCache();
} }
} }

View file

@ -402,11 +402,11 @@ public class PlotResource2 extends
@Override @Override
protected void disposeInternal() { protected void disposeInternal() {
resourceData.getPlotInfoRetriever().cancel();
progressiveDisclosure.shutdown();
if (generator != null) { if (generator != null) {
generator.shutdown(); generator.shutdown();
} }
resourceData.getPlotInfoRetriever().cancel();
progressiveDisclosure.shutdown();
clearImages(); clearImages();
} }