Merge "Issue make dispose/shutdown of plot jobs more permenant by joining." into development_on_ss_builds

Former-commit-id: 65ea6e46e059a058d5a46b0cf28f1b50c3057744
This commit is contained in:
Nate Jensen 2012-08-08 09:43:40 -05:00 committed by Gerrit Code Review
commit b704e8d3f4
3 changed files with 22 additions and 2 deletions
cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata

View file

@ -184,8 +184,11 @@ public class PlotDataThreadPool {
}
public void shutdown() {
List<PlotModelDataRequestJob> jobListCopy = new ArrayList<PlotModelDataRequestJob>(
jobList);
jobList.clear();
stationQueue.clear();
for (PlotModelDataRequestJob job : jobList) {
for (PlotModelDataRequestJob job : jobListCopy) {
job.shutdown();
}
}

View file

@ -145,6 +145,9 @@ public class PlotModelDataRequestJob extends Job {
// TODO need to determine if this type of plot is a combination or
// not
combineData(stationQuery);
if (monitor.isCanceled()) {
break;
}
for (PlotInfo[] infos : stationQuery) {
// schedule next work for other jobs
@ -341,8 +344,12 @@ public class PlotModelDataRequestJob extends Job {
public void shutdown() {
this.cancel();
try {
join();
} catch (InterruptedException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
this.generatorJob.shutdown();
this.generatorJob.clearImageCache();
}
}

View file

@ -32,6 +32,7 @@ import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.status.IUFStatusHandler;
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.data.IRenderedImageCallback;
import com.raytheon.uf.viz.core.drawables.IImage;
@ -118,6 +119,9 @@ public class PlotModelGeneratorJob extends Job {
}
}
}
if (monitor.isCanceled()) {
break;
}
caller.modelGenerated(infos, image);
} catch (Exception e) {
statusHandler.error("Error creating plot", e);
@ -152,5 +156,11 @@ public class PlotModelGeneratorJob extends Job {
protected void shutdown() {
cancel();
taskQueue.clear();
try {
join();
} catch (InterruptedException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
clearImageCache();
}
}