Issue #346: Create a dispose method for Parm and use it like AWIPS1's C++ destructor.
Change-Id: I2e8a4e82d5efd210e546abbaf8c0aba960803a9d Former-commit-id:5aa5b51a55
[formerlyd79f7e9613
[formerly b6d7661be725d8a37a8294b0eda982208c35ecbe]] Former-commit-id:d79f7e9613
Former-commit-id:ef903bc728
This commit is contained in:
parent
adfd42b5ce
commit
586f77e788
7 changed files with 96 additions and 9 deletions
|
@ -74,7 +74,6 @@ import com.raytheon.viz.gfe.core.msgs.Message;
|
||||||
import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg;
|
import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg;
|
||||||
import com.raytheon.viz.gfe.core.parm.ABVParmID;
|
import com.raytheon.viz.gfe.core.parm.ABVParmID;
|
||||||
import com.raytheon.viz.gfe.core.parm.Parm;
|
import com.raytheon.viz.gfe.core.parm.Parm;
|
||||||
import com.raytheon.viz.gfe.core.parm.VCParm;
|
|
||||||
import com.raytheon.viz.gfe.core.parm.vcparm.VCModule;
|
import com.raytheon.viz.gfe.core.parm.vcparm.VCModule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,6 +87,8 @@ import com.raytheon.viz.gfe.core.parm.vcparm.VCModule;
|
||||||
* 03/26/2008 chammack Split non-mock code from MockParmManager
|
* 03/26/2008 chammack Split non-mock code from MockParmManager
|
||||||
* 02/23/2012 #346 dgilling Dispose of VCParms from this class's
|
* 02/23/2012 #346 dgilling Dispose of VCParms from this class's
|
||||||
* dispose method.
|
* dispose method.
|
||||||
|
* 02/23/2012 #346 dgilling Ensure all Parms are disposed when calling
|
||||||
|
* dispose method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -400,13 +401,16 @@ public abstract class AbstractParmManager implements IParmManager {
|
||||||
dataManager.getNotificationRouter().removeObserver(
|
dataManager.getNotificationRouter().removeObserver(
|
||||||
this.siteActivationListener);
|
this.siteActivationListener);
|
||||||
|
|
||||||
for (VCModule module : vcModules) {
|
parms.acquireReadLock();
|
||||||
ParmID pid = module.getGpi().getParmID();
|
try {
|
||||||
Parm p = getParm(pid);
|
for (Parm p : parms) {
|
||||||
if (p != null) {
|
p.dispose();
|
||||||
((VCParm) p).dispose();
|
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
parms.releaseReadLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (VCModule module : vcModules) {
|
||||||
module.dispose();
|
module.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,9 @@ import com.raytheon.viz.gfe.core.DataManager;
|
||||||
import com.raytheon.viz.gfe.core.parm.DbParm;
|
import com.raytheon.viz.gfe.core.parm.DbParm;
|
||||||
import com.raytheon.viz.gfe.core.parm.Parm;
|
import com.raytheon.viz.gfe.core.parm.Parm;
|
||||||
import com.raytheon.viz.gfe.core.parm.ParmDisplayAttributes.VisMode;
|
import com.raytheon.viz.gfe.core.parm.ParmDisplayAttributes.VisMode;
|
||||||
import com.raytheon.viz.gfe.core.parm.vcparm.VCModule;
|
|
||||||
import com.raytheon.viz.gfe.core.parm.VCParm;
|
import com.raytheon.viz.gfe.core.parm.VCParm;
|
||||||
import com.raytheon.viz.gfe.core.parm.VParm;
|
import com.raytheon.viz.gfe.core.parm.VParm;
|
||||||
|
import com.raytheon.viz.gfe.core.parm.vcparm.VCModule;
|
||||||
import com.raytheon.viz.gfe.types.MutableInteger;
|
import com.raytheon.viz.gfe.types.MutableInteger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,6 +69,8 @@ import com.raytheon.viz.gfe.types.MutableInteger;
|
||||||
* 05/19/08 #875 bphillip Implemented save forecast for vectors
|
* 05/19/08 #875 bphillip Implemented save forecast for vectors
|
||||||
* 06/17/08 #940 bphillip Implemented GFE Locking
|
* 06/17/08 #940 bphillip Implemented GFE Locking
|
||||||
* 08/19/09 2547 rjpeter Implement Test/Prac database display.
|
* 08/19/09 2547 rjpeter Implement Test/Prac database display.
|
||||||
|
* 02/23/12 #346 dgilling Call Parm's dispose method when removing
|
||||||
|
* a Parm.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author bphillip
|
* @author bphillip
|
||||||
|
@ -529,6 +531,7 @@ public class ParmManager extends AbstractParmManager {
|
||||||
return mutableDb;
|
return mutableDb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public DatabaseID getOrigMutableDatabase() {
|
public DatabaseID getOrigMutableDatabase() {
|
||||||
return origMutableDb;
|
return origMutableDb;
|
||||||
}
|
}
|
||||||
|
@ -766,6 +769,11 @@ public class ParmManager extends AbstractParmManager {
|
||||||
} catch (GFEServerException e) {
|
} catch (GFEServerException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dispose the old parms
|
||||||
|
for (Parm p : removeParms) {
|
||||||
|
p.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateParmIdCache(final Collection<DatabaseID> removedDbs,
|
private void updateParmIdCache(final Collection<DatabaseID> removedDbs,
|
||||||
|
@ -1197,6 +1205,7 @@ public class ParmManager extends AbstractParmManager {
|
||||||
return new ArrayList<DatabaseID>(iscDbs);
|
return new ArrayList<DatabaseID>(iscDbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ParmID getISCParmID(ParmID pid) {
|
public ParmID getISCParmID(ParmID pid) {
|
||||||
List<DatabaseID> iscDbs = getIscDatabases();
|
List<DatabaseID> iscDbs = getIscDatabases();
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ import com.raytheon.viz.gfe.core.griddata.IGridData;
|
||||||
* 06/17/08 #940 bphillip Implemented GFE Locking
|
* 06/17/08 #940 bphillip Implemented GFE Locking
|
||||||
* 01/29/08 #1271 njensen Rewrote populateGridFromData()
|
* 01/29/08 #1271 njensen Rewrote populateGridFromData()
|
||||||
* to use IFPClient
|
* to use IFPClient
|
||||||
|
* 02/23/12 #346 dgilling Implement a dispose method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -114,6 +115,17 @@ public class DbParm extends Parm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.gfe.core.parm.Parm#dispose()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
looseLocks();
|
||||||
|
}
|
||||||
|
|
||||||
// -- private
|
// -- private
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
// DbParm::getGridsFromDb()
|
// DbParm::getGridsFromDb()
|
||||||
|
|
|
@ -171,6 +171,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* 12Sep2008 #1332 wdougherty Added deleteLockedTR() for editing hazards.
|
* 12Sep2008 #1332 wdougherty Added deleteLockedTR() for editing hazards.
|
||||||
* 04/16/2009 #2262 rjpeter Updated pencilStretch to return Grid2DBit.
|
* 04/16/2009 #2262 rjpeter Updated pencilStretch to return Grid2DBit.
|
||||||
* 06/08/2009 #2159 rjpeter Fixed undo.
|
* 06/08/2009 #2159 rjpeter Fixed undo.
|
||||||
|
* 02/23/2012 #346 dgilling Implement a dispose method to mimic
|
||||||
|
* AWIPS1 use of C++ destructor.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author chammack
|
* @author chammack
|
||||||
|
@ -346,7 +348,37 @@ public abstract class Parm implements Comparable<Parm> {
|
||||||
if (this.officeType == null) {
|
if (this.officeType == null) {
|
||||||
this.officeType = dataManager.getOfficeType();
|
this.officeType = dataManager.getOfficeType();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
if (isModified()) {
|
||||||
|
statusHandler.warn("Destroying parm " + getParmID().toString()
|
||||||
|
+ " with modified data.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataManager.getParmOp() != null) {
|
||||||
|
dataManager.getParmOp().clearUndoParmList(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// cleanup interpolator stuff
|
||||||
|
finishInterpolation(true);
|
||||||
|
|
||||||
|
// Once this is done we had better not talk to any of the parm clients
|
||||||
|
// again...
|
||||||
|
parmListeners.clearParmListeners();
|
||||||
|
|
||||||
|
// Remove the undo grids
|
||||||
|
purgeUndoGrids();
|
||||||
|
|
||||||
|
// remove all grids
|
||||||
|
grids.acquireWriteLock();
|
||||||
|
try {
|
||||||
|
grids.clear();
|
||||||
|
} finally {
|
||||||
|
grids.releaseWriteLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,8 +53,9 @@ import com.raytheon.viz.gfe.core.wxvalue.WxValue;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jun 13, 2008 chammack Initial creation
|
* Jun 13, 2008 chammack Initial creation
|
||||||
* Sep 01, 2009 #2788 randerso Changed listener lists to sets to prevent
|
* Sep 01, 2009 #2788 randerso Changed listener lists to sets to prevent
|
||||||
* multiple registration
|
* multiple registration
|
||||||
|
* Feb 23, 2012 #346 dgilling Implement clearParmListeners.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -100,6 +101,19 @@ public class ParmListeners {
|
||||||
this.notificationPool = pool;
|
this.notificationPool = pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void clearParmListeners() {
|
||||||
|
this.gridChangedListeners.clear();
|
||||||
|
this.parmInventoryChangedListeners.clear();
|
||||||
|
this.parmIDChangedListeners.clear();
|
||||||
|
this.selectionTimeRangeChangedListeners.clear();
|
||||||
|
this.parameterSelectionChangedListeners.clear();
|
||||||
|
this.combineModeChangedListeners.clear();
|
||||||
|
this.vectorModeChangedListeners.clear();
|
||||||
|
this.pickupValueChangedListeners.clear();
|
||||||
|
this.colorTableModifiedListeners.clear();
|
||||||
|
this.lockTableChangedListeners.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public void fireGridChangedListener(final ParmID parmID,
|
public void fireGridChangedListener(final ParmID parmID,
|
||||||
final TimeRange validTime) {
|
final TimeRange validTime) {
|
||||||
for (Object listener : this.gridChangedListeners.getListeners()) {
|
for (Object listener : this.gridChangedListeners.getListeners()) {
|
||||||
|
|
|
@ -77,7 +77,9 @@ import com.raytheon.viz.gfe.core.wxvalue.WxValue;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 04/04/2008 1066 Dan Fitch Initial Creation
|
* 04/04/2008 1066 Dan Fitch Initial Creation
|
||||||
* 11/11/2008 1666 njensen Added procedure cmds
|
* 11/11/2008 1666 njensen Added procedure cmds
|
||||||
* 06/24/09 1876 njensen Publish updates inventory
|
* 06/24/2009 1876 njensen Publish updates inventory
|
||||||
|
* 02/23/2012 1876 dgilling Implement missing clearUndoParmList
|
||||||
|
* function.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -109,6 +111,16 @@ public class ParmOp {
|
||||||
this.dataManager = dataManager;
|
this.dataManager = dataManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a parm from the list that can be undone.
|
||||||
|
*
|
||||||
|
* @param p
|
||||||
|
* <code>Parm</code> to remove from the undo list.
|
||||||
|
*/
|
||||||
|
public void clearUndoParmList(Parm p) {
|
||||||
|
undoParmList.remove(p);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the undo parm list. This is normally commanded by the edit tools
|
* Resets the undo parm list. This is normally commanded by the edit tools
|
||||||
* prior to an edit operation.
|
* prior to an edit operation.
|
||||||
|
|
|
@ -63,6 +63,7 @@ import com.raytheon.viz.gfe.core.parm.vcparm.VCModule.VCInventory;
|
||||||
* safety and fix disappearing ISC
|
* safety and fix disappearing ISC
|
||||||
* data. Also, remove overridden
|
* data. Also, remove overridden
|
||||||
* finalize function.
|
* finalize function.
|
||||||
|
* Feb 23, 2012 #346 dgilling Implement a dispose method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -115,7 +116,10 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
||||||
dataMgr.getParmManager().addParmListChangedListener(this);
|
dataMgr.getParmManager().addParmListChangedListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
|
||||||
this.dataManager.getParmManager().removeParmListChangedListener(this);
|
this.dataManager.getParmManager().removeParmListChangedListener(this);
|
||||||
|
|
||||||
// Unregister for the parm client notifications
|
// Unregister for the parm client notifications
|
||||||
|
|
Loading…
Add table
Reference in a new issue