public PreventionManager() { demoPrevs = new LRUMap(MAXITEMS); mShell = new HashMap<String, LRUMap>(1); mShell.put(PREVS, demoPrevs); mShell = Collections.synchronizedMap(mShell); pf = PreventionDS.getInstance(); }
public synchronized String getWarnings(String demo) { String ret = (String) mShell.get(PREVS).get(demo); if (ret == null) { try { Prevention prev = PreventionData.getLocalandRemotePreventions(Integer.parseInt(demo)); pf.getMessages(prev); @SuppressWarnings("unchecked") Map<String, Object> m = prev.getWarningMsgs(); @SuppressWarnings("rawtypes") Set set = m.entrySet(); @SuppressWarnings("rawtypes") Iterator i = set.iterator(); // Display elements String k = ""; if (ret == null || ret.equals("null")) { ret = ""; } while (i.hasNext()) { @SuppressWarnings("rawtypes") Map.Entry me = (Map.Entry) i.next(); k = "[" + me.getKey() + "=" + me.getValue() + "]"; boolean prevCheck = PreventionManager.isPrevDisabled(me.getKey().toString()); if (prevCheck == false) { ret = ret + k; } } mShell.get(PREVS).put(demo, ret); } catch (Exception e) { ret = ""; MiscUtils.getLogger().error("Error", e); } } return ret; }