diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/Parm.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/Parm.java index 04304a4b6a..e18387a9f4 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/Parm.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/Parm.java @@ -54,6 +54,7 @@ import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DByte; import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DFloat; import com.raytheon.uf.common.dataplugin.gfe.grid.Op; import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData; +import com.raytheon.uf.common.dataplugin.gfe.server.lock.Lock; import com.raytheon.uf.common.dataplugin.gfe.server.lock.LockTable; import com.raytheon.uf.common.dataplugin.gfe.server.lock.LockTable.LockMode; import com.raytheon.uf.common.dataplugin.gfe.server.lock.LockTable.LockStatus; @@ -185,6 +186,8 @@ import com.vividsolutions.jts.geom.Coordinate; * Apr 02, 2013 #1774 randerso Fixed a possible deadlock issue. * Aug 27, 2013 #2302 randerso Fix simultaneous save issue * Oct 31, 2013 #2508 randerso Change to use DiscreteGridSlice.getKeys() + * Jun 30, 2014 #3332 randerso Kept local reference to lock table to avoid + * race conditions with asynchronous updates * * * @@ -619,21 +622,19 @@ public abstract class Parm implements Comparable { return new TimeRange(); } - if (!isMutable()) { - return getInventorySpan(); - } + TimeRange tr = getInventorySpan(); - TimeRange tr = new TimeRange(); - if (lockTable != null) { - if (lockTable.getLocks().size() > 0) { - tr = lockTable.getLocks().get(0).getTimeRange(); - } - for (int i = 1; i < lockTable.getLocks().size(); i++) { - tr = tr.combineWith(lockTable.getLocks().get(i).getTimeRange()); + if (isMutable()) { + LockTable lt = this.lockTable; + if (lt != null) { + List locks = lt.getLocks(); + for (Lock lock : locks) { + tr = tr.combineWith(lock.getTimeRange()); + } } } - return tr.combineWith(getInventorySpan()); + return tr; } /** diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/ParmSaveJob.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/ParmSaveJob.java index 94329309a3..13b3a2b5e1 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/ParmSaveJob.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/ParmSaveJob.java @@ -28,6 +28,8 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; 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.time.TimeRange; /** @@ -40,6 +42,7 @@ import com.raytheon.uf.common.time.TimeRange; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Aug 27, 2013 #2302 randerso Initial creation + * Jun 30, 2014 #3332 randerso Added exception handling * * * @@ -48,6 +51,9 @@ import com.raytheon.uf.common.time.TimeRange; */ public class ParmSaveJob extends Job { + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(ParmSaveJob.class); + public static class ParmSaveStatus { boolean successful = false; @@ -127,8 +133,13 @@ public class ParmSaveJob extends Job { protected IStatus run(IProgressMonitor monitor) { ParmSaveRequest req = null; while ((req = this.saveQueue.poll()) != null) { - boolean successful = parm.saveParameterSubClass(req.times); - req.status.setSuccessful(successful); + try { + boolean successful = parm.saveParameterSubClass(req.times); + req.status.setSuccessful(successful); + } catch (Exception e) { + statusHandler.error("Error saving grids for " + this.parm, e); + req.status.setSuccessful(false); + } } return Status.OK_STATUS; }