jdk/src/share/classes/sun/management/ConnectorAddressLink.java
changeset 11530 a9d059c15b80
parent 5506 202f599c92aa
child 14342 8435a30053c1
equal deleted inserted replaced
11529:e08d565262ce 11530:a9d059c15b80
   115         try {
   115         try {
   116             bb = perf.attach(vmid, "r");
   116             bb = perf.attach(vmid, "r");
   117         } catch (IllegalArgumentException iae) {
   117         } catch (IllegalArgumentException iae) {
   118             throw new IOException(iae.getMessage());
   118             throw new IOException(iae.getMessage());
   119         }
   119         }
   120         List counters =
   120         List<Counter> counters =
   121                 new PerfInstrumentation(bb).findByPattern(CONNECTOR_ADDRESS_COUNTER);
   121                 new PerfInstrumentation(bb).findByPattern(CONNECTOR_ADDRESS_COUNTER);
   122         Iterator i = counters.iterator();
   122         Iterator<Counter> i = counters.iterator();
   123         if (i.hasNext()) {
   123         if (i.hasNext()) {
   124             Counter c = (Counter) i.next();
   124             Counter c = i.next();
   125             return (String) c.getValue();
   125             return (String) c.getValue();
   126         } else {
   126         } else {
   127             return null;
   127             return null;
   128         }
   128         }
   129     }
   129     }
   165         try {
   165         try {
   166             bb = perf.attach(vmid, "r");
   166             bb = perf.attach(vmid, "r");
   167         } catch (IllegalArgumentException iae) {
   167         } catch (IllegalArgumentException iae) {
   168             throw new IOException(iae.getMessage());
   168             throw new IOException(iae.getMessage());
   169         }
   169         }
   170         List counters = new PerfInstrumentation(bb).getAllCounters();
   170         List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
   171         Map<String, String> properties = new HashMap<String, String>();
   171         Map<String, String> properties = new HashMap<>();
   172         for (Object c : counters) {
   172         for (Counter c : counters) {
   173             String name = ((Counter) c).getName();
   173             String name =  c.getName();
   174             if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
   174             if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
   175                     !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
   175                     !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
   176                 properties.put(name, ((Counter) c).getValue().toString());
   176                 properties.put(name, c.getValue().toString());
   177             }
   177             }
   178         }
   178         }
   179         return properties;
   179         return properties;
   180     }
   180     }
   181 }
   181 }