src/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java

Print this page

        

*** 64,74 **** protected Map<String, ArrayList<String>> aliasMap; /** * A cache of resolved monitor aliases. */ ! protected Map aliasCache; /** * Constructor. * --- 64,74 ---- protected Map<String, ArrayList<String>> aliasMap; /** * A cache of resolved monitor aliases. */ ! protected Map<String, Monitor> aliasCache; /** * Constructor. *
*** 77,89 **** * instrumentation buffer. */ protected PerfDataBufferImpl(ByteBuffer buffer, int lvmid) { this.buffer = buffer; this.lvmid = lvmid; ! this.monitors = new TreeMap<String, Monitor>(); ! this.aliasMap = new HashMap<String, ArrayList<String>>(); ! this.aliasCache = new HashMap(); } /** * Get the Local Java Virtual Machine Identifier, or <em>lvmid</em> * for the target JVM associated with this instrumentation buffer. --- 77,89 ---- * instrumentation buffer. */ protected PerfDataBufferImpl(ByteBuffer buffer, int lvmid) { this.buffer = buffer; this.lvmid = lvmid; ! this.monitors = new TreeMap<>(); ! this.aliasMap = new HashMap<>(); ! this.aliasCache = new HashMap<>(); } /** * Get the Local Java Virtual Machine Identifier, or <em>lvmid</em> * for the target JVM associated with this instrumentation buffer.
*** 198,213 **** * aliases. */ protected Monitor findByAlias(String name) { assert Thread.holdsLock(this); ! Monitor m = (Monitor)aliasCache.get(name); if (m == null) { ! ArrayList al = aliasMap.get(name); if (al != null) { ! for (Iterator i = al.iterator(); i.hasNext() && m == null; ) { ! String alias = (String)i.next(); m = monitors.get(alias); } } } return m; --- 198,213 ---- * aliases. */ protected Monitor findByAlias(String name) { assert Thread.holdsLock(this); ! Monitor m = aliasCache.get(name); if (m == null) { ! ArrayList<String> al = aliasMap.get(name); if (al != null) { ! for (Iterator<String> i = al.iterator(); i.hasNext() && m == null; ) { ! String alias = i.next(); m = monitors.get(alias); } } } return m;
*** 285,309 **** } } Pattern pattern = Pattern.compile(patternString); Matcher matcher = pattern.matcher(""); ! List<Monitor> matches = new ArrayList<Monitor>(); ! Set monitorSet = monitors.entrySet(); ! for (Iterator i = monitorSet.iterator(); i.hasNext(); /* empty */) { ! Map.Entry me = (Map.Entry)i.next(); ! String name = (String)me.getKey(); ! Monitor m = (Monitor)me.getValue(); // apply pattern to monitor item name matcher.reset(name); // if the pattern matches, then add monitor to list if (matcher.lookingAt()) { ! matches.add((Monitor)me.getValue()); } } return matches; } --- 285,309 ---- } } Pattern pattern = Pattern.compile(patternString); Matcher matcher = pattern.matcher(""); ! List<Monitor> matches = new ArrayList<>(); ! Set<Map.Entry<String,Monitor>> monitorSet = monitors.entrySet(); ! for (Iterator<Map.Entry<String, Monitor>> i = monitorSet.iterator(); i.hasNext(); /* empty */) { ! Map.Entry<String, Monitor> me = i.next(); ! String name = me.getKey(); ! Monitor m = me.getValue(); // apply pattern to monitor item name matcher.reset(name); // if the pattern matches, then add monitor to list if (matcher.lookingAt()) { ! matches.add(me.getValue()); } } return matches; }