Issue #3332 Fixed race condition which could cause GFE grid saving to hang
Change-Id: I4a2ef9e25999d95ac1ecf204907c59b2f1e85652 Former-commit-id:083a933abc
[formerly10f629428e
] [formerly4b4629a2fd
] [formerly4b4629a2fd
[formerly111b04296c
]] [formerly5efba03474
[formerly4b4629a2fd
[formerly111b04296c
] [formerly5efba03474
[formerly b01b72b896b894568acce6a8dc4d45328a06067a]]]] Former-commit-id:5efba03474
Former-commit-id: 1e14dd96de8e306562bc12717eaaddb8800ab479 [formerly 629e83f9edf01bd52b896613ba791f05dcdcec19] [formerlye39615ab7a
[formerly1cc0ff4ab7
]] Former-commit-id:e39615ab7a
Former-commit-id:9691bf2dee
This commit is contained in:
parent
e746b95543
commit
8b91e674a9
2 changed files with 25 additions and 13 deletions
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -619,21 +622,19 @@ public abstract class Parm implements Comparable<Parm> {
|
|||
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<Lock> locks = lt.getLocks();
|
||||
for (Lock lock : locks) {
|
||||
tr = tr.combineWith(lock.getTimeRange());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tr.combineWith(getInventorySpan());
|
||||
return tr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue