Issue #2283 - cleaned up some synchronizrd code.

Former-commit-id: b8f94691c1 [formerly 027dae1e9b] [formerly ea4df9cb2d [formerly f162222be931d03c3a0401205869d48854703c36]]
Former-commit-id: ea4df9cb2d
Former-commit-id: d3268de97a
This commit is contained in:
Lee Venable 2013-08-26 09:39:50 -05:00
parent f56b906997
commit b03ec5a6fe

View file

@ -55,6 +55,7 @@ import com.raytheon.viz.aviation.monitor.AvnPyUtil;
* Nov 11, 2012 1298 rferrel Non-blocking dialog discovered problem * Nov 11, 2012 1298 rferrel Non-blocking dialog discovered problem
* adding dispose listener when not on the * adding dispose listener when not on the
* UI thread. * UI thread.
* Aug 26, 2013 #2283 lvenable Cleaned up some synchronized code.
* *
* </pre> * </pre>
* *
@ -200,7 +201,7 @@ public class PythonCacheGuidanceJob extends
* *
* @param req * @param req
*/ */
private synchronized void waitAdd(CacheGuidanceRequest req) { private void waitAdd(CacheGuidanceRequest req) {
synchronized (waitMonitor) { synchronized (waitMonitor) {
if (waitList.contains(req) == false) { if (waitList.contains(req) == false) {
waitList.add(req); waitList.add(req);
@ -213,7 +214,7 @@ public class PythonCacheGuidanceJob extends
* *
* @param req * @param req
*/ */
private synchronized void waitRemove(CacheGuidanceRequest req) { private void waitRemove(CacheGuidanceRequest req) {
synchronized (waitMonitor) { synchronized (waitMonitor) {
waitList.remove(req); waitList.remove(req);
waitMonitor.notify(); waitMonitor.notify();
@ -286,11 +287,13 @@ public class PythonCacheGuidanceJob extends
* - Unique tag * - Unique tag
* @return siteObj * @return siteObj
*/ */
public synchronized String getSiteObj(String siteID, String tag) { public String getSiteObj(String siteID, String tag) {
String siteObj = null; String siteObj = null;
Map<String, String> siteObjs = siteObjMaps.get(siteID); synchronized (siteObjMaps) {
if (siteObjs != null) { Map<String, String> siteObjs = siteObjMaps.get(siteID);
siteObj = siteObjs.get(tag); if (siteObjs != null) {
siteObj = siteObjs.get(tag);
}
} }
return siteObj; return siteObj;
} }
@ -303,10 +306,12 @@ public class PythonCacheGuidanceJob extends
* @param tag * @param tag
* - Unique tag * - Unique tag
*/ */
private synchronized void clearSiteObj(String siteID, String tag) { private void clearSiteObj(String siteID, String tag) {
Map<String, String> siteObjs = siteObjMaps.get(siteID); Map<String, String> siteObjs = siteObjMaps.get(siteID);
if (siteObjs != null) { synchronized (siteObjMaps) {
siteObjs.remove(tag); if (siteObjs != null) {
siteObjs.remove(tag);
}
} }
} }
@ -317,7 +322,7 @@ public class PythonCacheGuidanceJob extends
* A map with key of stites an array of tags to clear for the * A map with key of stites an array of tags to clear for the
* site * site
*/ */
public synchronized void clearSiteObjs(Map<String, ArrayList<String>> tags) { public void clearSiteObjs(Map<String, ArrayList<String>> tags) {
for (Object s : tags.keySet().toArray()) { for (Object s : tags.keySet().toArray()) {
String siteID = s.toString(); String siteID = s.toString();
for (String tag : tags.get(siteID)) { for (String tag : tags.get(siteID)) {
@ -336,14 +341,15 @@ public class PythonCacheGuidanceJob extends
* @param siteObj * @param siteObj
* - Pickle string to cache * - Pickle string to cache
*/ */
private synchronized void setSiteObj(String siteID, String tag, private void setSiteObj(String siteID, String tag, String siteObj) {
String siteObj) { synchronized (siteObjMaps) {
Map<String, String> siteObjs = siteObjMaps.get(siteID); Map<String, String> siteObjs = siteObjMaps.get(siteID);
if (siteObjs == null) { if (siteObjs == null) {
siteObjs = new HashMap<String, String>(); siteObjs = new HashMap<String, String>();
siteObjMaps.put(siteID, siteObjs); siteObjMaps.put(siteID, siteObjs);
}
siteObjs.put(tag, siteObj);
} }
siteObjs.put(tag, siteObj);
} }
/* /*